Class: CiLite::Build

Inherits:
Struct
  • Object
show all
Defined in:
lib/cilite/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/cilite/build.rb', line 3

def command
  @command
end

#outputObject (readonly)

Returns the value of attribute output.



3
4
5
# File 'lib/cilite/build.rb', line 3

def output
  @output
end

#pidObject

Returns the value of attribute pid

Returns:

  • (Object)

    the current value of pid



2
3
4
# File 'lib/cilite/build.rb', line 2

def pid
  @pid
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



2
3
4
# File 'lib/cilite/build.rb', line 2

def status
  @status
end

Instance Method Details

#startObject



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

Returns:

  • (Boolean)


19
20
21
# File 'lib/cilite/build.rb', line 19

def success?
  status == 0
end

#to_hashObject



23
24
25
# File 'lib/cilite/build.rb', line 23

def to_hash
  {:status => status, :output => output}
end