setup/git/010_TestSetup.rb in beaker-puppet-1.29.0 vs setup/git/010_TestSetup.rb in beaker-puppet-2.0.0
- old
+ new
@@ -1,7 +1,6 @@
-test_name "Install repositories on target machines..." do
-
+test_name 'Install repositories on target machines...' do
repositories = options[:install].map do |url|
extract_repo_info_from(build_git_url(url))
end
agents.each_with_index do |host, index|
@@ -27,51 +26,53 @@
repository[:path] = "file://#{mount[:container_path]}"
end
repo_dir = host.tmpdir(repository[:name])
on(host, "chmod 755 #{repo_dir}")
- gem_source = ENV["GEM_SOURCE"] || "https://rubygems.org"
+ gem_source = ENV['GEM_SOURCE'] || 'https://rubygems.org'
case repository[:path]
when /^(git:|https:|git@)/
sha = ENV['SHA'] || `git rev-parse HEAD`.chomp
gem_path = ":git => '#{repository[:path]}', :ref => '#{sha}'"
- when /^file:\/\/(.*)/
- gem_path = ":path => '#{$1}'"
+ when %r{^file://(.*)}
+ gem_path = ":path => '#{Regexp.last_match(1)}'"
else
gem_path = repository[:path]
end
- create_remote_file(host, "#{repo_dir}/Gemfile", <<-END)
-source '#{gem_source}'
-gem '#{repository[:name]}', #{gem_path}
+ create_remote_file(host, "#{repo_dir}/Gemfile", <<~END)
+ source '#{gem_source}'
+ gem '#{repository[:name]}', #{gem_path}
END
case host['platform']
when /windows/
# bundle must be passed a Windows style path for a binstubs location
bindir = host['puppetbindir'].split(':').first
binstubs_dir = on(host, "cygpath -m \"#{bindir}\"").stdout.chomp
- # note passing --shebang to bundle is not useful because Cygwin
+ # NOTE: passing --shebang to bundle is not useful because Cygwin
# already finds the Ruby interpreter OK with the standard shebang of:
# !/usr/bin/env ruby
# the problem is a Cygwin style path is passed to the interpreter and this can't be modified:
# http://cygwin.1069669.n5.nabble.com/Pass-windows-style-paths-to-the-interpreter-from-the-shebang-line-td43870.html
on host, "cd #{repo_dir} && #{bundle_command(host)} install --system --binstubs '#{binstubs_dir}'"
# bundler created but does not install batch files to the binstubs dir
# so we have to manually copy the batch files over
gemdir = on(host, "#{gem_command(host)} environment gemdir").stdout.chomp
gembindir = File.join(gemdir, 'bin')
- on host, "cd '#{host['puppetbindir']}' && test -f ./#{repository[:name]}.bat || cp '#{gembindir}/#{repository[:name]}.bat' '#{host['puppetbindir']}/#{repository[:name]}.bat'"
+ on host,
+ "cd '#{host['puppetbindir']}' && test -f ./#{repository[:name]}.bat || cp '#{gembindir}/#{repository[:name]}.bat' '#{host['puppetbindir']}/#{repository[:name]}.bat'"
else
on host, "cd #{repo_dir} && #{bundle_command(host)} install --system --binstubs #{host['puppetbindir']}"
end
- puppet_bundler_install_dir ||= on(host, "cd #{repo_dir} && #{bundle_command(host)} show #{repository[:name]}").stdout.chomp
+ puppet_bundler_install_dir ||= on(host,
+ "cd #{repo_dir} && #{bundle_command(host)} show #{repository[:name]}").stdout.chomp
host.add_env_var('RUBYLIB', File.join(puppet_bundler_install_dir, 'lib'))
end
end
- step "Hosts: create environments directory like AIO does" do
+ step 'Hosts: create environments directory like AIO does' do
agents.each do |host|
codedir = host.puppet['codedir']
on host, "mkdir -p #{codedir}/environments/production/manifests"
on host, "mkdir -p #{codedir}/environments/production/modules"
on host, "chmod -R 755 #{codedir}"