Sha256: f8b54cba239243852934cc8d6e53faca45e1de6b3bcf4b998d4acbdc906169c9

Contents?: true

Size: 777 Bytes

Versions: 3

Compression:

Stored size: 777 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 u|U)npatched versions 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

3 entries across 3 versions & 1 rubygems

Version Path
warder-0.2.2 lib/warder/bundle_audit_runner.rb
warder-0.2.1 lib/warder/bundle_audit_runner.rb
warder-0.2.0 lib/warder/bundle_audit_runner.rb