Merge github#846: net-p2p/i2p: minor changes.
[gentoo.git] / dev-ruby / rspec-core / rspec-core-3.3.2-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 USE_RUBY="ruby19 ruby20 ruby21 ruby22"
7
8 RUBY_FAKEGEM_TASK_TEST="none"
9 RUBY_FAKEGEM_TASK_DOC="none"
10
11 RUBY_FAKEGEM_EXTRADOC="Changelog.md README.md"
12
13 # Also install this custom path since internal paths depend on it.
14 RUBY_FAKEGEM_EXTRAINSTALL="exe"
15
16 RUBY_FAKEGEM_GEMSPEC="rspec-core.gemspec"
17
18 inherit ruby-fakegem
19
20 DESCRIPTION="A Behaviour Driven Development (BDD) framework for Ruby"
21 HOMEPAGE="https://github.com/rspec/rspec-core"
22 SRC_URI="https://github.com/rspec/${PN}/archive/v${PV}.tar.gz -> ${P}-git.tgz"
23
24 LICENSE="MIT"
25 SLOT="3"
26 KEYWORDS="~amd64 ~arm ~hppa ~ppc64"
27 IUSE="highlight"
28
29 SUBVERSION="$(get_version_component_range 1-2)"
30
31 ruby_add_rdepend "
32         =dev-ruby/rspec-support-${SUBVERSION}*
33         !!<dev-ruby/rspec-core-2.14.8-r4
34         highlight? ( >=dev-ruby/coderay-1.0.9 )
35 "
36
37 ruby_add_bdepend "test? (
38                 >=dev-ruby/nokogiri-1.5.2
39                 >=dev-ruby/coderay-1.0.9
40                 dev-ruby/syntax
41                 >=dev-ruby/thread_order-1.1.0
42                 >=dev-ruby/zentest-4.6.2
43                 >=dev-ruby/rspec-expectations-3.3.0:3
44                 >=dev-ruby/rspec-mocks-2.99.0:3
45         )"
46
47 # Skip yard for ruby22 for now since we don't support ruby22 eselected
48 # yet and we can't bootstrap otherwise.
49 USE_RUBY=${USE_RUBY/ruby22/} ruby_add_bdepend "doc? ( dev-ruby/yard )"
50
51 all_ruby_prepare() {
52         # Don't set up bundler: it doesn't understand our setup.
53         sed -i -e '/[Bb]undler/d' Rakefile || die
54
55         # Avoid dependency on cucumber since we can't run the features anyway.
56         sed -i -e '/[Cc]ucumber/ s:^:#:' Rakefile || die
57
58         # Duplicate exe also in bin. We can't change it since internal stuff
59         # also depends on this and fixing that is going to be fragile. This
60         # way we can at least install proper bin scripts.
61         cp -R exe bin || die
62
63         # Avoid unneeded dependency on git.
64         sed -i -e 's/git ls-files --/find/' rspec-core.gemspec || die
65
66         # Avoid aruba dependency so that we don't end up in dependency hell.
67         sed -i -e '/ArubaLoader/,/^end/ s:^:#:' -e '/Aruba/ s:^:#:' spec/spec_helper.rb || die
68         rm spec/integration/{filtering,order,persistence_failures}_spec.rb spec/support/aruba_support.rb || die
69
70         # Avoid a spec failing due to path issues
71         sed -i -e '/does not load files in the default path when run by ruby/,/end/ s:^:#:' \
72                 spec/rspec/core/configuration_spec.rb || die
73 }
74
75 each_ruby_prepare() {
76         sed -i -e 's:ruby -e:'${RUBY}' -e:' spec/rspec/core_spec.rb || die
77
78         # case ${RUBY} in
79         #       *ruby22)
80         #               # The rubygems version bundled with ruby 2.2 causes warnings.
81         #               sed -i -e '/a library that issues no warnings when loaded/,/^  end/ s:^:#:' spec/rspec/core_spec.rb || die
82         #               ;;
83         # esac
84 }
85
86 all_ruby_compile() {
87         if use doc ; then
88                 yardoc || die
89         fi
90 }
91
92 each_ruby_test() {
93         PATH="${S}/bin:${PATH}" RUBYLIB="${S}/lib" ${RUBY} -Ilib bin/rspec spec || die "Tests failed."
94 }
95
96 all_ruby_install() {
97         all_fakegem_install
98
99         ruby_fakegem_binwrapper rspec /usr/bin/rspec-3 'gem "rspec", "~>3.0"'
100 }