diff options
-rw-r--r-- | Rakefile | 12 | ||||
-rw-r--r-- | chef-config/Rakefile | 12 |
2 files changed, 22 insertions, 2 deletions
@@ -108,9 +108,19 @@ Dir[File.expand_path("../*gemspec", __FILE__)].reverse.each do |gemspec_path| Gem::PackageTask.new(gemspec).define end +def with_clean_env(&block) + if defined?(Bundler) + Bundler.with_clean_env(&block) + else + block.call + end +end + desc "Build and install a chef gem" task :install => [:package] do - sh %{gem install pkg/#{GEM_NAME}-#{VERSION}.gem --no-rdoc --no-ri} + with_clean_env do + sh %{gem install pkg/#{GEM_NAME}-#{VERSION}.gem --no-rdoc --no-ri} + end end task :uninstall do diff --git a/chef-config/Rakefile b/chef-config/Rakefile index 6eb195f672..10b6010de3 100644 --- a/chef-config/Rakefile +++ b/chef-config/Rakefile @@ -8,9 +8,19 @@ Dir[File.expand_path("../*gemspec", __FILE__)].reverse.each do |gemspec_path| Gem::PackageTask.new(gemspec).define end +def with_clean_env(&block) + if defined?(Bundler) + Bundler.with_clean_env(&block) + else + block.call + end +end + desc "Build and install a chef-config gem" task :install => [:package] do - sh %{gem install pkg/chef-config-#{ChefConfig::VERSION}.gem --no-rdoc --no-ri} + with_clean_env do + sh(%{gem install pkg/chef-config-#{ChefConfig::VERSION}.gem --no-rdoc --no-ri}, verbose: true) + end end task :default => :spec |