Skip to content

Commit

Permalink
Use bundle-audit rake task from the gem
Browse files Browse the repository at this point in the history
Instead of defining the audit task from scratch, we can import
the task from the gem itself.
  • Loading branch information
Oli Peate authored and odlp committed Mar 14, 2017
1 parent 3725842 commit ae2281e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/suspenders/app_builder.rb
Expand Up @@ -401,7 +401,7 @@ def setup_segment

def setup_bundler_audit
copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
append_file "Rakefile", %{\ntask default: "bundler:audit"\n}
append_file "Rakefile", %{\ntask default: "bundle:audit"\n}
end

def setup_spring
Expand Down
8 changes: 8 additions & 0 deletions spec/features/new_project_spec.rb
Expand Up @@ -29,6 +29,14 @@
end
end

it "includes the bundle:audit task" do
Dir.chdir(project_path) do
Bundler.with_clean_env do
expect(`rake -T`).to include('rake bundle:audit')
end
end
end

it "creates .ruby-version from Suspenders .ruby-version" do
ruby_version_file = IO.read("#{project_path}/.ruby-version")

Expand Down
12 changes: 2 additions & 10 deletions templates/bundler_audit.rake
@@ -1,12 +1,4 @@
if Rails.env.development? || Rails.env.test?
require "bundler/audit/cli"

namespace :bundler do
desc "Updates the ruby-advisory-db and runs audit"
task :audit do
%w(update check).each do |command|
Bundler::Audit::CLI.start [command]
end
end
end
require "bundler/audit/task"
Bundler::Audit::Task.new
end

0 comments on commit ae2281e

Please sign in to comment.