Class: JstdRunner::VncControl
- Inherits:
-
Object
- Object
- JstdRunner::VncControl
- Defined in:
- lib/jstd-runner/vnc_control.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#display ⇒ Object
readonly
Returns the value of attribute display.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(display = nil) ⇒ VncControl
constructor
A new instance of VncControl.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(display = nil) ⇒ VncControl
Returns a new instance of VncControl.
19 20 21 |
# File 'lib/jstd-runner/vnc_control.rb', line 19 def initialize(display = nil) @display = display end |
Instance Attribute Details
#display ⇒ Object (readonly)
Returns the value of attribute display.
17 18 19 |
# File 'lib/jstd-runner/vnc_control.rb', line 17 def display @display end |
Class Method Details
.all ⇒ Object
12 13 14 |
# File 'lib/jstd-runner/vnc_control.rb', line 12 def all displays.map { |display| new(":#{display}") } end |
.displays ⇒ Object
8 9 10 |
# File 'lib/jstd-runner/vnc_control.rb', line 8 def displays Dir[File.("~/.vnc/*.pid")].map { |e| e[/(\d+)\.pid/, 1] }.compact end |
Instance Method Details
#start ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/jstd-runner/vnc_control.rb', line 23 def start if @display server @display Log.info "vnc server launched on #{@display.inspect}" else output = server @display = output[/desktop is #{host}(\S+)/, 1] end end |
#stop ⇒ Object
33 34 35 |
# File 'lib/jstd-runner/vnc_control.rb', line 33 def stop server "-kill", @display.to_s end |