summaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-08-18 21:34:34 +1000
committerJames Turnbull <james@lovedthanlost.net>2009-08-18 21:34:34 +1000
commit7d4a5f921695d9502641e6da36213d912d54df5c (patch)
tree52e41aec77c038bb2cc4a2799a5561de5fd0fb08 /tasks
parent5982deb61a954852534c54e1d968f3d4b156e787 (diff)
downloadfacter-7d4a5f921695d9502641e6da36213d912d54df5c.tar.gz
facter-7d4a5f921695d9502641e6da36213d912d54df5c.tar.xz
facter-7d4a5f921695d9502641e6da36213d912d54df5c.zip
Updated Rakefile and moved Rake tasks to tasks/rake directory
Diffstat (limited to 'tasks')
-rw-r--r--tasks/rake/changlog.rake10
-rw-r--r--tasks/rake/ci.rake17
-rw-r--r--tasks/rake/dailybuild.rake9
-rw-r--r--tasks/rake/mail_patches.rake35
-rw-r--r--tasks/rake/metrics.rake6
5 files changed, 77 insertions, 0 deletions
diff --git a/tasks/rake/changlog.rake b/tasks/rake/changlog.rake
new file mode 100644
index 0000000..0427e41
--- /dev/null
+++ b/tasks/rake/changlog.rake
@@ -0,0 +1,10 @@
+desc "Create a ChangeLog based on git commits."
+task :changelog do
+ CHANGELOG_DIR = "#{Dir.pwd}"
+ mkdir(CHANGELOG_DIR) unless File.directory?(CHANGELOG_DIR)
+ change_body=`git log --pretty=format:'%aD%n%an <%ae>%n%s%n'`
+ File.open(File.join(CHANGELOG_DIR, "ChangeLog"), 'w') do |f|
+ f << change_body
+ end
+end
+
diff --git a/tasks/rake/ci.rake b/tasks/rake/ci.rake
new file mode 100644
index 0000000..1a79b98
--- /dev/null
+++ b/tasks/rake/ci.rake
@@ -0,0 +1,17 @@
+desc "Prep CI RSpec tests"
+task :ci_prep do
+ require 'rubygems'
+ begin
+ gem 'ci_reporter'
+ require 'ci/reporter/rake/rspec'
+ require 'ci/reporter/rake/test_unit'
+ ENV['CI_REPORTS'] = 'results'
+ rescue LoadError
+ puts 'Missing ci_reporter gem. You must have the ci_reporter gem installed to run the CI spec tests'
+ end
+end
+
+desc "Run the CI RSpec tests"
+task :ci_spec => [:ci_prep, 'ci:setup:rspec', :spec] do
+ sh "exit 0"
+end
diff --git a/tasks/rake/dailybuild.rake b/tasks/rake/dailybuild.rake
new file mode 100644
index 0000000..709bd48
--- /dev/null
+++ b/tasks/rake/dailybuild.rake
@@ -0,0 +1,9 @@
+desc "Create a Facter daily build"
+task :daily => :changelog do
+ version = "facter" + "-" + Time.now.localtime.strftime("%Y%m%d")
+ sh "git archive --format=tar --prefix=#{version}/ HEAD^{tree} >#{version}.tar"
+ sh "pax -waf #{version}.tar -s ':^:#{version}/:' ChangeLog"
+ sh "rm ChangeLog"
+ sh "gzip -f -9 #{version}.tar"
+end
+
diff --git a/tasks/rake/mail_patches.rake b/tasks/rake/mail_patches.rake
new file mode 100644
index 0000000..6375a22
--- /dev/null
+++ b/tasks/rake/mail_patches.rake
@@ -0,0 +1,35 @@
+desc "Send patch information to the puppet-dev list"
+task :mail_patches do
+ if Dir.glob("00*.patch").length > 0
+ raise "Patches already exist matching '00*.patch'; clean up first"
+ end
+
+ unless %x{git status} =~ /On branch (.+)/
+ raise "Could not get branch from 'git status'"
+ end
+ branch = $1
+
+ unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
+ raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
+ end
+
+ type, parent, name = $1, $2, $3
+
+ # Create all of the patches
+ sh "git format-patch -C -M -s -n --subject-prefix='PATCH/facter' #{parent}..HEAD"
+
+ # And then mail them out.
+
+ # If we've got more than one patch, add --compose
+ if Dir.glob("00*.patch").length > 1
+ compose = "--compose"
+ else
+ compose = ""
+ end
+
+ # Now send the mail.
+ sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
+
+ # Finally, clean up the patches
+ sh "rm 00*.patch"
+end
diff --git a/tasks/rake/metrics.rake b/tasks/rake/metrics.rake
new file mode 100644
index 0000000..63af552
--- /dev/null
+++ b/tasks/rake/metrics.rake
@@ -0,0 +1,6 @@
+begin
+ require 'metric_fu'
+rescue LoadError
+ # Metric-fu not installed
+ # http://metric-fu.rubyforge.org/
+end