diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-12-07 22:10:33 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-07 22:29:33 +0000 |
commit | 2755cb1b2fbc4a5f08ca56345b5945bd452da74e (patch) | |
tree | 3b4500389edac16971410262ec331bae515e29e4 /lib/bundler | |
parent | 9d696aa20461d94c2d32e1e474bd036ade20c94d (diff) |
[rubygems/rubygems] Use modern hashes consistently
https://github.com/rubygems/rubygems/commit/bb66253f2c
Diffstat (limited to 'lib/bundler')
47 files changed, 353 insertions, 439 deletions
diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb index 29fa833588..5d2a8b53bb 100644 --- a/lib/bundler/build_metadata.rb +++ b/lib/bundler/build_metadata.rb @@ -29,7 +29,7 @@ module Bundler # commit instance variable then we can't determine its commits SHA. git_dir = File.expand_path("../../../.git", __dir__) if File.directory?(git_dir) - return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { :chdir => git_dir }, &:read).strip.freeze + return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { chdir: git_dir }, &:read).strip.freeze end @git_commit_sha ||= "unknown" diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb index 1f3712d48e..705840143f 100644 --- a/lib/bundler/capistrano.rb +++ b/lib/bundler/capistrano.rb @@ -17,6 +17,6 @@ end Capistrano::Configuration.instance(:must_exist).load do before "deploy:finalize_update", "bundle:install" - Bundler::Deployment.define_task(self, :task, :except => { :no_release => true }) + Bundler::Deployment.define_task(self, :task, except: { no_release: true }) set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" } end diff --git a/lib/bundler/checksum.rb b/lib/bundler/checksum.rb index de9a74cf70..abc635bd4d 100644 --- a/lib/bundler/checksum.rb +++ b/lib/bundler/checksum.rb @@ -23,7 +23,7 @@ module Bundler def from_gem(io, pathname, algo = DEFAULT_ALGORITHM) digest = Bundler::SharedHelpers.digest(algo.upcase).new - buf = String.new(:capacity => DEFAULT_BLOCK_SIZE) + buf = String.new(capacity: DEFAULT_BLOCK_SIZE) digest << io.readpartial(DEFAULT_BLOCK_SIZE, buf) until io.eof? Checksum.new(algo, digest.hexdigest!, Source.new(:gem, pathname)) end diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index f90ddf4147..022d2c9142 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -80,10 +80,10 @@ module Bundler unprinted_warnings.each {|w| Bundler.ui.warn(w) } end - check_unknown_options!(:except => [:config, :exec]) + check_unknown_options!(except: [:config, :exec]) stop_on_unknown_option! :exec - desc "cli_help", "Prints a summary of bundler commands", :hide => true + desc "cli_help", "Prints a summary of bundler commands", hide: true def cli_help version Bundler.ui.info "\n" @@ -99,19 +99,19 @@ module Bundler shell.say "Bundler commands:\n\n" shell.say " Primary commands:\n" - shell.print_table(primary_commands, :indent => 4, :truncate => true) + shell.print_table(primary_commands, indent: 4, truncate: true) shell.say shell.say " Utilities:\n" - shell.print_table(utilities, :indent => 4, :truncate => true) + shell.print_table(utilities, indent: 4, truncate: true) shell.say self.class.send(:class_options_help, shell) end default_task(Bundler.feature_flag.default_cli_command) - 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 "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" def help(cli = nil) case cli @@ -155,8 +155,8 @@ module Bundler Gemfile to a gem with a gemspec, the --gemspec option will automatically add each dependency listed in the gemspec file to the newly created Gemfile. D - method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile" - method_option "gemfile", :type => :string, :banner => "Use the specified name for the gemfile instead of 'Gemfile'" + method_option "gemspec", type: :string, banner: "Use the specified .gemspec to create the Gemfile" + method_option "gemfile", type: :string, banner: "Use the specified name for the gemfile instead of 'Gemfile'" def init require_relative "cli/init" Init.new(options.dup).run @@ -168,12 +168,9 @@ module Bundler all gems are found, Bundler prints a success message and exits with a status of 0. If not, the first missing gem is listed and Bundler exits status 1. D - method_option "dry-run", :type => :boolean, :default => false, :banner => - "Lock the Gemfile" - method_option "gemfile", :type => :string, :banner => - "Use the specified gemfile instead of Gemfile" - 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" unless Bundler.feature_flag.forget_cli_options?}" + method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile" + method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile" + 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" unless Bundler.feature_flag.forget_cli_options?}" def check remembered_flag_deprecation("path") @@ -187,13 +184,12 @@ module Bundler long_desc <<-D Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning. D - method_option "install", :type => :boolean, :banner => - "Runs 'bundle install' after removing the gems from the Gemfile" + method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile" def remove(*gems) if ARGV.include?("--install") message = "The `--install` flag has been deprecated. `bundle install` is triggered by default." removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default." - SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) + SharedHelpers.major_deprecation(2, message, removed_message: removed_message) end require_relative "cli/remove" @@ -211,47 +207,27 @@ module Bundler If the bundle has already been installed, bundler will tell you so and then exit. D - method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => - "Generate bin stubs for bundled gems to ./bin" - method_option "clean", :type => :boolean, :banner => - "Run bundle clean automatically after install" - method_option "deployment", :type => :boolean, :banner => - "Install using defaults tuned for deployment environments" - method_option "frozen", :type => :boolean, :banner => - "Do not allow the Gemfile.lock to be updated after this install" - method_option "full-index", :type => :boolean, :banner => - "Fall back to using the single-file index of all gems" - method_option "gemfile", :type => :string, :banner => - "Use the specified gemfile instead of Gemfile" - method_option "jobs", :aliases => "-j", :type => :numeric, :banner => - "Specify the number of jobs to run in parallel" - method_option "local", :type => :boolean, :banner => - "Do not attempt to fetch gems remotely and use the gem cache instead" - method_option "prefer-local", :type => :boolean, :banner => - "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely" - method_option "no-cache", :type => :boolean, :banner => - "Don't update the existing gem cache." - method_option "redownload", :type => :boolean, :aliases => "--force", :banner => - "Force downloading every gem." - 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" unless Bundler.feature_flag.forget_cli_options?}" - method_option "quiet", :type => :boolean, :banner => - "Only output warnings and errors." - method_option "shebang", :type => :string, :banner => - "Specify a different shebang executable name than the default (usually 'ruby')" - method_option "standalone", :type => :array, :lazy_default => [], :banner => - "Make a bundle that can work without the Bundler runtime" - method_option "system", :type => :boolean, :banner => - "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" - method_option "trust-policy", :alias => "P", :type => :string, :banner => - "Gem trust policy (like gem install -P). Must be one of " + - Bundler.rubygems.security_policy_keys.join("|") - method_option "without", :type => :array, :banner => - "Exclude gems that are part of the specified named group." - method_option "with", :type => :array, :banner => - "Include gems that are part of the specified named group." + method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin" + method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install" + method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments" + method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install" + method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems" + method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile" + method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel" + method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead" + method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely" + method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache." + method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem." + 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" unless Bundler.feature_flag.forget_cli_options?}" + method_option "quiet", type: :boolean, banner: "Only output warnings and errors." + method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')" + method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime" + method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" + method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of " + + Bundler.rubygems.security_policy_keys.join("|") + method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group." + method_option "with", type: :array, banner: "Include gems that are part of the specified named group." def install SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") @@ -264,7 +240,7 @@ module Bundler remembered_negative_flag_deprecation("no-deployment") require_relative "cli/install" - Bundler.settings.temporary(:no_install => false) do + Bundler.settings.temporary(no_install: false) do Install.new(options.dup).run end end @@ -277,44 +253,27 @@ module Bundler update when you have changed the Gemfile, or if you want to get the newest possible versions of the gems in the bundle. D - method_option "full-index", :type => :boolean, :banner => - "Fall back to using the single-file index of all gems" - method_option "gemfile", :type => :string, :banner => - "Use the specified gemfile instead of Gemfile" - method_option "group", :aliases => "-g", :type => :array, :banner => - "Update a specific group" - method_option "jobs", :aliases => "-j", :type => :numeric, :banner => - "Specify the number of jobs to run in parallel" - method_option "local", :type => :boolean, :banner => - "Do not attempt to fetch gems remotely and use the gem cache instead" - method_option "quiet", :type => :boolean, :banner => - "Only output warnings and errors." - method_option "source", :type => :array, :banner => - "Update a specific source (and all gems associated with it)" - method_option "redownload", :type => :boolean, :aliases => "--force", :banner => - "Force downloading every gem." - method_option "ruby", :type => :boolean, :banner => - "Update ruby specified in Gemfile.lock" - method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner => - "Update the locked version of bundler" - method_option "patch", :type => :boolean, :banner => - "Prefer updating only to next patch version" - method_option "minor", :type => :boolean, :banner => - "Prefer updating only to next minor version" - method_option "major", :type => :boolean, :banner => - "Prefer updating to next major version (default)" - method_option "pre", :type => :boolean, :banner => - "Always choose the highest allowed version when updating gems, regardless of prerelease status" - method_option "strict", :type => :boolean, :banner => - "Do not allow any gem to be updated past latest --patch | --minor | --major" - method_option "conservative", :type => :boolean, :banner => - "Use bundle install conservative update behavior and do not allow shared dependencies to be updated." - method_option "all", :type => :boolean, :banner => - "Update everything." + method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems" + method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile" + method_option "group", aliases: "-g", type: :array, banner: "Update a specific group" + method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel" + method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead" + method_option "quiet", type: :boolean, banner: "Only output warnings and errors." + method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)" + method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem." + method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock" + method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler" + method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version" + method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version" + method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)" + method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status" + method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major" + method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated." + method_option "all", type: :boolean, banner: "Update everything." def update(*gems) SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require_relative "cli/update" - Bundler.settings.temporary(:no_install => false) do + Bundler.settings.temporary(no_install: false) do Update.new(options, gems).run end end @@ -324,25 +283,25 @@ module Bundler Show lists the names and versions of all gems that are required by your Gemfile. Calling show with [GEM] will list the exact location of that gem on your machine. D - method_option "paths", :type => :boolean, - :banner => "List the paths of all gems that are required by your Gemfile." - method_option "outdated", :type => :boolean, - :banner => "Show verbose output including whether gems are outdated." + method_option "paths", type: :boolean, + banner: "List the paths of all gems that are required by your Gemfile." + method_option "outdated", type: :boolean, + banner: "Show verbose output including whether gems are outdated." def show(gem_name = nil) if ARGV.include?("--outdated") message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement" removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement" - SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) + SharedHelpers.major_deprecation(2, message, removed_message: removed_message) end require_relative "cli/show" Show.new(options, gem_name).run end desc "list", "List all gems in the bundle" - method_option "name-only", :type => :boolean, :banner => "print only the gem names" - method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups" - method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups" - method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle" + method_option "name-only", type: :boolean, banner: "print only the gem names" + method_option "only-group", type: :array, default: [], banner: "print gems from a given set of groups" + method_option "without-group", type: :array, default: [], banner: "print all gems except from a given set of groups" + method_option "paths", type: :boolean, banner: "print the path to each gem in the bundle" def list require_relative "cli/list" List.new(options).run @@ -351,8 +310,8 @@ module Bundler map aliases_for("list") desc "info GEM [OPTIONS]", "Show information for the given gem" - method_option "path", :type => :boolean, :banner => "Print full path to gem" - method_option "version", :type => :boolean, :banner => "Print gem version" + method_option "path", type: :boolean, banner: "Print full path to gem" + method_option "version", type: :boolean, banner: "Print gem version" def info(gem_name) require_relative "cli/info" Info.new(options, gem_name).run @@ -364,18 +323,12 @@ module Bundler or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]] will create binstubs for all given gems. D - method_option "force", :type => :boolean, :default => false, :banner => - "Overwrite existing binstubs if they exist" - method_option "path", :type => :string, :lazy_default => "bin", :banner => - "Binstub destination directory (default bin)" - method_option "shebang", :type => :string, :banner => - "Specify a different shebang executable name than the default (usually 'ruby')" - method_option "standalone", :type => :boolean, :banner => - "Make binstubs that can work without the Bundler runtime" - method_option "all", :type => :boolean, :banner => - "Install binstubs for all gems" - method_option "all-platforms", :type => :boolean, :default => false, :banner => - "Install binstubs for all platforms" + method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist" + method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)" + method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')" + method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime" + method_option "all", type: :boolean, banner: "Install binstubs for all gems" + method_option "all-platforms", type: :boolean, default: false, banner: "Install binstubs for all platforms" def binstubs(*gems) require_relative "cli/binstubs" Binstubs.new(options, gems).run @@ -385,19 +338,18 @@ module Bundler long_desc <<-D Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step. D - method_option "version", :aliases => "-v", :type => :string - method_option "group", :aliases => "-g", :type => :string - method_option "source", :aliases => "-s", :type => :string - method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string." - method_option "path", :type => :string - method_option "git", :type => :string - method_option "github", :type => :string - method_option "branch", :type => :string - method_option "ref", :type => :string - method_option "skip-install", :type => :boolean, :banner => - "Adds gem to the Gemfile but does not install it" - method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem" - method_option "strict", :type => :boolean, :banner => "Adds strict declaration of version to gem" + method_option "version", aliases: "-v", type: :string + method_option "group", aliases: "-g", type: :string + method_option "source", aliases: "-s", type: :string + method_option "require", aliases: "-r", type: :string, banner: "Adds require path to gem. Provide false, or a path as a string." + method_option "path", type: :string + method_option "git", type: :string + method_option "github", type: :string + method_option "branch", type: :string + method_option "ref", type: :string + method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it" + method_option "optimistic", type: :boolean, banner: "Adds optimistic declaration of version to gem" + method_option "strict", type: :boolean, banner: "Adds strict declaration of version to gem" def add(*gems) require_relative "cli/add" Add.new(options.dup, gems).run @@ -413,55 +365,46 @@ module Bundler For more information on patch level options (--major, --minor, --patch, --strict) see documentation on the same options on the update command. D - method_option "group", :type => :string, :banner => "List gems from a specific group" - method_option "groups", :type => :boolean, :banner => "List gems organized by groups" - method_option "local", :type => :boolean, :banner => - "Do not attempt to fetch gems remotely and use the gem cache instead" - method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems" - method_option "source", :type => :array, :banner => "Check against a specific source" - method_option "filter-strict", :type => :boolean, :aliases => "--strict", :banner => - "Only list newer versions allowed by your Gemfile requirements" - method_option "update-strict", :type => :boolean, :banner => - "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major" - method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version" - method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)" - method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version" - method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions" - method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions" - method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions" - method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner => - "Use minimal formatting for more parseable output" - method_option "json", :type => :boolean, :banner => "Produce parseable json output" - method_option "only-explicit", :type => :boolean, :banner => - "Only list gems specified in your Gemfile, not their dependencies" + method_option "group", type: :string, banner: "List gems from a specific group" + method_option "groups", type: :boolean, banner: "List gems organized by groups" + method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead" + method_option "pre", type: :boolean, banner: "Check for newer pre-release gems" + method_option "source", type: :array, banner: "Check against a specific source" + method_option "filter-strict", type: :boolean, aliases: "--strict", banner: "Only list newer versions allowed by your Gemfile requirements" + method_option "update-strict", type: :boolean, banner: "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major" + method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version" + method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)" + method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version" + method_option "filter-major", type: :boolean, banner: "Only list major newer versions" + method_option "filter-minor", type: :boolean, banner: "Only list minor newer versions" + method_option "filter-patch", type: :boolean, banner: "Only list patch newer versions" + method_option "parseable", aliases: "--porcelain", type: :boolean, banner: "Use minimal formatting for more parseable output" + method_option "json", type: :boolean, banner: "Produce parseable json output" + method_option "only-explicit", type: :boolean, banner: "Only list gems specified in your Gemfile, not their dependencies" def outdated(*gems) require_relative "cli/outdated" Outdated.new(options, gems).run end desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance" - method_option "group", :aliases => "-g", :type => :array, :banner => - "Fetch funding information for a specific group" + method_option "group", aliases: "-g", type: :array, banner: "Fetch funding information for a specific group" def fund require_relative "cli/fund" Fund.new(options).run end desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" - method_option "all", :type => :boolean, - :default => Bundler.feature_flag.cache_all?, - :banner => "Include all sources (including path and git)." - method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one" - 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 install the gems, only update the cache." - 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" unless Bundler.feature_flag.forget_cli_options?}" - method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." - method_option "frozen", :type => :boolean, :banner => - "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install" + method_option "all", type: :boolean, + default: Bundler.feature_flag.cache_all?, + banner: "Include all sources (including path and git)." + method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one" + 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 install the gems, only update the cache." + 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" unless Bundler.feature_flag.forget_cli_options?}" + method_option "quiet", type: :boolean, banner: "Only output warnings and errors." + method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install" long_desc <<-D The cache command will copy the .gem files for every gem in the bundle into the directory ./vendor/cache. If you then check that directory into your source @@ -481,7 +424,7 @@ module Bundler "The `--path` flag has been removed because its semantics were unclear. " \ "Use `bundle config cache_path` to configure the path of your cache of gems, " \ "and `bundle config path` to configure the path where your gems are installed." - SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + SharedHelpers.major_deprecation 2, message, removed_message: removed_message end require_relative "cli/cache" @@ -491,8 +434,8 @@ module Bundler map aliases_for("cache") desc "exec [OPTIONS]", "Run the command in context of the bundle" - method_option :keep_file_descriptors, :type => :boolean, :default => true - method_option :gemfile, :type => :string, :required => false + method_option :keep_file_descriptors, type: :boolean, default: true + method_option :gemfile, type: :string, required: false long_desc <<-D Exec runs a command, providing it access to the gems in the bundle. While using bundle exec you can require and call the bundled gems as if they were installed @@ -502,7 +445,7 @@ module Bundler if ARGV.include?("--no-keep-file-descriptors") message = "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" removed_message = "The `--no-keep-file-descriptors` has been removed. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" - SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) + SharedHelpers.major_deprecation(2, message, removed_message: removed_message) end require_relative "cli/exec" @@ -527,7 +470,7 @@ module Bundler subcommand "config", Config desc "open GEM", "Opens the source directory of the given bundled gem" - method_option "path", :type => :string, :lazy_default => "", :banner => "Open relative path of the gem source." + method_option "path", type: :string, lazy_default: "", banner: "Open relative path of the gem source." def open(name) require_relative "cli/open" Open.new(options, name).run @@ -572,17 +515,17 @@ module Bundler end unless Bundler.feature_flag.bundler_3_mode? - desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true + desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true long_desc <<-D Viz generates a PNG file of the current Gemfile as a dependency graph. Viz requires the ruby-graphviz gem (and its dependencies). The associated gems must also be installed via 'bundle install'. D - method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option" - method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..." - method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency." - method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version." - method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group." + method_option :file, type: :string, default: "gem_graph", aliases: "-f", desc: "The name to use for the generated file. see format option" + method_option :format, type: :string, default: "png", aliases: "-F", desc: "This is output format option. Supported format is png, jpg, svg, dot ..." + method_option :requirements, type: :boolean, default: false, aliases: "-R", desc: "Set to show the version of each required dependency." + method_option :version, type: :boolean, default: false, aliases: "-v", desc: "Set to show each gem version." + method_option :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group." def viz SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph" require_relative "cli/viz" @@ -593,23 +536,23 @@ module Bundler old_gem = instance_method(:gem) desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem" - method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library." - method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`." - method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", - :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, - :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" - method_option :ext, :type => :string, :desc => "Generate the boilerplate for C extension code.", :enum => EXTENSIONS - method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library." - method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`." - method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`." - method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`." - method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library", - :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`." - method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "", - :desc => "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`" - method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "", - :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`" - method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`." + method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library." + method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`." + method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR", + lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, + desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" + method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS + method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library." + method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`." + method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`." + method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`." + method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library", + desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`." + method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", + desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`" + method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", + desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`" + method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`." def gem(name) end @@ -640,29 +583,24 @@ module Bundler File.expand_path("templates", __dir__) end - desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true - method_option "dry-run", :type => :boolean, :default => false, :banner => - "Only print out changes, do not clean gems" - method_option "force", :type => :boolean, :default => false, :banner => - "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application." + desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true + method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems" + method_option "force", type: :boolean, default: false, banner: "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application." def clean require_relative "cli/clean" Clean.new(options.dup).run end desc "platform [OPTIONS]", "Displays platform compatibility information" - method_option "ruby", :type => :boolean, :default => false, :banner => - "only display ruby related platform information" + method_option "ruby", type: :boolean, default: false, banner: "only display ruby related platform information" def platform require_relative "cli/platform" Platform.new(options).run end - desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true - method_option "source", :type => :string, :banner => - "Install gem from the given source" - method_option "group", :type => :string, :banner => - "Install gem into a bundler group" + desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true + method_option "source", type: :string, banner: "Install gem from the given source" + method_option "group", type: :string, banner: "Install gem into a bundler group" def inject(name, version) SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command" require_relative "cli/inject" @@ -670,36 +608,21 @@ module Bundler end desc "lock", "Creates a lockfile without installing" - method_option "update", :type => :array, :lazy_default => true, :banner => - "ignore the existing lockfile, update all gems by default, or update list of given gems" - method_option "local", :type => :boolean, :default => false, :banner => - "do not attempt to fetch remote gemspecs and use the local gem cache only" - method_option "print", :type => :boolean, :default => false, :banner => - "print the lockfile to STDOUT instead of writing to the file system" - method_option "gemfile", :type => :string, :banner => - "Use the specified gemfile instead of Gemfile" - method_option "lockfile", :type => :string, :default => nil, :banner => - "the path the lockfile should be written to" - method_option "full-index", :type => :boolean, :default => false, :banner => - "Fall back to using the single-file index of all gems" - method_option "add-platform", :type => :array, :default => [], :banner => - "Add a new platform to the lockfile" - method_option "remove-platform", :type => :array, :default => [], :banner => - "Remove a platform from the lockfile" - method_option "patch", :type => :boolean, :banner => - "If updating, prefer updating only to next patch version" - method_option "minor", :type => :boolean, :banner => - "If updating, prefer updating only to next minor version" - method_option "major", :type => :boolean, :banner => - "If updating, prefer updating to next major version (default)" - method_option "pre", :type => :boolean, :banner => - "If updating, always choose the highest allowed version, regardless of prerelease status" - method_option "strict", :type => :boolean, :banner => - "If updating, do not allow any gem to be updated past latest --patch | --minor | --major" - method_option "conservative", :type => :boolean, :banner => - "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated" - method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner => - "Update the locked version of bundler" + method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems" + method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only" + method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system" + method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile" + method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to" + method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems" + method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile" + method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile" + method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version" + method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version" + method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)" + method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status" + method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major" + method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated" + method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler" def lock require_relative "cli/lock" Lock.new(options).run @@ -716,10 +639,8 @@ module Bundler missing dependencies are detected, Bundler prints them and exits status 1. Otherwise, Bundler prints a success message and exits with a status of 0. D - method_option "gemfile", :type => :string, :banner => - "Use the specified gemfile instead of Gemfile" - method_option "quiet", :type => :boolean, :banner => - "Only output warnings and errors." + method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile" + method_option "quiet", type: :boolean, banner: "Only output warnings and errors." def doctor require_relative "cli/doctor" Doctor.new(options).run @@ -783,7 +704,7 @@ module Bundler if deprecated_ext_value?(arguments) message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used." removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension." - SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + SharedHelpers.major_deprecation 2, message, removed_message: removed_message arguments[arguments.index("--ext")] = "--ext=c" end end @@ -918,7 +839,7 @@ module Bundler "remembered across bundler invocations, which bundler will no longer " \ "do. Instead please use `bundle config set #{option_name} " \ "#{option_value}`, and stop using this flag" - Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message end end end diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb index 08fa6547fb..002d9e1d33 100644 --- a/lib/bundler/cli/add.rb +++ b/lib/bundler/cli/add.rb @@ -28,9 +28,9 @@ module Bundler dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) } Injector.inject(dependencies, - :conservative_versioning => options[:version].nil?, # Perform conservative versioning only when version is not specified - :optimistic => options[:optimistic], - :strict => options[:strict]) + conservative_versioning: options[:version].nil?, # Perform conservative versioning only when version is not specified + optimistic: options[:optimistic], + strict: options[:strict]) end def validate_options! diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb index fc2fad47a5..ad41ebf4b4 100644 --- a/lib/bundler/cli/binstubs.rb +++ b/lib/bundler/cli/binstubs.rb @@ -17,9 +17,9 @@ module Bundler installer = Installer.new(Bundler.root, Bundler.definition) installer_opts = { - :force => options[:force], - :binstubs_cmd => true, - :all_platforms => options["all-platforms"], + force: options[:force], + binstubs_cmd: true, + all_platforms: options["all-platforms"], } if options[:all] @@ -45,7 +45,7 @@ module Bundler next end - Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do + Bundler.settings.temporary(path: (Bundler.settings[:path] || Bundler.root)) do installer.generate_standalone_bundler_executable_stubs(spec, installer_opts) end else diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb index c8698ed7e3..2e63a16ec3 100644 --- a/lib/bundler/cli/cache.rb +++ b/lib/bundler/cli/cache.rb @@ -19,7 +19,7 @@ module Bundler # TODO: move cache contents here now that all bundles are locked custom_path = Bundler.settings[:path] if options[:path] - Bundler.settings.temporary(:cache_all_platforms => options["all-platforms"]) do + Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do Bundler.load.cache(custom_path) end end diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index 85c49f510a..33d31cdd27 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -32,7 +32,7 @@ module Bundler Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present" exit 1 else - Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"] + Bundler.load.lock(preserve_unknown_sections: true) unless options[:"dry-run"] Bundler.ui.info "The Gemfile's dependencies are satisfied" end end diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index 30b22cf2d5..77b502fe60 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -2,17 +2,17 @@ module Bundler class CLI::Config < Thor - class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output" + class_option :parseable, type: :boolean, banner: "Use minimal formatting for more parseable output" def self.scope_options - method_option :global, :type => :boolean, :banner => "Only change the global config" - method_option :local, :type => :boolean, :banner => "Only change the local config" + method_option :global, type: :boolean, banner: "Only change the global config" + method_option :local, type: :boolean, banner: "Only change the local config" end private_class_method :scope_options - desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true + desc "base NAME [VALUE]", "The Bundler 1 config interface", hide: true scope_options - method_option :delete, :type => :boolean, :banner => "delete" + method_option :delete, type: :boolean, banner: "delete" def base(name = nil, *value) new_args = if ARGV.size == 1 @@ -27,7 +27,7 @@ module Bundler message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead." removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead." - SharedHelpers.major_deprecation 3, message, :removed_message => removed_message + SharedHelpers.major_deprecation 3, message, removed_message: removed_message Base.new(options, name, value, self).run end diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index a3891723f9..840cf14fd7 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -11,7 +11,7 @@ module Bundler def run message = "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" removed_message = "bundle console has been replaced by `bin/console` generated by `bundle gem <name>`" - Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require ARGV.clear diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 42b602a055..f81cd5d2c4 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -12,7 +12,7 @@ module Bundler @options = options @cmd = args.shift @args = args - @args << { :close_others => !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby? + @args << { close_others: !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby? end def run diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index aef45d19e1..63d18f4ae3 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -59,23 +59,23 @@ module Bundler end config = { - :name => name, - :underscored_name => underscored_name, - :namespaced_path => namespaced_path, - :makefile_path => "#{underscored_name}/#{underscored_name}", - :constant_name => constant_name, - :constant_array => constant_array, - :author => git_author_name.empty? ? "TODO: Write your name" : git_author_name, - :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email, - :test => options[:test], - :ext => extension, - :exe => options[:exe], - :bundler_version => bundler_dependency_version, - :git => use_git, - :github_username => github_username.empty? ? "[USERNAME]" : github_username, - :required_ruby_version => required_ruby_version, - :rust_builder_required_rubygems_version => rust_builder_required_rubygems_version, - :minitest_constant_name => minitest_constant_name, + name: name, + underscored_name: underscored_name, + namespaced_path: namespaced_path, + makefile_path: "#{underscored_name}/#{underscored_name}", + constant_name: constant_name, + constant_array: constant_array, + author: git_author_name.empty? ? "TODO: Write your name" : git_author_name, + email: git_user_email.empty? ? "TODO: Write your email address" : git_user_email, + test: options[:test], + ext: extension, + exe: options[:exe], + bundler_version: bundler_dependency_version, + git: use_git, + github_username: github_username.empty? ? "[USERNAME]" : github_username, + required_ruby_version: required_ruby_version, + rust_builder_required_rubygems_version: rust_builder_required_rubygems_version, + minitest_constant_name: minitest_constant_name, } ensure_safe_gem_name(name, constant_array) @@ -236,7 +236,7 @@ module Bundler end if use_git - IO.popen(%w[git add .], { :chdir => target }, &:read) + IO.popen(%w[git add .], { chdir: target }, &:read) end # Open gemspec in editor @@ -382,18 +382,18 @@ module Bundler if options[:rubocop] Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop", - :removed_message => "--rubocop has been removed, use --linter=rubocop" + removed_message: "--rubocop has been removed, use --linter=rubocop" "rubocop" else Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter", - :removed_message => "--no-rubocop has been removed, use --linter" + removed_message: "--no-rubocop has been removed, use --linter" false end elsif !Bundler.settings["gem.rubocop"].nil? Bundler::SharedHelpers.major_deprecation 2, "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead", - :removed_message => "config gem.rubocop has been removed; we've updated your config to use gem.linter instead" + removed_message: "config gem.rubocop has been removed; we've updated your config to use gem.linter instead" Bundler.settings["gem.rubocop"] ? "rubocop" : false end end diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index c7d287e45f..6c102d537d 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -52,7 +52,7 @@ module Bundler if options["binstubs"] Bundler::SharedHelpers.major_deprecation 2, "The --binstubs option will be removed in favor of `bundle binstubs --all`", - :removed_message => "The --binstubs option have been removed in favor of `bundle binstubs --all`" + removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`" end Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? @@ -62,7 +62,7 @@ module Bundler installer = Installer.install(Bundler.root, definition, options) - Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do + Bundler.settings.temporary(cache_all_platforms: options[:local] ? false : Bundler.settings[:cache_all_platforms]) do Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle? end @@ -96,7 +96,7 @@ module Bundler def warn_if_root return if Bundler.settings[:silence_root_warning] || Gem.win_platform? || !Process.uid.zero? Bundler.ui.warn "Don't run Bundler as root. Installing your bundle as root " \ - "will break this application for all non-root users on this machine.", :wrap => true + "will break this application for all non-root users on this machine.", wrap: true end def dependencies_count_for(definition) @@ -149,7 +149,7 @@ module Bundler Bundler.settings.set_command_option_if_given :path, options[:path] if options["standalone"] && Bundler.settings[:path].nil? && !options["local"] - Bundler.settings.temporary(:path_relative_to_cwd => false) do + Bundler.settings.temporary(path_relative_to_cwd: false) do Bundler.settings.set_command_option :path, "bundle" end end diff --git a/lib/bundler/cli/lock.rb b/lib/bundler/cli/lock.rb index a03a5bae35..7247121df5 100644 --- a/lib/bundler/cli/lock.rb +++ b/lib/bundler/cli/lock.rb @@ -26,14 +26,14 @@ module Bundler if update.is_a?(Array) # unlocking specific gems Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update) - update = { :gems => update, :conservative => conservative } + update = { gems: update, conservative: conservative } elsif update && conservative - update = { :conservative => conservative } + update = { conservative: conservative } elsif update && bundler - update = { :bundler => bundler } + update = { bundler: bundler } end - Bundler.settings.temporary(:frozen => false) do + Bundler.settings.temporary(frozen: false) do definition = Bundler.definition(update) Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update] diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb index 87c1c3b1db..f24693b843 100644 --- a/lib/bundler/cli/open.rb +++ b/lib/bundler/cli/open.rb @@ -21,7 +21,7 @@ module Bundler require "shellwords" command = Shellwords.split(editor) << File.join([root_path, path].compact) Bundler.with_original_env do - system(*command, { :chdir => root_path }) + system(*command, { chdir: root_path }) end || Bundler.ui.info("Could not run '#{command.join(" ")}'") end end diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 783e5fc2c0..68c1bfd405 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -41,12 +41,12 @@ module Bundler # We're doing a full update Bundler.definition(true) else - Bundler.definition(:gems => gems, :sources => sources) + Bundler.definition(gems: gems, sources: sources) end Bundler::CLI::Common.configure_gem_version_promoter( Bundler.definition, - options.merge(:strict => @strict) + options.merge(strict: @strict) ) definition_resolution = proc do @@ -90,10 +90,10 @@ module Bundler end outdated_gems << { - :active_spec => active_spec, - :current_spec => current_spec, - :dependency => dependency, - :groups => groups, + active_spec: active_spec, + current_spec: current_spec, + dependency: dependency, + groups: groups, } end @@ -105,7 +105,7 @@ module Bundler end else relevant_outdated_gems = if options_include_groups - by_group(outdated_gems, :filter => options[:group]) + by_group(outdated_gems, filter: options[:group]) else outdated_gems end @@ -188,7 +188,7 @@ module Bundler ) end - data = { :outdated_count => gems_list.count, :outdated_gems => data } + data = { outdated_count: gems_list.count, outdated_gems: data } Bundler.ui.info data.to_json end @@ -233,21 +233,21 @@ module Bundler def gem_data_for(current_spec, active_spec, dependency, groups) { - :current_spec => spec_data_for(current_spec), - :active_spec => spec_data_for(active_spec), - :dependency => dependency&.to_s, - :groups => (groups || "").split(", "), + current_spec: spec_data_for(current_spec), + active_spec: spec_data_for(active_spec), + dependency: dependency&.to_s, + groups: (groups || "").split(", "), } end def spec_data_for(spec) { - :name => spec.name, - :version => spec.version.to_s, - :platform => spec.platform, - :source => spec.source.to_s, - :required_ruby_version => spec.required_ruby_version.to_s, - :required_rubygems_version => spec.required_rubygems_version.to_s, + name: spec.name, + version: spec.version.to_s, + platform: spec.platform, + source: spec.source.to_s, + required_ruby_version: spec.required_ruby_version.to_s, + required_rubygems_version: spec.required_rubygems_version.to_s, } end diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb index fe3f4412fa..1a33b5fc27 100644 --- a/lib/bundler/cli/plugin.rb +++ b/lib/bundler/cli/plugin.rb @@ -7,18 +7,12 @@ module Bundler long_desc <<-D Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources D - method_option "source", :type => :string, :default => nil, :banner => - "URL of the RubyGems source to fetch the plugin from" - method_option "version", :type => :string, :default => nil, :banner => - "The version of the plugin to fetch" - method_option "git", :type => :string, :default => nil, :banner => - "URL of the git repo to fetch from" - method_option "local_git", :type => :string, :default => nil, :banner => - "Path of the local git repo to fetch from" - method_option "branch", :type => :string, :default => nil, :banner => - "The git branch to checkout" - method_option "ref", :type => :string, :default => nil, :banner => - "The git revision to check out" + method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from" + method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch" + method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from" + method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from" + method_option "branch", type: :string, default: nil, banner: "The git branch to checkout" + method_option "ref", type: :string, default: nil, banner: "The git revision to check out" def install(*plugins) Bundler::Plugin.install(plugins, options) end @@ -27,8 +21,7 @@ module Bundler long_desc <<-D Uninstall given list of plugins. To uninstall all the plugins, use -all option. D - method_option "all", :type => :boolean, :default => nil, :banner => - "Uninstall all the installed plugins. If no plugin is installed, then it does nothing." + method_option "all", type: :boolean, default: nil, banner: "Uninstall all the installed plugins. If no plugin is installed, then it does nothing." def uninstall(*plugins) Bundler::Plugin.uninstall(plugins, options) end diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 22dd1a78dd..985e8db051 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -35,7 +35,7 @@ module Bundler if full_update if conservative - Bundler.definition(:conservative => conservative) + Bundler.definition(conservative: conservative) else Bundler.definition(true) end @@ -51,9 +51,9 @@ module Bundler gems.concat(deps.map(&:name)) end - Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby], - :conservative => conservative, - :bundler => update_bundler) + Bundler.definition(gems: gems, sources: sources, ruby: options[:ruby], + conservative: conservative, + bundler: update_bundler) end Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options) @@ -71,7 +71,7 @@ module Bundler if locked_gems = Bundler.definition.locked_gems previous_locked_info = locked_gems.specs.reduce({}) do |h, s| - h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier } + h[s.name] = { spec: s, version: s.version, source: s.source.identifier } h end end diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 3493f0732d..88f25c962f 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -528,7 +528,7 @@ module Bundler @resolution_packages ||= begin last_resolve = converge_locked_specs remove_invalid_platforms!(current_dependencies) - packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?) + packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlock[:gems], prerelease: gem_version_promoter.pre?) additional_base_requirements_for_resolve(packages, last_resolve) end end @@ -916,9 +916,9 @@ module Bundler source_requirements = if precompute_source_requirements_for_indirect_dependencies? all_requirements = source_map.all_requirements all_requirements = pin_locally_available_names(all_requirements) if @prefer_local - { :default => default_source }.merge(all_requirements) + { default: default_source }.merge(all_requirements) else - { :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements) + { default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements) end source_requirements.merge!(source_map.locked_requirements) unless @remote metadata_dependencies.each do |dep| diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index 82c4c1866b..ae0a35ad69 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -11,17 +11,17 @@ module Bundler ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze PLATFORM_MAP = { - :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], - :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], - :rbx => [Gem::Platform::RUBY], - :truffleruby => [Gem::Platform::RUBY], - :jruby => [Gem::Platform::JAVA, [18, 19]], - :windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS], + ruby: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], + mri: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], + rbx: [Gem::Platform::RUBY], + truffleruby: [Gem::Platform::RUBY], + jruby: [Gem::Platform::JAVA, [18, 19]], + windows: [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS], # deprecated - :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS], - :mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]], - :mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS], - :x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]], + mswin: [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS], + mswin64: [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]], + mingw: [Gem::Platform::MINGW, ALL_RUBY_VERSIONS], + x64_mingw: [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]], }.each_with_object({}) do |(platform, spec), hash| hash[platform] = spec[0] spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] } diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 6c627d28be..45229a84f6 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -76,11 +76,11 @@ module Bundler @gemspecs << spec - gem spec.name, :name => spec.name, :path => path, :glob => glob + gem spec.name, name: spec.name, path: path, glob: glob group(development_group) do spec.development_dependencies.each do |dep| - gem dep.name, *(dep.requirement.as_list + [:type => :development]) + gem dep.name, *(dep.requirement.as_list + [type: :development]) end end when 0 @@ -435,7 +435,7 @@ module Bundler removed_message = "The source :#{source} is disallowed because HTTP requests are insecure.\n" \ "Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not." - Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message "http://rubygems.org" when String source @@ -490,7 +490,7 @@ module Bundler "Using `source` more than once without a block is a security risk, and " \ "may result in installing unexpected gems. To resolve this error, use " \ "a block to indicate which gems should come from the secondary source." - Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message end end diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 27d931da4d..d7dd17f5c5 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -253,7 +253,7 @@ module Bundler Bundler.settings[:ssl_client_cert] raise SSLError if needs_ssl && !defined?(OpenSSL::SSL) - con = PersistentHTTP.new :name => "bundler", :proxy => :ENV + con = PersistentHTTP.new name: "bundler", proxy: :ENV if gem_proxy = Gem.configuration[:http_proxy] con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy end diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index b66a046d37..e61ed64450 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -32,7 +32,7 @@ module Bundler if Bundler.ui.debug? Bundler.ui.trace error else - Bundler.ui.error error.message, :wrap => true + Bundler.ui.error error.message, wrap: true end when Thor::Error Bundler.ui.error error.message @@ -40,7 +40,7 @@ module Bundler Bundler.ui.error "\nQuitting..." Bundler.ui.trace error when Gem::InvalidSpecificationException - Bundler.ui.error error.message, :wrap => true + Bundler.ui.error error.message, wrap: true when SystemExit when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \ diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index dcf759cded..d535d54f9b 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -215,7 +215,7 @@ module Bundler def sh_with_status(cmd, &block) Bundler.ui.debug(cmd) SharedHelpers.chdir(base) do - outbuf = IO.popen(cmd, :err => [:child, :out], &:read) + outbuf = IO.popen(cmd, err: [:child, :out], &:read) status = $? block&.call(outbuf) if status.success? [outbuf, status] diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 3c008e63e3..b22b17a453 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -84,7 +84,7 @@ module Bundler else raise ArgumentError, "2nd argument is invalid" end - label.nil? ? {} : { :label => label } + label.nil? ? {} : { label: label } end def spec_for_dependency(dependency) @@ -103,7 +103,7 @@ module Bundler end def g - @g ||= ::GraphViz.digraph(@graph_name, :concentrate => true, :normalize => true, :nodesep => 0.55) do |g| + @g ||= ::GraphViz.digraph(@graph_name, concentrate: true, normalize: true, nodesep: 0.55) do |g| g.edge[:weight] = 2 g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif" g.edge[:fontsize] = 12 @@ -114,10 +114,10 @@ module Bundler @groups.each do |group| g.add_nodes( group, { - :style => "filled", - :fillcolor => "#B9B9D5", - :shape => "box3d", - :fontsize => 16, + style: "filled", + fillcolor: "#B9B9D5", + shape: "box3d", + fontsize: 16, }.merge(@node_options[group]) ) end @@ -125,8 +125,8 @@ module Bundler @relations.each do |parent, children| children.each do |child| if @groups.include?(parent) - g.add_nodes(child, { :style => "filled", :fillcolor => "#B9B9D5" }.merge(@node_options[child])) - g.add_edges(parent, child, { :constraint => false }.merge(@edge_options["#{parent}_#{child}"])) + g.add_nodes(child, { style: "filled", fillcolor: "#B9B9D5" }.merge(@node_options[child])) + g.add_edges(parent, child, { constraint: false }.merge(@edge_options["#{parent}_#{child}"])) else g.add_nodes(child, @node_options[child]) g.add_edges(parent, child, @edge_options["#{parent}_#{child}"]) @@ -135,7 +135,7 @@ module Bundler end if @output_format.to_s == "debug" - $stdout.puts g.output :none => String + $stdout.puts g.output none: String Bundler.ui.info "debugging bundle viz..." else begin diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index a738992068..2cf7754ecb 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -29,7 +29,7 @@ module Bundler end # temporarily unfreeze - Bundler.settings.temporary(:deployment => false, :frozen => false) do + Bundler.settings.temporary(deployment: false, frozen: false) do # evaluate the Gemfile we have now builder = Dsl.new builder.eval_gemfile(gemfile_path) diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 5c184f67a1..ae4ccf2138 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -48,14 +48,14 @@ def gemfile(install = false, options = {}, &gemfile) builder.instance_eval(&gemfile) builder.check_primary_source_safety - Bundler.settings.temporary(:deployment => false, :frozen => false) do + Bundler.settings.temporary(deployment: false, frozen: false) do definition = builder.to_definition(nil, true) def definition.lock(*); end definition.validate_runtime! if install || definition.missing_specs? - Bundler.settings.temporary(:inline => true, :no_install => false) do - installer = Bundler::Installer.install(Bundler.root, definition, :system => true) + Bundler.settings.temporary(inline: true, no_install: false) do + installer = Bundler::Installer.install(Bundler.root, definition, system: true) installer.post_install_messages.each do |name, message| Bundler.ui.info "Post-install message from #{name}:\n#{message}" end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 59b6a6ad22..c38b0e48ed 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -136,12 +136,12 @@ module Bundler mode = Gem.win_platform? ? "wb:UTF-8" : "w" require "erb" - content = ERB.new(template, :trim_mode => "-").result(binding) + content = ERB.new(template, trim_mode: "-").result(binding) - File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask) + File.write(binstub_path, content, mode: mode, perm: 0o777 & ~File.umask) if Gem.win_platform? || options[:all_platforms] prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" - File.write("#{binstub_path}.cmd", prefix + content, :mode => mode) + File.write("#{binstub_path}.cmd", prefix + content, mode: mode) end end @@ -179,12 +179,12 @@ module Bundler mode = Gem.win_platform? ? "wb:UTF-8" : "w" require "erb" - content = ERB.new(template, :trim_mode => "-").result(binding) + content = ERB.new(template, trim_mode: "-").result(binding) - File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755) + File.write("#{bin_path}/#{executable}", content, mode: mode, perm: 0o755) if Gem.win_platform? || options[:all_platforms] prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" - File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode) + File.write("#{bin_path}/#{executable}.cmd", prefix + content, mode: mode) end end end diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index b6065c24d0..d3bbcc90f5 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -53,10 +53,10 @@ module Bundler def install spec.source.install( spec, - :force => force, - :ensure_builtin_gems_cached => standalone, - :build_args => Array(spec_settings), - :previous_spec => previous_spec, + force: force, + ensure_builtin_gems_cached: standalone, + build_args: Array(spec_settings), + previous_spec: previous_spec, ) end @@ -77,7 +77,7 @@ module Bundler if Bundler.settings[:bin] && standalone installer.generate_standalone_bundler_executable_stubs(spec) elsif Bundler.settings[:bin] - installer.generate_bundler_executable_stubs(spec, :force => true) + installer.generate_bundler_executable_stubs(spec, force: true) end end end diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb index 2cdada44d6..5331df2e95 100644 --- a/lib/bundler/installer/standalone.rb +++ b/lib/bundler/installer/standalone.rb @@ -56,7 +56,7 @@ module Bundler if spec.source.instance_of?(Source::Path) && spec.source.path.absolute? full_path else - SharedHelpers.relative_path_to(full_path, :from => Bundler.root.join(bundler_path)) + SharedHelpers.relative_path_to(full_path, from: Bundler.root.join(bundler_path)) end rescue TypeError error_message = "#{spec.name} #{spec.version} has an invalid gemspec" diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index ca68ee5652..f2d1016732 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -102,7 +102,7 @@ module Bundler installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform) - specification = __materialize__(installable_candidates, :fallback_to_non_installable => false) + specification = __materialize__(installable_candidates, fallback_to_non_installable: false) return specification unless specification.nil? if target_platform != platform diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index e3f698ec43..6da9882990 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -101,7 +101,7 @@ module Bundler # @param [Pathname] gemfile path # @param [Proc] block that can be evaluated for (inline) Gemfile def gemfile_install(gemfile = nil, &inline) - Bundler.settings.temporary(:frozen => false, :deployment => false) do + Bundler.settings.temporary(frozen: false, deployment: false) do builder = DSL.new if block_given? builder.instance_eval(&inline) diff --git a/lib/bundler/plugin/api/source.rb b/lib/bundler/plugin/api/source.rb index 57d4eb64ad..f051f938c2 100644 --- a/lib/bundler/plugin/api/source.rb +++ b/lib/bundler/plugin/api/source.rb @@ -96,7 +96,7 @@ module Bundler # # Note: Do not override if you don't know what you are doing. def post_install(spec, disable_exts = false) - opts = { :env_shebang => false, :disable_extensions => disable_exts } + opts = { env_shebang: false, disable_extensions: disable_exts } installer = Bundler::Source::Path::Installer.new(spec, opts) installer.post_install end diff --git a/lib/bundler/plugin/installer.rb b/lib/bundler/plugin/installer.rb index c9ff12ce4b..256dcf526c 100644 --- a/lib/bundler/plugin/installer.rb +++ b/lib/bundler/plugin/installer.rb @@ -83,7 +83,7 @@ module Bundler Bundler.configure_gem_home_and_path(Plugin.root) - Bundler.settings.temporary(:deployment => false, :frozen => false) do + Bundler.settings.temporary(deployment: false, frozen: false) do definition = Definition.new(nil, deps, source_list, true) install_definition(definition) diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 9ec39d5a35..f60069f421 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -29,7 +29,7 @@ module Bundler Bundler.ui.info "Resolving dependencies...", true - solve_versions(:root => root, :logger => logger) + solve_versions(root: root, logger: logger) end def setup_solver @@ -77,7 +77,7 @@ module Bundler end def solve_versions(root:, logger:) - solver = PubGrub::VersionSolver.new(:source => self, :root => root, :logger => logger) + solver = PubGrub::VersionSolver.new(source: self, root: root, logger: logger) result = solver.solve result.map {|package, version| version.to_specs(package) }.flatten.uniq rescue PubGrub::SolveFailure => e @@ -152,7 +152,7 @@ module Bundler requirement_to_range(dependency) end - PubGrub::VersionConstraint.new(package, :range => range) + PubGrub::VersionConstraint.new(package, range: range) end def versions_for(package, range=VersionRange.any) @@ -181,7 +181,7 @@ module Bundler extended_explanation = other_specs_matching_message(specs_matching_other_platforms, label) if specs_matching_other_platforms.any? end - Incompatibility.new([unsatisfied_term], :cause => cause, :custom_explanation => custom_explanation, :extended_explanation => extended_explanation) + Incompatibility.new([unsatisfied_term], cause: cause, custom_explanation: custom_explanation, extended_explanation: extended_explanation) end def debug? @@ -220,9 +220,9 @@ module Bundler sorted_versions[high] end - range = PubGrub::VersionRange.new(:min => low, :max => high, :include_min => true) + range = PubGrub::VersionRange.new(min: low, max: high, include_min: true) - self_constraint = PubGrub::VersionConstraint.new(package, :range => range) + self_constraint = PubGrub::VersionConstraint.new(package, range: range) dep_term = PubGrub::Term.new(dep_constraint, false) self_term = PubGrub::Term.new(self_constraint, true) @@ -231,7 +231,7 @@ module Bundler "current #{dep_package} version is #{dep_constraint.constraint_string}" end - PubGrub::Incompatibility.new([self_term, dep_term], :cause => :dependency, :custom_explanation => custom_explanation) + PubGrub::Incompatibility.new([self_term, dep_term], cause: :dependency, custom_explanation: custom_explanation) end end @@ -266,11 +266,11 @@ module Bundler platform_specs.flatten! ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY) - groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any? + groups << Resolver::Candidate.new(version, specs: ruby_specs) if ruby_specs.any? next groups if platform_specs == ruby_specs || package.force_ruby_platform? - groups << Resolver::Candidate.new(version, :specs => platform_specs) + groups << Resolver::Candidate.new(version, specs: platform_specs) groups end @@ -408,19 +408,19 @@ module Bundler when "~>" name = "~> #{ver}" bump = Resolver::Candidate.new(version.bump.to_s + ".A") - PubGrub::VersionRange.new(:name => name, :min => ver, :max => bump, :include_min => true) + PubGrub::VersionRange.new(name: name, min: ver, max: bump, include_min: true) when ">" - PubGrub::VersionRange.new(:min => platform_ver) + PubGrub::VersionRange.new(min: platform_ver) when ">=" - PubGrub::VersionRange.new(:min => ver, :include_min => true) + PubGrub::VersionRange.new(min: ver, include_min: true) when "<" - PubGrub::VersionRange.new(:max => ver) + PubGrub::VersionRange.new(max: ver) when "<=" - PubGrub::VersionRange.new(:max => platform_ver, :include_max => true) + PubGrub::VersionRange.new(max: platform_ver, include_max: true) when "=" - PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true) + PubGrub::VersionRange.new(min: ver, max: platform_ver, include_min: true, include_max: true) when "!=" - PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true).invert + PubGrub::VersionRange.new(min: ver, max: platform_ver, include_min: true, include_max: true).invert else raise "bad version specifier: #{op}" end diff --git a/lib/bundler/resolver/base.rb b/lib/bundler/resolver/base.rb index e5c3763c3f..ad19eeb3f4 100644 --- a/lib/bundler/resolver/base.rb +++ b/lib/bundler/resolver/base.rb @@ -24,7 +24,7 @@ module Bundler name = dep.name - @packages[name] = Package.new(name, dep_platforms, **options.merge(:dependency => dep)) + @packages[name] = Package.new(name, dep_platforms, **options.merge(dependency: dep)) dep end.compact diff --git a/lib/bundler/resolver/incompatibility.rb b/lib/bundler/resolver/incompatibility.rb index c61151fbeb..4ac1b2e1ea 100644 --- a/lib/bundler/resolver/incompatibility.rb +++ b/lib/bundler/resolver/incompatibility.rb @@ -8,7 +8,7 @@ module Bundler def initialize(terms, cause:, custom_explanation: nil, extended_explanation: nil) @extended_explanation = extended_explanation - super(terms, :cause => cause, :custom_explanation => custom_explanation) + super(terms, cause: cause, custom_explanation: custom_explanation) end end end diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 1d5a42cbbe..abdf19e6fe 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -376,7 +376,7 @@ module Gem remove_method :glob_files_in_dir def glob_files_in_dir(glob, base_path) - Dir.glob(glob, :base => base_path).map! {|f| File.expand_path(f, base_path) } + Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) } end end end diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb index 23fb3c0416..d563868cd2 100644 --- a/lib/bundler/rubygems_gem_installer.rb +++ b/lib/bundler/rubygems_gem_installer.rb @@ -20,7 +20,7 @@ module Bundler strict_rm_rf spec.extension_dir SharedHelpers.filesystem_access(gem_dir, :create) do - FileUtils.mkdir_p gem_dir, :mode => 0o755 + FileUtils.mkdir_p gem_dir, mode: 0o755 end extract_files diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 95cf78dd41..045f29c5ad 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -32,7 +32,7 @@ module Bundler setup_manpath - lock(:preserve_unknown_sections => true) + lock(preserve_unknown_sections: true) self end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 8885b22e08..8f941c448d 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -335,11 +335,11 @@ module Bundler def configs @configs ||= { - :temporary => @temporary, - :local => @local_config, - :env => @env_config, - :global => @global_config, - :default => DEFAULT_CONFIG, + temporary: @temporary, + local: @local_config, + env: @env_config, + global: @global_config, + default: DEFAULT_CONFIG, } end diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 08589eea27..23cbaae940 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -203,7 +203,7 @@ module Bundler SharedHelpers.filesystem_access(path, :read) do File.open(path, "rb") do |f| digest = SharedHelpers.digest(digest).new - buf = String.new(:capacity => 16_384, :encoding => Encoding::BINARY) + buf = String.new(capacity: 16_384, encoding: Encoding::BINARY) digest << buf while f.read(16_384, buf) digest.hexdigest end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 1d77c39f77..831a13cba3 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -20,7 +20,7 @@ module Bundler # Stringify options that could be set as symbols %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] } - @uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false) + @uri = URINormalizer.normalize_suffix(options["uri"] || "", trailing_slash: false) @safe_uri = URICredentialsFilter.credential_filtered_uri(@uri) @branch = options["branch"] @ref = options["ref"] || options["branch"] || options["tag"] @@ -198,7 +198,7 @@ module Bundler @copied = true end - generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] } + generate_bin_options = { disable_extensions: !Bundler.rubygems.spec_missing_extensions?(spec), build_args: options[:build_args] } generate_bin(spec, generate_bin_options) requires_checkout? ? spec.post_install_message : nil diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 0b507abc76..484a031835 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -80,13 +80,13 @@ module Bundler def current_branch @current_branch ||= with_path do - git_local("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip + git_local("rev-parse", "--abbrev-ref", "HEAD", dir: path).strip end end def contains?(commit) allowed_with_path do - result, status = git_null("branch", "--contains", commit, :dir => path) + result, status = git_null("branch", "--contains", commit, dir: path) status.success? && result =~ /^\* (.*)$/ end end @@ -132,18 +132,18 @@ module Bundler ref = @commit_ref || (locked_to_full_sha? && @revision) if ref - git "config", "uploadpack.allowAnySHA1InWant", "true", :dir => path.to_s if @commit_ref.nil? && needs_allow_any_sha1_in_want? + git "config", "uploadpack.allowAnySHA1InWant", "true", dir: path.to_s if @commit_ref.nil? && needs_allow_any_sha1_in_want? - git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination + git "fetch", "--force", "--quiet", *extra_fetch_args(ref), dir: destination end - git "reset", "--hard", @revision, :dir => destination + git "reset", "--hard", @revision, dir: destination if submodules - git_retry "submodule", "update", "--init", "--recursive", :dir => destination + git_retry "submodule", "update", "--init", "--recursive", dir: destination elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0") inner_command = "git -C $toplevel submodule deinit --force $sm_path" - git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination + git_retry "submodule", "foreach", "--quiet", inner_command, dir: destination end end @@ -266,32 +266,32 @@ module Bundler def git_null(*command, dir: nil) check_allowed(command) - capture(command, dir, :ignore_err => true) + capture(command, dir, ignore_err: true) end def git_retry(*command, dir: nil) command_with_no_credentials = check_allowed(command) Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do - git(*command, :dir => dir) + git(*command, dir: dir) end end def git(*command, dir: nil) - run_command(*command, :dir => dir) do |unredacted_command| + run_command(*command, dir: dir) do |unredacted_command| check_allowed(unredacted_command) end end def git_local(*command, dir: nil) - run_command(*command, :dir => dir) do |unredacted_command| + run_command(*command, dir: dir) do |unredacted_command| redact_and_check_presence(unredacted_command) end end def has_revision_cached? return unless @revision && path.exist? - git("cat-file", "-e", @revision, :dir => path) + git("cat-file", "-e", @revision, dir: path) true rescue GitError false @@ -314,7 +314,7 @@ module Bundler end def verify(reference) - git("rev-parse", "--verify", reference, :dir => path).strip + git("rev-parse", "--verify", reference, dir: path).strip end # Adds credentials to the URI @@ -398,7 +398,7 @@ module Bundler if Bundler.feature_flag.bundler_3_mode? || supports_minus_c? ["git", "-C", dir.to_s, *cmd] else - ["git", *cmd, { :chdir => dir.to_s }] + ["git", *cmd, { chdir: dir.to_s }] end end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 3bb7fbfed5..978b0b2c9f 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -86,7 +86,7 @@ module Bundler using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}" using_message += " and installing its executables" unless spec.executables.empty? print_using_message using_message - generate_bin(spec, :disable_extensions => true) + generate_bin(spec, disable_extensions: true) nil # no post-install message end @@ -237,10 +237,10 @@ module Bundler installer = Path::Installer.new( spec, - :env_shebang => false, - :disable_extensions => options[:disable_extensions], - :build_args => options[:build_args], - :bundler_extension_cache_path => extension_cache_path(spec) + env_shebang: false, + disable_extensions: options[:disable_extensions], + build_args: options[:build_args], + bundler_extension_cache_path: extension_cache_path(spec) ) installer.post_install rescue Gem::InvalidSpecificationException => e diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index e67e7a97ff..dfcedb5b16 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -171,14 +171,14 @@ module Bundler installer = Bundler::RubyGemsGemInstaller.at( path, - :security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]], - :install_dir => install_path.to_s, - :bin_dir => bin_path.to_s, - :ignore_dependencies => true, - :wrappers => true, - :env_shebang => true, - :build_args => options[:build_args], - :bundler_extension_cache_path => extension_cache_path(spec) + security_policy: Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]], + install_dir: install_path.to_s, + bin_dir: bin_path.to_s, + ignore_dependencies: true, + wrappers: true, + env_shebang: true, + build_args: options[:build_args], + bundler_extension_cache_path: extension_cache_path(spec) ) if spec.remote diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb index 538e8c3e74..6179d0e4eb 100644 --- a/lib/bundler/vlad.rb +++ b/lib/bundler/vlad.rb @@ -13,5 +13,5 @@ require_relative "deployment" include Rake::DSL if defined? Rake::DSL namespace :vlad do - Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app) + Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, roles: :app) end |