pairing with luke, nagios_command provider skeleton
[vinpup.git] / Rakefile
blob6b0f6a827532dc900754c7d8dcc28ba04bf21d39
1 # Rakefile for Puppet -*- ruby -*-
3 $: << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
5 begin
6     require 'rake/reductive'
7 rescue LoadError
8     $stderr.puts "You must have the Reductive build library in your RUBYLIB."
9     exit(14)
10 end
12 TESTHOSTS = %w{rh3a fedora1 centos1 freebsd1 culain}
14 project = Rake::RedLabProject.new("puppet") do |p|
15     p.summary = "System Automation and Configuration Management Software"
16     p.description = "Puppet is a declarative language for expressing system
17         configuration, a client and server for distributing it, and a library
18         for realizing the configuration."
20     p.filelist = [
21         'install.rb',
22         '[A-Z]*',
23         'lib/puppet.rb',
24         'lib/puppet/**/*.rb',
25         'test/**/*.rb',
26         'bin/**/*',
27         'ext/**/*',
28         'examples/**/*',
29         'conf/**/*'
30     ]
31     p.filelist.exclude("bin/pi")
33     p.add_dependency('facter', '1.1.0')
35     #p.epmhosts = %w{culain}
36     #p.sunpkghost = "sol10b"
37     #p.rpmhost = "fedora1"
38 end
40 if project.has?(:gem)
41     # Make our gem task.  This actually just fills out the spec.
42     project.mkgemtask do |task|
44         task.require_path = 'lib'                         # Use these for libraries.
46         task.bindir = "bin"                               # Use these for applications.
47         task.executables = ["puppet", "puppetd", "puppetmasterd", "puppetdoc",
48                          "puppetca", "puppetrun", "ralsh"]
49         task.default_executable = "puppet"
50         task.autorequire = 'puppet'
52         #### Documentation and testing.
54         task.has_rdoc = true
55         #s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
56         task.rdoc_options <<
57             '--title' <<  'Puppet - Configuration Management' <<
58             '--main' << 'README' <<
59             '--line-numbers'
60         task.test_file = "test/Rakefile"
61     end
62 end
64 if project.has?(:epm)
65     project.mkepmtask do |task|
66         task.bins = FileList.new("bin/puppet", "bin/puppetca")
67         task.sbins = FileList.new("bin/puppetmasterd", "bin/puppetd")
68         task.rubylibs = FileList.new('lib/**/*')
69     end
70 end
72 rule(/_is_runnable$/) do |t|
73     available = false
74     executable = t.name.sub(/_is_runnable$/, '')
75     ENV['PATH'].split(':').each do |elem|
76         available = true if File.executable? File.join(elem, executable)
77     end
78     
79     unless available
80         puts "You do not have #{executable} available in your path"
81         exit 1
82     end
83 end
85 file "debian" => :bzr_is_runnable do
86     system("bzr get http://www.hezmatt.org/~mpalmer/bzr/puppet.debian.svn debian") || exit(1)
87 end
89 task :check_build_deps => 'dpkg-checkbuilddeps_is_runnable' do
90     system("dpkg-checkbuilddeps") || exit(1)
91 end
93 task :debian_packages => [ "debian", :check_build_deps, :fakeroot_is_runnable ] do
94     system("fakeroot debian/rules clean") || exit(1)
95     system("fakeroot debian/rules binary") || exit(1)
96 end
99 def dailyfile(package)
100     "#{downdir}/#{package}/#{package}-daily-#{stamp}.tgz"
103 def daily(package)
104     edir = "/tmp/daily-export"
105     Dir.mkdir edir
106     Dir.chdir(edir) do
107         sh %{svn export http://reductivelabs.com/svn/#{package}/trunk #{package} >/dev/null}
108         sh %{tar cf - #{package} | gzip -c > #{dailyfile(package)}}
109     end
110     FileUtils.rm_rf(edir)
113 def downdir
114     ENV['DOWNLOAD_DIR'] || "/opt/rl/docroots/reductivelabs.com/htdocs/downloads"
117 def stamp
118     [Time.now.year, Time.now.month, Time.now.day].collect { |i| i.to_s}.join
121 pdaily = dailyfile("puppet")
122 fdaily = dailyfile("facter")
124 file pdaily do
125     daily("puppet")
128 file fdaily do
129     daily("facter")
132 task :daily => [pdaily, fdaily]
134 task :dailyclean do
135     Dir.glob("#{downdir}/*/*daily*.tgz").each do |file|
136         puts "Removing %s" % file
137         File.unlink(file)
138     end