1
1
# Rakefile for Puppet -*- ruby -*-
3
$: << File.expand_path('lib')
3
4
$LOAD_PATH << File.join(File.dirname(__FILE__), 'tasks')
5
$: << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
8
require 'rake/reductive'
10
$stderr.puts "You must have the Reductive build library in your RUBYLIB; see http://github.com/lak/reductive-build/tree/master."
14
TESTHOSTS = %w{rh3a fedora1 centos1 freebsd1 culain}
16
project = Rake::RedLabProject.new("puppet") do |p|
17
p.summary = "System Automation and Configuration Management Software"
18
p.description = "Puppet is a declarative language for expressing system
19
configuration, a client and server for distributing it, and a library
20
for realizing the configuration."
36
p.filelist.exclude("bin/pi")
38
p.add_dependency('facter', '1.1.0')
42
# Make our gem task. This actually just fills out the spec.
43
project.mkgemtask do |task|
45
task.require_path = 'lib' # Use these for libraries.
47
task.bindir = "bin" # Use these for applications.
48
task.executables = ["puppet", "puppetd", "puppetmasterd", "puppetdoc",
49
"puppetca", "puppetrun", "ralsh"]
50
task.default_executable = "puppet"
52
#### Documentation and testing.
55
#s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
57
'--title' << 'Puppet - Configuration Management' <<
58
'--main' << 'README' <<
60
task.test_file = "test/Rakefile"
61
task.author = "Luke Kanies"
65
rule(/_is_runnable$/) do |t|
67
executable = t.name.sub(/_is_runnable$/, '')
68
ENV['PATH'].split(':').each do |elem|
69
available = true if File.executable? File.join(elem, executable)
73
puts "You do not have #{executable} available in your path"
78
task :check_build_deps => 'dpkg-checkbuilddeps_is_runnable' do
79
system("dpkg-checkbuilddeps") || exit(1)
82
task :debian_packages => [ "debian", :check_build_deps, :fakeroot_is_runnable ] do
83
system("fakeroot debian/rules clean") || exit(1)
84
system("fakeroot debian/rules binary") || exit(1)
88
def dailyfile(package)
89
"#{downdir}/#{package}/#{package}-daily-#{stamp}.tgz"
93
edir = "/tmp/daily-export"
96
sh %{git clone git://reductivelabs.com/#{package} #{package} >/dev/null}
97
sh %{tar cf - #{package} | gzip -c > #{dailyfile(package)}}
103
ENV['DOWNLOAD_DIR'] || "/opt/rl/docroots/reductivelabs.com/htdocs/downloads"
107
[Time.now.year, Time.now.month, Time.now.day].collect { |i| i.to_s}.join
110
pdaily = dailyfile("puppet")
111
fdaily = dailyfile("facter")
121
task :daily => [pdaily, fdaily]
124
Dir.glob("#{downdir}/*/*daily*.tgz").each do |file|
125
puts "Removing %s" % file
132
require 'puppet/util/reference'
133
Puppet::Util::Reference.references.each do |ref|
134
sh "puppetdoc -m trac -r #{ref.to_s}"
6
require './lib/puppet.rb'
8
require 'rake/packagetask'
9
require 'rake/gempackagetask'
11
Dir['tasks/**/*.rake'].each { |t| load t }
27
Rake::PackageTask.new("puppet", Puppet::PUPPETVERSION) do |pkg|
28
pkg.package_dir = 'pkg'
29
pkg.need_tar_gz = true
30
pkg.package_files = FILES.to_a
37
task :puppetpackages => [:create_gem, :package]
138
39
desc "Run the specs under spec/"
141
42
require 'spec/rake/spectask'
143
48
Spec::Rake::SpecTask.new do |t|
145
t.spec_opts = ['--format','s', '--loadby','mtime']
146
t.spec_files = FileList['spec/**/*.rb']
49
t.spec_opts = ['--format','s', '--loadby','mtime']
50
t.spec_files = FileList['spec/**/*.rb']
53
t.rcov_opts = ['--exclude', 'spec/*,test/*,results/*,/usr/lib/*,/usr/local/lib/*']
150
58
desc "Run the unit tests"
152
60
sh "cd test; rake"
157
desc "Run the CI prep tasks"
161
require 'ci/reporter/rake/rspec'
162
require 'ci/reporter/rake/test_unit'
163
ENV['CI_REPORTS'] = 'results'
166
desc "Run CI Unit tests"
167
task :unit => [:prep, 'ci:setup:testunit'] do
168
sh "cd test; rake test; exit 0"
171
desc "Run CI RSpec tests"
172
task :spec => [:prep, 'ci:setup:rspec'] do
173
sh "cd spec; rake all; exit 0"
178
desc "Send patch information to the puppet-dev list"
179
task :mail_patches do
180
if Dir.glob("00*.patch").length > 0
181
raise "Patches already exist matching '00*.patch'; clean up first"
184
unless %x{git status} =~ /On branch (.+)/
185
raise "Could not get branch from 'git status'"
189
unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
190
raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
193
type, parent, name = $1, $2, $3
195
# Create all of the patches
196
sh "git format-patch -C -M -s -n #{parent}..HEAD"
198
# And then mail them out.
200
# If we've got more than one patch, add --compose
201
if Dir.glob("00*.patch").length > 1
202
compose = "--compose"
208
sh "git send-email #{compose} --no-chain-reply-to --no-signed-off-by-cc --suppress-from --no-thread --to puppet-dev@googlegroups.com 00*.patch"
210
# Finally, clean up the patches
214
desc "Create a changelog based on your git commits."
217
CHANGELOG_DIR = "#{Dir.pwd}"
219
mkdir(CHANGELOG_DIR) unless File.directory?(CHANGELOG_DIR)
221
change_body=`git log --pretty=format:'%aD%n%an <%ae>%n%s%n'`
223
File.open(File.join(CHANGELOG_DIR, "CHANGELOG.git"), 'w') do |f|
228
`git add #{CHANGELOG_DIR}/CHANGELOG.git`
229
`git commit -m "Update CHANGELOG.git"`