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