class Bundler::Audit::Task
Defines the ‘bundle:audit` rake tasks.
Public Class Methods
new()
click to toggle source
Initializes the task.
# File lib/bundler/audit/task.rb, line 15 def initialize define end
Public Instance Methods
bundler_audit(*arguments)
click to toggle source
Runs the ‘bundler-audit` command with the additional arguments.
@param [Array<String>] arguments
Additional command-line arguments for `bundler-audit`.
@return [true]
The `bundler-audit` command successfully exited.
@raise [CommandNotFound]
The `bundler-audit` command could not be executed or was not found.
@note
If the `bundler-audit` command exits with an error, the rake task will also exit with the same error code.
@api private
# File lib/bundler/audit/task.rb, line 37 def bundler_audit(*arguments) case system('bundler-audit',*arguments) when false exit $?.exitstatus || 1 when nil raise(CommandNotFound,"bundler-audit could not be executed") else return true end end
check()
click to toggle source
Runs the ‘bundle-audit check` command.
@return [true]
The `bundler-audit` command successfully exited.
@raise [CommandNotFound]
The `bundler-audit` command could not be executed or was not found.
@note
If the `bundler-audit` command exits with an error, the rake task will also exit with the same error code.
@api private
# File lib/bundler/audit/task.rb, line 63 def check bundler_audit 'check' end
update()
click to toggle source
Runs the ‘bundle-audit update` command.
@return [true]
The `bundler-audit` command successfully exited.
@raise [CommandNotFound]
The `bundler-audit` command could not be executed or was not found.
@note
If the `bundler-audit` command exits with an error, the rake task will also exit with the same error code.
@api private
# File lib/bundler/audit/task.rb, line 82 def update bundler_audit 'update' end
Protected Instance Methods
define()
click to toggle source
Defines the ‘bundle:audit` and `bundle:audit:update` task.
# File lib/bundler/audit/task.rb, line 91 def define namespace :bundle do namespace :audit do desc 'Checks the Gemfile.lock for insecure dependencies' task :check do check end desc 'Updates the bundler-audit vulnerability database' task :update do update end end task :audit => 'audit:check' end task 'bundler:audit' => 'bundle:audit' task 'bundler:audit:check' => 'bundle:audit:check' task 'bundler:audit:update' => 'bundle:audit:update' end