diff options
-rw-r--r-- | .rubocop_todo.yml | 48 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 6 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 8 | ||||
-rw-r--r-- | lib/bundler/fetcher.rb | 2 | ||||
-rw-r--r-- | lib/bundler/gem_helpers.rb | 2 | ||||
-rw-r--r-- | lib/bundler/graph.rb | 2 | ||||
-rw-r--r-- | lib/bundler/resolver.rb | 20 | ||||
-rw-r--r-- | lib/bundler/ruby_version.rb | 2 | ||||
-rw-r--r-- | lib/bundler/similarity_detector.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 8 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 8 | ||||
-rw-r--r-- | spec/plugins/install_spec.rb | 14 | ||||
-rw-r--r-- | spec/support/artifice/endpoint.rb | 2 | ||||
-rw-r--r-- | spec/support/builders.rb | 2 |
15 files changed, 46 insertions, 82 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 80d5f9b4cc..ef3186ee8d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -70,29 +70,11 @@ Layout/ClosingHeredocIndentation: - 'spec/lock/lockfile_spec.rb' - 'spec/other/platform_spec.rb' -# Offense count: 5 -# Cop supports --auto-correct. -Layout/ElseAlignment: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 290 # Cop supports --auto-correct. Layout/EmptyLineAfterGuardClause: Enabled: false -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. -# SupportedStylesAlignWith: keyword, variable, start_of_line -Layout/EndAlignment: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: IndentationWidth. @@ -107,15 +89,6 @@ Layout/IndentArray: Layout/IndentHeredoc: Enabled: false -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: Width, IgnoredPatterns. -Layout/IndentationWidth: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. @@ -622,27 +595,6 @@ Style/StderrPuts: Style/SymbolArray: EnforcedStyle: brackets -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInArrayLiteral: - Exclude: - - 'lib/bundler/gem_helpers.rb' - - 'lib/bundler/ruby_version.rb' - - 'lib/bundler/similarity_detector.rb' - -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInHashLiteral: - Exclude: - - 'lib/bundler/cli/gem.rb' - - 'lib/bundler/fetcher.rb' - - 'lib/bundler/graph.rb' - - 'spec/support/artifice/endpoint.rb' - # Offense count: 2 # Cop supports --auto-correct. Style/UnneededCondition: diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 58e2f8a3fd..3db1ec7843 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -11,7 +11,7 @@ module Bundler class CLI::Gem TEST_FRAMEWORK_VERSIONS = { "rspec" => "3.0", - "minitest" => "5.0" + "minitest" => "5.0", }.freeze attr_reader :options, :gem_name, :thor, :name, :target @@ -57,7 +57,7 @@ module Bundler :ext => options[:ext], :exe => options[:exe], :bundler_version => bundler_dependency_version, - :github_username => github_username.empty? ? "[USERNAME]" : github_username + :github_username => github_username.empty? ? "[USERNAME]" : github_username, } ensure_safe_gem_name(name, constant_array) @@ -69,7 +69,7 @@ module Bundler "Rakefile.tt" => "Rakefile", "README.md.tt" => "README.md", "bin/console.tt" => "bin/console", - "bin/setup.tt" => "bin/setup" + "bin/setup.tt" => "bin/setup", } executables = %w[ diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 6f0d361160..69dcc6427f 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -441,10 +441,10 @@ repo_name ||= user_name message = String.new message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " message << if invalid_keys.size > 1 - "as options for #{command}, but they are invalid." - else - "as an option for #{command}, but it is invalid." - end + "as options for #{command}, but they are invalid." + else + "as an option for #{command}, but it is invalid." + end message << " Valid options are: #{valid_keys.join(", ")}." message << " You may be able to resolve this by upgrading Bundler to the newest version." diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 7ab71d99a8..7df42adc34 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -226,7 +226,7 @@ module Bundler "GO_SERVER_URL" => "go", "SNAP_CI" => "snap", "CI_NAME" => ENV["CI_NAME"], - "CI" => "ci" + "CI" => "ci", } env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci } end diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index 019ae10c66..9d35169b99 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -10,7 +10,7 @@ module Bundler [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")], [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")], - [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")] + [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")], ].freeze def generic(p) diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index de6bba0214..648754df29 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -117,7 +117,7 @@ module Bundler :style => "filled", :fillcolor => "#B9B9D5", :shape => "box3d", - :fontsize => 16 + :fontsize => 16, }.merge(@node_options[group]) ) end diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index aaa7bb7583..96ff5473fe 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -279,10 +279,10 @@ module Bundler versions_with_platforms = specs.map {|s| [s.version, s.platform] } message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n") message << if versions_with_platforms.any? - "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" - else - "The source does not contain any versions of '#{name}'" - end + "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" + else + "The source does not contain any versions of '#{name}'" + end else message = "Could not find gem '#{requirement}' in any of the gem sources " \ "listed in your Gemfile#{cache_message}." @@ -375,12 +375,12 @@ module Bundler o << " " o << if relevant_sources.empty? - "in any of the sources.\n" - elsif metadata_requirement - "is not available in #{relevant_sources.join(" or ")}" - else - "in any of the relevant sources:\n #{relevant_sources * "\n "}\n" - end + "in any of the sources.\n" + elsif metadata_requirement + "is not available in #{relevant_sources.join(" or ")}" + else + "in any of the relevant sources:\n #{relevant_sources * "\n "}\n" + end end end, :version_for_spec => lambda {|spec| spec.version }, diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index e6c31a94c9..ebfdb1a086 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -74,7 +74,7 @@ module Bundler @host ||= [ RbConfig::CONFIG["host_cpu"], RbConfig::CONFIG["host_vendor"], - RbConfig::CONFIG["host_os"] + RbConfig::CONFIG["host_os"], ].join("-") end diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index b7f3ee7afa..f698f46a4c 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -51,7 +51,7 @@ module Bundler dm[i][j] = [ dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub), dm[i][j - 1] + ins, - dm[i - 1][j] + del + dm[i - 1][j] + del, ].min end end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index ed734bf549..5f3f1bc2e4 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -191,10 +191,10 @@ module Bundler else message = String.new("The path `#{expanded_path}` ") message << if File.exist?(expanded_path) - "is not a directory." - else - "does not exist." - end + "is not a directory." + else + "does not exist." + end raise PathError, message end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 9e5032c079..88d88320e6 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -106,7 +106,7 @@ module Bundler end end - if installed?(spec) && !force + if (installed?(spec) || Plugin.installed?(spec.name)) && !force print_using_message "Using #{version_message(spec)}" return nil # no post-install message end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index aa19fa1ce0..cac571754c 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -221,7 +221,7 @@ RSpec.describe "bundle install with git sources" do end Dir.chdir(lib_path("foo-1.0")) do - `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1` + `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1` end # want to ensure we don't fallback to HEAD @@ -257,7 +257,7 @@ RSpec.describe "bundle install with git sources" do end Dir.chdir(lib_path("foo-1.0")) do - `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1` + `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1` end # want to ensure we don't fallback to HEAD @@ -282,7 +282,7 @@ RSpec.describe "bundle install with git sources" do it "does not download random non-head refs" do Dir.chdir(lib_path("foo-1.0")) do - sys_exec!("git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1") + sys_exec!('git update-ref -m "Bundler Spec!" refs/bundler/1 master~1') end bundle! "config global_gem_cache true" @@ -1163,7 +1163,7 @@ RSpec.describe "bundle install with git sources" do void Init_foo() { rb_define_global_function("foo", &foo, 0); } C end - `git commit -m 'commit for iteration #{i}' ext/foo.c` + `git commit -m "commit for iteration #{i}" ext/foo.c` end git_commit_sha = git_reader.ref_for("HEAD") diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb index 3d13278d9c..afc6087c1b 100644 --- a/spec/plugins/install_spec.rb +++ b/spec/plugins/install_spec.rb @@ -22,6 +22,18 @@ RSpec.describe "bundler plugin install" do plugin_should_be_installed("foo") end + context "plugin is already installed" do + before do + bundle "plugin install foo --source file://#{gem_repo2}" + end + + it "doesn't install plugin again" do + bundle "plugin install foo --source file://#{gem_repo2}" + expect(out).not_to include("Installing plugin foo") + expect(out).not_to include("Installed plugin foo") + end + end + it "installs multiple plugins" do bundle "plugin install foo kung-foo --source file://#{gem_repo2}" @@ -165,7 +177,7 @@ RSpec.describe "bundler plugin install" do build_plugin "foo", "1.1.0" end - install_gemfile <<-G + gemfile <<-G source 'file://#{gem_repo2}' plugin 'foo', "1.0" G diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb index 9a0cfae8a2..fcced6ea35 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -59,7 +59,7 @@ class Endpoint < Sinatra::Base :platform => spec.platform.to_s, :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep| [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")] - end + end, } end.compact end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 442623a415..33a81f6f65 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -649,7 +649,7 @@ module Spec `git config user.email "lol@wut.com"` `git config user.name "lolwut"` `git config commit.gpgsign false` - `git commit -m 'OMG INITIAL COMMIT'` + `git commit -m "OMG INITIAL COMMIT"` end end end |