diff options
Diffstat (limited to 'lib')
92 files changed, 697 insertions, 783 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 668c0b6660..19ecafb607 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -194,7 +194,7 @@ module Bundler end def environment - SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", :print_caller_location => true + SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", print_caller_location: true load end @@ -353,7 +353,7 @@ module Bundler removed_message = "`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`" - Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) + Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) unbundled_env end @@ -396,7 +396,7 @@ module Bundler removed_message = "`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`" - Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) + Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) with_env(unbundled_env) { yield } end @@ -418,7 +418,7 @@ module Bundler removed_message = "`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`" - Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) + Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) with_env(unbundled_env) { Kernel.system(*args) } end @@ -440,7 +440,7 @@ module Bundler removed_message = "`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`" - Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) + Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true) with_env(unbundled_env) { Kernel.exec(*args) } end @@ -517,7 +517,7 @@ module Bundler raise MarshalError, "#{e.class}: #{e.message}" end else - load_marshal(data, :marshal_proc => SafeMarshal.proc) + load_marshal(data, marshal_proc: SafeMarshal.proc) end end 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 diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb index 22864a9b29..72dcf1dd17 100644 --- a/lib/rubygems/commands/cert_command.rb +++ b/lib/rubygems/commands/cert_command.rb @@ -6,7 +6,7 @@ require_relative "../security" class Gem::Commands::CertCommand < Gem::Command def initialize super "cert", "Manage RubyGems certificates and signing settings", - :add => [], :remove => [], :list => [], :build => [], :sign => [] + add: [], remove: [], list: [], build: [], sign: [] add_option("-a", "--add CERT", "Add a trusted certificate.") do |cert_file, options| diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index 6552258552..fb23dd9cb4 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -10,7 +10,7 @@ class Gem::Commands::CheckCommand < Gem::Command def initialize super "check", "Check a gem repository for added or missing files", - :alien => true, :doctor => false, :dry_run => false, :gems => true + alien: true, doctor: false, dry_run: false, gems: true add_option("-a", "--[no-]alien", 'Report "unmanaged" or rogue files in the', diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index 26beba48df..08fb598cea 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -8,8 +8,8 @@ class Gem::Commands::CleanupCommand < Gem::Command def initialize super "cleanup", "Clean up old versions of installed gems", - :force => false, :install_dir => Gem.dir, - :check_dev => true + force: false, install_dir: Gem.dir, + check_dev: true add_option("-n", "-d", "--dry-run", "Do not uninstall gems") do |_value, options| @@ -166,8 +166,8 @@ If no gems are named all gems in GEM_HOME are cleaned. say "Attempting to uninstall #{spec.full_name}" uninstall_options = { - :executables => false, - :version => "= #{spec.version}", + executables: false, + version: "= #{spec.version}", } uninstall_options[:user_install] = Gem.user_dir == spec.base_dir diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb index f3783468aa..807158d9c9 100644 --- a/lib/rubygems/commands/contents_command.rb +++ b/lib/rubygems/commands/contents_command.rb @@ -8,8 +8,8 @@ class Gem::Commands::ContentsCommand < Gem::Command def initialize super "contents", "Display the contents of the installed gems", - :specdirs => [], :lib_only => false, :prefix => true, - :show_install_dir => false + specdirs: [], lib_only: false, prefix: true, + show_install_dir: false add_version_option diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb index 109bf03aff..9aaefae999 100644 --- a/lib/rubygems/commands/dependency_command.rb +++ b/lib/rubygems/commands/dependency_command.rb @@ -11,7 +11,7 @@ class Gem::Commands::DependencyCommand < Gem::Command def initialize super "dependency", "Show the dependencies of an installed gem", - :version => Gem::Requirement.default, :domain => :local + version: Gem::Requirement.default, domain: :local add_version_option add_platform_option diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb index 950d4fe30e..f7f5b62306 100644 --- a/lib/rubygems/commands/fetch_command.rb +++ b/lib/rubygems/commands/fetch_command.rb @@ -10,8 +10,8 @@ class Gem::Commands::FetchCommand < Gem::Command def initialize defaults = { - :suggest_alternate => true, - :version => Gem::Requirement.default, + suggest_alternate: true, + version: Gem::Requirement.default, } super "fetch", "Download a gem and place it in the current directory", defaults diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb index ce580cfaf9..0bf74355ae 100644 --- a/lib/rubygems/commands/generate_index_command.rb +++ b/lib/rubygems/commands/generate_index_command.rb @@ -12,7 +12,7 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command def initialize super "generate_index", "Generates the index files for a gem server directory", - :directory => ".", :build_modern => true + directory: ".", build_modern: true add_option "-d", "--directory=DIRNAME", "repository base dir containing gems subdir" do |dir, options| diff --git a/lib/rubygems/commands/info_command.rb b/lib/rubygems/commands/info_command.rb index ced7751ff5..f65c639662 100644 --- a/lib/rubygems/commands/info_command.rb +++ b/lib/rubygems/commands/info_command.rb @@ -8,8 +8,8 @@ class Gem::Commands::InfoCommand < Gem::Command def initialize super "info", "Show information for the given gem", - :name => //, :domain => :local, :details => false, :versions => true, - :installed => nil, :version => Gem::Requirement.default + name: //, domain: :local, details: false, versions: true, + installed: nil, version: Gem::Requirement.default add_query_options diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 9e59aee1c9..2091634a29 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -23,11 +23,11 @@ class Gem::Commands::InstallCommand < Gem::Command def initialize defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({ - :format_executable => false, - :lock => true, - :suggest_alternate => true, - :version => Gem::Requirement.default, - :without_groups => [], + format_executable: false, + lock: true, + suggest_alternate: true, + version: Gem::Requirement.default, + without_groups: [], }) defaults.merge!(install_update_options) diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb index 522c771f90..fab4b73814 100644 --- a/lib/rubygems/commands/list_command.rb +++ b/lib/rubygems/commands/list_command.rb @@ -11,8 +11,8 @@ class Gem::Commands::ListCommand < Gem::Command def initialize super "list", "Display local gems whose name matches REGEXP", - :domain => :local, :details => false, :versions => true, - :installed => nil, :version => Gem::Requirement.default + domain: :local, details: false, versions: true, + installed: nil, version: Gem::Requirement.default add_query_options end diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb index 3a9512fe3f..f7fd5ada16 100644 --- a/lib/rubygems/commands/lock_command.rb +++ b/lib/rubygems/commands/lock_command.rb @@ -5,7 +5,7 @@ require_relative "../command" class Gem::Commands::LockCommand < Gem::Command def initialize super "lock", "Generate a lockdown list of gems", - :strict => false + strict: false add_option "-s", "--[no-]strict", "fail if unable to satisfy a dependency" do |strict, options| diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb index f342fa6c6b..0fe90dc8b8 100644 --- a/lib/rubygems/commands/open_command.rb +++ b/lib/rubygems/commands/open_command.rb @@ -70,7 +70,7 @@ class Gem::Commands::OpenCommand < Gem::Command end def open_editor(path) - system(*@editor.split(/\s+/) + [path], { :chdir => path }) + system(*@editor.split(/\s+/) + [path], { chdir: path }) end def spec_for(name) diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb index fce32aca3e..12bfe3a834 100644 --- a/lib/rubygems/commands/owner_command.rb +++ b/lib/rubygems/commands/owner_command.rb @@ -39,7 +39,7 @@ permission to. add_proxy_option add_key_option add_otp_option - defaults.merge! :add => [], :remove => [] + defaults.merge! add: [], remove: [] add_option "-a", "--add NEW_OWNER", "Add an owner by user identifier" do |value, options| options[:add] << value diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 3dbbb3e50c..456d897df2 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -11,10 +11,10 @@ class Gem::Commands::PristineCommand < Gem::Command def initialize super "pristine", "Restores installed gems to pristine condition from files located in the gem cache", - :version => Gem::Requirement.default, - :extensions => true, - :extensions_set => false, - :all => false + version: Gem::Requirement.default, + extensions: true, + extensions_set: false, + all: false add_option("--all", "Restore all installed gems to pristine", @@ -179,12 +179,12 @@ extensions will be restored. install_dir = options[:install_dir] if options[:install_dir] installer_options = { - :wrappers => true, - :force => true, - :install_dir => install_dir || spec.base_dir, - :env_shebang => env_shebang, - :build_args => spec.build_args, - :bin_dir => bin_dir, + wrappers: true, + force: true, + install_dir: install_dir || spec.base_dir, + env_shebang: env_shebang, + build_args: spec.build_args, + bin_dir: bin_dir, } if options[:only_executables] diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb index 418b46acc5..591ddc3a80 100644 --- a/lib/rubygems/commands/push_command.rb +++ b/lib/rubygems/commands/push_command.rb @@ -30,7 +30,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo end def initialize - super "push", "Push a gem up to the gem server", :host => host + super "push", "Push a gem up to the gem server", host: host @user_defined_host = false diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index e7d21f341b..3b527974a3 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -20,8 +20,8 @@ class Gem::Commands::QueryCommand < Gem::Command def initialize(name = "query", summary = "Query gem information in local or remote repositories") super name, summary, - :domain => :local, :details => false, :versions => true, - :installed => nil, :version => Gem::Requirement.default + domain: :local, details: false, versions: true, + installed: nil, version: Gem::Requirement.default add_option("-n", "--name-matches REGEXP", "Name of gem(s) to query on matches the", diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb index e318a52914..1321bc45f7 100644 --- a/lib/rubygems/commands/rdoc_command.rb +++ b/lib/rubygems/commands/rdoc_command.rb @@ -10,8 +10,8 @@ class Gem::Commands::RdocCommand < Gem::Command def initialize super "rdoc", "Generates RDoc for pre-installed gems", - :version => Gem::Requirement.default, - :include_rdoc => false, :include_ri => true, :overwrite => false + version: Gem::Requirement.default, + include_rdoc: false, include_ri: true, overwrite: false add_option("--all", "Generate RDoc/RI documentation for all", diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb index c7469e1fa8..50e161ac9b 100644 --- a/lib/rubygems/commands/search_command.rb +++ b/lib/rubygems/commands/search_command.rb @@ -8,8 +8,8 @@ class Gem::Commands::SearchCommand < Gem::Command def initialize super "search", "Display remote gems whose name matches REGEXP", - :domain => :remote, :details => false, :versions => true, - :installed => nil, :version => Gem::Requirement.default + domain: :remote, details: false, versions: true, + installed: nil, version: Gem::Requirement.default add_query_options end diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 611bcaabb8..9cef1c6c11 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -14,12 +14,12 @@ class Gem::Commands::SetupCommand < Gem::Command def initialize super "setup", "Install RubyGems", - :format_executable => false, :document => %w[ri], - :force => true, - :site_or_vendor => "sitelibdir", - :destdir => "", :prefix => "", :previous_version => "", - :regenerate_binstubs => true, - :regenerate_plugins => true + format_executable: false, document: %w[ri], + force: true, + site_or_vendor: "sitelibdir", + destdir: "", prefix: "", previous_version: "", + regenerate_binstubs: true, + regenerate_plugins: true add_option "--previous-version=VERSION", "Previous version of RubyGems", @@ -265,7 +265,7 @@ By default, this RubyGems will install gem as: fp.puts bin.join end - install bin_tmp_file, dest_file, :mode => prog_mode + install bin_tmp_file, dest_file, mode: prog_mode bin_file_names << dest_file ensure rm bin_tmp_file @@ -287,7 +287,7 @@ By default, this RubyGems will install gem as: TEXT end - install bin_cmd_file, "#{dest_file}.bat", :mode => prog_mode + install bin_cmd_file, "#{dest_file}.bat", mode: prog_mode ensure rm bin_cmd_file end @@ -369,7 +369,7 @@ By default, this RubyGems will install gem as: File.dirname(loaded_from) else target_specs_dir = File.join(default_dir, "specifications", "default") - mkdir_p target_specs_dir, :mode => 0o755 + mkdir_p target_specs_dir, mode: 0o755 target_specs_dir end @@ -393,7 +393,7 @@ By default, this RubyGems will install gem as: end bundler_bin_dir = bundler_spec.bin_dir - mkdir_p bundler_bin_dir, :mode => 0o755 + mkdir_p bundler_bin_dir, mode: 0o755 bundler_spec.executables.each do |e| cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e) end @@ -430,8 +430,8 @@ By default, this RubyGems will install gem as: lib_dir, bin_dir = generate_default_dirs end - mkdir_p lib_dir, :mode => 0o755 - mkdir_p bin_dir, :mode => 0o755 + mkdir_p lib_dir, mode: 0o755 + mkdir_p bin_dir, mode: 0o755 [lib_dir, bin_dir] end @@ -576,8 +576,8 @@ abort "#{deprecation_message}" def uninstall_old_gemcutter require_relative "../uninstaller" - ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true, - :version => "< 0.4") + ui = Gem::Uninstaller.new("gemcutter", all: true, ignore: true, + version: "< 0.4") ui.uninstall rescue Gem::InstallError end @@ -639,10 +639,10 @@ abort "#{deprecation_message}" dest_file = File.join dest_dir, file dest_dir = File.dirname dest_file unless File.directory? dest_dir - mkdir_p dest_dir, :mode => 0o755 + mkdir_p dest_dir, mode: 0o755 end - install file, dest_file, :mode => options[:data_mode] || 0o644 + install file, dest_file, mode: options[:data_mode] || 0o644 end def remove_file_list(files, dir) diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index 938b9507f9..a21ed35be3 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -13,8 +13,8 @@ class Gem::Commands::SpecificationCommand < Gem::Command Gem.load_yaml super "specification", "Display gem specification (in yaml)", - :domain => :local, :version => Gem::Requirement.default, - :format => :yaml + domain: :local, version: Gem::Requirement.default, + format: :yaml add_version_option("examine") add_platform_option diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb index 7f6d5a4bb7..2a77ec72cf 100644 --- a/lib/rubygems/commands/uninstall_command.rb +++ b/lib/rubygems/commands/uninstall_command.rb @@ -15,8 +15,8 @@ class Gem::Commands::UninstallCommand < Gem::Command def initialize super "uninstall", "Uninstall gems from the local repository", - :version => Gem::Requirement.default, :user_install => true, - :check_dev => false, :vendor => false + version: Gem::Requirement.default, user_install: true, + check_dev: false, vendor: false add_option("-a", "--[no-]all", "Uninstall all matching versions") do |value, options| diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb index 73eefe153c..f25c045c62 100644 --- a/lib/rubygems/commands/unpack_command.rb +++ b/lib/rubygems/commands/unpack_command.rb @@ -21,8 +21,8 @@ class Gem::Commands::UnpackCommand < Gem::Command require "fileutils" super "unpack", "Unpack an installed gem to the current directory", - :version => Gem::Requirement.default, - :target => Dir.pwd + version: Gem::Requirement.default, + target: Dir.pwd add_option("--target=DIR", "target directory for unpacking") do |value, options| diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 6d3597fb56..10ae6d9a93 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -21,7 +21,7 @@ class Gem::Commands::UpdateCommand < Gem::Command def initialize options = { - :force => false, + force: false, } options.merge!(install_update_options) diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb index ec464d9672..5ed4d9d142 100644 --- a/lib/rubygems/commands/which_command.rb +++ b/lib/rubygems/commands/which_command.rb @@ -5,7 +5,7 @@ require_relative "../command" class Gem::Commands::WhichCommand < Gem::Command def initialize super "which", "Find the location of a library file you can require", - :search_gems_first => false, :show_all => false + search_gems_first: false, show_all: false add_option "-a", "--[no-]all", "show all matching files" do |show_all, options| options[:show_all] = show_all diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb index 56a9309a7e..b119dca1cf 100644 --- a/lib/rubygems/dependency_installer.rb +++ b/lib/rubygems/dependency_installer.rb @@ -17,18 +17,18 @@ class Gem::DependencyInstaller extend Gem::Deprecate DEFAULT_OPTIONS = { # :nodoc: - :env_shebang => false, - :document => %w[ri], - :domain => :both, # HACK: dup - :force => false, - :format_executable => false, # HACK: dup - :ignore_dependencies => false, - :prerelease => false, - :security_policy => nil, # HACK: NoSecurity requires OpenSSL. AlmostNo? Low? - :wrappers => true, - :build_args => nil, - :build_docs_in_background => false, - :install_as_default => false, + env_shebang: false, + document: %w[ri], + domain: :both, # HACK: dup + force: false, + format_executable: false, # HACK: dup + ignore_dependencies: false, + prerelease: false, + security_policy: nil, # HACK: NoSecurity requires OpenSSL. AlmostNo? Low? + wrappers: true, + build_args: nil, + build_docs_in_background: false, + install_as_default: false, }.freeze ## @@ -228,22 +228,22 @@ class Gem::DependencyInstaller @installed_gems = [] options = { - :bin_dir => @bin_dir, - :build_args => @build_args, - :document => @document, - :env_shebang => @env_shebang, - :force => @force, - :format_executable => @format_executable, - :ignore_dependencies => @ignore_dependencies, - :prerelease => @prerelease, - :security_policy => @security_policy, - :user_install => @user_install, - :wrappers => @wrappers, - :build_root => @build_root, - :install_as_default => @install_as_default, - :dir_mode => @dir_mode, - :data_mode => @data_mode, - :prog_mode => @prog_mode, + bin_dir: @bin_dir, + build_args: @build_args, + document: @document, + env_shebang: @env_shebang, + force: @force, + format_executable: @format_executable, + ignore_dependencies: @ignore_dependencies, + prerelease: @prerelease, + security_policy: @security_policy, + user_install: @user_install, + wrappers: @wrappers, + build_root: @build_root, + install_as_default: @install_as_default, + dir_mode: @dir_mode, + data_mode: @data_mode, + prog_mode: @prog_mode, } options[:install_dir] = @install_dir if @only_install_dir diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index 242dd0125a..ccd0853fff 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -88,7 +88,7 @@ class Gem::Ext::Builder # Set $SOURCE_DATE_EPOCH for the subprocess. build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env) output, status = begin - Open3.capture2e(build_env, *command, :chdir => dir) + Open3.capture2e(build_env, *command, chdir: dir) rescue StandardError => error raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}" end diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb index 885201e20b..5cf32e9af3 100644 --- a/lib/rubygems/ext/cargo_builder.rb +++ b/lib/rubygems/ext/cargo_builder.rb @@ -198,7 +198,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder output, status = begin - Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", :chdir => cargo_dir) + Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", chdir: cargo_dir) rescue StandardError => error raise Gem::InstallError, "cargo metadata failed #{error.message}" end diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 7efd4a06b7..f38fe5947e 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -48,7 +48,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder FileUtils.mkdir_p lib_dir entries = Dir.entries(full_tmp_dest) - %w[. ..] entries = entries.map {|entry| File.join full_tmp_dest, entry } - FileUtils.cp_r entries, lib_dir, :remove_destination => true + FileUtils.cp_r entries, lib_dir, remove_destination: true end FileUtils::Entry_.new(full_tmp_dest).traverse do |ent| diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index 074a0df334..570604110f 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -136,7 +136,7 @@ module Gem::GemcutterUtilities sign_in_host, scope: scope) do |request| request.basic_auth email, password request["OTP"] = otp if otp - request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params)) + request.body = URI.encode_www_form({ api_key: api_key }.merge(update_scope_params)) end with_response response do |_resp| diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb index f4c981b9ef..82c334672f 100644 --- a/lib/rubygems/indexer.rb +++ b/lib/rubygems/indexer.rb @@ -48,7 +48,7 @@ class Gem::Indexer require "tmpdir" require "zlib" - options = { :build_modern => true }.merge options + options = { build_modern: true }.merge options @build_modern = options[:build_modern] @@ -302,10 +302,10 @@ class Gem::Indexer dst_name = File.join(@dest_directory, @quick_marshal_dir_base) - FileUtils.mkdir_p File.dirname(dst_name), :verbose => verbose - FileUtils.rm_rf dst_name, :verbose => verbose + FileUtils.mkdir_p File.dirname(dst_name), verbose: verbose + FileUtils.rm_rf dst_name, verbose: verbose FileUtils.mv(@quick_marshal_dir, dst_name, - :verbose => verbose, :force => true) + verbose: verbose, force: true) end files = files.map do |path| @@ -316,9 +316,9 @@ class Gem::Indexer src_name = File.join @directory, file dst_name = File.join @dest_directory, file - FileUtils.rm_rf dst_name, :verbose => verbose + FileUtils.rm_rf dst_name, verbose: verbose FileUtils.mv(src_name, @dest_directory, - :verbose => verbose, :force => true) + verbose: verbose, force: true) end end @@ -327,7 +327,7 @@ class Gem::Indexer def make_temp_directories FileUtils.rm_rf @directory - FileUtils.mkdir_p @directory, :mode => 0o700 + FileUtils.mkdir_p @directory, mode: 0o700 FileUtils.mkdir_p @quick_marshal_dir end @@ -397,8 +397,8 @@ class Gem::Indexer src_name = File.join @directory, file dst_name = File.join @dest_directory, file # REFACTOR: duped above - FileUtils.mv src_name, dst_name, :verbose => verbose, - :force => true + FileUtils.mv src_name, dst_name, verbose: verbose, + force: true File.utime newest_mtime, newest_mtime, dst_name end diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb index 5c7289426e..aad207a718 100644 --- a/lib/rubygems/install_update_options.rb +++ b/lib/rubygems/install_update_options.rb @@ -186,7 +186,7 @@ module Gem::InstallUpdateOptions def install_update_options { - :document => %w[ri], + document: %w[ri], } end diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 0477b47035..45405a805f 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -319,7 +319,7 @@ class Gem::Installer FileUtils.rm_rf spec.extension_dir dir_mode = options[:dir_mode] - FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0o755 + FileUtils.mkdir_p gem_dir, mode: dir_mode && 0o755 if @options[:install_as_default] extract_bin @@ -569,7 +569,7 @@ class Gem::Installer File.unlink dst end - FileUtils.symlink src, dst, :verbose => Gem.configuration.really_verbose + FileUtils.symlink src, dst, verbose: Gem.configuration.really_verbose rescue NotImplementedError, SystemCallError alert_warning "Unable to use symlinks, installing wrapper" generate_bin_script filename, bindir @@ -654,11 +654,11 @@ class Gem::Installer def process_options # :nodoc: @options = { - :bin_dir => nil, - :env_shebang => false, - :force => false, - :only_install_dir => false, - :post_install_message => true, + bin_dir: nil, + env_shebang: false, + force: false, + only_install_dir: false, + post_install_message: true, }.merge options @env_shebang = options[:env_shebang] @@ -727,7 +727,7 @@ class Gem::Installer end def verify_gem_home # :nodoc: - FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0o755 + FileUtils.mkdir_p gem_home, mode: options[:dir_mode] && 0o755 end def verify_spec @@ -948,7 +948,7 @@ TEXT build_info_dir = File.join gem_home, "build_info" dir_mode = options[:dir_mode] - FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0o755 + FileUtils.mkdir_p build_info_dir, mode: dir_mode && 0o755 build_info_file = File.join build_info_dir, "#{spec.full_name}.info" diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index 7fc639a60b..68517cd4c0 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -384,7 +384,7 @@ EOM def extract_files(destination_dir, pattern = "*") verify unless @spec - FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0o755 + FileUtils.mkdir_p destination_dir, mode: dir_mode && 0o755 @gem.with_read_io do |io| reader = Gem::Package::TarReader.new io diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb index 207fd0b44f..1a13ac3e29 100644 --- a/lib/rubygems/package/old.rb +++ b/lib/rubygems/package/old.rb @@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package FileUtils.rm_rf destination - FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0o755 + FileUtils.mkdir_p File.dirname(destination), mode: dir_mode && 0o755 File.open destination, "wb", file_mode(entry["mode"]) do |out| out.write file_data diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb index 6fb5b3b2e3..7deafa994f 100644 --- a/lib/rubygems/package/tar_header.rb +++ b/lib/rubygems/package/tar_header.rb @@ -106,24 +106,24 @@ class Gem::Package::TarHeader fields = header.unpack UNPACK_FORMAT - new :name => fields.shift, - :mode => strict_oct(fields.shift), - :uid => oct_or_256based(fields.shift), - :gid => oct_or_256based(fields.shift), - :size => strict_oct(fields.shift), - :mtime => strict_oct(fields.shift), - :checksum => strict_oct(fields.shift), - :typeflag => fields.shift, - :linkname => fields.shift, - :magic => fields.shift, - :version => strict_oct(fields.shift), - :uname => fields.shift, - :gname => fields.shift, - :devmajor => strict_oct(fields.shift), - :devminor => strict_oct(fields.shift), - :prefix => fields.shift, - - :empty => empty + new name: fields.shift, + mode: strict_oct(fields.shift), + uid: oct_or_256based(fields.shift), + gid: oct_or_256based(fields.shift), + size: strict_oct(fields.shift), + mtime: strict_oct(fields.shift), + checksum: strict_oct(fields.shift), + typeflag: fields.shift, + linkname: fields.shift, + magic: fields.shift, + version: strict_oct(fields.shift), + uname: fields.shift, + gname: fields.shift, + devmajor: strict_oct(fields.shift), + devminor: strict_oct(fields.shift), + prefix: fields.shift, + + empty: empty end def self.strict_oct(str) diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb index e06ec25961..b24bdb63e7 100644 --- a/lib/rubygems/package/tar_writer.rb +++ b/lib/rubygems/package/tar_writer.rb @@ -116,9 +116,9 @@ class Gem::Package::TarWriter final_pos = @io.pos @io.pos = init_pos - header = Gem::Package::TarHeader.new :name => name, :mode => mode, - :size => size, :prefix => prefix, - :mtime => Gem.source_date_epoch + header = Gem::Package::TarHeader.new name: name, mode: mode, + size: size, prefix: prefix, + mtime: Gem.source_date_epoch @io.write header @io.pos = final_pos @@ -209,9 +209,9 @@ class Gem::Package::TarWriter name, prefix = split_name name - header = Gem::Package::TarHeader.new(:name => name, :mode => mode, - :size => size, :prefix => prefix, - :mtime => Gem.source_date_epoch).to_s + header = Gem::Package::TarHeader.new(name: name, mode: mode, + size: size, prefix: prefix, + mtime: Gem.source_date_epoch).to_s @io.write header os = BoundedStream.new @io, size @@ -235,11 +235,11 @@ class Gem::Package::TarWriter name, prefix = split_name name - header = Gem::Package::TarHeader.new(:name => name, :mode => mode, - :size => 0, :typeflag => "2", - :linkname => target, - :prefix => prefix, - :mtime => Gem.source_date_epoch).to_s + header = Gem::Package::TarHeader.new(name: name, mode: mode, + size: 0, typeflag: "2", + linkname: target, + prefix: prefix, + mtime: Gem.source_date_epoch).to_s @io.write header @@ -289,10 +289,10 @@ class Gem::Package::TarWriter name, prefix = split_name(name) - header = Gem::Package::TarHeader.new :name => name, :mode => mode, - :typeflag => "5", :size => 0, - :prefix => prefix, - :mtime => Gem.source_date_epoch + header = Gem::Package::TarHeader.new name: name, mode: mode, + typeflag: "5", size: 0, + prefix: prefix, + mtime: Gem.source_date_epoch @io.write header diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb index a67d8cb916..d26411684d 100644 --- a/lib/rubygems/package_task.rb +++ b/lib/rubygems/package_task.rb @@ -97,13 +97,13 @@ class Gem::PackageTask < Rake::PackageTask gem_path = File.join package_dir, gem_file gem_dir = File.join package_dir, gem_spec.full_name - task :package => [:gem] + task package: [:gem] directory package_dir directory gem_dir desc "Build the gem file #{gem_file}" - task :gem => [gem_path] + task gem: [gem_path] trace = Rake.application.options.trace Gem.configuration.verbose = trace diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb index 698da378b5..4347d22ccb 100644 --- a/lib/rubygems/request_set/gem_dependency_api.rb +++ b/lib/rubygems/request_set/gem_dependency_api.rb @@ -33,22 +33,22 @@ class Gem::RequestSet::GemDependencyAPI ENGINE_MAP = { # :nodoc: - :jruby => %w[jruby], - :jruby_18 => %w[jruby], - :jruby_19 => %w[jruby], - :maglev => %w[maglev], - :mri => %w[ruby], - :mri_18 => %w[ruby], - :mri_19 => %w[ruby], - :mri_20 => %w[ruby], - :mri_21 => %w[ruby], - :rbx => %w[rbx], - :truffleruby => %w[truffleruby], - :ruby => %w[ruby rbx maglev truffleruby], - :ruby_18 => %w[ruby rbx maglev truffleruby], - :ruby_19 => %w[ruby rbx maglev truffleruby], - :ruby_20 => %w[ruby rbx maglev truffleruby], - :ruby_21 => %w[ruby rbx maglev truffleruby], + jruby: %w[jruby], + jruby_18: %w[jruby], + jruby_19: %w[jruby], + maglev: %w[maglev], + mri: %w[ruby], + mri_18: %w[ruby], + mri_19: %w[ruby], + mri_20: %w[ruby], + mri_21: %w[ruby], + rbx: %w[rbx], + truffleruby: %w[truffleruby], + ruby: %w[ruby rbx maglev truffleruby], + ruby_18: %w[ruby rbx maglev truffleruby], + ruby_19: %w[ruby rbx maglev truffleruby], + ruby_20: %w[ruby rbx maglev truffleruby], + ruby_21: %w[ruby rbx maglev truffleruby], }.freeze mswin = Gem::Platform.new "x86-mswin32" @@ -57,39 +57,39 @@ class Gem::RequestSet::GemDependencyAPI x64_mingw = Gem::Platform.new "x64-mingw32" PLATFORM_MAP = { # :nodoc: - :jruby => Gem::Platform::RUBY, - :jruby_18 => Gem::Platform::RUBY, - :jruby_19 => Gem::Platform::RUBY, - :maglev => Gem::Platform::RUBY, - :mingw => x86_mingw, - :mingw_18 => x86_mingw, - :mingw_19 => x86_mingw, - :mingw_20 => x86_mingw, - :mingw_21 => x86_mingw, - :mri => Gem::Platform::RUBY, - :mri_18 => Gem::Platform::RUBY, - :mri_19 => Gem::Platform::RUBY, - :mri_20 => Gem::Platform::RUBY, - :mri_21 => Gem::Platform::RUBY, - :mswin => mswin, - :mswin_18 => mswin, - :mswin_19 => mswin, - :mswin_20 => mswin, - :mswin_21 => mswin, - :mswin64 => mswin64, - :mswin64_19 => mswin64, - :mswin64_20 => mswin64, - :mswin64_21 => mswin64, - :rbx => Gem::Platform::RUBY, - :ruby => Gem::Platform::RUBY, - :ruby_18 => Gem::Platform::RUBY, - :ruby_19 => Gem::Platform::RUBY, - :ruby_20 => Gem::Platform::RUBY, - :ruby_21 => Gem::Platform::RUBY, - :truffleruby => Gem::Platform::RUBY, - :x64_mingw => x64_mingw, - :x64_mingw_20 => x64_mingw, - :x64_mingw_21 => x64_mingw, + jruby: Gem::Platform::RUBY, + jruby_18: Gem::Platform::RUBY, + jruby_19: Gem::Platform::RUBY, + maglev: Gem::Platform::RUBY, + mingw: x86_mingw, + mingw_18: x86_mingw, + mingw_19: x86_mingw, + mingw_20: x86_mingw, + mingw_21: x86_mingw, + mri: Gem::Platform::RUBY, + mri_18: Gem::Platform::RUBY, + mri_19: Gem::Platform::RUBY, + mri_20: Gem::Platform::RUBY, + mri_21: Gem::Platform::RUBY, + mswin: mswin, + mswin_18: mswin, + mswin_19: mswin, + mswin_20: mswin, + mswin_21: mswin, + mswin64: mswin64, + mswin64_19: mswin64, + mswin64_20: mswin64, + mswin64_21: mswin64, + rbx: Gem::Platform::RUBY, + ruby: Gem::Platform::RUBY, + ruby_18: Gem::Platform::RUBY, + ruby_19: Gem::Platform::RUBY, + ruby_20: Gem::Platform::RUBY, + ruby_21: Gem::Platform::RUBY, + truffleruby: Gem::Platform::RUBY, + x64_mingw: x64_mingw, + x64_mingw_20: x64_mingw, + x64_mingw_21: x64_mingw, }.freeze gt_eq_0 = Gem::Requirement.new ">= 0" @@ -99,70 +99,70 @@ class Gem::RequestSet::GemDependencyAPI tilde_gt_2_1_0 = Gem::Requirement.new "~> 2.1.0" VERSION_MAP = { # :nodoc: - :jruby => gt_eq_0, - :jruby_18 => tilde_gt_1_8_0, - :jruby_19 => tilde_gt_1_9_0, - :maglev => gt_eq_0, - :mingw => gt_eq_0, - :mingw_18 => tilde_gt_1_8_0, - :mingw_19 => tilde_gt_1_9_0, - :mingw_20 => tilde_gt_2_0_0, - :mingw_21 => tilde_gt_2_1_0, - :mri => gt_eq_0, - :mri_18 => tilde_gt_1_8_0, - :mri_19 => tilde_gt_1_9_0, - :mri_20 => tilde_gt_2_0_0, - :mri_21 => tilde_gt_2_1_0, - :mswin => gt_eq_0, - :mswin_18 => tilde_gt_1_8_0, - :mswin_19 => tilde_gt_1_9_0, - :mswin_20 => tilde_gt_2_0_0, - :mswin_21 => tilde_gt_2_1_0, - :mswin64 => gt_eq_0, - :mswin64_19 => tilde_gt_1_9_0, - :mswin64_20 => tilde_gt_2_0_0, - :mswin64_21 => tilde_gt_2_1_0, - :rbx => gt_eq_0, - :ruby => gt_eq_0, - :ruby_18 => tilde_gt_1_8_0, - :ruby_19 => tilde_gt_1_9_0, - :ruby_20 => tilde_gt_2_0_0, - :ruby_21 => tilde_gt_2_1_0, - :truffleruby => gt_eq_0, - :x64_mingw => gt_eq_0, - :x64_mingw_20 => tilde_gt_2_0_0, - :x64_mingw_21 => tilde_gt_2_1_0, + jruby: gt_eq_0, + jruby_18: tilde_gt_1_8_0, + jruby_19: tilde_gt_1_9_0, + maglev: gt_eq_0, + mingw: gt_eq_0, + mingw_18: tilde_gt_1_8_0, + mingw_19: tilde_gt_1_9_0, + mingw_20: tilde_gt_2_0_0, + mingw_21: tilde_gt_2_1_0, + mri: gt_eq_0, + mri_18: tilde_gt_1_8_0, + mri_19: tilde_gt_1_9_0, + mri_20: tilde_gt_2_0_0, + mri_21: tilde_gt_2_1_0, + mswin: gt_eq_0, + mswin_18: tilde_gt_1_8_0, + mswin_19: tilde_gt_1_9_0, + mswin_20: tilde_gt_2_0_0, + mswin_21: tilde_gt_2_1_0, + mswin64: gt_eq_0, + mswin64_19: tilde_gt_1_9_0, + mswin64_20: tilde_gt_2_0_0, + mswin64_21: tilde_gt_2_1_0, + rbx: gt_eq_0, + ruby: gt_eq_0, + ruby_18: tilde_gt_1_8_0, + ruby_19: tilde_gt_1_9_0, + ruby_20: tilde_gt_2_0_0, + ruby_21: tilde_gt_2_1_0, + truffleruby: gt_eq_0, + x64_mingw: gt_eq_0, + x64_mingw_20: tilde_gt_2_0_0, + x64_mingw_21: tilde_gt_2_1_0, }.freeze WINDOWS = { # :nodoc: - :mingw => :only, - :mingw_18 => :only, - :mingw_19 => :only, - :mingw_20 => :only, - :mingw_21 => :only, - :mri => :never, - :mri_18 => :never, - :mri_19 => :never, - :mri_20 => :never, - :mri_21 => :never, - :mswin => :only, - :mswin_18 => :only, - :mswin_19 => :only, - :mswin_20 => :only, - :mswin_21 => :only, - :mswin64 => :only, - :mswin64_19 => :only, - :mswin64_20 => :only, - :mswin64_21 => :only, - :rbx => :never, - :ruby => :never, - :ruby_18 => :never, - :ruby_19 => :never, - :ruby_20 => :never, - :ruby_21 => :never, - :x64_mingw => :only, - :x64_mingw_20 => :only, - :x64_mingw_21 => :only, + mingw: :only, + mingw_18: :only, + mingw_19: :only, + mingw_20: :only, + mingw_21: :only, + mri: :never, + mri_18: :never, + mri_19: :never, + mri_20: :never, + mri_21: :never, + mswin: :only, + mswin_18: :only, + mswin_19: :only, + mswin_20: :only, + mswin_21: :only, + mswin64: :only, + mswin64_19: :only, + mswin64_20: :only, + mswin64_21: :only, + rbx: :never, + ruby: :never, + ruby_18: :never, + ruby_19: :never, + ruby_20: :never, + ruby_21: :never, + x64_mingw: :only, + x64_mingw_20: :only, + x64_mingw_21: :only, }.freeze ## diff --git a/lib/rubygems/security/policies.rb b/lib/rubygems/security/policies.rb index 4180832d85..41f66043ad 100644 --- a/lib/rubygems/security/policies.rb +++ b/lib/rubygems/security/policies.rb @@ -6,12 +6,12 @@ module Gem::Security NoSecurity = Policy.new( "No Security", - :verify_data => false, - :verify_signer => false, - :verify_chain => false, - :verify_root => false, - :only_trusted => false, - :only_signed => false + verify_data: false, + verify_signer: false, + verify_chain: false, + verify_root: false, + only_trusted: false, + only_signed: false ) ## @@ -24,12 +24,12 @@ module Gem::Security AlmostNoSecurity = Policy.new( "Almost No Security", - :verify_data => true, - :verify_signer => false, - :verify_chain => false, - :verify_root => false, - :only_trusted => false, - :only_signed => false + verify_data: true, + verify_signer: false, + verify_chain: false, + verify_root: false, + only_trusted: false, + only_signed: false ) ## @@ -41,12 +41,12 @@ module Gem::Security LowSecurity = Policy.new( "Low Security", - :verify_data => true, - :verify_signer => true, - :verify_chain => false, - :verify_root => false, - :only_trusted => false, - :only_signed => false + verify_data: true, + verify_signer: true, + verify_chain: false, + verify_root: false, + only_trusted: false, + only_signed: false ) ## @@ -60,12 +60,12 @@ module Gem::Security MediumSecurity = Policy.new( "Medium Security", - :verify_data => true, - :verify_signer => true, - :verify_chain => true, - :verify_root => true, - :only_trusted => true, - :only_signed => false + verify_data: true, + verify_signer: true, + verify_chain: true, + verify_root: true, + only_trusted: true, + only_signed: false ) ## @@ -79,12 +79,12 @@ module Gem::Security HighSecurity = Policy.new( "High Security", - :verify_data => true, - :verify_signer => true, - :verify_chain => true, - :verify_root => true, - :only_trusted => true, - :only_signed => true + verify_data: true, + verify_signer: true, + verify_chain: true, + verify_root: true, + only_trusted: true, + only_signed: true ) ## @@ -92,12 +92,12 @@ module Gem::Security SigningPolicy = Policy.new( "Signing Policy", - :verify_data => false, - :verify_signer => true, - :verify_chain => true, - :verify_root => true, - :only_trusted => false, - :only_signed => false + verify_data: false, + verify_signer: true, + verify_chain: true, + verify_root: true, + only_trusted: false, + only_signed: false ) ## diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb index ea011e6d65..d23d161cfe 100644 --- a/lib/rubygems/security/trust_dir.rb +++ b/lib/rubygems/security/trust_dir.rb @@ -9,8 +9,8 @@ class Gem::Security::TrustDir # Default permissions for the trust directory and its contents DEFAULT_PERMISSIONS = { - :trust_dir => 0o700, - :trusted_cert => 0o600, + trust_dir: 0o700, + trusted_cert: 0o600, }.freeze ## @@ -111,7 +111,7 @@ class Gem::Security::TrustDir FileUtils.chmod 0o700, @dir else - FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir] + FileUtils.mkdir_p @dir, mode: @permissions[:trust_dir] end end end diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index 5a51e22787..d90e311b65 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -12,9 +12,9 @@ class Gem::Source include Gem::Text FILES = { # :nodoc: - :released => "specs", - :latest => "latest_specs", - :prerelease => "prerelease_specs", + released: "specs", + latest: "latest_specs", + prerelease: "prerelease_specs", }.freeze ## diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 34e6d7638c..610edf25c9 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -69,9 +69,9 @@ class Gem::SpecFetcher @prerelease_specs = {} @caches = { - :latest => @latest_specs, - :prerelease => @prerelease_specs, - :released => @specs, + latest: @latest_specs, + prerelease: @prerelease_specs, + released: @specs, } @fetcher = Gem::RemoteFetcher.fetcher diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 91d4408a16..017bed617f 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -127,35 +127,35 @@ class Gem::Specification < Gem::BasicSpecification # Map of attribute names to default values. @@default_value = { - :authors => [], - :autorequire => nil, - :bindir => "bin", - :cert_chain => [], - :date => nil, - :dependencies => [], - :description => nil, - :email => nil, - :executables => [], - :extensions => [], - :extra_rdoc_files => [], - :files => [], - :homepage => nil, - :licenses => [], - :metadata => {}, - :name => nil, - :platform => Gem::Platform::RUBY, - :post_install_message => nil, - :rdoc_options => [], - :require_paths => ["lib"], - :required_ruby_version => Gem::Requirement.default, - :required_rubygems_version => Gem::Requirement.default, - :requirements => [], - :rubygems_version => Gem::VERSION, - :signing_key => nil, - :specification_version => CURRENT_SPECIFICATION_VERSION, - :summary => nil, - :test_files => [], - :version => nil, + authors: [], + autorequire: nil, + bindir: "bin", + cert_chain: [], + date: nil, + dependencies: [], + description: nil, + email: nil, + executables: [], + extensions: [], + extra_rdoc_files: [], + files: [], + homepage: nil, + licenses: [], + metadata: {}, + name: nil, + platform: Gem::Platform::RUBY, + post_install_message: nil, + rdoc_options: [], + require_paths: ["lib"], + required_ruby_version: Gem::Requirement.default, + required_rubygems_version: Gem::Requirement.default, + requirements: [], + rubygems_version: Gem::VERSION, + signing_key: nil, + specification_version: CURRENT_SPECIFICATION_VERSION, + summary: nil, + test_files: [], + version: nil, }.freeze # rubocop:disable Style/MutableConstant diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index 5c65dcc424..eba89e64e3 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -60,7 +60,7 @@ module Gem::Util # Invokes system, but silences all output. def self.silent_system(*command) - opt = { :out => IO::NULL, :err => [:child, :out] } + opt = { out: IO::NULL, err: [:child, :out] } if Hash === command.last opt.update(command.last) cmds = command[0...-1] |