bin/cucumber-chef in cucumber-chef-2.0.4 vs bin/cucumber-chef in cucumber-chef-2.0.5

- old
+ new

@@ -55,12 +55,12 @@ if ( !chef_repo || ( !File.exists?(chef_repo) || !File.directory?(chef_repo) ) ) fatal("It does not look like you are inside a chef-repo! Please relocate to one and execute your command again!") exit(255) end - $logger = Cucumber::Chef::Logger.new - Cucumber::Chef.is_rc? and ($logger.level = Cucumber::Chef::Logger::DEBUG) + $logger = ZTK::Logger.new(Cucumber::Chef.log_file) + Cucumber::Chef.is_rc? and ($logger.level = ZTK::Logger::DEBUG) message = "cucumber-chef v#{Cucumber::Chef::VERSION}" puts(set_color(message, :green, true)) $logger.info { "================================================================================" } @@ -257,30 +257,29 @@ def ssh(*args) load_config puts if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0) - ssh = Cucumber::Chef::SSH.new + ssh = ZTK::SSH.new if args.size == 0 - ssh.config[:host] = test_lab.labs_running.first.public_ip_address - ssh.config[:ssh_user] = "ubuntu" - ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:ssh_user]}") + ssh.config.host_name = test_lab.labs_running.first.public_ip_address + ssh.config.user = "ubuntu" + ssh.config.keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.user}") puts([set_color("Attempting SSH connection to cucumber-chef '", :blue, true), set_color("test lab", :cyan, true), set_color("'...", :blue, true)].join) ssh.console else container = args[0] - ssh.config[:proxy] = true - ssh.config[:proxy_host] = test_lab.labs_running.first.public_ip_address - ssh.config[:proxy_ssh_user] = "ubuntu" - ssh.config[:proxy_identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:proxy_ssh_user]}") + ssh.config.proxy_host_name = test_lab.labs_running.first.public_ip_address + ssh.config.proxy_user = "ubuntu" + ssh.config.proxy_keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.proxy_user}") - ssh.config[:host] = container - ssh.config[:ssh_user] = "root" - ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:proxy_ssh_user]}") + ssh.config.host_name = container + ssh.config.user = "root" + ssh.config.keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.proxy_user}") puts([set_color("Attempting SSH connection to cucumber-chef container '", :blue, true), set_color(container, :cyan, true), set_color("'...", :blue, true)].join) ssh.console end @@ -303,20 +302,19 @@ def diagnose(container) load_config puts if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0) - ssh = Cucumber::Chef::SSH.new + ssh = ZTK::SSH.new - ssh.config[:proxy] = true - ssh.config[:proxy_host] = test_lab.labs_running.first.public_ip_address - ssh.config[:proxy_ssh_user] = "ubuntu" - ssh.config[:proxy_identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:proxy_ssh_user]}") + ssh.config.proxy_host_name = test_lab.labs_running.first.public_ip_address + ssh.config.proxy_user = "ubuntu" + ssh.config.proxy_keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.proxy_user}") - ssh.config[:host] = container - ssh.config[:ssh_user] = "root" - ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:proxy_ssh_user]}") + ssh.config.host_name = container + ssh.config.user = "root" + ssh.config.keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.proxy_user}") puts([set_color("Attempting to collect diagnostic information on cucumber-chef container '", :blue, true), set_color(container, :cyan, true), set_color("'...", :blue, true)].join) if @options.strace? puts puts("chef-stacktrace.out:") @@ -360,15 +358,15 @@ def ps(*args) load_config puts if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0) - ssh = Cucumber::Chef::SSH.new + ssh = ZTK::SSH.new - ssh.config[:host] = test_lab.labs_running.first.public_ip_address - ssh.config[:ssh_user] = "ubuntu" - ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config[:ssh_user]}") + ssh.config.host_name = test_lab.labs_running.first.public_ip_address + ssh.config.user = "ubuntu" + ssh.config.keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{ssh.config.user}") puts(set_color("Getting container processes from cucumber-chef test lab...", :blue, true)) puts puts(set_color("============================================================================", :bold)) ssh.exec("lxc-ps --lxc -- #{args.join(" ")}") @@ -411,35 +409,9 @@ steps = File.join(features_dir, "step_definitions", "#{project}.steps") puts puts(set_color("Project created!", :green, true)) say("Please look at the README in '#{features_dir}/#{project}/', and the example features (#{File.basename(feature)}) and steps (#{File.basename(steps)}), which I have autogenerated for you.", :green) - puts - - rescue Cucumber::Chef::Error => e - $logger.fatal { e.backtrace.join("\n") } - fatal(e) - end - -################################################################################ - - desc "test [cucumber-options]", "Test a project using the cucumber-chef test suite." - method_option :destroy, :type => :boolean, :desc => "destroy all containers before test run", :aliases => "-z", :default => false - def test(*args) - load_config - - puts - root_path = Cucumber::Chef.locate_parent(".cucumber-chef") - features_path = File.expand_path(File.join(root_path, "features")) - - unless (File.exists?(features_path) && File.directory?(features_path)) - raise Error, "Features directory '#{features_path}' does not exist." - else - puts("Using features directory: #{features_path}") - end - - runner = Cucumber::Chef::TestRunner.new(features_path) - runner.run(@options.destroy?, args) puts rescue Cucumber::Chef::Error => e $logger.fatal { e.backtrace.join("\n") } fatal(e)