Skip to content

Commit

Permalink
[rubygems/rubygems] Only add .rubocop.yml when --rubocop flag is passed
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

rubygems/rubygems@ef2dae4222
  • Loading branch information
utkarsh2102 authored and hsbt committed Jun 18, 2020
1 parent f9de8cc commit d9c888d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/bundler/cli/gem.rb
Expand Up @@ -148,6 +148,7 @@ def run
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
config[:rubocop] = true
Bundler.ui.info "RuboCop enabled in config"
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
end

templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
Expand Down
8 changes: 8 additions & 0 deletions spec/bundler/commands/newgem_spec.rb
Expand Up @@ -169,6 +169,10 @@ def gem_skeleton_assertions
rubocop_dep = builder.dependencies.find {|d| d.name == "rubocop" }
expect(rubocop_dep).not_to be_nil
end

it "generates a default .rubocop.yml" do
expect(bundled_app("#{gem_name}/.rubocop.yml")).to exist
end
end

shared_examples_for "--no-rubocop flag" do
Expand All @@ -192,6 +196,10 @@ def gem_skeleton_assertions
rubocop_dep = builder.dependencies.find {|d| d.name == "rubocop" }
expect(rubocop_dep).to be_nil
end

it "doesn't generate a default .rubocop.yml" do
expect(bundled_app("#{gem_name}/.rubocop.yml")).to_not exist
end
end

shared_examples_for "CI config is absent" do
Expand Down

0 comments on commit d9c888d

Please sign in to comment.