Sha256: 78b7e7af02fd2f4de115349cf04fd697f0a020d0754bef0c10ea2b293ddb5e97

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

require 'rake'
require 'rake/tasklib'
require 'bundler/audit/scanner'
require 'bundler/audit/cli'

module Bundler
  module Audit
    class Task < ::Rake::TaskLib
      attr_accessor :name
      attr_accessor :options
      attr_accessor :block
      attr_accessor :verbose
      attr_accessor :ignore

      def initialize(*args, &block)
        @options = args || []
        @block = block if block
        @verbose = false

        define
      end

      protected
      def define
        desc "Run Bundler-audit" unless ::Rake.application.last_comment
        @name = options.shift || :audit

        task @name, *options do |_, task_args|
          RakeFileUtils.send(:verbose, @verbose) do
            block.call(self) if block
            run
          end
        end
      end

      def run
        t = ['check']
        t << '-v' if verbose
        t << '-i' << ignore if ignore
        Bundler::Audit::CLI.start t
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mrjoy-bundler-audit-0.3.6 lib/bundler/audit/task.rb
mrjoy-bundler-audit-0.3.5 lib/bundler/audit/task.rb
mrjoy-bundler-audit-0.3.4 lib/bundler/audit/task.rb
mrjoy-bundler-audit-0.3.3 lib/bundler/audit/task.rb