From 8e6a2af13b92fe692552cb8bccbecd968f164d48 Mon Sep 17 00:00:00 2001 From: "Chad Humphries, Nick Ang and Rob Sanheim" Date: Sat, 26 Sep 2009 20:12:51 -0400 Subject: [PATCH] Fixing rake git:something Turns out their was a ENV key being set by jeweler that was causing the issue. All fixed now --- Rakefile | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/Rakefile b/Rakefile index cc33a0d1..7f045497 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ require 'rubygems' require 'rake' +require 'fileutils' +require 'pathname' begin require 'jeweler' @@ -14,33 +16,34 @@ begin gem.add_dependency "rspec-mocks", ">= 2.0.0.a1" # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end - rescue LoadError puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" end +def arbitrary_command(command) + # Jeweler sets some ENV keys for GIT that cause our normal flow to explode + ENV.keys.grep(/GIT/).each { |k| ENV.delete(k) } + base_rspec2_path = Pathname.new(Dir.pwd.split('meta').first) + ['meta', 'core', 'expectations', 'mocks'].each do |dir| + path = base_rspec2_path.join(dir) + puts "=====================================" + puts "Running [#{command}] in #{path}" + puts "=====================================" + if command.include?('git') + system command.sub(/^git/, "git --git-dir=#{path}/.git --work-tree=#{path}") + else + system command + end + puts + end +end + task :clobber do rm_rf 'pkg' end task :spec do - system <<-COMMANDS - cd ../core && - echo '================================' - echo 'Running spec/core suite . . .' - echo '================================' - rake && - cd ../mocks && - echo '================================' - echo 'Running spec/mocks suite . . .' - echo '================================' - rake && - cd ../expectations && - echo '================================' - echo 'Running spec/expectations suite . . .' - echo '================================' - rake - COMMANDS + arbitrary_command('rake') end task :default => :spec @@ -50,13 +53,7 @@ namespace :git do command = key == :reset ? "reset --hard" : key.to_s desc "git #{command} on all the repos" task key do - ["../meta","../core","../expectations", "../mocks"].each do |repo| - puts - puts "=" * 50 - puts "running git #{command} on #{repo}:" - puts "=" * 50 - puts `cd #{repo} && git #{command}` - end + arbitrary_command("git #{command}") end end