spec/support/test_app.rb in capistrano-3.8.0 vs spec/support/test_app.rb in capistrano-3.8.1
- old
+ new
@@ -42,18 +42,18 @@
File.open(gemfile, "w+") do |file|
file.write "gem 'capistrano', path: '#{path_to_cap}'"
end
Dir.chdir(test_app_path) do
- `bundle`
+ run "bundle"
end
end
def install_test_app_with(config)
create_test_app
Dir.chdir(test_app_path) do
- `bundle exec cap install STAGES=#{stage}`
+ run "cap install STAGES=#{stage}"
end
write_local_deploy_file(config)
end
def write_local_deploy_file(config)
@@ -89,18 +89,19 @@
def create_shared_file(path)
File.open(shared_path.join(path), "w")
end
def cap(task, subdirectory=nil)
- run "bundle exec cap #{stage} #{task}", subdirectory
+ run "cap #{stage} #{task} --trace", subdirectory
end
def run(command, subdirectory=nil)
output = nil
+ command = "bundle exec #{command}" unless command =~ /^bundle\b/
dir = subdirectory ? test_app_path.join(subdirectory) : test_app_path
Dir.chdir(dir) do
- output = `#{command}`
+ output = with_clean_bundler_env { `#{command}` }
end
[$CHILD_STATUS.success?, output]
end
def stage
@@ -184,7 +185,12 @@
FileUtils.mv(config_path, location)
end
def git_wrapper_path
"/tmp/git-ssh-my_app_name-#{stage}-#{current_user}.sh"
+ end
+
+ def with_clean_bundler_env(&block)
+ return yield unless defined?(Bundler)
+ Bundler.with_clean_env(&block)
end
end