Method: CloudTest::CLI#each

Defined in:
lib/cloud_test/cli.rb

#each(*commands) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/cloud_test/cli.rb', line 72

def each(*commands)
  require 'open3'
  config = Core.load_config
  config['browsers'].keys.each { |browser_config_name|
    Open3.popen2e({'CLOUD_TEST' =>browser_config_name.to_s}, commands.join(" ")) do |stdin, stdout_err, wait_thr|
      unless options[:q]
        while line = stdout_err.gets
          puts line
        end
      end
      exit_status = wait_thr.value
      if exit_status == 0
        puts "Test on browser: #{browser_config_name} was successful!"
      else
        puts "Error on browser: #{browser_config_name}!"
        puts stdout_err.read
        puts "Error on browser: #{browser_config_name}!"
      end
    end
  }
end