Sha256: a20e6854802ef99a693d5ce873c5a3b9168a3cd560d750bf1be73b3ddf487a84

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

#!/usr/bin/env ruby
require 'cucumber-chef'

tag = Cucumber::Chef.tag("cc-push")
puts(tag)
Cucumber::Chef.boot(tag)
$logger = Cucumber::Chef.logger

if ($test_lab = Cucumber::Chef::TestLab.new) && $test_lab.alive?
  gem_name = "cucumber-chef-#{Cucumber::Chef::VERSION}.gem"
  gem_path = File.join(Cucumber::Chef.root_dir, gem_name)

  $logger.info { "gem_name == '#{gem_name}'" }
  $logger.info { "gem_path == '#{gem_path}'" }

  if !File.exists?(gem_path)
    puts
    puts("To build cucumber-chef and install the gem in to the test lab, execute:")
    puts
    puts [ "cd #{Cucumber::Chef.root_dir}", "gem build cucumber-chef.gemspec", "cd #{Dir.pwd}", "bundle exec cc-push" ].join(" ; ")
    puts
  else
    local_file = File.join(Cucumber::Chef.root_dir, gem_name)
    remote_file = File.join("/", "home", $test_lab.ssh.config.user, gem_name)
    $logger.info { "#{local_file} -> #{$test_lab.ssh.config.user}@#{$test_lab.ip}:#{remote_file}" }

    $test_lab.ssh.upload(local_file, remote_file)
    FileUtils.rm_f(File.join(Cucumber::Chef.root_dir, "*.gem"))

    $test_lab.ssh.exec(<<-EOH
sudo /bin/bash -c '
pkill -9 cc-server
cd #{File.dirname(remote_file)}
ls -la | grep 'cucumber-chef-'
gem uninstall cucumber-chef ztk --all --ignore-dependencies --executables --backtrace
rm -fv /usr/lib/ruby/gems/1.8/cache/#{gem_name}
gem cleanup cucumber-chef --backtrace
gem install #{remote_file} --backtrace
rm -fv /home/#{$test_lab.ssh.config.user}/*.gem
exit 0'
EOH
    )
    File.exists?(gem_path) && File.delete(gem_path)
  end

else
  puts("No running cucumber-chef test labs to connect to!")
  exit(1)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cucumber-chef-2.1.0.rc.6 bin/cc-push
cucumber-chef-2.1.0.rc.5 bin/cc-push
cucumber-chef-2.1.0.rc.4 bin/cc-push
cucumber-chef-2.1.0.rc.3 bin/cc-push