Class: BuildEm::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/buildem/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(kernel = Kernel, argv = ARGV) ⇒ Runner

Returns a new instance of Runner.



35
36
37
38
# File 'lib/buildem/runner.rb', line 35

def initialize(kernel = Kernel, argv = ARGV)
  @kernel = kernel
  @argv   = argv
end

Instance Method Details

#process_standard_inObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/buildem/runner.rb', line 40

def process_standard_in
  if @argv.empty?
    output = []
    while input = @kernel.gets and not input == "start\n"
      output << input
    end 
    unless output.empty?
      output = output.join("\n")
      @kernel.eval(output)
    end
  end
end

#startObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/buildem/runner.rb', line 53

def start
  if ARGV.size == 1
    begin
      puts "running #{ARGV[0]}"
      $configuration = BuildEm::Configuration.new
      load ARGV[0]
    ensure
      puts "finished #{ARGV[0]}"
    end
  else
    puts usage
  end
end