Class: CiLite::Build
- Inherits:
-
Struct
- Object
- Struct
- CiLite::Build
- Defined in:
- lib/cilite/build.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(command) ⇒ Build
constructor
A new instance of Build.
- #start ⇒ Object
- #success? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(command) ⇒ Build
Returns a new instance of Build.
5 6 7 |
# File 'lib/cilite/build.rb', line 5 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/cilite/build.rb', line 3 def command @command end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
3 4 5 |
# File 'lib/cilite/build.rb', line 3 def output @output end |
#pid ⇒ Object
Returns the value of attribute pid
2 3 4 |
# File 'lib/cilite/build.rb', line 2 def pid @pid end |
#status ⇒ Object
Returns the value of attribute status
2 3 4 |
# File 'lib/cilite/build.rb', line 2 def status @status end |
Instance Method Details
#start ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/cilite/build.rb', line 9 def start IO.popen("#{command} 2>&1") do |io| @pid = pid @output = io.read end @status = $?.exitstatus.to_i rescue Exception => e @status = -1 end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/cilite/build.rb', line 19 def success? status == 0 end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/cilite/build.rb', line 23 def to_hash {:status => status, :output => output} end |