Class: Pipeline::BundleAudit

Inherits:
BaseTask show all
Includes:
Util
Defined in:
lib/pipeline/tasks/bundle-audit.rb

Instance Attribute Summary

Attributes inherited from BaseTask

#appname, #description, #findings, #labels, #name, #stage, #trigger, #warnings

Instance Method Summary collapse

Methods included from Util

#fingerprint, #relative_path, #runsystem, #strip_archive_path

Methods inherited from BaseTask

#report, #severity, #warn

Constructor Details

#initialize(trigger, tracker) ⇒ BundleAudit

Returns a new instance of BundleAudit.



10
11
12
13
14
15
16
# File 'lib/pipeline/tasks/bundle-audit.rb', line 10

def initialize(trigger, tracker)
  super(trigger, tracker)
  @name = "BundleAudit"
  @description = "Dependency Checker analysis for Ruby"
  @stage = :code
  @labels << "code" << "ruby"
end

Instance Method Details

#analyzeObject



27
28
29
30
31
32
33
34
35
# File 'lib/pipeline/tasks/bundle-audit.rb', line 27

def analyze
  # puts @result
  begin
    get_warnings
  rescue Exception => e
    Pipeline.warn e.message
    Pipeline.notify "Appears not to be a project with Gemfile.lock or there was another problem ... bundle-audit skipped."
  end
end

#runObject



18
19
20
21
22
23
24
25
# File 'lib/pipeline/tasks/bundle-audit.rb', line 18

def run
  # Pipeline.notify "#{@name}"
  rootpath = @trigger.path
  Pipeline.debug "Rootpath: #{rootpath}"
  Dir.chdir("#{rootpath}") do
    @result= runsystem(true, "bundle-audit", "check")
  end
end

#supported?Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
43
44
45
# File 'lib/pipeline/tasks/bundle-audit.rb', line 37

def supported?
  supported=runsystem(true, "bundle-audit", "update")
  if supported =~ /command not found/
    Pipeline.notify "Run: gem install bundler-audit"
    return false
  else
    return true
  end
end