Class: Pipeline::Test
- Includes:
- Util
- Defined in:
- lib/pipeline/tasks/test.rb
Instance Attribute Summary
Attributes inherited from BaseTask
#appname, #description, #findings, #labels, #name, #stage, #trigger, #warnings
Instance Method Summary collapse
- #analyze ⇒ Object
-
#initialize(trigger, tracker) ⇒ Test
constructor
A new instance of Test.
- #run ⇒ Object
- #supported? ⇒ Boolean
Methods included from Util
#fingerprint, #relative_path, #runsystem, #strip_archive_path
Methods inherited from BaseTask
Constructor Details
#initialize(trigger, tracker) ⇒ Test
Returns a new instance of Test.
8 9 10 11 12 13 14 |
# 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 |
Instance Method Details
#analyze ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# 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. Pipeline.notify "Error grepping ... " end end |
#run ⇒ Object
16 17 18 19 20 21 22 23 |
# 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? ⇒ Boolean
37 38 39 40 41 42 43 44 45 |
# 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 |