Sha256: 9cd311035973f94e995aa004911ee359655af1bc3d1339b079afaca78b9d3e1b

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

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

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

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

  ui.logger.info { "gem_name == '#{gem_name}'" }
  ui.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.bootstrap_ssh.config.user, gem_name)
    ui.logger.info { "#{local_file} -> #{test_lab.bootstrap_ssh.config.user}@#{test_lab.ip}:#{remote_file}" }

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

    test_lab.bootstrap_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.bootstrap_ssh.config.user}/*.gem
exit 0'
EOH
    )
    File.exists?(gem_path) and File.delete(gem_path)
  end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-chef-2.1.0.rc.11 bin/cc-push
cucumber-chef-2.1.0.rc.10 bin/cc-push
cucumber-chef-2.1.0.rc.9 bin/cc-push
cucumber-chef-2.1.0.rc.8 bin/cc-push
cucumber-chef-2.1.0.rc.7 bin/cc-push