diff --git a/tasks/rake/gem.rake b/tasks/rake/gem.rake index d654886ae..efea73882 100644 --- a/tasks/rake/gem.rake +++ b/tasks/rake/gem.rake @@ -1,59 +1,60 @@ -require 'ftools' +require 'fileutils' GEM_FILES = FileList[ '[A-Z]*', 'install.rb', 'bin/**/*', 'lib/**/*', 'conf/**/*', 'man/**/*', 'examples/**/*', 'ext/**/*', 'tasks/**/*', 'test/**/*', 'spec/**/*' ] EXECUTABLES = FileList[ 'bin/**/*', 'sbin/**/*' ] SBIN = Dir.glob("sbin/*") spec = Gem::Specification.new do |spec| spec.platform = Gem::Platform::RUBY spec.name = 'puppet' spec.files = GEM_FILES.to_a spec.executables = EXECUTABLES.gsub(/sbin\/|bin\//, '').to_a spec.version = Puppet::PUPPETVERSION spec.add_dependency('facter', '>= 1.5.1') spec.summary = 'Puppet, an automated configuration management tool' spec.description = 'Puppet, an automated configuration management tool' spec.author = 'Puppet Labs' spec.email = 'puppet@puppetlabs.com' spec.homepage = 'http://puppetlabs.com' spec.rubyforge_project = 'puppet' spec.has_rdoc = true spec.rdoc_options << '--title' << 'Puppet - Configuration Management' << '--main' << 'README' << '--line-numbers' end desc "Prepare binaries for gem creation" task :prepare_gem do SBIN.each do |f| - File.copy(f,"bin") + FileUtils.copy(f,"bin") end end desc "Create the gem" task :create_gem => :prepare_gem do Dir.mkdir("pkg") rescue nil Gem::Builder.new(spec).build - File.move("puppet-#{Puppet::PUPPETVERSION}.gem", "pkg") + FileUtils.move("puppet-#{Puppet::PUPPETVERSION}.gem", "pkg") SBIN.each do |f| - File.unlink("bin/" + f.gsub(/sbin\//, '')) + fn = f.gsub(/sbin\/(.*)/, '\1') + FileUtils.rm_r "bin/" + fn end end diff --git a/tasks/rake/git_workflow.rake b/tasks/rake/git_workflow.rake index 1ba57c1aa..75dc8833a 100644 --- a/tasks/rake/git_workflow.rake +++ b/tasks/rake/git_workflow.rake @@ -1,132 +1,132 @@ # This set of tasks helps automate the workflow as described on # http://projects.puppetlabs.com/projects/puppet/wiki/Development_Lifecycle def find_start(start) # This is a case statement, as we might want to map certain # git tags to starting points that are not currently in git. - case start - when nil?: - when @next_release: return "master" - else return start - end + case start + when nil?; + when @next_release; return "master" + else return start + end end desc "Set up git for working with Puppet" task :git_setup do - # This should be changed as new versions get released - @next_release = '0.26.x' - @remote = {} - default_remote = {} - default_remote[:url] = 'git://github.com/reductivelabs/puppet' - default_remote[:name] = 'origin' - @remote[:name] = %x{git config puppet.defaultremote}.chomp - @remote[:name] = @remote[:name].empty? ? default_remote[:name] : @remote[:name] - @remote[:url] = default_remote[:url] if @remote[:name] == default_remote[:name] - default_fetch = '+refs/heads/*:refs/remotes/puppet/*' - @remote[:fetch] = %x{git config puppet.#{@remote[:name]}.fetch}.chomp - @remote[:fetch] = @remote[:fetch].empty? ? default_fetch : @remote[:fetch] + # This should be changed as new versions get released + @next_release = '0.26.x' + @remote = {} + default_remote = {} + default_remote[:url] = 'git://github.com/reductivelabs/puppet' + default_remote[:name] = 'origin' + @remote[:name] = %x{git config puppet.defaultremote}.chomp + @remote[:name] = @remote[:name].empty? ? default_remote[:name] : @remote[:name] + @remote[:url] = default_remote[:url] if @remote[:name] == default_remote[:name] + default_fetch = '+refs/heads/*:refs/remotes/puppet/*' + @remote[:fetch] = %x{git config puppet.#{@remote[:name]}.fetch}.chomp + @remote[:fetch] = @remote[:fetch].empty? ? default_fetch : @remote[:fetch] end desc "Start work on a feature" task :start_feature, [:feature,:remote,:branch] => :git_setup do |t, args| - args.with_defaults(:remote => @remote[:name]) - args.with_defaults(:branch => @next_release) - start_at = find_start(args.branch) - branch = "feature/#{start_at}/#{args.feature}" - sh "git checkout -b #{branch} #{start_at}" do |ok, res| - if ! ok - raise < @remote[:name]) + args.with_defaults(:branch => @next_release) + start_at = find_start(args.branch) + branch = "feature/#{start_at}/#{args.feature}" + sh "git checkout -b #{branch} #{start_at}" do |ok, res| + if ! ok + raise < :git_setup do |t, args| - args.with_defaults(:remote => @remote[:name]) - args.with_defaults(:branch => @next_release) - start_at = find_start(args.branch) - branch = "tickets/#{start_at}/#{args.ticket}" - sh "git checkout -b #{branch} #{start_at}" do |ok, res| - unless ok - raise < @remote[:name]) + args.with_defaults(:branch => @next_release) + start_at = find_start(args.branch) + branch = "tickets/#{start_at}/#{args.ticket}" + sh "git checkout -b #{branch} #{start_at}" do |ok, res| + unless ok + raise < 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 // 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/puppet' #{parent}..HEAD" # Add info to the patches additional_info = "Local-branch: #{branch}\n" files = Dir.glob("00*.patch") files.each do |file| contents = File.read(file) contents.sub!(/^---\n/, "---\n#{additional_info}") File.open(file, 'w') do |file_handle| file_handle.print contents end end # And then mail them out. # If we've got more than one patch, add --compose if files.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