Codebase list facter / 7d4a5f9
Updated Rakefile and moved Rake tasks to tasks/rake directory James Turnbull 14 years ago
6 changed file(s) with 80 addition(s) and 52 deletion(s). Raw diff Collapse all Expand all
00 # Rakefile for facter
11
22 $: << File.expand_path('lib')
3 $LOAD_PATH << File.join(File.dirname(__FILE__), 'tasks')
4
5 Dir['tasks/**/*.rake'].each { |t| load t }
36
47 require './lib/facter.rb'
58 require 'rake'
5760 t.spec_files = FileList['spec/**/*.rb']
5861 end
5962 end
60
61 desc "Prep CI RSpec tests"
62 task :ci_prep do
63 require 'rubygems'
64 begin
65 gem 'ci_reporter'
66 require 'ci/reporter/rake/rspec'
67 require 'ci/reporter/rake/test_unit'
68 ENV['CI_REPORTS'] = 'results'
69 rescue LoadError
70 puts 'Missing ci_reporter gem. You must have the ci_reporter gem installed to run the CI spec tests'
71 end
72 end
73
74 desc "Run the CI RSpec tests"
75 task :ci_spec => [:ci_prep, 'ci:setup:rspec', :spec]
76
77 desc "Send patch information to the puppet-dev list"
78 task :mail_patches do
79 if Dir.glob("00*.patch").length > 0
80 raise "Patches already exist matching '00*.patch'; clean up first"
81 end
82
83 unless %x{git status} =~ /On branch (.+)/
84 raise "Could not get branch from 'git status'"
85 end
86 branch = $1
87
88 unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
89 raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
90 end
91
92 type, parent, name = $1, $2, $3
93
94 # Create all of the patches
95 sh "git format-patch -C -M -s -n --subject-prefix='PATCH/facter' #{parent}..HEAD"
96
97 # And then mail them out.
98
99 # If we've got more than one patch, add --compose
100 if Dir.glob("00*.patch").length > 1
101 compose = "--compose"
102 else
103 compose = ""
104 end
105
106 # Now send the mail.
107 sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
108
109 # Finally, clean up the patches
110 sh "rm 00*.patch"
111 end
0 desc "Create a ChangeLog based on git commits."
1 task :changelog do
2 CHANGELOG_DIR = "#{Dir.pwd}"
3 mkdir(CHANGELOG_DIR) unless File.directory?(CHANGELOG_DIR)
4 change_body=`git log --pretty=format:'%aD%n%an <%ae>%n%s%n'`
5 File.open(File.join(CHANGELOG_DIR, "ChangeLog"), 'w') do |f|
6 f << change_body
7 end
8 end
9
0 desc "Prep CI RSpec tests"
1 task :ci_prep do
2 require 'rubygems'
3 begin
4 gem 'ci_reporter'
5 require 'ci/reporter/rake/rspec'
6 require 'ci/reporter/rake/test_unit'
7 ENV['CI_REPORTS'] = 'results'
8 rescue LoadError
9 puts 'Missing ci_reporter gem. You must have the ci_reporter gem installed to run the CI spec tests'
10 end
11 end
12
13 desc "Run the CI RSpec tests"
14 task :ci_spec => [:ci_prep, 'ci:setup:rspec', :spec] do
15 sh "exit 0"
16 end
0 desc "Create a Facter daily build"
1 task :daily => :changelog do
2 version = "facter" + "-" + Time.now.localtime.strftime("%Y%m%d")
3 sh "git archive --format=tar --prefix=#{version}/ HEAD^{tree} >#{version}.tar"
4 sh "pax -waf #{version}.tar -s ':^:#{version}/:' ChangeLog"
5 sh "rm ChangeLog"
6 sh "gzip -f -9 #{version}.tar"
7 end
8
0 desc "Send patch information to the puppet-dev list"
1 task :mail_patches do
2 if Dir.glob("00*.patch").length > 0
3 raise "Patches already exist matching '00*.patch'; clean up first"
4 end
5
6 unless %x{git status} =~ /On branch (.+)/
7 raise "Could not get branch from 'git status'"
8 end
9 branch = $1
10
11 unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
12 raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
13 end
14
15 type, parent, name = $1, $2, $3
16
17 # Create all of the patches
18 sh "git format-patch -C -M -s -n --subject-prefix='PATCH/facter' #{parent}..HEAD"
19
20 # And then mail them out.
21
22 # If we've got more than one patch, add --compose
23 if Dir.glob("00*.patch").length > 1
24 compose = "--compose"
25 else
26 compose = ""
27 end
28
29 # Now send the mail.
30 sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
31
32 # Finally, clean up the patches
33 sh "rm 00*.patch"
34 end
0 begin
1 require 'metric_fu'
2 rescue LoadError
3 # Metric-fu not installed
4 # http://metric-fu.rubyforge.org/
5 end