Sha256: c468de4261f06a29cbc94698105cf5caa71a51c26dee09aeaf771507c0da8d00

Contents?: true

Size: 1002 Bytes

Versions: 10

Compression:

Stored size: 1002 Bytes

Contents

require 'cerberus/builder/ruby_base'

class Cerberus::Builder::Ruby < Cerberus::Builder::RubyBase
  def initialize(config)
    super(config, "ruby")
  end
  
  def run
    ENV['PATH'] = "#{@config[:builder, @name.to_sym, :ruby_path]}::#{ENV['PATH']}"
    super
  end
  
  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

  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
  
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
cerberus-0.8.0 lib/cerberus/builder/ruby.rb
cerberus-0.7.9 lib/cerberus/builder/ruby.rb
edavis10-cerberus-0.7.8 lib/cerberus/builder/ruby.rb
cerberus-0.7.8 lib/cerberus/builder/ruby.rb
cerberus-0.7.7 lib/cerberus/builder/ruby.rb
cerberus-0.7.6 lib/cerberus/builder/ruby.rb
cerberus-0.7.2 lib/cerberus/builder/ruby.rb
cerberus-0.7.5 lib/cerberus/builder/ruby.rb
cerberus-0.7 lib/cerberus/builder/ruby.rb
cerberus-0.6 lib/cerberus/builder/ruby.rb