From 94f3a5f2eaf065aff69bc50681416655d25efc53 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 23 Oct 2018 20:08:46 +1100 Subject: [PATCH] fix: ensure bundle install for pact_broker:dev:setup uses correct Gemfile Closes: https://github.com/pact-foundation/pact_broker/issues/243 --- tasks/development.rake | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tasks/development.rake b/tasks/development.rake index 91a978117..91e588a79 100644 --- a/tasks/development.rake +++ b/tasks/development.rake @@ -1,10 +1,19 @@ +desc 'Set up a dev instance of the Pact Broker' task 'pact_broker:dev:setup' do + puts "Copying example directory" FileUtils.cp_r 'example', 'dev' gemfile_contents = File.read('dev/Gemfile') + + + puts "Changing source of pact_broker gem from rubygems.org to local file system" new_gemfile_contents = gemfile_contents.gsub(/^.*gem.*pact_broker.*$/, "gem 'pact_broker', path: '../'") File.open('dev/Gemfile', "w") { |file| file << new_gemfile_contents } - bundle_install = "BUNDLE_GEMFILE=dev/Gemfile bundle install" - puts bundle_install - puts `#{bundle_install}` + + Dir.chdir("dev") do + Bundler.with_clean_env do + puts "Executing bundle install" + puts `bundle install` + end + end end