diff options
author | Samuel E. Giddins <segiddins@segiddins.me> | 2015-08-13 09:28:30 -0700 |
---|---|---|
committer | Samuel E. Giddins <segiddins@segiddins.me> | 2015-08-13 09:28:30 -0700 |
commit | 21ddb03ee952f96ef3cf09935c8c90db2503e088 (patch) | |
tree | 3a6737b134e2ab0f0892fced32a721670cb02232 | |
parent | 05c8262d3dff0c50c77ac8a1c6933e18f63c71fe (diff) | |
parent | b779901301730efd1fe3a30e3e2f1a00c8120c1a (diff) | |
download | bundler-21ddb03ee952f96ef3cf09935c8c90db2503e088.tar.gz |
Merge pull request #3920 from bundler/seg-update-rubocop
[RuboCop] Update to 0.33.0
-rw-r--r-- | .rubocop.yml | 3 | ||||
-rw-r--r-- | Rakefile | 4 | ||||
-rwxr-xr-x | bin/rubocop | 2 | ||||
-rw-r--r-- | bundler.gemspec | 2 | ||||
-rw-r--r-- | lib/bundler.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli.rb | 10 | ||||
-rw-r--r-- | lib/bundler/cli/outdated.rb | 2 | ||||
-rw-r--r-- | lib/bundler/definition.rb | 4 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 2 | ||||
-rw-r--r-- | lib/bundler/fetcher.rb | 2 | ||||
-rw-r--r-- | lib/bundler/graph.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/retry.rb | 6 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 4 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 6 | ||||
-rw-r--r-- | lib/bundler/similarity_detector.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 2 | ||||
-rw-r--r-- | spec/cache/git_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/dependency_api_spec.rb | 2 | ||||
-rw-r--r-- | spec/realworld/edgecases_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/builders.rb | 12 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 2 |
22 files changed, 40 insertions, 37 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 8b9a20f661..269c8c519a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -30,6 +30,9 @@ Style/MultilineOperationIndentation: Style/SpaceInsideBlockBraces: SpaceBeforeBlockParameters: false +Style/TrivialAccessors: + Enabled: false + # We adopted raise instead of fail. Style/SignalException: EnforcedStyle: only_raise @@ -33,7 +33,7 @@ namespace :spec do deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d| [d.name, d.requirement.to_s] end] - deps["rubocop"] ||= ">= 0.32.1" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement + deps["rubocop"] ||= "= 0.33.0" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement # JRuby can't build ronn or rdiscount, so we skip that if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" @@ -88,7 +88,7 @@ begin if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement - gem "rubocop", ">= 0.32.1" + gem "rubocop", "= 0.33.0" require "rubocop/rake_task" RuboCop::RakeTask.new end diff --git a/bin/rubocop b/bin/rubocop index cc9107c6cc..7936c64fa2 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -7,5 +7,5 @@ bundler_spec.dependencies.each do |dep| gem dep.name, dep.requirement.to_s end -gem "rubocop", ">= 0.32.1" +gem "rubocop", "= 0.33.0" load Gem.bin_path("rubocop", "rubocop") diff --git a/bundler.gemspec b/bundler.gemspec index ef2a04df77..52f65b2a03 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.0" - s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) } + s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) } # we don't check in man pages, but we need to ship them because # we use them to generate the long-form help for each command. s.files += Dir.glob("lib/bundler/man/**/*") diff --git a/lib/bundler.rb b/lib/bundler.rb index 5bb35f4d40..143d49e9cf 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -428,7 +428,7 @@ module Bundler eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s) rescue ScriptError, StandardError => e original_line = e.backtrace.find {|line| line.include?(path.to_s) } - msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}" + msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}" msg << " from\n #{original_line}" if original_line msg << "\n" diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index e79cd5b145..c481ac7322 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -17,7 +17,7 @@ module Bundler super custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] - ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile + ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile Bundler.settings[:retry] = options[:retry] if options[:retry] @@ -38,7 +38,7 @@ module Bundler class_option "no-color", :type => :boolean, :desc => "Disable colorization in output" class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM", :desc => "Specify the number of times you wish to attempt network commands" - class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V" + class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V" def help(cli = nil) case cli @@ -240,7 +240,7 @@ module Bundler desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" - method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." + method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." def cache require "bundler/cli/cache" Cache.new(options).run @@ -252,8 +252,8 @@ module Bundler method_option "cache-path", :type => :string, :banner => "Specify a different cache path than the default (vendor/cache)." method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" - method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package." - method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." + method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package." + method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index b80519fb1e..640e4f7ca7 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -39,7 +39,7 @@ module Bundler dependency = current_dependencies[current_spec.name] if options["strict"] - active_spec = definition.specs.detect {|spec| spec.name == current_spec.name } + active_spec = definition.specs.detect {|spec| spec.name == current_spec.name } else active_spec = definition.index[current_spec.name].sort_by(&:version) if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1 diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index f65587316a..4f68c2248e 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -61,7 +61,7 @@ module Bundler if lockfile && File.exist?(lockfile) @lockfile_contents = Bundler.read_file(lockfile) locked = LockfileParser.new(@lockfile_contents) - @platforms = locked.platforms + @platforms = locked.platforms @locked_bundler_version = locked.bundler_version if unlock != true @@ -419,7 +419,7 @@ module Bundler end def pretty_dep(dep, source = false) - msg = "#{dep.name}" + msg = "#{dep.name}" msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default msg << " from the `#{dep.source}` source" if source && dep.source msg diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 7d66b5e621..5d7dfddf22 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -439,7 +439,7 @@ module Bundler lines = contents.lines.to_a indent = " # " - indicator = indent.gsub("#", ">") + indicator = indent.tr('#', ">") first_line = (line_numer.zero?) last_line = (line_numer == (lines.count - 1)) diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 1ef8772150..829b709c38 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -58,7 +58,7 @@ module Bundler attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries end - self.redirect_limit = Bundler.settings[:redirect] # How many redirects to allow in one request + self.redirect_limit = Bundler.settings[:redirect] # How many redirects to allow in one request self.api_timeout = Bundler.settings[:timeout] # How long to wait for each API call self.max_retries = Bundler.settings[:retry] # How many retries for the API call diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 74a59c115b..66ea2d99a8 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -135,7 +135,7 @@ module Bundler @groups.each do |group| g.add_nodes( group, - { :style => "filled", + { :style => "filled", :fillcolor => "#B9B9D5", :shape => "box3d", :fontsize => 16 }.merge(@node_options[group]) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 2240c17f1a..e4a9a8c9fe 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -232,7 +232,7 @@ module Bundler spec.require_paths.each do |path| full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path) gem_path = Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)) - paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}", '#{ruby_engine}/#{ruby_version}') # rubocop:disable Style/StringLiterals + paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}", '#{ruby_engine}/#{ruby_version}') end end diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb index 7f6da8a58e..85bff78807 100644 --- a/lib/bundler/retry.rb +++ b/lib/bundler/retry.rb @@ -15,10 +15,10 @@ module Bundler end def initialize(name, exceptions = nil, retries = self.class.default_retries) - @name = name - @retries = retries + @name = name + @retries = retries @exceptions = Array(exceptions) || [] - @total_runs = @retries + 1 # will run once, then upto attempts.times + @total_runs = @retries + 1 # will run once, then upto attempts.times end def attempt(&block) diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 5ce80d7a78..d8c3b8d048 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -278,7 +278,7 @@ module Bundler dep = Gem::Dependency.new(dep, reqs) end - spec = specs.find {|s| s.name == dep.name } + spec = specs.find {|s| s.name == dep.name } if spec.nil? @@ -349,7 +349,7 @@ module Bundler "to work around a system/bundle conflict." end else - spec = specs.find {|s| s.name == name } + spec = specs.find {|s| s.name == name } exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}" end diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 497f3b77bc..28767af5e2 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -81,7 +81,7 @@ module Bundler if dep.autorequire.nil? && dep.name.include?("-") begin - namespaced_file = dep.name.gsub("-", "/") + namespaced_file = dep.name.tr("-", "/") Kernel.require namespaced_file rescue LoadError => e REQUIRE_ERRORS.find {|r| r =~ e.message } @@ -225,7 +225,7 @@ module Bundler private def prune_gem_cache(resolve, cache_path) - cached = Dir["#{cache_path}/*.gem"] + cached = Dir["#{cache_path}/*.gem"] cached = cached.delete_if do |path| spec = Bundler.rubygems.spec_from_gem path @@ -246,7 +246,7 @@ module Bundler end def prune_git_and_path_cache(resolve, cache_path) - cached = Dir["#{cache_path}/*/.bundlecache"] + cached = Dir["#{cache_path}/*/.bundlecache"] cached = cached.delete_if do |path| name = File.basename(File.dirname(path)) diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index 0657192eda..de2de05992 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -31,7 +31,7 @@ module Bundler # ins, del, sub are weighted costs return nil if this.nil? return nil if that.nil? - dm = [] # distance matrix + dm = [] # distance matrix # Initialize first row values dm[0] = (0..this.length).collect {|i| i * ins } diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index b42d172cce..0c408b4bbf 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -147,7 +147,7 @@ module Bundler s.platform = Gem::Platform::RUBY s.summary = "Fake gemspec for #{@name}" s.relative_loaded_from = "#{@name}.gemspec" - s.authors = ["no one"] + s.authors = ["no one"] if expanded_path.join("bin").exist? executables = expanded_path.join("bin").children executables.reject! {|p| File.directory?(p) } diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 5aacd5a0f2..81c10cf873 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe "git base name" do it "base_name should strip private repo uris" do - source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git") + source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git") expect(source.send(:base_name)).to eq("bundler") end diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 2d68bc2575..97b1c6fc9e 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -290,7 +290,7 @@ describe "gemcutter's dependency API" do build_repo4 do build_gem "activesupport", "1.2.0" build_gem "somegem", "1.0.0" do |s| - s.add_dependency "activesupport", "1.2.3" #This version exists only in repo1 + s.add_dependency "activesupport", "1.2.3" #This version exists only in repo1 end end diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 1af311e233..89c313eafc 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -47,7 +47,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do expect(out).to include("capybara 2.2.1") end - it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do + it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do install_gemfile <<-G source "https://rubygems.org" diff --git a/spec/support/builders.rb b/spec/support/builders.rb index ca26655ff4..b5e044b67d 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -3,7 +3,7 @@ require "bundler/shared_helpers" module Spec module Builders def self.constantize(name) - name.gsub("-", "").upcase + name.delete("-").upcase end def v(version) @@ -35,7 +35,7 @@ module Spec s.add_dependency "rack", "0.9.1" end - build_gem "rails", "2.3.2" do |s| + build_gem "rails", "2.3.2" do |s| s.executables = "rails" s.add_dependency "rake", "10.0.2" s.add_dependency "actionpack", "2.3.2" @@ -43,19 +43,19 @@ module Spec s.add_dependency "actionmailer", "2.3.2" s.add_dependency "activeresource", "2.3.2" end - build_gem "actionpack", "2.3.2" do |s| + build_gem "actionpack", "2.3.2" do |s| s.add_dependency "activesupport", "2.3.2" end - build_gem "activerecord", ["2.3.1", "2.3.2"] do |s| + build_gem "activerecord", ["2.3.1", "2.3.2"] do |s| s.add_dependency "activesupport", "2.3.2" end - build_gem "actionmailer", "2.3.2" do |s| + build_gem "actionmailer", "2.3.2" do |s| s.add_dependency "activesupport", "2.3.2" end build_gem "activeresource", "2.3.2" do |s| s.add_dependency "activesupport", "2.3.2" end - build_gem "activesupport", %w(1.2.3 2.3.2 2.3.5) + build_gem "activesupport", %w(1.2.3 2.3.2 2.3.5) build_gem "activemerchant" do |s| s.add_dependency "activesupport", ">= 2.0.0" diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index a879955a05..8456de163f 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -41,7 +41,7 @@ module Spec args = args.gsub(/(?=")/, "\\") args = %["#{args}"] end - lib = File.join(File.dirname(__FILE__), "..", "..", "lib") + lib = File.join(File.dirname(__FILE__), "..", "..", "lib") %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip end |