| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.2 2009/12/15 15:32:27 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.29 2011/04/25 08:36:51 graaff Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: ruby-fakegem.eclass |
5 | # @ECLASS: ruby-fakegem.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 16 | # providing integration into the RubyGems system even for "regular" packages. |
16 | # providing integration into the RubyGems system even for "regular" packages. |
| 17 | # |
17 | # |
| 18 | |
18 | |
| 19 | inherit ruby-ng |
19 | inherit ruby-ng |
| 20 | |
20 | |
| 21 | SRC_URI="mirror://rubygems/${P}.gem" |
|
|
| 22 | |
|
|
| 23 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME |
21 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_NAME |
| 24 | # @DESCRIPTION: |
22 | # @DESCRIPTION: |
| 25 | # Sets the Gem name for the generated fake gemspec. |
23 | # Sets the Gem name for the generated fake gemspec. |
| 26 | # RUBY_FAKEGEM_NAME="${PN}" |
24 | # RUBY_FAKEGEM_NAME="${PN}" |
| 27 | |
25 | |
| … | |
… | |
| 31 | # RUBY_FAKEGEM_VERSION="${PV}" |
29 | # RUBY_FAKEGEM_VERSION="${PV}" |
| 32 | |
30 | |
| 33 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC |
31 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_DOC |
| 34 | # @DESCRIPTION: |
32 | # @DESCRIPTION: |
| 35 | # Specify the rake(1) task to run to generate documentation. |
33 | # Specify the rake(1) task to run to generate documentation. |
| 36 | # RUBY_FAKEGEM_VERSION="rdoc" |
34 | # RUBY_FAKEGEM_TASK_DOC="rdoc" |
| 37 | |
35 | |
| 38 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST |
36 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_TASK_TEST |
| 39 | # @DESCRIPTION: |
37 | # @DESCRIPTION: |
| 40 | # Specify the rake(1) task used for executing tests. |
38 | # Specify the rake(1) task used for executing tests. |
| 41 | # RUBY_FAKEGEM_VERSION="test" |
39 | # RUBY_FAKEGEM_TASK_TEST="test" |
|
|
40 | |
|
|
41 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_DOCDIR |
|
|
42 | # @DESCRIPTION: |
|
|
43 | # Specify the directory under which the documentation is built; |
|
|
44 | # if empty no documentation will be installed automatically. |
|
|
45 | # RUBY_FAKEGEM_DOCDIR="" |
|
|
46 | |
|
|
47 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_EXTRADOC |
|
|
48 | # @DESCRIPTION: |
|
|
49 | # Extra documentation to install (readme, changelogs, …). |
|
|
50 | # RUBY_FAKEGEM_EXTRADOC="" |
|
|
51 | |
|
|
52 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_BINWRAP |
|
|
53 | # @DESCRIPTION: |
|
|
54 | # Binaries to wrap around (relative to the bin/ directory) |
|
|
55 | # RUBY_FAKEGEM_BINWRAP="*" |
|
|
56 | |
|
|
57 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS |
|
|
58 | # @DESCRIPTION: |
|
|
59 | # Extra require paths (beside lib) to add to the specification |
|
|
60 | # RUBY_FAKEGEM_REQUIRE_PATHS="" |
|
|
61 | |
|
|
62 | # @ECLASS-VARIABLE: RUBY_FAKEGEM_GEMSPEC |
|
|
63 | # @DESCRIPTION: |
|
|
64 | # Filename of .gemspec file to install instead of generating a generic one. |
|
|
65 | # RUBY_FAKEGEM_GEMSPEC="" |
| 42 | |
66 | |
| 43 | RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" |
67 | RUBY_FAKEGEM_NAME="${RUBY_FAKEGEM_NAME:-${PN}}" |
| 44 | RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV}}" |
68 | RUBY_FAKEGEM_VERSION="${RUBY_FAKEGEM_VERSION:-${PV/_pre/.pre}}" |
|
|
69 | RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}" |
| 45 | |
70 | |
| 46 | RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" |
71 | RUBY_FAKEGEM_TASK_DOC="${RUBY_FAKEGEM_TASK_DOC-rdoc}" |
| 47 | RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" |
72 | RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" |
| 48 | |
73 | |
|
|
74 | RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}" |
|
|
75 | |
| 49 | if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then |
76 | if [[ ${RUBY_FAKEGEM_TASK_DOC} != "" ]]; then |
| 50 | IUSE="$IUSE doc" |
77 | IUSE="$IUSE doc" |
| 51 | ruby_add_bdepend doc "dev-ruby/rake" |
78 | ruby_add_bdepend "doc? ( dev-ruby/rake )" |
|
|
79 | fi |
|
|
80 | |
|
|
81 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]]; then |
|
|
82 | IUSE="$IUSE doc" |
| 52 | fi |
83 | fi |
| 53 | |
84 | |
| 54 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
85 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
| 55 | IUSE="$IUSE test" |
86 | IUSE="$IUSE test" |
| 56 | ruby_add_bdepend test "dev-ruby/rake" |
87 | ruby_add_bdepend "test? ( dev-ruby/rake )" |
| 57 | fi |
88 | fi |
| 58 | |
89 | |
|
|
90 | SRC_URI="mirror://rubygems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${RUBY_FAKEGEM_SUFFIX:+-${RUBY_FAKEGEM_SUFFIX}}.gem" |
|
|
91 | |
|
|
92 | ruby_add_bdepend dev-ruby/rubygems |
| 59 | ruby_add_rdepend virtual/rubygems |
93 | ruby_add_rdepend dev-ruby/rubygems |
| 60 | |
94 | |
| 61 | # @FUNCTION: ruby_fakegem_gemsdir |
95 | # @FUNCTION: ruby_fakegem_gemsdir |
| 62 | # @RETURN: Returns the gem data directory |
96 | # @RETURN: Returns the gem data directory |
| 63 | # @DESCRIPTION: |
97 | # @DESCRIPTION: |
| 64 | # This function returns the gems data directory for the ruby |
98 | # This function returns the gems data directory for the ruby |
| 65 | # implementation in question. |
99 | # implementation in question. |
| 66 | ruby_fakegem_gemsdir() { |
100 | ruby_fakegem_gemsdir() { |
| 67 | local _gemsitedir=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' | sed -e 's:site_ruby:gems:') |
101 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
|
|
102 | |
|
|
103 | local _gemsitedir=$(ruby_rbconfig_value 'sitelibdir') |
|
|
104 | _gemsitedir=${_gemsitedir//site_ruby/gems} |
|
|
105 | _gemsitedir=${_gemsitedir#${EPREFIX}} |
| 68 | |
106 | |
| 69 | [[ -z ${_gemsitedir} ]] && { |
107 | [[ -z ${_gemsitedir} ]] && { |
| 70 | eerror "Unable to find the gems dir" |
108 | eerror "Unable to find the gems dir" |
| 71 | die "Unable to find the gems dir" |
109 | die "Unable to find the gems dir" |
| 72 | } |
110 | } |
| … | |
… | |
| 101 | insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${newdirname} |
139 | insinto $(ruby_fakegem_gemsdir)/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}${newdirname} |
| 102 | newins "$1" ${newbasename} |
140 | newins "$1" ${newbasename} |
| 103 | ) || die "failed $0 $@" |
141 | ) || die "failed $0 $@" |
| 104 | } |
142 | } |
| 105 | |
143 | |
|
|
144 | # @FUNCTION: ruby_fakegem_install_gemspec |
|
|
145 | # @DESCRIPTION: |
|
|
146 | # Install a .gemspec file for this package. Either use the file indicated |
|
|
147 | # by the RUBY_FAKEGEM_GEMSPEC variable, or generate one using |
|
|
148 | # ruby_fakegem_genspec. |
|
|
149 | ruby_fakegem_install_gemspec() { |
|
|
150 | local gemspec="${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} |
|
|
151 | |
|
|
152 | ( |
|
|
153 | if [[ ${RUBY_FAKEGEM_GEMSPEC} != "" ]]; then |
|
|
154 | ruby_fakegem_gemspec_gemspec ${RUBY_FAKEGEM_GEMSPEC} ${gemspec} |
|
|
155 | else |
|
|
156 | local metadata="${WORKDIR}"/${_ruby_implementation}/metadata |
|
|
157 | |
|
|
158 | if [[ -e ${metadata} ]]; then |
|
|
159 | ruby_fakegem_metadata_gemspec ${metadata} ${gemspec} |
|
|
160 | else |
|
|
161 | ruby_fakegem_genspec ${gemspec} |
|
|
162 | fi |
|
|
163 | fi |
|
|
164 | ) || die "Unable to generate gemspec file." |
|
|
165 | |
|
|
166 | insinto $(ruby_fakegem_gemsdir)/specifications |
|
|
167 | newins ${gemspec} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec || die "Unable to install gemspec file." |
|
|
168 | } |
|
|
169 | |
|
|
170 | # @FUNCTION: ruby_fakegem_gemspec_gemspec |
|
|
171 | # @USAGE: gemspec-input gemspec-output |
|
|
172 | # @DESCRIPTION: |
|
|
173 | # Generates an installable version of the specification indicated by |
|
|
174 | # RUBY_FAKEGEM_GEMSPEC. This file is eval'ed to produce a final specification |
|
|
175 | # in a way similar to packaging the gemspec file. |
|
|
176 | ruby_fakegem_gemspec_gemspec() { |
|
|
177 | ${RUBY} -e "puts eval(File::open('$1').read).to_ruby" > $2 |
|
|
178 | } |
|
|
179 | |
|
|
180 | # @FUNCTION: ruby_fakegem_metadata_gemspec |
|
|
181 | # @USAGE: gemspec-metadata gemspec-output |
|
|
182 | # @DESCRIPTION: |
|
|
183 | # Generates an installable version of the specification indicated by |
|
|
184 | # the metadata distributed by the gem itself. This is similar to how |
|
|
185 | # rubygems creates an installation from a .gem file. |
|
|
186 | ruby_fakegem_metadata_gemspec() { |
|
|
187 | ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2 |
|
|
188 | } |
|
|
189 | |
| 106 | # @FUNCTION: ruby_fakegem_genspec |
190 | # @FUNCTION: ruby_fakegem_genspec |
|
|
191 | # @USAGE: output-gemspec |
| 107 | # @DESCRIPTION: |
192 | # @DESCRIPTION: |
| 108 | # Generates a gemspec for the package and places it into the "specifications" |
193 | # Generates a gemspec for the package and places it into the "specifications" |
| 109 | # directory of RubyGems. |
194 | # directory of RubyGems. |
|
|
195 | # If the metadata normally distributed with a gem is present then that is |
|
|
196 | # used to generate the gemspec file. |
|
|
197 | # |
|
|
198 | # As a fallback we can generate our own version. |
| 110 | # In the gemspec, the following values are set: name, version, summary, |
199 | # In the gemspec, the following values are set: name, version, summary, |
| 111 | # homepage, and require_paths=["lib"]. |
200 | # homepage, and require_paths=["lib"]. |
| 112 | # See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version. |
201 | # See RUBY_FAKEGEM_NAME and RUBY_FAKEGEM_VERSION for setting name and version. |
|
|
202 | # See RUBY_FAKEGEM_REQUIRE_PATHS for setting extra require paths. |
| 113 | ruby_fakegem_genspec() { |
203 | ruby_fakegem_genspec() { |
| 114 | ( |
204 | local required_paths="'lib'" |
|
|
205 | for path in ${RUBY_FAKEGEM_REQUIRE_PATHS}; do |
|
|
206 | required_paths="${required_paths}, '${path}'" |
|
|
207 | done |
|
|
208 | |
| 115 | # We use the _ruby_implementation variable to avoid having stray |
209 | # We use the _ruby_implementation variable to avoid having stray |
| 116 | # copies with different implementations; while for now we're using |
210 | # copies with different implementations; while for now we're using |
| 117 | # the same exact content, we might have differences in the future, |
211 | # the same exact content, we might have differences in the future, |
| 118 | # so better taking this into consideration. |
212 | # so better taking this into consideration. |
| 119 | cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF |
213 | local quoted_description=${DESCRIPTION//\"/\\\"} |
|
|
214 | cat - > $1 <<EOF |
|
|
215 | # generated by ruby-fakegem.eclass $Revision: 1.29 $ |
| 120 | Gem::Specification.new do |s| |
216 | Gem::Specification.new do |s| |
| 121 | s.name = "${RUBY_FAKEGEM_NAME}" |
217 | s.name = "${RUBY_FAKEGEM_NAME}" |
| 122 | s.version = "${RUBY_FAKEGEM_VERSION}" |
218 | s.version = "${RUBY_FAKEGEM_VERSION}" |
| 123 | s.summary = "${DESCRIPTION}" |
219 | s.summary = "${quoted_description}" |
| 124 | s.homepage = "${HOMEPAGE}" |
220 | s.homepage = "${HOMEPAGE}" |
| 125 | s.require_paths = ["lib"] |
221 | s.require_paths = [${required_paths}] |
| 126 | end |
222 | end |
| 127 | EOF |
223 | EOF |
| 128 | |
|
|
| 129 | insinto $(ruby_fakegem_gemsdir)/specifications |
|
|
| 130 | newins "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} ${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}.gemspec |
|
|
| 131 | ) || die "Unable to install fake gemspec" |
|
|
| 132 | } |
224 | } |
| 133 | |
225 | |
| 134 | # @FUNCTION: ruby_fakegem_binwrapper |
226 | # @FUNCTION: ruby_fakegem_binwrapper |
| 135 | # @USAGE: command [path] |
227 | # @USAGE: command [path] |
| 136 | # @DESCRIPTION: |
228 | # @DESCRIPTION: |
| … | |
… | |
| 138 | # path defaults to /usr/bin/$command |
230 | # path defaults to /usr/bin/$command |
| 139 | ruby_fakegem_binwrapper() { |
231 | ruby_fakegem_binwrapper() { |
| 140 | ( |
232 | ( |
| 141 | local gembinary=$1 |
233 | local gembinary=$1 |
| 142 | local newbinary=${2:-/usr/bin/$gembinary} |
234 | local newbinary=${2:-/usr/bin/$gembinary} |
|
|
235 | local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} |
|
|
236 | local binpath=$(dirname $newbinary) |
|
|
237 | [[ ${binpath} = . ]] && binpath=/usr/bin |
|
|
238 | |
|
|
239 | # Try to find out whether the package is going to install for |
|
|
240 | # one or multiple implementations; if we're installing for a |
|
|
241 | # *single* implementation, no need to use “/usr/bin/env ruby” |
|
|
242 | # in the shebang, and we can actually avoid errors when |
|
|
243 | # calling the script by default (see for instance the |
|
|
244 | # JRuby-specific commands). |
|
|
245 | local rubycmd= |
|
|
246 | for implementation in ${USE_RUBY}; do |
|
|
247 | # ignore non-enabled implementations |
|
|
248 | use ruby_targets_${implementation} || continue |
|
|
249 | if [ -z $rubycmd ]; then |
|
|
250 | # if no other implementation was set before, set it. |
|
|
251 | rubycmd="$(ruby_implementation_command ${implementation})" |
|
|
252 | else |
|
|
253 | # if another implementation already arrived, then make |
|
|
254 | # it generic and break out of the loop. This ensures |
|
|
255 | # that we do at most two iterations. |
|
|
256 | rubycmd="/usr/bin/env ruby" |
|
|
257 | break |
|
|
258 | fi |
|
|
259 | done |
| 143 | |
260 | |
| 144 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
261 | cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF |
| 145 | #!/usr/bin/env ruby |
262 | #!${rubycmd} |
| 146 | # This is a simplified version of the RubyGems wrapper |
263 | # This is a simplified version of the RubyGems wrapper |
| 147 | # |
264 | # |
| 148 | # Generated by ruby-fakegem.eclass |
265 | # Generated by ruby-fakegem.eclass $Revision: 1.29 $ |
| 149 | |
266 | |
| 150 | require 'rubygems' |
267 | require 'rubygems' |
| 151 | |
268 | |
| 152 | load Gem::GemPathSearcher.new.find('$(tr [A-Z] [a-z] <<< ${RUBY_FAKEGEM_NAME})').full_gem_path + "/bin/${gembinary}" |
269 | load Gem::default_path[-1] + "/gems/${relativegembinary}" |
| 153 | |
270 | |
| 154 | EOF |
271 | EOF |
| 155 | |
272 | |
| 156 | exeinto $(dirname $newbinary) |
273 | exeinto ${binpath:-/usr/bin} |
| 157 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |
274 | newexe "${T}"/gembin-wrapper-${gembinary} $(basename $newbinary) |
| 158 | ) || die "Unable to create fakegem wrapper" |
275 | ) || die "Unable to create fakegem wrapper" |
| 159 | } |
276 | } |
| 160 | |
277 | |
| 161 | # @FUNCTION: all_fakegem_compile |
278 | # @FUNCTION: all_fakegem_compile |
| … | |
… | |
| 173 | # Unpack the source archive, including support for unpacking gems. |
290 | # Unpack the source archive, including support for unpacking gems. |
| 174 | all_ruby_unpack() { |
291 | all_ruby_unpack() { |
| 175 | # Special support for extracting .gem files; the file need to be |
292 | # Special support for extracting .gem files; the file need to be |
| 176 | # extracted twice and the mtime from the archive _has_ to be |
293 | # extracted twice and the mtime from the archive _has_ to be |
| 177 | # ignored (it's always set to epoch 0). |
294 | # ignored (it's always set to epoch 0). |
| 178 | # |
295 | for archive in ${A}; do |
| 179 | # This only works if there is exactly one archive and that archive |
296 | case "${archive}" in |
| 180 | # is a .gem file! |
297 | *.gem) |
| 181 | if [[ $(wc -w <<< ${A}) == 1 ]] && |
298 | # Make sure that we're not running unpack for more than |
| 182 | [[ ${A} == *.gem ]]; then |
299 | # one .gem file, since we won't support that at all. |
|
|
300 | [[ -d "${S}" ]] && die "Unable to unpack ${archive}, ${S} exists" |
|
|
301 | |
| 183 | ebegin "Unpacking .gem file..." |
302 | ebegin "Unpacking .gem file..." |
| 184 | tar -mxf ${DISTDIR}/${A} || die |
303 | tar -mxf ${DISTDIR}/${archive} || die |
| 185 | eend $? |
304 | eend $? |
| 186 | |
305 | |
|
|
306 | ebegin "Uncompressing metadata" |
|
|
307 | gunzip metadata.gz || die |
|
|
308 | eend $? |
|
|
309 | |
| 187 | mkdir "${S}" |
310 | mkdir "${S}" |
| 188 | pushd "${S}" |
311 | pushd "${S}" &>/dev/null |
| 189 | |
312 | |
| 190 | ebegin "Unpacking data.tar.gz" |
313 | ebegin "Unpacking data.tar.gz" |
| 191 | tar -mxf "${my_WORKDIR}"/data.tar.gz || die |
314 | tar -mxf "${my_WORKDIR}"/data.tar.gz || die |
| 192 | eend $? |
315 | eend $? |
| 193 | else |
316 | |
| 194 | [[ -n ${A} ]] && unpack ${A} |
317 | popd &>/dev/null |
| 195 | fi |
318 | ;; |
|
|
319 | *.patch.bz2) |
|
|
320 | # We apply the patches with RUBY_PATCHES directly from DISTDIR, |
|
|
321 | # as the WORKDIR variable changes value between the global-scope |
|
|
322 | # and the time all_ruby_unpack/_prepare are called. Since we can |
|
|
323 | # simply decompress them when applying, this is much easier to |
|
|
324 | # deal with for us. |
|
|
325 | einfo "Keeping ${archive} as-is" |
|
|
326 | ;; |
|
|
327 | *) |
|
|
328 | unpack ${archive} |
|
|
329 | ;; |
|
|
330 | esac |
|
|
331 | done |
| 196 | } |
332 | } |
| 197 | |
333 | |
| 198 | # @FUNCTION: all_ruby_compile |
334 | # @FUNCTION: all_ruby_compile |
| 199 | # @DESCRIPTION: |
335 | # @DESCRIPTION: |
| 200 | # Compile the package. |
336 | # Compile the package. |
| … | |
… | |
| 205 | # @FUNCTION: each_fakegem_test |
341 | # @FUNCTION: each_fakegem_test |
| 206 | # @DESCRIPTION: |
342 | # @DESCRIPTION: |
| 207 | # Run tests for the package for each ruby target if the test task is defined. |
343 | # Run tests for the package for each ruby target if the test task is defined. |
| 208 | each_fakegem_test() { |
344 | each_fakegem_test() { |
| 209 | local rubyflags= |
345 | local rubyflags= |
| 210 | |
|
|
| 211 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
|
|
| 212 | ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" |
346 | ${RUBY} ${rubyflags} -S rake ${RUBY_FAKEGEM_TASK_TEST} || die "tests failed" |
| 213 | else |
|
|
| 214 | echo "No test task defined, skipping tests." |
|
|
| 215 | fi |
|
|
| 216 | } |
347 | } |
| 217 | |
348 | |
|
|
349 | if [[ ${RUBY_FAKEGEM_TASK_TEST} != "" ]]; then |
| 218 | # @FUNCTION: each_ruby_test |
350 | # @FUNCTION: each_ruby_test |
| 219 | # @DESCRIPTION: |
351 | # @DESCRIPTION: |
| 220 | # Run the tests for this package. |
352 | # Run the tests for this package. |
| 221 | each_ruby_test() { |
353 | each_ruby_test() { |
| 222 | each_fakegem_test |
354 | each_fakegem_test |
| 223 | } |
355 | } |
|
|
356 | fi |
| 224 | |
357 | |
| 225 | # @FUNCTION: each_fakegem_install |
358 | # @FUNCTION: each_fakegem_install |
| 226 | # @DESCRIPTION: |
359 | # @DESCRIPTION: |
| 227 | # Install the package for each ruby target. |
360 | # Install the package for each ruby target. |
| 228 | each_fakegem_install() { |
361 | each_fakegem_install() { |
| 229 | ruby_fakegem_genspec |
362 | ruby_fakegem_install_gemspec |
| 230 | |
363 | |
| 231 | local _gemlibdirs= |
364 | local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}" |
| 232 | for directory in bin lib ${RUBY_FAKEGEM_EXTRAINSTALL}; do |
365 | for directory in bin lib; do |
| 233 | [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" |
366 | [[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" |
| 234 | done |
367 | done |
| 235 | |
368 | |
|
|
369 | [[ -n ${_gemlibdirs} ]] && \ |
| 236 | ruby_fakegem_doins -r ${_gemlibdirs} |
370 | ruby_fakegem_doins -r ${_gemlibdirs} |
| 237 | } |
371 | } |
| 238 | |
372 | |
| 239 | # @FUNCTION: each_ruby_install |
373 | # @FUNCTION: each_ruby_install |
| 240 | # @DESCRIPTION: |
374 | # @DESCRIPTION: |
| 241 | # Install the package for each target. |
375 | # Install the package for each target. |
| … | |
… | |
| 246 | # @FUNCTION: all_fakegem_install |
380 | # @FUNCTION: all_fakegem_install |
| 247 | # @DESCRIPTION: |
381 | # @DESCRIPTION: |
| 248 | # Install files common to all ruby targets. |
382 | # Install files common to all ruby targets. |
| 249 | all_fakegem_install() { |
383 | all_fakegem_install() { |
| 250 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then |
384 | if [[ -n ${RUBY_FAKEGEM_DOCDIR} ]] && use doc; then |
| 251 | pushd ${RUBY_FAKEGEM_DOCDIR} |
385 | for dir in ${RUBY_FAKEGEM_DOCDIR}; do |
|
|
386 | [[ -d ${dir} ]] || continue |
|
|
387 | |
|
|
388 | pushd ${dir} &>/dev/null |
| 252 | dohtml -r * || die "failed to install documentation" |
389 | dohtml -r * || die "failed to install documentation" |
| 253 | popd |
390 | popd &>/dev/null |
|
|
391 | done |
| 254 | fi |
392 | fi |
| 255 | |
393 | |
| 256 | if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then |
394 | if [[ -n ${RUBY_FAKEGEM_EXTRADOC} ]]; then |
| 257 | dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" |
395 | dodoc ${RUBY_FAKEGEM_EXTRADOC} || die "failed to install further documentation" |
| 258 | fi |
396 | fi |
|
|
397 | |
|
|
398 | # binary wrappers; we assume that all the implementations get the |
|
|
399 | # same binaries, or something is wrong anyway, so... |
|
|
400 | if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then |
|
|
401 | local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) |
|
|
402 | |
|
|
403 | if [[ -d "${bindir}" ]]; then |
|
|
404 | pushd "${bindir}" &>/dev/null |
|
|
405 | local binaries=$(eval ls ${RUBY_FAKEGEM_BINWRAP}) |
|
|
406 | for binary in $binaries; do |
|
|
407 | ruby_fakegem_binwrapper $binary |
|
|
408 | done |
|
|
409 | popd &>/dev/null |
|
|
410 | fi |
|
|
411 | fi |
| 259 | } |
412 | } |
| 260 | |
413 | |
| 261 | # @FUNCTION: all_ruby_install |
414 | # @FUNCTION: all_ruby_install |
| 262 | # @DESCRIPTION: |
415 | # @DESCRIPTION: |
| 263 | # Install files common to all ruby targets. |
416 | # Install files common to all ruby targets. |