summaryrefslogtreecommitdiffstats
path: root/Rakefile
blob: 9d7d90614e40400d3d9c70fa93dcaab2fa9540f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Rakefile for facter

$: << File.expand_path('lib')
$LOAD_PATH << File.join(File.dirname(__FILE__), 'tasks')

require 'rubygems'
require 'rspec'
require 'rspec/core/rake_task'
begin
    require 'rcov'
rescue LoadError
end

Dir['tasks/**/*.rake'].each { |t| load t } 

require 'rake'
require 'rake/packagetask'
require 'rake/gempackagetask'

module Facter
    FACTERVERSION = File.read('lib/facter.rb')[/FACTERVERSION *= *'(.*)'/,1] or fail "Couldn't find FACTERVERSION"
end

FILES = FileList[
    '[A-Z]*',
    'install.rb',
    'bin/**/*',
    'lib/**/*',
    'conf/**/*',
    'etc/**/*',
    'spec/**/*'
]

spec = Gem::Specification.new do |spec|
    spec.platform = Gem::Platform::RUBY
    spec.name = 'facter'
    spec.files = FILES.to_a
    spec.executables = %w{facter}
    spec.version = Facter::FACTERVERSION
    spec.summary = 'Facter, a system inventory tool'
    spec.author = 'Puppet Labs'
    spec.email = 'info@puppetlabs.com'
    spec.homepage = 'http://puppetlabs.com'
    spec.rubyforge_project = 'facter'
    spec.has_rdoc = true
    spec.rdoc_options <<
        '--title' <<  'Facter - System Inventory Tool' <<
        '--main' << 'README' <<
        '--line-numbers'
end

Rake::PackageTask.new("facter", Facter::FACTERVERSION) do |pkg|
    pkg.package_dir = 'pkg'
    pkg.need_tar_gz = true
    pkg.package_files = FILES.to_a
end

Rake::GemPackageTask.new(spec) do |pkg|
end

task :default do
    sh %{rake -T}
end

RSpec::Core::RakeTask.new do |t|
    t.pattern ='spec/{unit,integration}/**/*_spec.rb'
    t.fail_on_error = false
end

RSpec::Core::RakeTask.new('spec:rcov') do |t|
    t.pattern ='spec/{unit,integration}/**/*_spec.rb'
    t.fail_on_error = false
    if defined?(Rcov)
        t.rcov = true
        t.rcov_opts = ['--exclude', 'spec/*,test/*,results/*,/usr/lib/*,/usr/local/lib/*,gems/*']
    end
end