Merge remote-tracking branch 'github/pr/872'.
[gentoo.git] / dev-ruby / rspec-core / rspec-core-3.4.2.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 USE_RUBY="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="~alpha ~amd64 ~arm ~hppa ~ppc64 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
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 all_ruby_prepare() {
48         # Don't set up bundler: it doesn't understand our setup.
49         sed -i -e '/[Bb]undler/d' Rakefile || die
50
51         # Avoid dependency on cucumber since we can't run the features anyway.
52         sed -i -e '/[Cc]ucumber/ s:^:#:' Rakefile || die
53
54         # Duplicate exe also in bin. We can't change it since internal stuff
55         # also depends on this and fixing that is going to be fragile. This
56         # way we can at least install proper bin scripts.
57         cp -R exe bin || die
58
59         # Avoid unneeded dependency on git.
60         sed -i -e 's/git ls-files --/find/' rspec-core.gemspec || die
61
62         # Avoid aruba dependency so that we don't end up in dependency hell.
63         sed -i -e '/ArubaLoader/,/^end/ s:^:#:' -e '/Aruba/ s:^:#:' spec/spec_helper.rb || die
64         rm spec/integration/{failed_line_detection,filtering,order,persistence_failures}_spec.rb spec/support/aruba_support.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         # Avoid specs for older coderay version which is no longer packaged
71         sed -i -e '/highlights the syntax of the provided lines/ s/do/,skip: true do/' \
72                 -e '/dynamically adjusts to changing color config/ s/do/,skip: true do/' \
73                 spec/rspec/core/source/syntax_highlighter_spec.rb
74 }
75
76 each_ruby_prepare() {
77         sed -i -e 's:ruby -e:'${RUBY}' -e:' spec/rspec/core_spec.rb || die
78
79         # case ${RUBY} in
80         #       *ruby22)
81         #               # The rubygems version bundled with ruby 2.2 causes warnings.
82         #               sed -i -e '/a library that issues no warnings when loaded/,/^  end/ s:^:#:' spec/rspec/core_spec.rb || die
83         #               ;;
84         # esac
85 }
86
87 all_ruby_compile() {
88         if use doc ; then
89                 yardoc || die
90         fi
91 }
92
93 each_ruby_test() {
94         PATH="${S}/bin:${PATH}" RUBYLIB="${S}/lib" ${RUBY} -Ilib bin/rspec spec || die "Tests failed."
95 }
96
97 all_ruby_install() {
98         all_fakegem_install
99
100         ruby_fakegem_binwrapper rspec /usr/bin/rspec-3 'gem "rspec", "~>3.0"'
101 }