lib/itamae/mitsurin/serverspec_task.rb in itamae-mitsurin-0.3 vs lib/itamae/mitsurin/serverspec_task.rb in itamae-mitsurin-0.4

- old
+ new

@@ -42,10 +42,12 @@ end end recipes end + color = SimpleColor.new + namespace :spec do all = [] Dir.glob("tmp-nodes/**/*.json").each do |node_file| file_name = File.basename(node_file, '.json') @@ -72,21 +74,24 @@ end node_name = node_attr[:environments][:hostname] ssh_user = node_attr[:environments][:ssh_user] ssh_password = node_attr[:environments][:ssh_password] + sudo_password = node_attr[:environments][:sudo_password] ssh_port = node_attr[:environments][:ssh_port] ssh_key = node_attr[:environments][:ssh_key] node_short = node_name.split(".")[0] all << node_short desc "Run spec to #{file_name}" ENV['TARGET_HOST'] = node_name ENV['NODE_FILE'] = node_file ENV['SSH_PASSWORD'] = ssh_password + ENV['SUDO_PASSWORD'] = sudo_password ENV['SSH_KEY'] = "keys/#{ssh_key}" + ENV['SSH_PORT'] = ssh_port specs = "bundle exec rspec" # recipe load to_spec spec_pattern = [] @@ -103,10 +108,9 @@ specs << spec_pattern.join run_list_noti = [] spec_pattern.each {|c_spec| run_list_noti << c_spec.split("/") [2]} color.echos(:red ,%!Run Serverspec to \"#{node_name}\"!) color.echos(:green, %!Run List to \"#{run_list_noti.uniq.join(", ")}\"!) - puts color.echos(:white, %!#{specs}!) st = system specs exit 1 unless st end task :all => all task :default => :all