Sha256: 78d125ecde4be50e648a0acafec8a68a04952094b686fc49a6897a7dbdcb62b9

Contents?: true

Size: 774 Bytes

Versions: 6

Compression:

Stored size: 774 Bytes

Contents

module Warder
  # responsible for run bundle freshness validation
  class BundleAuditRunner < Runner
    CLI_OPTION = 'b'
    CLI_FULL_OPTION = 'bundle-audit'
    DESCRIPTION = 'Run bundle freshness validation'
    COMMAND_NAME = 'bundle-audit'
    FAILURE_REGEXP = /(No v|V)ulnerabilities found/

    private

    attr_reader :stats_msg

    def command_with_options
      path = @options.files.split(' ').first
      "#{COMMAND_NAME} update &> /dev/null && "\
        "(cd #{path} && #{COMMAND_NAME} check)"
    end

    def number_of_issues(line)
      match = FAILURE_REGEXP.match(line)
      return 0 unless match
      @stats_msg = line
      match[1].match('No ') ? 0 : 1
    end

    def printable?(line)
      super && !FAILURE_REGEXP.match(line)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
warder-0.3.4 lib/warder/bundle_audit_runner.rb
warder-0.3.2 lib/warder/bundle_audit_runner.rb
warder-0.3.1 lib/warder/bundle_audit_runner.rb
warder-0.3.0 lib/warder/bundle_audit_runner.rb
warder-0.2.4 lib/warder/bundle_audit_runner.rb
warder-0.2.3 lib/warder/bundle_audit_runner.rb