bundler-audit

Public
bundler-audit provides patch-level verification for Bundled apps.
Icons/chart bar
Used 50 times
Created by
V Viktor Schmidt

Usage
RubyGems: https://rubygems.org/gems/bundler-audit

$ bin/bundler-audit check --update

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/zJosgN"
Template Source

Review the code before running this template on your machine.

def do_bundle
  Bundler.with_original_env { run "bundle install" }
end

def print_green(heredoc)
  puts set_color heredoc, :green
end

def do_commit
  git :init
  git add: "."
  git commit: " -m 'Add bundler-audit patch-level verification' "
end

def puts_usage
  say "\nUsage:"
  say "`bin/bundler-audit check --update`"
end

say "\nApplying bundler-audit patch-level verification..."
inject_into_file 'Gemfile', after: 'group :development do' do
  <<-RUBY

  # bundler-audit provides patch-level verification for Bundled apps.
  gem "bundler-audit", "~> 0.9", require: false
  RUBY
end

do_bundle

run "bundle binstubs bundler-audit"
run "bin/bundler-audit check --update"

say "\nAdding documentation for developers..."
create_file "doc/security.md", "# Security\n" unless File.exist? "doc/security.md"
append_file "doc/security.md" do
  <<~EOF  

  ## Bundler-Audit

  [bundler-audit](https://rubygems.org/gems/bundler-audit) provides patch-level verification for Bundled apps.

  Update audit db:

  `$ bin/bundler-audit update`

  Run checks:

  `$ bin/bundler-audit check`

  Or run it all in one command:

  `$ bin/bundler-audit check --update`
  EOF
end

do_commit

print_green "\nAdded bundler-audit successfully!"
puts_usage
Comments

Sign up or Login to leave a comment.

© 2023 GoRails, LLC