Sha256: 8380c4302ca10a7bbc7c6966157ec665c8b6407db830c703af2c6701b85b6a91
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
module BrowserShooter::Commander def self.script( commands, driver, browser, output_path ) command_executor = BrowserShooter::Commands::Base.new( driver, browser, output_path ) test_result = commands.map do |command| command_result = BrowserShooter::Commander.wrapper_execute( command_executor, command.strip ) BrowserShooter::Logger.command_result( command_result ) command_result end BrowserShooter::Logger.test_result( test_result ) test_result end def self.wrapper_execute( command_executor, command ) result = { :time => Time.now.to_i, :command => command } begin message = BrowserShooter::Commander.execute( command_executor, command ) result.merge!( :success => true, :message => message ) rescue Exception => e BrowserShooter::Logger.log "ERROR: #{e.message}" # puts "XXX: Exception" # puts e.backtrace.join( "\n" ) result.merge!( :success => false, :message => e.message ) end return result end def self.execute( command_executor, command ) BrowserShooter::Logger.log "command: #{command}" command_name = command.split( /[\s\(]/ )[0].strip if( command_executor.respond_to?( command_name.to_sym ) ) eval "command_executor.#{command}" else eval "command_executor.driver.#{command}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
browser_shooter-0.3.9 | lib/browser_shooter/commander.rb |
browser_shooter-0.3.7 | lib/browser_shooter/commander.rb |
browser_shooter-0.3.5 | lib/browser_shooter/commander.rb |