*/*: Discontinue Gentoo SuperH port
[gentoo.git] / dev-ruby / rdoc / rdoc-5.1.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 USE_RUBY="ruby24"
6
7 RUBY_FAKEGEM_TASK_DOC=""
8 RUBY_FAKEGEM_DOCDIR="doc"
9 RUBY_FAKEGEM_EXTRADOC="History.rdoc README.rdoc RI.rdoc TODO.rdoc"
10
11 RUBY_FAKEGEM_BINWRAP=""
12 RUBY_FAKEGEM_BINDIR="exe"
13
14 inherit ruby-fakegem eutils
15
16 DESCRIPTION="An extended version of the RDoc library from Ruby 1.8"
17 HOMEPAGE="https://github.com/rdoc/rdoc/"
18 SRC_URI="https://github.com/rdoc/rdoc/archive/v${PV}.tar.gz -> ${P}.tar.gz"
19
20 LICENSE="Ruby MIT"
21 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sparc x86 ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
22 SLOT="0"
23 IUSE=""
24
25 RDEPEND+=">=app-eselect/eselect-ruby-20161226"
26
27 RUBY_PATCHES=( "${FILESDIR}/${P}-jquery.patch" )
28
29 ruby_add_bdepend "
30         dev-ruby/kpeg
31         dev-ruby/racc
32         test? (
33                 dev-ruby/bundler
34                 >=dev-ruby/minitest-5.8:5
35         )"
36
37 ruby_add_rdepend "dev-ruby/json:2"
38
39 all_ruby_prepare() {
40         # Other packages also have use for a nonexistent directory, bug 321059
41         sed -i -e 's#/nonexistent#/nonexistent_rdoc_tests#g' test/test_rdoc*.rb || die
42
43         # Avoid unneeded dependency on bundler, bug 603696
44         sed -i -e '/bundler/ s:^:#:' \
45                 -e 's/Bundler::GemHelper.gemspec.full_name/"rdoc"/' Rakefile || die
46
47         # Remove test that is depending on the locale, which we can't garantuee.
48         sed -i -e '/def test_encode_with/,/^  end/ s:^:#:' test/test_rdoc_options.rb || die
49
50         # Remove test depending on FEATURES=userpriv, bug 361959
51         sed -i -e '/def test_check_files/,/^  end/ s:^:#:' test/test_rdoc_options.rb || die
52
53         # Remove tests for code that is not included and not listed in Manifest.txt
54         rm -f test/test_rdoc_i18n_{locale,text}.rb \
55            test/test_rdoc_generator_pot* || die
56
57         # Removal is not included in the upstream patch
58         rm -f  lib/rdoc/generator/template/darkfish/js/jquery.js || die
59 }
60
61 all_ruby_compile() {
62         all_fakegem_compile
63
64         if use doc ; then
65                 ruby -Ilib -S exe/rdoc || die
66         fi
67 }
68
69 each_ruby_compile() {
70         ${RUBY} -S rake generate || die
71 }
72
73 each_ruby_test() {
74         ${RUBY} -Ilib:. -e 'gem "json", "~>2.0"; Dir["test/test_*.rb"].each{|f| require f}' || die
75 }
76
77 all_ruby_install() {
78         all_fakegem_install
79
80         for bin in rdoc ri; do
81                 ruby_fakegem_binwrapper $bin /usr/bin/$bin-2
82
83                 for version in $(ruby_get_use_implementations); do
84                         version=`echo ${version} | cut -c 5-`
85                         if use ruby_targets_ruby${version}; then
86                                 ruby_fakegem_binwrapper $bin /usr/bin/${bin}${version}
87                                 sed -i -e "1s/env ruby/ruby${version}/" \
88                                         "${ED}/usr/bin/${bin}${version}" || die
89                         fi
90                 done
91         done
92 }
93
94 pkg_postinst() {
95         if [[ ! -n $(readlink "${ROOT}"usr/bin/rdoc) ]] ; then
96                 eselect ruby set $(eselect --brief --colour=no ruby show | head -n1)
97         fi
98 }