class Pipeline::Test

Public Class Methods

new(trigger, tracker) click to toggle source
Calls superclass method Pipeline::BaseTask::new
# File lib/pipeline/tasks/test.rb, line 8
def initialize(trigger, tracker)
  super(trigger, tracker)
  @name = "Test"
  @description = "Test"
  @stage = :code
  @labels << "code" << "ruby"
end

Public Instance Methods

analyze() click to toggle source
# File lib/pipeline/tasks/test.rb, line 25
def analyze
  begin
    list = @result.split(/\n/)
    list.each do |match|
        report "Match", match, @name, :low, "fingerprint"
    end
rescue Exception => e
    Pipeline.warn e.message
    Pipeline.notify "Error grepping ... "
  end
end
run() click to toggle source
# File lib/pipeline/tasks/test.rb, line 16
def run
  # Pipeline.notify "#{@name}"
  rootpath = @trigger.path
  Pipeline.debug "Rootpath: #{rootpath}"
  Dir.chdir("#{rootpath}") do
    @result= runsystem(true, "grep", "-R", "secret")
  end
end
supported?() click to toggle source
# File lib/pipeline/tasks/test.rb, line 37
def supported?
  supported=runsystem(true, "grep", "-h")
  if supported =~ /usage/
    Pipeline.notify "Install grep."
    return false
  else
    return true
  end
end