Class: Cerberus::Builder::RubyBase

Inherits:
Object
  • Object
show all
Defined in:
lib/cerberus/builder/ruby_base.rb

Direct Known Subclasses

RSpec, Rake, Rant, Ruby

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, name, cmd = name) ⇒ RubyBase

Returns a new instance of RubyBase.



6
7
8
9
10
# File 'lib/cerberus/builder/ruby_base.rb', line 6

def initialize(config, name, cmd = name)
  @config = config
  @cmd = cmd
  @name = name
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



4
5
6
# File 'lib/cerberus/builder/ruby_base.rb', line 4

def output
  @output
end

Instance Method Details

#brokenessObject



24
25
26
27
28
# File 'lib/cerberus/builder/ruby_base.rb', line 24

def brokeness
  if @output =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
    return $1.to_i + $2.to_i
  end
end

#runObject



12
13
14
15
16
17
18
# File 'lib/cerberus/builder/ruby_base.rb', line 12

def run
  build_dir = @config[:builder, :build_dir]
  Dir.chdir(build_dir) if build_dir

  @output = `#{@config[:bin_path]}#{choose_exec()} #{@config[:builder, @name.to_sym, :task]} 2>&1`
  successful?
end

#successful?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/cerberus/builder/ruby_base.rb', line 20

def successful?
  $?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!")
end