Skip to content

Instantly share code, notes, and snippets.

@laurynas
Created March 25, 2017 10:07
Show Gist options
  • Save laurynas/451a7806aa4c0218055b7421da24a6be to your computer and use it in GitHub Desktop.
Save laurynas/451a7806aa4c0218055b7421da24a6be to your computer and use it in GitHub Desktop.
Bundler security audit rake task
# run with `bundle:audit_and_notify`
require 'bundler/audit/task'
Bundler::Audit::Task.new
task default: 'bundle:audit'
namespace :bundle do
desc 'Audit and notify about gem vulnerabilities'
task audit_and_notify: :environment do
output = `rake bundle:audit`
unless $CHILD_STATUS.success?
Notifier.notify_admin('Bundle vulnerabilities found', output).deliver
end
puts output
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment