Module: Kernel

Defined in:
lib/buildem/base.rb,
lib/buildem/logger.rb,
lib/buildem/runner.rb

Instance Method Summary collapse

Instance Method Details

#exitstatusObject



7
8
9
# File 'lib/buildem/base.rb', line 7

def exitstatus
  $?
end

#output_to(filename = "output.log", stream = :stdout) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/buildem/logger.rb', line 4

def output_to(filename="output.log", stream=:stdout)
  if block_given?
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval("$#{stream} = #{stream.upcase}")
    end
  else
    fail "output_to must be used in block format with a 'do' and 'end'."
  end
  
  File.open(filename, "w+") {|f| f.puts result }
  
end

#queued_run(command, optz = {}) ⇒ Object



22
23
24
# File 'lib/buildem/runner.rb', line 22

def queued_run(command, optz = {})
  $jobs << BuildEm::Executor.new([command,optz])
end

#run(command, optz = {}) ⇒ Object



26
27
28
# File 'lib/buildem/runner.rb', line 26

def run(command, optz = {})
  BuildEm::Executor.new([command,optz]).run
end

#run_command(cmd) ⇒ Object



11
12
13
# File 'lib/buildem/base.rb', line 11

def run_command(cmd) 
  `#{cmd}`
end

#unorderedObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/buildem/runner.rb', line 9

def unordered
  puts "Started unordered sequence"
  yield
  $pool = ProcessPool.new($configuration.workers)
  puts $configuration.workers
  $jobs.each do |command|
    $pool.schedule(command,command.argz)
  end
  $pool.start
  $pool.shutdown
  puts "Finished #{$jobs.size} unordered jobs"
end