Class: CukeJob
- Inherits:
-
Object
- Object
- CukeJob
- Defined in:
- lib/virtualmonkey/cuke_monk.rb
Instance Attribute Summary collapse
-
#deployment ⇒ Object
Returns the value of attribute deployment.
-
#logfile ⇒ Object
Returns the value of attribute logfile.
-
#no_resume ⇒ Object
Returns the value of attribute no_resume.
-
#output ⇒ Object
Returns the value of attribute output.
-
#rest_log ⇒ Object
Returns the value of attribute rest_log.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #link_to_rightscale ⇒ Object
- #on_exit(status) ⇒ Object
- #on_read_stderr(data) ⇒ Object
- #on_read_stdout(data) ⇒ Object
- #receive_data(data) ⇒ Object
- #run(deployment, cmd) ⇒ Object
- #unbind ⇒ Object
Instance Attribute Details
#deployment ⇒ Object
Returns the value of attribute deployment.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def deployment @deployment end |
#logfile ⇒ Object
Returns the value of attribute logfile.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def logfile @logfile end |
#no_resume ⇒ Object
Returns the value of attribute no_resume.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def no_resume @no_resume end |
#output ⇒ Object
Returns the value of attribute output.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def output @output end |
#rest_log ⇒ Object
Returns the value of attribute rest_log.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def rest_log @rest_log end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 8 def status @status end |
Instance Method Details
#link_to_rightscale ⇒ Object
10 11 12 13 14 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 10 def link_to_rightscale i = deployment.href.split(/\//).last d = deployment.href.split(/\./).first.split(/\//).last "https://#{d}.rightscale.com/deployments/#{i}#auditentries" end |
#on_exit(status) ⇒ Object
37 38 39 40 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 37 def on_exit(status) @status = status.exitstatus # File.open(@logfile, "a") { |f| f.write(@output) } end |
#on_read_stderr(data) ⇒ Object
22 23 24 25 26 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 22 def on_read_stderr(data) # @output ||= "" # @output << data File.open(@logfile, "a") { |f| f.write(data) } end |
#on_read_stdout(data) ⇒ Object
16 17 18 19 20 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 16 def on_read_stdout(data) # @output ||= "" # @output << data File.open(@logfile, "a") { |f| f.write(data) } end |
#receive_data(data) ⇒ Object
28 29 30 31 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 28 def receive_data data # @output += data File.open(@logfile, "a") { |f| f.write(data) } end |
#run(deployment, cmd) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 42 def run(deployment, cmd) RightScale.popen3(:command => cmd, :target => self, :environment => {"DEPLOYMENT" => deployment.nickname, "AWS_ACCESS_KEY_ID" => Fog.credentials[:aws_access_key_id], "AWS_SECRET_ACCESS_KEY" => Fog.credentials[:aws_secret_access_key], "REST_CONNECTION_LOG" => @rest_log, "MONKEY_NO_RESUME" => "#{@no_resume}", "MONKEY_NO_DEBUG" => "true"}, :stdout_handler => :on_read_stdout, :stderr_handler => :on_read_stderr, :exit_handler => :on_exit) end |
#unbind ⇒ Object
33 34 35 |
# File 'lib/virtualmonkey/cuke_monk.rb', line 33 def unbind @status = get_status.exitstatus end |