Class: SeleniumGrid::AWS::RemoteCommand
- Inherits:
-
Object
- Object
- SeleniumGrid::AWS::RemoteCommand
- Defined in:
- lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #execute ⇒ Object
- #full_command ⇒ Object
-
#initialize(command, options = {}) ⇒ RemoteCommand
constructor
A new instance of RemoteCommand.
- #remote_command ⇒ Object
- #ssh_command ⇒ Object
Constructor Details
#initialize(command, options = {}) ⇒ RemoteCommand
Returns a new instance of RemoteCommand.
7 8 9 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 7 def initialize(command, ={}) @command, @options = command, end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 5 def @options end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 11 def execute puts full_command system full_command raise "Error with #{full_command}" if 0 != $? end |
#full_command ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 17 def full_command cmd = "#{ssh_command} " cmd << "\"su -l #{[:su]} -c " if [:su] cmd << "'#{remote_command}'" cmd << '"' if [:su] cmd end |
#remote_command ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 33 def remote_command shell_command = [] shell_command << "PATH=#{[:path]}:${PATH}; export PATH;" if [:path] shell_command << "DISPLAY=#{[:display]}; export DISPLAY;" if [:display] shell_command << "cd '#{[:pwd]}';" if [:pwd] shell_command << @command shell_command.join " " end |
#ssh_command ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb', line 25 def ssh_command shell_command = [ "ssh" ] shell_command << "-i '#{[:keypair]}'" if [:keypair] shell_command << "root@#{[:host]}" shell_command.join " " end |