dev-ruby/facter: 3.9.2 bup
[gentoo.git] / dev-ruby / facter / facter-2.5.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 USE_RUBY="ruby20 ruby21 ruby22 ruby23"
7 RUBY_FAKEGEM_TASK_DOC=""
8 RUBY_FAKEGEM_RECIPE_TEST="rspec"
9 RUBY_FAKEGEM_EXTRADOC="README.md"
10 RUBY_FAKEGEM_BINWRAP="facter"
11
12 inherit ruby-fakegem
13
14 DESCRIPTION="A cross-platform Ruby library for retrieving facts from operating systems"
15 HOMEPAGE="http://www.puppetlabs.com/puppet/related-projects/facter/"
16
17 LICENSE="Apache-2.0"
18 SLOT="0"
19 IUSE="+dmi +pciutils +virt"
20 KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
21
22 CDEPEND="
23         app-emulation/virt-what
24         sys-apps/net-tools
25         sys-apps/lsb-release
26         dmi? ( sys-apps/dmidecode )
27         pciutils? ( sys-apps/pciutils )"
28
29 RDEPEND+=" ${CDEPEND}"
30 DEPEND+=" test? ( ${CDEPEND} )"
31
32 ruby_add_bdepend "test? ( dev-ruby/mocha:1.0 )"
33
34 all_ruby_prepare() {
35         # Provide explicit path since /sbin is not in the default PATH on
36         # Gentoo.
37         sed -i -e 's:arp -an:/sbin/arp -an:' lib/facter/util/ec2.rb spec/unit/util/ec2_spec.rb || die
38
39         # Ensure the correct version of mocha is used without using bundler.
40         sed -i -e '1igem "mocha", "~>1.0"' spec/spec_helper.rb || die
41
42         # Avoid because tests try to access outside stuff, e.g. /sys/block
43         sed -i -e '/should load facts on the facter search path only once/,/^  end/ s:^:#:' spec/unit/util/loader_spec.rb || die
44
45         # Allow specs to work with newer rspec 2.x versions.
46         sed -i -e '1irequire "rspec-expectations"' spec/puppetlabs_spec/matchers.rb || die
47
48         # Avoid specs specific to macosx requiring cfpropertylist which is
49         # not available anymore.
50         rm spec/unit/util/macosx_spec.rb || die
51         sed -i -e '/macosx/ s:^:#:' \
52                 -e '/on Darwin/,/^  end/ s:^:#:' spec/unit/virtual_spec.rb || die
53         sed -i -e '/Facter::Processors::Darwin/,/^end/ s:^:#:' spec/unit/processors/os_spec.rb || die
54 }
55
56 all_ruby_install() {
57         all_fakegem_install
58
59         # Create the directory for custom facts.
60         keepdir /etc/facter/facts.d
61 }