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