diff options
55 files changed, 204 insertions, 210 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f8d8cc2515..1e8b11e46c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2017-05-09 10:32:47 +0900 using RuboCop version 0.48.1. +# on 2017-05-09 12:52:15 +0900 using RuboCop version 0.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -317,12 +317,6 @@ Style/NumericPredicate: - 'lib/bundler/source/git/git_proxy.rb' - 'lib/bundler/source/path.rb' -# Offense count: 192 -# Cop supports --auto-correct. -# Configuration parameters: PreferredDelimiters. -Style/PercentLiteralDelimiters: - Enabled: false - # Offense count: 9 # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. # NamePrefix: is_, has_, have_ @@ -104,14 +104,14 @@ begin end desc "Run the real-world spec suite (requires internet)" - task :realworld => %w(set_realworld spec) + task :realworld => %w[set_realworld spec] task :set_realworld do ENV["BUNDLER_REALWORLD_TESTS"] = "1" end desc "Run the spec suite with the sudo tests" - task :sudo => %w(set_sudo spec clean_sudo) + task :sudo => %w[set_sudo spec clean_sudo] task :set_sudo do ENV["BUNDLER_SUDO_TESTS"] = "1" @@ -126,13 +126,13 @@ begin namespace :rubygems do rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! - branches = %w(master) - releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8) + branches = %w[master] + releases = %w[v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8] (branches + releases).each do |rg| desc "Run specs with RubyGems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| - t.rspec_opts = %w(--format progress --color) - t.ruby_opts = %w(-w) + t.rspec_opts = %w[--format progress --color] + t.ruby_opts = %w[-w] end # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs @@ -172,8 +172,8 @@ begin desc "Run specs under a RubyGems checkout (set RG=path)" RSpec::Core::RakeTask.new("co") do |t| - t.rspec_opts = %w(--format documentation --color) - t.ruby_opts = %w(-w) + t.rspec_opts = %w[--format documentation --color] + t.ruby_opts = %w[-w] end task "setup_co" do diff --git a/bundler.gemspec b/bundler.gemspec index 38d739b0ba..f5c459eaed 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -43,6 +43,6 @@ Gem::Specification.new do |s| s.files += Dir.glob("man/**/*") s.bindir = "exe" - s.executables = %w(bundle bundler) + s.executables = %w[bundle bundler] s.require_paths = ["lib"] end diff --git a/exe/bundle b/exe/bundle index ab2bde16e2..d73e9984c9 100755 --- a/exe/bundle +++ b/exe/bundle @@ -28,7 +28,7 @@ Bundler.with_friendly_errors do require "bundler/cli" # Allow any command to use --help flag to show help for that command - help_flags = %w(--help -h) + help_flags = %w[--help -h] help_flag_used = ARGV.any? {|a| help_flags.include? a } args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV diff --git a/lib/bundler.rb b/lib/bundler.rb index 4285e3ae20..717c2d11e9 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -15,7 +15,7 @@ require "bundler/constants" require "bundler/current_ruby" module Bundler - environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH)) + environment_preserver = EnvironmentPreserver.new(ENV, %w[PATH GEM_PATH]) ORIGINAL_ENV = environment_preserver.restore ENV.replace(environment_preserver.backup) SUDO_MUTEX = Mutex.new diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 554c24d3a3..38db7db492 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -4,7 +4,7 @@ require "bundler/vendored_thor" module Bundler class CLI < Thor - AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean).freeze + AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze def self.start(*) super @@ -241,7 +241,7 @@ module Bundler Show.new(options, gem_name).run end # TODO: 2.0 remove `bundle list` - map %w(list) => "show" + map %w[list] => "show" desc "info GEM [OPTIONS]", "Show information for the given gem" method_option "path", :type => :boolean, :banner => "Print full path to gem" @@ -345,7 +345,7 @@ module Bundler require "bundler/cli/package" Package.new(options).run end - map %w(pack) => :package + map %w[pack] => :package desc "exec [OPTIONS]", "Run the command in context of the bundle" method_option :keep_file_descriptors, :type => :boolean, :default => false @@ -395,7 +395,7 @@ module Bundler def version Bundler.ui.info "Bundler version #{Bundler::VERSION}" end - map %w(-v --version) => :version + map %w[-v --version] => :version desc "licenses", "Prints the license of all gems in the bundle" def licenses @@ -569,14 +569,14 @@ module Bundler # into the corresponding `bundle help #{command}` call def self.reformatted_help_args(args) bundler_commands = all_commands.keys - help_flags = %w(--help -h) - exec_commands = %w(e ex exe exec) + help_flags = %w[--help -h] + exec_commands = %w[e ex exe exec] help_used = args.index {|a| help_flags.include? a } exec_used = args.index {|a| exec_commands.include? a } command = args.find {|a| bundler_commands.include? a } if exec_used && help_used if exec_used + help_used == 1 - %w(help exec) + %w[help exec] else args end @@ -615,7 +615,7 @@ module Bundler return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug? _, _, config = @_initializer current_command = config[:current_command].name - return if %w(exec version check platform show help).include?(current_command) + return if %w[exec version check platform show help].include?(current_command) command = ["bundle", current_command] + args command << Thor::Options.to_switches(options) command.reject!(&:empty?) diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index e8f13620ec..a61cf128b1 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -112,7 +112,7 @@ module Bundler end def valid_scope?(scope) - %w(delete local global).include?(scope) + %w[delete local global].include?(scope) end end end diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 62f7bc26cb..990f71f1d1 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -5,7 +5,7 @@ module Bundler class CLI::Exec attr_reader :options, :args, :cmd - RESERVED_SIGNALS = %w(SEGV BUS ILL FPE VTALRM KILL STOP).freeze + RESERVED_SIGNALS = %w[SEGV BUS ILL FPE VTALRM KILL STOP].freeze def initialize(options, args) @options = options diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 0e4b7f742b..26dc8eedd9 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -71,10 +71,10 @@ module Bundler "bin/setup.tt" => "bin/setup" } - executables = %w( + executables = %w[ bin/console bin/setup - ) + ] templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present? diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 863d0dd388..62cfc3d28c 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -46,7 +46,7 @@ module Bundler Bundler::CLI::Common.patch_level_options(options).any? filter_options_patch = options.keys & - %w(filter-major filter-minor filter-patch) + %w[filter-major filter-minor filter-patch] definition_resolution = proc do options[:local] ? definition.resolve_with_cache! : definition.resolve_remotely! diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index cca40100ad..fbdd3182a9 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -8,7 +8,7 @@ module Bundler end class CurrentRuby - KNOWN_MINOR_VERSIONS = %w( + KNOWN_MINOR_VERSIONS = %w[ 1.8 1.9 2.0 @@ -17,11 +17,11 @@ module Bundler 2.3 2.4 2.5 - ).freeze + ].freeze KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze - KNOWN_PLATFORMS = %w( + KNOWN_PLATFORMS = %w[ jruby maglev mingw @@ -31,7 +31,7 @@ module Bundler rbx ruby x64_mingw - ).freeze + ].freeze def ruby? !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev") diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 92c813113b..2d219edcc7 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -14,8 +14,8 @@ module Bundler VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze - VALID_KEYS = %w(group groups git path glob name branch ref tag require submodules - platform platforms type source install_if).freeze + VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules + platform platforms type source install_if].freeze attr_reader :gemspecs attr_accessor :dependencies @@ -356,7 +356,7 @@ module Bundler opts["git"] = @git_sources[git_name].call(opts[git_name]) end - %w(git path).each do |type| + %w[git path].each do |type| next unless param = opts[type] if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/ options = opts.merge("name" => name, "version" => $1) @@ -378,7 +378,7 @@ module Bundler normalize_hash(opts) groups = groups.map {|group| ":#{group}" }.join(", ") - validate_keys("group #{groups}", opts, %w(optional)) + validate_keys("group #{groups}", opts, %w[optional]) opts["optional"] ||= false end diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index 5e0800889e..c1c3349e2b 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -22,7 +22,7 @@ module Bundler out << "Git #{git_version}\n" out << "Platform #{Gem::Platform.local}\n" out << "OpenSSL #{OpenSSL::OPENSSL_VERSION}\n" if defined?(OpenSSL::OPENSSL_VERSION) - %w(rubygems-bundler open_gem).each do |name| + %w[rubygems-bundler open_gem].each do |name| specs = Bundler.rubygems.find_name(name) out << "#{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty? end diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index b6a0c0024f..3c1680a194 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -187,7 +187,7 @@ module Bundler end def gem_push? - !%w(n no nil false off 0).include?(ENV["gem_push"].to_s.downcase) + !%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase) end end end diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index b62a5e7676..576ce2a274 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -60,7 +60,7 @@ The error was: #{e} ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s - if !Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) && (ARGV.empty? || ARGV.any? {|a| %w(install i).include? a }) + if !Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) && (ARGV.empty? || ARGV.any? {|a| %w[install i].include? a }) puts <<-WARN.strip You're running Bundler #{installed_version} but this project uses #{running_version}. To update, run `bundle update --bundler`. WARN diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 85c653bee6..8b7ed19465 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -179,7 +179,7 @@ module Bundler end def repository_subdirectories - %w(cache doc gems specifications) + %w[cache doc gems specifications] end def clear_paths @@ -306,7 +306,7 @@ module Bundler end def security_policy_keys - %w(High Medium Low AlmostNo No).map {|level| "#{level}Security" } + %w[High Medium Low AlmostNo No].map {|level| "#{level}Security" } end def security_policies diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 9a93eebf83..68a7add942 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -6,7 +6,7 @@ module Bundler autoload :Mirror, "bundler/mirror" autoload :Mirrors, "bundler/mirror" - BOOL_KEYS = %w( + BOOL_KEYS = %w[ allow_offline_install auto_install cache_all @@ -28,14 +28,14 @@ module Bundler plugins silence_root_warning error_on_stderr - ).freeze + ].freeze - NUMBER_KEYS = %w( + NUMBER_KEYS = %w[ redirect retry ssl_verify_mode timeout - ).freeze + ].freeze DEFAULT_CONFIG = { :redirect => 5, @@ -318,9 +318,9 @@ module Bundler end end - PER_URI_OPTIONS = %w( + PER_URI_OPTIONS = %w[ fallback_timeout - ).freeze + ].freeze NORMALIZE_URI_OPTIONS_PATTERN = / diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 74700cde35..b3354972d4 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -63,7 +63,7 @@ module Bundler end def with_clean_git_env(&block) - keys = %w(GIT_DIR GIT_WORK_TREE) + keys = %w[GIT_DIR GIT_WORK_TREE] old_env = keys.inject({}) do |h, k| h.update(k => ENV[k]) end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index b3e218e390..4f94f790c8 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -18,7 +18,7 @@ module Bundler @allow_remote = false # Stringify options that could be set as symbols - %w(ref branch tag revision).each {|k| options[k] = options[k].to_s if options[k] } + %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] } @uri = options["uri"] || "" @branch = options["branch"] @@ -39,7 +39,7 @@ module Bundler out = String.new("GIT\n") out << " remote: #{@uri}\n" out << " revision: #{revision}\n" - %w(ref branch tag submodules).each do |opt| + %w[ref branch tag submodules].each do |opt| out << " #{opt}: #{options[opt]}\n" if options[opt] end out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index 5d4fd76acb..a1a2cbad18 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -4,7 +4,7 @@ require "bundler/vendored_thor" module Bundler module UI class Shell - LEVELS = %w(silent error warn confirm info debug).freeze + LEVELS = %w[silent error warn confirm info debug].freeze attr_writer :shell diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb index 268c0d99ac..1667b8b875 100644 --- a/spec/bundler/bundler_spec.rb +++ b/spec/bundler/bundler_spec.rb @@ -106,7 +106,7 @@ RSpec.describe Bundler do describe "#which" do let(:executable) { "executable" } - let(:path) { %w(/a /b c ../d /e) } + let(:path) { %w[/a /b c ../d /e] } let(:expected) { "executable" } before do diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 73d44a93ab..23dfc19b78 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -221,7 +221,7 @@ RSpec.describe Bundler::Definition do :gems => ["shared_owner_a"], :lock_shared_dependencies => true ) locked = definition.send(:converge_locked_specs).map(&:name) - expect(locked).to eq %w(isolated_dep isolated_owner shared_dep shared_owner_b) + expect(locked).to eq %w[isolated_dep isolated_owner shared_dep shared_owner_b] expect(locked.include?("shared_dep")).to be_truthy end end @@ -242,7 +242,7 @@ RSpec.describe Bundler::Definition do describe "find_indexed_specs" do it "with no platform set in indexed specs" do index = Bundler::Index.new - %w(1.0.0 1.0.1 1.1.0).each {|v| index << build_stub_spec("foo", v) } + %w[1.0.0 1.0.1 1.1.0].each {|v| index << build_stub_spec("foo", v) } dfn = Bundler::Definition.new(nil, [], mock_source_list, true) dfn.instance_variable_set("@index", index) diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 78eab0227f..5ee50031a6 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -206,7 +206,7 @@ RSpec.describe Bundler::Dsl do # end describe "#git" do it "from a single repo" do - rails_gems = %w(railties action_pack active_model) + rails_gems = %w[railties action_pack active_model] subject.git "https://github.com/rails/rails.git" do rails_gems.each {|rails_gem| subject.send :gem, rails_gem } end @@ -221,7 +221,7 @@ RSpec.describe Bundler::Dsl do # end describe "#github" do it "from github" do - spree_gems = %w(spree_core spree_api spree_backend) + spree_gems = %w[spree_core spree_api spree_backend] subject.github "spree" do spree_gems.each {|spree_gem| subject.send :gem, spree_gem } end diff --git a/spec/bundler/environment_preserver_spec.rb b/spec/bundler/environment_preserver_spec.rb index 41d2650055..fe4770f37c 100644 --- a/spec/bundler/environment_preserver_spec.rb +++ b/spec/bundler/environment_preserver_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Bundler::EnvironmentPreserver do it "should not affect the original env" do subject - expect(env.keys.sort).to eq(%w(bar foo)) + expect(env.keys.sort).to eq(%w[bar foo]) end context "when a key is empty" do diff --git a/spec/bundler/fetcher/dependency_spec.rb b/spec/bundler/fetcher/dependency_spec.rb index f470b4b2fb..0e616f679b 100644 --- a/spec/bundler/fetcher/dependency_spec.rb +++ b/spec/bundler/fetcher/dependency_spec.rb @@ -64,7 +64,7 @@ RSpec.describe Bundler::Fetcher::Dependency do end describe "#specs" do - let(:gem_names) { %w(foo bar) } + let(:gem_names) { %w[foo bar] } let(:full_dependency_list) { ["bar"] } let(:last_spec_list) { [["boulder", gem_version1, "ruby", resque]] } let(:fail_errors) { double(:fail_errors) } @@ -103,7 +103,7 @@ RSpec.describe Bundler::Fetcher::Dependency do context "when all given gem names are in the full dependency list" do let(:gem_names) { ["foo"] } - let(:full_dependency_list) { %w(foo bar) } + let(:full_dependency_list) { %w[foo bar] } let(:last_spec_list) { ["boulder"] } it "should return a hash with the remote_uri and the last spec list" do @@ -190,7 +190,7 @@ RSpec.describe Bundler::Fetcher::Dependency do end describe "#dependency_specs" do - let(:gem_names) { [%w(foo bar), %w(bundler rubocop)] } + let(:gem_names) { [%w[foo bar], %w[bundler rubocop]] } let(:gem_list) { double(:gem_list) } let(:formatted_specs_and_deps) { double(:formatted_specs_and_deps) } @@ -212,7 +212,7 @@ RSpec.describe Bundler::Fetcher::Dependency do end describe "#unmarshalled_dep_gems" do - let(:gem_names) { [%w(foo bar), %w(bundler rubocop)] } + let(:gem_names) { [%w[foo bar], %w[bundler rubocop]] } let(:dep_api_uri) { double(:dep_api_uri) } let(:unmarshalled_gems) { double(:unmarshalled_gems) } let(:fetch_response) { double(:fetch_response, :body => double(:body)) } @@ -254,7 +254,7 @@ RSpec.describe Bundler::Fetcher::Dependency do spec_list, deps_list = subject.get_formatted_specs_and_deps(gem_list) expect(spec_list).to eq([["typhoeus", "1.0.1", "ruby", [["resque", ["req3,req4"]]]], ["grape", "2.0.2", "jruby", [["faraday", ["req1,req2"]]]]]) - expect(deps_list).to eq(%w(resque faraday)) + expect(deps_list).to eq(%w[resque faraday]) end end @@ -262,7 +262,7 @@ RSpec.describe Bundler::Fetcher::Dependency do let(:uri) { URI("http://gem-api.com") } context "with gem names" do - let(:gem_names) { %w(foo bar bundler rubocop) } + let(:gem_names) { %w[foo bar bundler rubocop] } before { allow(subject).to receive(:fetch_uri).and_return(uri) } diff --git a/spec/bundler/fetcher/index_spec.rb b/spec/bundler/fetcher/index_spec.rb index b17e0d1727..a3bba3444f 100644 --- a/spec/bundler/fetcher/index_spec.rb +++ b/spec/bundler/fetcher/index_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Bundler::Fetcher::Index do let(:remote) { nil } let(:display_uri) { "http://sample_uri.com" } let(:rubygems) { double(:rubygems) } - let(:gem_names) { %w(foo bar) } + let(:gem_names) { %w[foo bar] } subject { described_class.new(downloader, remote, display_uri) } diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb index 5244fc2b18..2c1a613d6b 100644 --- a/spec/bundler/fetcher_spec.rb +++ b/spec/bundler/fetcher_spec.rb @@ -74,7 +74,7 @@ RSpec.describe Bundler::Fetcher do describe "#user_agent" do it "builds user_agent with current ruby version and Bundler settings" do - allow(Bundler.settings).to receive(:all).and_return(%w(foo bar)) + allow(Bundler.settings).to receive(:all).and_return(%w[foo bar]) expect(fetcher.user_agent).to match(%r{bundler/(\d.)}) expect(fetcher.user_agent).to match(%r{rubygems/(\d.)}) expect(fetcher.user_agent).to match(%r{ruby/(\d.)}) diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index 498ed89447..3e48146b2e 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -105,8 +105,8 @@ RSpec.describe Bundler::GemHelper do context "defines Rake tasks" do let(:task_names) do - %w(build install release release:guard_clean - release:source_control_push release:rubygem_push) + %w[build install release release:guard_clean + release:source_control_push release:rubygem_push] end context "before installation" do diff --git a/spec/bundler/gem_version_promoter_spec.rb b/spec/bundler/gem_version_promoter_spec.rb index c7620e2620..fd52bdfedc 100644 --- a/spec/bundler/gem_version_promoter_spec.rb +++ b/spec/bundler/gem_version_promoter_spec.rb @@ -44,28 +44,28 @@ RSpec.describe Bundler::GemVersionPromoter do it "when keeping build_spec, keep current, next release" do keep_locked(:level => :patch) res = @gvp.filter_dep_specs( - build_spec_group("foo", %w(1.7.8 1.7.9 1.8.0)), + build_spec_group("foo", %w[1.7.8 1.7.9 1.8.0]), build_spec("foo", "1.7.8").first ) - expect(versions(res)).to eq %w(1.7.9 1.7.8) + expect(versions(res)).to eq %w[1.7.9 1.7.8] end it "when unlocking prefer next release first" do unlocking(:level => :patch) res = @gvp.filter_dep_specs( - build_spec_group("foo", %w(1.7.8 1.7.9 1.8.0)), + build_spec_group("foo", %w[1.7.8 1.7.9 1.8.0]), build_spec("foo", "1.7.8").first ) - expect(versions(res)).to eq %w(1.7.8 1.7.9) + expect(versions(res)).to eq %w[1.7.8 1.7.9] end it "when unlocking keep current when already at latest release" do unlocking(:level => :patch) res = @gvp.filter_dep_specs( - build_spec_group("foo", %w(1.7.9 1.8.0 2.0.0)), + build_spec_group("foo", %w[1.7.9 1.8.0 2.0.0]), build_spec("foo", "1.7.9").first ) - expect(versions(res)).to eq %w(1.7.9) + expect(versions(res)).to eq %w[1.7.9] end end @@ -73,19 +73,19 @@ RSpec.describe Bundler::GemVersionPromoter do it "when unlocking favor next releases, remove minor and major increases" do unlocking(:level => :minor) res = @gvp.filter_dep_specs( - build_spec_group("foo", %w(0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1)), + build_spec_group("foo", %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1]), build_spec("foo", "0.2.0").first ) - expect(versions(res)).to eq %w(0.2.0 0.3.0 0.3.1 0.9.0) + expect(versions(res)).to eq %w[0.2.0 0.3.0 0.3.1 0.9.0] end it "when keep locked, keep current, then favor next release, remove minor and major increases" do keep_locked(:level => :minor) res = @gvp.filter_dep_specs( - build_spec_group("foo", %w(0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1)), + build_spec_group("foo", %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1]), build_spec("foo", "0.2.0").first ) - expect(versions(res)).to eq %w(0.3.0 0.3.1 0.9.0 0.2.0) + expect(versions(res)).to eq %w[0.3.0 0.3.1 0.9.0 0.2.0] end end @@ -93,37 +93,37 @@ RSpec.describe Bundler::GemVersionPromoter do it "when not unlocking, same order but make sure build_spec version is most preferred to stay put" do keep_locked(:level => :patch) res = @gvp.sort_dep_specs( - build_spec_group("foo", %w(1.5.4 1.6.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 2.0.0 2.0.1)), + build_spec_group("foo", %w[1.5.4 1.6.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 2.0.0 2.0.1]), build_spec("foo", "1.7.7").first ) - expect(versions(res)).to eq %w(1.5.4 1.6.5 1.7.6 2.0.0 2.0.1 1.8.0 1.8.1 1.7.8 1.7.9 1.7.7) + expect(versions(res)).to eq %w[1.5.4 1.6.5 1.7.6 2.0.0 2.0.1 1.8.0 1.8.1 1.7.8 1.7.9 1.7.7] end it "when unlocking favor next release, then current over minor increase" do unlocking(:level => :patch) res = @gvp.sort_dep_specs( - build_spec_group("foo", %w(1.7.7 1.7.8 1.7.9 1.8.0)), + build_spec_group("foo", %w[1.7.7 1.7.8 1.7.9 1.8.0]), build_spec("foo", "1.7.8").first ) - expect(versions(res)).to eq %w(1.7.7 1.8.0 1.7.8 1.7.9) + expect(versions(res)).to eq %w[1.7.7 1.8.0 1.7.8 1.7.9] end it "when unlocking do proper integer comparison, not string" do unlocking(:level => :patch) res = @gvp.sort_dep_specs( - build_spec_group("foo", %w(1.7.7 1.7.8 1.7.9 1.7.15 1.8.0)), + build_spec_group("foo", %w[1.7.7 1.7.8 1.7.9 1.7.15 1.8.0]), build_spec("foo", "1.7.8").first ) - expect(versions(res)).to eq %w(1.7.7 1.8.0 1.7.8 1.7.9 1.7.15) + expect(versions(res)).to eq %w[1.7.7 1.8.0 1.7.8 1.7.9 1.7.15] end it "leave current when unlocking but already at latest release" do unlocking(:level => :patch) res = @gvp.sort_dep_specs( - build_spec_group("foo", %w(1.7.9 1.8.0 2.0.0)), + build_spec_group("foo", %w[1.7.9 1.8.0 2.0.0]), build_spec("foo", "1.7.9").first ) - expect(versions(res)).to eq %w(2.0.0 1.8.0 1.7.9) + expect(versions(res)).to eq %w[2.0.0 1.8.0 1.7.9] end end @@ -131,10 +131,10 @@ RSpec.describe Bundler::GemVersionPromoter do it "when unlocking favor next release, then minor increase over current" do unlocking(:level => :minor) res = @gvp.sort_dep_specs( - build_spec_group("foo", %w(0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1)), + build_spec_group("foo", %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.0 2.0.1]), build_spec("foo", "0.2.0").first ) - expect(versions(res)).to eq %w(2.0.0 2.0.1 1.0.0 0.2.0 0.3.0 0.3.1 0.9.0) + expect(versions(res)).to eq %w[2.0.0 2.0.1 1.0.0 0.2.0 0.3.0 0.3.1 0.9.0] end end @@ -159,7 +159,7 @@ RSpec.describe Bundler::GemVersionPromoter do end it "should accept major, minor patch strings" do - %w(major minor patch).each do |value| + %w[major minor patch].each do |value| subject.level = value expect(subject.level).to eq value.to_sym end diff --git a/spec/bundler/rubygems_integration_spec.rb b/spec/bundler/rubygems_integration_spec.rb index 37eb499e38..b8297fb550 100644 --- a/spec/bundler/rubygems_integration_spec.rb +++ b/spec/bundler/rubygems_integration_spec.rb @@ -70,7 +70,7 @@ RSpec.describe Bundler::RubygemsIntegration do expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response) expect(fetcher).to receive(:fetch_path).with(uri + "prerelease_specs.4.8.gz").and_return(prerelease_specs_response) result = Bundler.rubygems.fetch_all_remote_specs(remote_with_mirror) - expect(result).to eq(%w(specs prerelease_specs)) + expect(result).to eq(%w[specs prerelease_specs]) end end @@ -83,7 +83,7 @@ RSpec.describe Bundler::RubygemsIntegration do expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response) expect(fetcher).to receive(:fetch_path).with(uri + "prerelease_specs.4.8.gz").and_return(prerelease_specs_response) result = Bundler.rubygems.fetch_all_remote_specs(remote_no_mirror) - expect(result).to eq(%w(specs prerelease_specs)) + expect(result).to eq(%w[specs prerelease_specs]) end end end diff --git a/spec/bundler/spec_set_spec.rb b/spec/bundler/spec_set_spec.rb index 37bdcdaf7f..fa136a624a 100644 --- a/spec/bundler/spec_set_spec.rb +++ b/spec/bundler/spec_set_spec.rb @@ -66,13 +66,13 @@ RSpec.describe Bundler::SpecSet do describe "#to_a" do it "returns the specs in order" do - expect(subject.to_a.map(&:full_name)).to eq %w( + expect(subject.to_a.map(&:full_name)).to eq %w[ a-1.0 b-1.0 e-1.0.0.pre.1 c-1.1 d-2.0 - ) + ] end end end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 31b3816a3b..4bd0aa41b5 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "git base name" do end end -%w(cache package).each do |cmd| +%w[cache package].each do |cmd| RSpec.describe "bundle #{cmd} with git" do it "copies repository to vendor cache and uses it" do git = build_git "foo" diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index bbce448759..ab54e39663 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "spec_helper" -%w(cache package).each do |cmd| +%w[cache package].each do |cmd| RSpec.describe "bundle #{cmd} with path" do it "is no-op when the path is within the bundle" do build_lib "foo", :path => bundled_app("lib/foo") diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 9791ba2c3d..0aeb17d529 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -66,7 +66,7 @@ RSpec.describe "bundle binstubs <gem>" do FileUtils.mkdir_p(lib_path("foo/bin")) FileUtils.touch(lib_path("foo/bin/foo")) build_git "foo", "1.0", :path => lib_path("foo") do |s| - s.executables = %w(foo) + s.executables = %w[foo] end install_gemfile <<-G gem "foo", :git => "#{lib_path("foo")}" @@ -81,7 +81,7 @@ RSpec.describe "bundle binstubs <gem>" do FileUtils.mkdir_p(lib_path("foo/bin")) FileUtils.touch(lib_path("foo/bin/foo")) build_lib "foo", "1.0", :path => lib_path("foo") do |s| - s.executables = %w(foo) + s.executables = %w[foo] end install_gemfile <<-G gem "foo", :path => "#{lib_path("foo")}" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index d70fc636c6..26a3e09b85 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" RSpec.describe "bundle exec" do - let(:system_gems_to_install) { %w(rack-1.0.0 rack-0.9.1) } + let(:system_gems_to_install) { %w[rack-1.0.0 rack-0.9.1] } before :each do system_gems(system_gems_to_install) end diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb index 52c281a6ae..d36bf1a449 100644 --- a/spec/commands/lock_spec.rb +++ b/spec/commands/lock_spec.rb @@ -111,17 +111,17 @@ RSpec.describe "bundle lock" do context "conservative updates" do before do build_repo4 do - build_gem "foo", %w(1.4.3 1.4.4) do |s| + build_gem "foo", %w[1.4.3 1.4.4] do |s| s.add_dependency "bar", "~> 2.0" end - build_gem "foo", %w(1.4.5 1.5.0) do |s| + build_gem "foo", %w[1.4.5 1.5.0] do |s| s.add_dependency "bar", "~> 2.1" end - build_gem "foo", %w(1.5.1) do |s| + build_gem "foo", %w[1.5.1] do |s| s.add_dependency "bar", "~> 3.0" end - build_gem "bar", %w(2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0) - build_gem "qux", %w(1.0.0 1.0.1 1.1.0 2.0.0) + build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] + build_gem "qux", %w[1.0.0 1.0.1 1.1.0 2.0.0] end # establish a lockfile set to 1.4.3 @@ -144,13 +144,13 @@ RSpec.describe "bundle lock" do it "single gem updates dependent gem to minor" do bundle "lock --update foo --patch" - expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w(foo-1.4.5 bar-2.1.1 qux-1.0.0).sort) + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-1.4.5 bar-2.1.1 qux-1.0.0].sort) end it "minor preferred with strict" do bundle "lock --update --minor --strict" - expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w(foo-1.5.0 bar-2.1.1 qux-1.1.0).sort) + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-1.5.0 bar-2.1.1 qux-1.1.0].sort) end end @@ -212,7 +212,7 @@ RSpec.describe "bundle lock" do # we need all these versions to get the sorting the same as it would be # pulling from rubygems.org - %w(0.8.3 0.8.2 0.8.1 0.8.0).each do |v| + %w[0.8.3 0.8.2 0.8.1 0.8.0].each do |v| build_gem "win32-process", v do |s| s.add_dependency "ffi", ">= 1.0.0" end diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index c6b6c9f59e..eb22b3d7c5 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -334,7 +334,7 @@ RSpec.describe "bundle outdated" do G update_repo2 do - build_gem "activesupport", %w(2.4.0 3.0.0) + build_gem "activesupport", %w[2.4.0 3.0.0] build_gem "weakling", "0.0.5" end @@ -352,7 +352,7 @@ RSpec.describe "bundle outdated" do G update_repo2 do - build_gem "activesupport", %w(2.3.9) + build_gem "activesupport", %w[2.3.9] build_gem "weakling", "0.1.5" end @@ -370,7 +370,7 @@ RSpec.describe "bundle outdated" do G update_repo2 do - build_gem "activesupport", %w(2.4.0 2.5.0) + build_gem "activesupport", %w[2.4.0 2.5.0] build_gem "weakling", "1.1.5" end @@ -629,9 +629,9 @@ RSpec.describe "bundle outdated" do context "without update-strict" do before do build_repo4 do - build_gem "patch", %w(1.0.0 1.0.1) - build_gem "minor", %w(1.0.0 1.0.1 1.1.0) - build_gem "major", %w(1.0.0 1.0.1 1.1.0 2.0.0) + build_gem "patch", %w[1.0.0 1.0.1] + build_gem "minor", %w[1.0.0 1.0.1 1.1.0] + build_gem "major", %w[1.0.0 1.0.1 1.1.0 2.0.0] end # establish a lockfile set to 1.0.0 @@ -689,17 +689,17 @@ RSpec.describe "bundle outdated" do context "with update-strict" do before do build_repo4 do - build_gem "foo", %w(1.4.3 1.4.4) do |s| + build_gem "foo", %w[1.4.3 1.4.4] do |s| s.add_dependency "bar", "~> 2.0" end - build_gem "foo", %w(1.4.5 1.5.0) do |s| + build_gem "foo", %w[1.4.5 1.5.0] do |s| s.add_dependency "bar", "~> 2.1" end - build_gem "foo", %w(1.5.1) do |s| + build_gem "foo", %w[1.5.1] do |s| s.add_dependency "bar", "~> 3.0" end - build_gem "bar", %w(2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0) - build_gem "qux", %w(1.0.0 1.1.0 2.0.0) + build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] + build_gem "qux", %w[1.0.0 1.1.0 2.0.0] end # establish a lockfile set to 1.4.3 diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 41a2b38077..bed8720d4a 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -492,17 +492,17 @@ RSpec.describe "bundle update conservative" do context "patch and minor options" do before do build_repo4 do - build_gem "foo", %w(1.4.3 1.4.4) do |s| + build_gem "foo", %w[1.4.3 1.4.4] do |s| s.add_dependency "bar", "~> 2.0" end - build_gem "foo", %w(1.4.5 1.5.0) do |s| + build_gem "foo", %w[1.4.5 1.5.0] do |s| s.add_dependency "bar", "~> 2.1" end - build_gem "foo", %w(1.5.1) do |s| + build_gem "foo", %w[1.5.1] do |s| s.add_dependency "bar", "~> 3.0" end - build_gem "bar", %w(2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0) - build_gem "qux", %w(1.0.0 1.0.1 1.1.0 2.0.0) + build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] + build_gem "qux", %w[1.0.0 1.0.1 1.1.0 2.0.0] end # establish a lockfile set to 1.4.3 @@ -562,18 +562,18 @@ RSpec.describe "bundle update conservative" do context "eager unlocking" do before do build_repo4 do - build_gem "isolated_owner", %w(1.0.1 1.0.2) do |s| + build_gem "isolated_owner", %w[1.0.1 1.0.2] do |s| s.add_dependency "isolated_dep", "~> 2.0" end - build_gem "isolated_dep", %w(2.0.1 2.0.2) + build_gem "isolated_dep", %w[2.0.1 2.0.2] - build_gem "shared_owner_a", %w(3.0.1 3.0.2) do |s| + build_gem "shared_owner_a", %w[3.0.1 3.0.2] do |s| s.add_dependency "shared_dep", "~> 5.0" end - build_gem "shared_owner_b", %w(4.0.1 4.0.2) do |s| + build_gem "shared_owner_b", %w[4.0.1 4.0.2] do |s| s.add_dependency "shared_dep", "~> 5.0" end - build_gem "shared_dep", %w(5.0.1 5.0.2) + build_gem "shared_dep", %w[5.0.1 5.0.2] end gemfile <<-G diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index 1ea613c9d2..8dcf14c0a5 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -197,7 +197,7 @@ RSpec.describe "bundle install from an existing gemspec" do # # issue was caused by rubygems having an unresolved gem during a require, # so emulate that - system_gems %w(rack-1.0.0 rack-0.9.1 rack-obama-1.0) + system_gems %w[rack-1.0.0 rack-0.9.1 rack-obama-1.0] build_lib("foo", :path => bundled_app) gemspec = bundled_app("foo.gemspec").read @@ -415,7 +415,7 @@ RSpec.describe "bundle install from an existing gemspec" do end end - %w(ruby jruby).each do |platform| + %w[ruby jruby].each do |platform| simulate_platform(platform) do install_gemfile <<-G source "file://#{gem_repo2}" diff --git a/spec/install/gemfile/specific_platform_spec.rb b/spec/install/gemfile/specific_platform_spec.rb index cc6c82c0ff..fd02fdd5de 100644 --- a/spec/install/gemfile/specific_platform_spec.rb +++ b/spec/install/gemfile/specific_platform_spec.rb @@ -61,10 +61,10 @@ RSpec.describe "bundle install with specific_platform enabled" do install_gemfile!(google_protobuf) expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")]) expect(the_bundle).to include_gem("google-protobuf 3.0.0.alpha.5.0.5.1 universal-darwin") - expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w( + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[ google-protobuf-3.0.0.alpha.5.0.5.1 google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin - )) + ]) end it "caches both the universal-darwin and ruby gems when --all-platforms is passed" do @@ -93,11 +93,11 @@ RSpec.describe "bundle install with specific_platform enabled" do bundle! "lock --add-platform=#{x64_mingw}" expect(the_bundle.locked_gems.platforms).to eq([rb, x64_mingw, pl("x86_64-darwin-15")]) - expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w( + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[ google-protobuf-3.0.0.alpha.5.0.5.1 google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin google-protobuf-3.0.0.alpha.5.0.5.1-x64-mingw32 - )) + ]) end it "falls back on plain ruby when that version doesnt have a platform-specific gem" do @@ -105,10 +105,10 @@ RSpec.describe "bundle install with specific_platform enabled" do bundle! "lock --add-platform=#{java}" expect(the_bundle.locked_gems.platforms).to eq([java, rb, pl("x86_64-darwin-15")]) - expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w( + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[ google-protobuf-3.0.0.alpha.5.0.5.1 google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin - )) + ]) end end end diff --git a/spec/other/ssl_cert_spec.rb b/spec/other/ssl_cert_spec.rb index 2de4dfdd0c..9cf9a1c8d1 100644 --- a/spec/other/ssl_cert_spec.rb +++ b/spec/other/ssl_cert_spec.rb @@ -3,12 +3,12 @@ require "spec_helper" require "bundler/ssl_certs/certificate_manager" RSpec.describe "SSL Certificates", :rubygems_master do - hosts = %w( + hosts = %w[ rubygems.org index.rubygems.org rubygems.global.ssl.fastly.net staging.rubygems.org - ) + ] hosts.each do |host| it "can securely connect to #{host}", :realworld do diff --git a/spec/other/trampoline_spec.rb b/spec/other/trampoline_spec.rb index 39de7048c7..8a67d4bc56 100644 --- a/spec/other/trampoline_spec.rb +++ b/spec/other/trampoline_spec.rb @@ -83,7 +83,7 @@ RSpec.describe "bundler version trampolining" do if Bundler::RubygemsIntegration.provides?("< 2.6.4") # necessary since we intall with 2.6.4 but the specs can run against # older versions that match againt the "gem" invocation - %w(bundle bundler).each do |exe| + %w[bundle bundler].each do |exe| system_gem_path.join("bin", exe).open("a") do |f| f << %(\ngem "bundler", ">= 0.a"\n) end diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb index e2d351181c..6533614c81 100644 --- a/spec/plugins/install_spec.rb +++ b/spec/plugins/install_spec.rb @@ -58,7 +58,7 @@ RSpec.describe "bundler plugin install" do end end RUBY - s.require_paths = %w(lib src) + s.require_paths = %w[lib src] s.write("src/fubar.rb") end end diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index c2a4ae536b..51cdc2a1f7 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -67,7 +67,7 @@ RSpec.describe "The library itself" do failing_lines = [] File.readlines(filename).each_with_index do |line, number| next if line =~ /^\s+#.*\s+\n$/ - next if %w(LICENCE.md).include?(line) + next if %w[LICENCE.md].include?(line) failing_lines << number + 1 if line =~ /\s+\n$/ end @@ -77,7 +77,7 @@ RSpec.describe "The library itself" do def check_for_expendable_words(filename) failing_line_message = [] - useless_words = %w( + useless_words = %w[ actually basically clearly @@ -85,7 +85,7 @@ RSpec.describe "The library itself" do obviously really simply - ) + ] pattern = /\b#{Regexp.union(useless_words)}\b/i File.readlines(filename).each_with_index do |line, number| @@ -192,11 +192,11 @@ RSpec.describe "The library itself" do end it "documents all used settings" do - exemptions = %w( + exemptions = %w[ gem.coc gem.mit warned_version - ) + ] all_settings = Hash.new {|h, k| h[k] = [] } documented_settings = exemptions @@ -241,11 +241,11 @@ RSpec.describe "The library itself" do it "does not contain any warnings" do Dir.chdir(root.join("lib")) do - exclusions = %w( + exclusions = %w[ bundler/capistrano.rb bundler/gem_tasks.rb bundler/vlad.rb - ) + ] lib_files = `git ls-files -z`.split("\x0").grep(/\.rb$/) - exclusions lib_files.reject! {|f| f.start_with?("bundler/vendor") } lib_files.map! {|f| f.chomp(".rb") } diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb index 9e93847ab5..dab79b74d3 100644 --- a/spec/resolver/basic_spec.rb +++ b/spec/resolver/basic_spec.rb @@ -9,31 +9,31 @@ RSpec.describe "Resolving" do it "resolves a single gem" do dep "rack" - should_resolve_as %w(rack-1.1) + should_resolve_as %w[rack-1.1] end it "resolves a gem with dependencies" do dep "actionpack" - should_resolve_as %w(actionpack-2.3.5 activesupport-2.3.5 rack-1.0) + should_resolve_as %w[actionpack-2.3.5 activesupport-2.3.5 rack-1.0] end it "resolves a conflicting index" do @index = a_conflict_index dep "my_app" - should_resolve_as %w(activemodel-3.2.11 builder-3.0.4 grape-0.2.6 my_app-1.0.0) + should_resolve_as %w[activemodel-3.2.11 builder-3.0.4 grape-0.2.6 my_app-1.0.0] end it "resolves a complex conflicting index" do @index = a_complex_conflict_index dep "my_app" - should_resolve_as %w(a-1.4.0 b-0.3.5 c-3.2 d-0.9.8 my_app-1.1.0) + should_resolve_as %w[a-1.4.0 b-0.3.5 c-3.2 d-0.9.8 my_app-1.1.0] end it "resolves a index with conflict on child" do @index = index_with_conflict_on_child dep "chef_app" - should_resolve_as %w(berkshelf-2.0.7 chef-10.26 chef_app-1.0.0 json-1.7.7) + should_resolve_as %w[berkshelf-2.0.7 chef-10.26 chef_app-1.0.0 json-1.7.7] end it "resolves a index with root level conflict on child" do @@ -42,7 +42,7 @@ RSpec.describe "Resolving" do dep "activesupport", "~> 3.0" dep "activerecord", "~> 3.0" dep "builder", "~> 2.1.2" - should_resolve_as %w(activesupport-3.0.5 i18n-0.4.2 builder-2.1.2 activerecord-3.0.5 activemodel-3.0.5) + should_resolve_as %w[activesupport-3.0.5 i18n-0.4.2 builder-2.1.2 activerecord-3.0.5 activemodel-3.0.5] end it "raises an exception if a child dependency is not resolved" do @@ -55,7 +55,7 @@ RSpec.describe "Resolving" do it "raises an exception with the minimal set of conflicting dependencies" do @index = build_index do - %w(0.9 1.0 2.0).each {|v| gem("a", v) } + %w[0.9 1.0 2.0].each {|v| gem("a", v) } gem("b", "1.0") { dep "a", ">= 2" } gem("c", "1.0") { dep "a", "< 1" } end @@ -88,14 +88,14 @@ Bundler could not find compatible versions for gem "a": it "should install the latest possible version of a direct requirement with no constraints given" do @index = a_complicated_index dep "foo" - should_resolve_and_include %w(foo-3.0.5) + should_resolve_and_include %w[foo-3.0.5] end # Issue #3459 it "should install the latest possible version of a direct requirement with constraints given" do @index = a_complicated_index dep "foo", ">= 3.0.0" - should_resolve_and_include %w(foo-3.0.5) + should_resolve_and_include %w[foo-3.0.5] end it "takes into account required_ruby_version" do @@ -125,7 +125,7 @@ Bundler could not find compatible versions for gem "a": deps << Bundler::DepProxy.new(d, "ruby") end - should_resolve_and_include %w(foo-1.0.0 bar-1.0.0), [{}, []] + should_resolve_and_include %w[foo-1.0.0 bar-1.0.0], [{}, []] end context "conservative" do @@ -139,7 +139,7 @@ Bundler could not find compatible versions for gem "a": gem("foo", "1.5.0") { dep "bar", "~> 2.1" } gem("foo", "1.5.1") { dep "bar", "~> 3.0" } gem("foo", "2.0.0") { dep "bar", "~> 3.0" } - gem "bar", %w(2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0) + gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] end dep "foo" @@ -147,23 +147,23 @@ Bundler could not find compatible versions for gem "a": @base = Bundler::SpecSet.new([]) # locked represents versions in lockfile - @locked = locked(%w(foo 1.4.3), %w(bar 2.0.3)) + @locked = locked(%w[foo 1.4.3], %w[bar 2.0.3]) end it "resolves all gems to latest patch" do # strict is not set, so bar goes up a minor version due to dependency from foo 1.4.5 - should_conservative_resolve_and_include :patch, [], %w(foo-1.4.5 bar-2.1.1) + should_conservative_resolve_and_include :patch, [], %w[foo-1.4.5 bar-2.1.1] end it "resolves all gems to latest patch strict" do # strict is set, so foo can only go up to 1.4.4 to avoid bar going up a minor version, and bar can go up to 2.0.5 - should_conservative_resolve_and_include [:patch, :strict], [], %w(foo-1.4.4 bar-2.0.5) + should_conservative_resolve_and_include [:patch, :strict], [], %w[foo-1.4.4 bar-2.0.5] end it "resolves foo only to latest patch - same dependency case" do - @locked = locked(%w(foo 1.3.7), %w(bar 2.0.3)) + @locked = locked(%w[foo 1.3.7], %w[bar 2.0.3]) # bar is locked, and the lock holds here because the dependency on bar doesn't change on the matching foo version. - should_conservative_resolve_and_include :patch, ["foo"], %w(foo-1.3.8 bar-2.0.3) + should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.3.8 bar-2.0.3] end it "resolves foo only to latest patch - changing dependency not declared case" do @@ -173,44 +173,44 @@ Bundler could not find compatible versions for gem "a": # dependency of "bar", "~> 2.1" -- bar-2.1.1 -- is selected. This is not a bug and follows # the long-standing documented Conservative Updating behavior of bundle install. # http://bundler.io/v1.12/man/bundle-install.1.html#CONSERVATIVE-UPDATING - should_conservative_resolve_and_include :patch, ["foo"], %w(foo-1.4.5 bar-2.1.1) + should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.4.5 bar-2.1.1] end it "resolves foo only to latest patch - changing dependency declared case" do # bar is locked AND a declared dependency in the Gemfile, so it will not move, and therefore # foo can only move up to 1.4.4. @base << build_spec("bar", "2.0.3").first - should_conservative_resolve_and_include :patch, ["foo"], %w(foo-1.4.4 bar-2.0.3) + should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.4.4 bar-2.0.3] end it "resolves foo only to latest patch strict" do # adding strict helps solve the possibly unexpected behavior of bar changing in the prior test case, # because no versions will be returned for bar ~> 2.1, so the engine falls back to ~> 2.0 (turn on # debugging to see this happen). - should_conservative_resolve_and_include [:patch, :strict], ["foo"], %w(foo-1.4.4 bar-2.0.3) + should_conservative_resolve_and_include [:patch, :strict], ["foo"], %w[foo-1.4.4 bar-2.0.3] end it "resolves bar only to latest patch" do # bar is locked, so foo can only go up to 1.4.4 - should_conservative_resolve_and_include :patch, ["bar"], %w(foo-1.4.3 bar-2.0.5) + should_conservative_resolve_and_include :patch, ["bar"], %w[foo-1.4.3 bar-2.0.5] end it "resolves all gems to latest minor" do # strict is not set, so bar goes up a major version due to dependency from foo 1.4.5 - should_conservative_resolve_and_include :minor, [], %w(foo-1.5.1 bar-3.0.0) + should_conservative_resolve_and_include :minor, [], %w[foo-1.5.1 bar-3.0.0] end it "resolves all gems to latest minor strict" do # strict is set, so foo can only go up to 1.5.0 to avoid bar going up a major version - should_conservative_resolve_and_include [:minor, :strict], [], %w(foo-1.5.0 bar-2.1.1) + should_conservative_resolve_and_include [:minor, :strict], [], %w[foo-1.5.0 bar-2.1.1] end it "resolves all gems to latest major" do - should_conservative_resolve_and_include :major, [], %w(foo-2.0.0 bar-3.0.0) + should_conservative_resolve_and_include :major, [], %w[foo-2.0.0 bar-3.0.0] end it "resolves all gems to latest major strict" do - should_conservative_resolve_and_include [:major, :strict], [], %w(foo-2.0.0 bar-3.0.0) + should_conservative_resolve_and_include [:major, :strict], [], %w[foo-2.0.0 bar-3.0.0] end # Why would this happen in real life? If bar 2.2 has a bug that the author of foo wants to bypass @@ -221,7 +221,7 @@ Bundler could not find compatible versions for gem "a": gem("foo", "1.4.3") { dep "bar", "~> 2.2" } gem("foo", "1.4.4") { dep "bar", "~> 2.1.0" } gem("foo", "1.5.0") { dep "bar", "~> 2.0.0" } - gem "bar", %w(2.0.5 2.1.1 2.2.3) + gem "bar", %w[2.0.5 2.1.1 2.2.3] end dep "foo" @@ -229,28 +229,28 @@ Bundler could not find compatible versions for gem "a": @base = Bundler::SpecSet.new([]) # locked represents versions in lockfile - @locked = locked(%w(foo 1.4.3), %w(bar 2.2.3)) + @locked = locked(%w[foo 1.4.3], %w[bar 2.2.3]) end it "could revert to a previous version level patch" do - should_conservative_resolve_and_include :patch, [], %w(foo-1.4.4 bar-2.1.1) + should_conservative_resolve_and_include :patch, [], %w[foo-1.4.4 bar-2.1.1] end it "cannot revert to a previous version in strict mode level patch" do # the strict option removes the version required to match, so a version conflict results expect do - should_conservative_resolve_and_include [:patch, :strict], [], %w(foo-1.4.3 bar-2.1.1) + should_conservative_resolve_and_include [:patch, :strict], [], %w[foo-1.4.3 bar-2.1.1] end.to raise_error Bundler::VersionConflict, /#{Regexp.escape("Could not find gem 'bar (~> 2.1.0)'")}/ end it "could revert to a previous version level minor" do - should_conservative_resolve_and_include :minor, [], %w(foo-1.5.0 bar-2.0.5) + should_conservative_resolve_and_include :minor, [], %w[foo-1.5.0 bar-2.0.5] end it "cannot revert to a previous version in strict mode level minor" do # the strict option removes the version required to match, so a version conflict results expect do - should_conservative_resolve_and_include [:minor, :strict], [], %w(foo-1.4.3 bar-2.1.1) + should_conservative_resolve_and_include [:minor, :strict], [], %w[foo-1.4.3 bar-2.1.1] end.to raise_error Bundler::VersionConflict, /#{Regexp.escape("Could not find gem 'bar (~> 2.0.0)'")}/ end end diff --git a/spec/resolver/platform_spec.rb b/spec/resolver/platform_spec.rb index 90d6f637ce..2028ba26dc 100644 --- a/spec/resolver/platform_spec.rb +++ b/spec/resolver/platform_spec.rb @@ -11,21 +11,21 @@ RSpec.describe "Resolving platform craziness" do dep "nokogiri" platforms "ruby", "java" - should_resolve_as %w(nokogiri-1.4.2 nokogiri-1.4.2-java weakling-0.0.3) + should_resolve_as %w[nokogiri-1.4.2 nokogiri-1.4.2-java weakling-0.0.3] end it "doesn't pull gems that don't exist for the current platform" do dep "nokogiri" platforms "ruby" - should_resolve_as %w(nokogiri-1.4.2) + should_resolve_as %w[nokogiri-1.4.2] end it "doesn't pull gems when the version is available for all requested platforms" do dep "nokogiri" platforms "mswin32" - should_resolve_as %w(nokogiri-1.4.2.1-x86-mswin32) + should_resolve_as %w[nokogiri-1.4.2.1-x86-mswin32] end end @@ -43,32 +43,32 @@ RSpec.describe "Resolving platform craziness" do # win32 is hardcoded to get CPU x86 in rubygems platforms "mswin32" dep "thin" - should_resolve_as %w(thin-1.2.7-x86-mswin32) + should_resolve_as %w[thin-1.2.7-x86-mswin32] end it "finds mingw gems" do # mingw is _not_ hardcoded to add CPU x86 in rubygems platforms "x86-mingw32" dep "thin" - should_resolve_as %w(thin-1.2.7-mingw32) + should_resolve_as %w[thin-1.2.7-mingw32] end it "finds x64-mingw gems" do platforms "x64-mingw32" dep "thin" - should_resolve_as %w(thin-1.2.7-x64-mingw32) + should_resolve_as %w[thin-1.2.7-x64-mingw32] end it "finds universal-mingw gems on x86-mingw" do platform "x86-mingw32" dep "win32-api" - should_resolve_as %w(win32-api-1.5.1-universal-mingw32) + should_resolve_as %w[win32-api-1.5.1-universal-mingw32] end it "finds universal-mingw gems on x64-mingw" do platform "x64-mingw32" dep "win32-api" - should_resolve_as %w(win32-api-1.5.1-universal-mingw32) + should_resolve_as %w[win32-api-1.5.1-universal-mingw32] end end @@ -87,7 +87,7 @@ RSpec.describe "Resolving platform craziness" do dep "baz", " ~> 1.1.0" end - gem "baz", %w(1.0.0 1.1.0 1.2.0) + gem "baz", %w[1.0.0 1.1.0 1.2.0] end end diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb index b68313726b..2eedb79ce3 100644 --- a/spec/runtime/require_spec.rb +++ b/spec/runtime/require_spec.rb @@ -86,7 +86,7 @@ RSpec.describe "Bundler.require" do # required in resolver order instead of gemfile order run("Bundler.require(:not)") - expect(out.split("\n").sort).to eq(%w(seven three)) + expect(out.split("\n").sort).to eq(%w[seven three]) # test require: true run "Bundler.require(:require_true)" diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 33833becd7..7f32477ad2 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -718,7 +718,7 @@ end build_gem("requirepaths") do |s| s.write("lib/rq.rb", "puts 'yay'") s.write("src/rq.rb", "puts 'nooo'") - s.require_paths = %w(lib src) + s.require_paths = %w[lib src] end end @@ -1138,7 +1138,7 @@ end if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") || ENV["RGV"] == "master" [] else - %w(io-console openssl) + %w[io-console openssl] end << "bundler" end diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb index 9111ed8211..f831a4d7a2 100644 --- a/spec/support/artifice/compact_index.rb +++ b/spec/support/artifice/compact_index.rb @@ -67,7 +67,7 @@ class CompactIndexAPI < Endpoint @gems ||= {} @gems[gem_repo] ||= begin specs = Bundler::Deprecate.skip_during do - %w(specs.4.8 prerelease_specs.4.8).map do |filename| + %w[specs.4.8 prerelease_specs.4.8].map do |filename| Marshal.load(File.open(gem_repo.join(filename)).read).map do |name, version, platform| load_spec(name, version, platform, gem_repo) end diff --git a/spec/support/artifice/compact_index_creds_diff_host.rb b/spec/support/artifice/compact_index_creds_diff_host.rb index 0c417f0580..362f407e47 100644 --- a/spec/support/artifice/compact_index_creds_diff_host.rb +++ b/spec/support/artifice/compact_index_creds_diff_host.rb @@ -10,7 +10,7 @@ class CompactIndexCredsDiffHost < CompactIndexAPI end def authorized? - auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w(user pass) + auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w[user pass] end def protected! diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb index 861ac49e93..ba763c8248 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -19,7 +19,7 @@ class Endpoint < Sinatra::Base require "rubygems" require "bundler" Bundler::Deprecate.skip_during do - all_specs = %w(specs.4.8 prerelease_specs.4.8).map do |filename| + all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename| Marshal.load(File.open(gem_repo.join(filename)).read) end.inject(:+) diff --git a/spec/support/artifice/endpoint_creds_diff_host.rb b/spec/support/artifice/endpoint_creds_diff_host.rb index cd152848fe..6bd1bfec32 100644 --- a/spec/support/artifice/endpoint_creds_diff_host.rb +++ b/spec/support/artifice/endpoint_creds_diff_host.rb @@ -10,7 +10,7 @@ class EndpointCredsDiffHost < Endpoint end def authorized? - auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w(user pass) + auth.provided? && auth.basic? && auth.credentials && auth.credentials == %w[user pass] end def protected! diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 4f19c47e90..df731adf14 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -18,7 +18,7 @@ module Spec def build_repo1 build_repo gem_repo1 do - build_gem "rack", %w(0.9.1 1.0.0) do |s| + build_gem "rack", %w[0.9.1 1.0.0] do |s| s.executables = "rackup" s.post_install_message = "Rack's post install message" end @@ -57,7 +57,7 @@ module Spec 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/helpers.rb b/spec/support/helpers.rb index 800ea82c03..3f1c0a3068 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -3,7 +3,7 @@ module Spec module Helpers def reset! Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir| - next if %w(base remote1 gems rubygems . ..).include?(File.basename(dir)) + next if %w[base remote1 gems rubygems . ..].include?(File.basename(dir)) if ENV["BUNDLER_SUDO_TESTS"] `sudo rm -rf "#{dir}"` else diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb index 29780014fc..bb941e66ab 100644 --- a/spec/support/indexes.rb +++ b/spec/support/indexes.rb @@ -67,8 +67,8 @@ module Spec def an_awesome_index build_index do - gem "rack", %w(0.8 0.9 0.9.1 0.9.2 1.0 1.1) - gem "rack-mount", %w(0.4 0.5 0.5.1 0.5.2 0.6) + gem "rack", %w[0.8 0.9 0.9.1 0.9.2 1.0 1.1] + gem "rack-mount", %w[0.4 0.5 0.5.1 0.5.2 0.6] # --- Rails versions "1.2.3 2.2.3 2.3.5 3.0.0.beta 3.0.0.beta1" do |version| @@ -136,7 +136,7 @@ module Spec # goes well, it should resolve to 3.0.4 def a_conflict_index build_index do - gem "builder", %w(3.0.4 3.1.4) + gem "builder", %w[3.0.4 3.1.4] gem("grape", "0.2.6") do dep "builder", ">= 0" end @@ -156,11 +156,11 @@ module Spec def a_complex_conflict_index build_index do - gem("a", %w(1.0.2 1.1.4 1.2.0 1.4.0)) do + gem("a", %w[1.0.2 1.1.4 1.2.0 1.4.0]) do dep "d", ">= 0" end - gem("d", %w(1.3.0 1.4.1)) do + gem("d", %w[1.3.0 1.4.1]) do dep "x", ">= 0" end @@ -203,7 +203,7 @@ module Spec def index_with_conflict_on_child build_index do - gem "json", %w(1.6.5 1.7.7 1.8.0) + gem "json", %w[1.6.5 1.7.7 1.8.0] gem("chef", "10.26") do dep "json", [">= 1.4.4", "<= 1.7.7"] @@ -223,7 +223,7 @@ module Spec # Issue #3459 def a_complicated_index build_index do - gem "foo", %w(3.0.0 3.0.5) do + gem "foo", %w[3.0.0 3.0.5] do dep "qux", ["~> 3.1"] dep "baz", ["< 9.0", ">= 5.0"] dep "bar", ["~> 1.0"] @@ -262,7 +262,7 @@ module Spec dep "garply", [">= 0.3.1"] end - gem "grault", %w(2.6.3 3.1.1) + gem "grault", %w[2.6.3 3.1.1] gem "garply", "0.5.1" do dep "waldo", ["~> 0.1.3"] @@ -272,7 +272,7 @@ module Spec dep "plugh", ["~> 0.6.0"] end - gem "plugh", %w(0.6.3 0.6.11 0.7.0) + gem "plugh", %w[0.6.3 0.6.11 0.7.0] gem "qux", "3.2.21" do dep "plugh", [">= 0.6.4", "~> 0.6"] @@ -285,7 +285,7 @@ module Spec def a_unresovable_child_index build_index do - gem "json", %w(1.8.0) + gem "json", %w[1.8.0] gem("chef", "10.26") do dep "json", [">= 1.4.4", "<= 1.7.7"] @@ -304,10 +304,10 @@ module Spec def a_index_with_root_conflict_on_child build_index do - gem "builder", %w(2.1.2 3.0.1 3.1.3) - gem "i18n", %w(0.4.1 0.4.2) + gem "builder", %w[2.1.2 3.0.1 3.1.3] + gem "i18n", %w[0.4.1 0.4.2] - gem "activesupport", %w(3.0.0 3.0.1 3.0.5 3.1.7) + gem "activesupport", %w[3.0.0 3.0.1 3.0.5 3.1.7] gem("activemodel", "3.0.5") do dep "activesupport", "= 3.0.5" |