Class: Cerberus::Builder::Ruby

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

Instance Attribute Summary

Attributes inherited from RubyBase

#output

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Ruby

Returns a new instance of Ruby.



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

def initialize(config)
  super(config, "ruby")
end

Instance Method Details

#brokenessObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cerberus/builder/ruby.rb', line 21

def brokeness
  if @config[:builder, @name.to_sym, :brokeness]
    re = Regexp.new( @config[:builder, @name.to_sym, :brokeness] )
    md = re.match( @output )
    if md
      return md.captures.inject( 0 ) { |sum, n| sum += n.to_i }
    end
  else 
    super # use RubyBase default if custom :brokeness not specified
  end
end

#runObject



8
9
10
11
# File 'lib/cerberus/builder/ruby.rb', line 8

def run
  ENV['PATH'] = "#{@config[:builder, @name.to_sym, :ruby_path]}::#{ENV['PATH']}"
  super
end

#successful?Boolean

Returns:

  • (Boolean)


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

def successful?
  if ( @config[:builder, @name.to_sym, :failure] and @config[:builder, @name.to_sym, :success] )
    $?.exitstatus == 0 and !@output.include?(@config[:builder, @name.to_sym, :failure]) and @output.include?(@config[:builder, @name.to_sym, :success])
  else
    super # use RubyBase default if custom :success and :failure not specified
  end
end