[rubygems/rubygems] Use modern hashes consistently

https://github.com/rubygems/rubygems/commit/bb66253f2c
This commit is contained in:
David Rodríguez 2023-12-07 22:10:33 +01:00 committed by git
parent 9d696aa204
commit 2755cb1b2f
262 changed files with 3027 additions and 3113 deletions

View File

@ -194,7 +194,7 @@ module Bundler
end end
def environment 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 load
end end
@ -353,7 +353,7 @@ module Bundler
removed_message = removed_message =
"`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \ "`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`" "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 unbundled_env
end end
@ -396,7 +396,7 @@ module Bundler
removed_message = removed_message =
"`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \ "`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`" "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 } with_env(unbundled_env) { yield }
end end
@ -418,7 +418,7 @@ module Bundler
removed_message = removed_message =
"`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \ "`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`" "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) } with_env(unbundled_env) { Kernel.system(*args) }
end end
@ -440,7 +440,7 @@ module Bundler
removed_message = removed_message =
"`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \ "`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`" "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) } with_env(unbundled_env) { Kernel.exec(*args) }
end end
@ -517,7 +517,7 @@ module Bundler
raise MarshalError, "#{e.class}: #{e.message}" raise MarshalError, "#{e.class}: #{e.message}"
end end
else else
load_marshal(data, :marshal_proc => SafeMarshal.proc) load_marshal(data, marshal_proc: SafeMarshal.proc)
end end
end end

View File

@ -29,7 +29,7 @@ module Bundler
# commit instance variable then we can't determine its commits SHA. # commit instance variable then we can't determine its commits SHA.
git_dir = File.expand_path("../../../.git", __dir__) git_dir = File.expand_path("../../../.git", __dir__)
if File.directory?(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 end
@git_commit_sha ||= "unknown" @git_commit_sha ||= "unknown"

View File

@ -17,6 +17,6 @@ end
Capistrano::Configuration.instance(:must_exist).load do Capistrano::Configuration.instance(:must_exist).load do
before "deploy:finalize_update", "bundle:install" 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" } set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
end end

View File

@ -23,7 +23,7 @@ module Bundler
def from_gem(io, pathname, algo = DEFAULT_ALGORITHM) def from_gem(io, pathname, algo = DEFAULT_ALGORITHM)
digest = Bundler::SharedHelpers.digest(algo.upcase).new 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? digest << io.readpartial(DEFAULT_BLOCK_SIZE, buf) until io.eof?
Checksum.new(algo, digest.hexdigest!, Source.new(:gem, pathname)) Checksum.new(algo, digest.hexdigest!, Source.new(:gem, pathname))
end end

View File

@ -80,10 +80,10 @@ module Bundler
unprinted_warnings.each {|w| Bundler.ui.warn(w) } unprinted_warnings.each {|w| Bundler.ui.warn(w) }
end end
check_unknown_options!(:except => [:config, :exec]) check_unknown_options!(except: [:config, :exec])
stop_on_unknown_option! :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 def cli_help
version version
Bundler.ui.info "\n" Bundler.ui.info "\n"
@ -99,19 +99,19 @@ module Bundler
shell.say "Bundler commands:\n\n" shell.say "Bundler commands:\n\n"
shell.say " Primary commands:\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
shell.say " Utilities:\n" shell.say " Utilities:\n"
shell.print_table(utilities, :indent => 4, :truncate => true) shell.print_table(utilities, indent: 4, truncate: true)
shell.say shell.say
self.class.send(:class_options_help, shell) self.class.send(:class_options_help, shell)
end end
default_task(Bundler.feature_flag.default_cli_command) default_task(Bundler.feature_flag.default_cli_command)
class_option "no-color", :type => :boolean, :desc => "Disable colorization in output" class_option "no-color", type: :boolean, desc: "Disable colorization in output"
class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM", class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
:desc => "Specify the number of times you wish to attempt network commands" desc: "Specify the number of times you wish to attempt network commands"
class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V" class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
def help(cli = nil) def help(cli = nil)
case cli case cli
@ -155,8 +155,8 @@ module Bundler
Gemfile to a gem with a gemspec, the --gemspec option will automatically add each 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. dependency listed in the gemspec file to the newly created Gemfile.
D D
method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the 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'" method_option "gemfile", type: :string, banner: "Use the specified name for the gemfile instead of 'Gemfile'"
def init def init
require_relative "cli/init" require_relative "cli/init"
Init.new(options.dup).run 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. 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. If not, the first missing gem is listed and Bundler exits status 1.
D D
method_option "dry-run", :type => :boolean, :default => false, :banner => method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile"
"Lock the Gemfile" method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "gemfile", :type => :string, :banner => 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?}"
"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 def check
remembered_flag_deprecation("path") remembered_flag_deprecation("path")
@ -187,13 +184,12 @@ module Bundler
long_desc <<-D 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. 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 D
method_option "install", :type => :boolean, :banner => method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
"Runs 'bundle install' after removing the gems from the Gemfile"
def remove(*gems) def remove(*gems)
if ARGV.include?("--install") if ARGV.include?("--install")
message = "The `--install` flag has been deprecated. `bundle install` is triggered by default." 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." 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 end
require_relative "cli/remove" 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. If the bundle has already been installed, bundler will tell you so and then exit.
D D
method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin"
"Generate bin stubs for bundled gems to ./bin" method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install"
method_option "clean", :type => :boolean, :banner => method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments"
"Run bundle clean automatically after install" method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install"
method_option "deployment", :type => :boolean, :banner => method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
"Install using defaults tuned for deployment environments" method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "frozen", :type => :boolean, :banner => method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
"Do not allow the Gemfile.lock to be updated after this install" method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "full-index", :type => :boolean, :banner => method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
"Fall back to using the single-file index of all gems" method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
method_option "gemfile", :type => :string, :banner => method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
"Use the specified gemfile instead of Gemfile" method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
method_option "jobs", :aliases => "-j", :type => :numeric, :banner => 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?}"
"Specify the number of jobs to run in parallel" method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "local", :type => :boolean, :banner => method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
"Do not attempt to fetch gems remotely and use the gem cache instead" method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime"
method_option "prefer-local", :type => :boolean, :banner => 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"
"Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely" method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of " +
method_option "no-cache", :type => :boolean, :banner => Bundler.rubygems.security_policy_keys.join("|")
"Don't update the existing gem cache." method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
method_option "redownload", :type => :boolean, :aliases => "--force", :banner => method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
"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 def install
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") 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") remembered_negative_flag_deprecation("no-deployment")
require_relative "cli/install" require_relative "cli/install"
Bundler.settings.temporary(:no_install => false) do Bundler.settings.temporary(no_install: false) do
Install.new(options.dup).run Install.new(options.dup).run
end end
end end
@ -277,44 +253,27 @@ module Bundler
update when you have changed the Gemfile, or if you want to get the newest update when you have changed the Gemfile, or if you want to get the newest
possible versions of the gems in the bundle. possible versions of the gems in the bundle.
D D
method_option "full-index", :type => :boolean, :banner => method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
"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 "gemfile", :type => :string, :banner => method_option "group", aliases: "-g", type: :array, banner: "Update a specific group"
"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 "group", :aliases => "-g", :type => :array, :banner => method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
"Update a specific group" method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "jobs", :aliases => "-j", :type => :numeric, :banner => method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
"Specify the number of jobs to run in parallel" method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
method_option "local", :type => :boolean, :banner => method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
"Do not attempt to fetch gems remotely and use the gem cache instead" method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
method_option "quiet", :type => :boolean, :banner => method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
"Only output warnings and errors." method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
method_option "source", :type => :array, :banner => method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
"Update a specific source (and all gems associated with it)" method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
method_option "redownload", :type => :boolean, :aliases => "--force", :banner => method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
"Force downloading every gem." method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
method_option "ruby", :type => :boolean, :banner => method_option "all", type: :boolean, banner: "Update everything."
"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) def update(*gems)
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require_relative "cli/update" require_relative "cli/update"
Bundler.settings.temporary(:no_install => false) do Bundler.settings.temporary(no_install: false) do
Update.new(options, gems).run Update.new(options, gems).run
end end
end end
@ -324,25 +283,25 @@ module Bundler
Show lists the names and versions of all gems that are required by your Gemfile. 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. Calling show with [GEM] will list the exact location of that gem on your machine.
D D
method_option "paths", :type => :boolean, method_option "paths", type: :boolean,
:banner => "List the paths of all gems that are required by your Gemfile." banner: "List the paths of all gems that are required by your Gemfile."
method_option "outdated", :type => :boolean, method_option "outdated", type: :boolean,
:banner => "Show verbose output including whether gems are outdated." banner: "Show verbose output including whether gems are outdated."
def show(gem_name = nil) def show(gem_name = nil)
if ARGV.include?("--outdated") if ARGV.include?("--outdated")
message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement" 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" 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 end
require_relative "cli/show" require_relative "cli/show"
Show.new(options, gem_name).run Show.new(options, gem_name).run
end end
desc "list", "List all gems in the bundle" desc "list", "List all gems in the bundle"
method_option "name-only", :type => :boolean, :banner => "print only the gem names" 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 "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 "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 "paths", type: :boolean, banner: "print the path to each gem in the bundle"
def list def list
require_relative "cli/list" require_relative "cli/list"
List.new(options).run List.new(options).run
@ -351,8 +310,8 @@ module Bundler
map aliases_for("list") map aliases_for("list")
desc "info GEM [OPTIONS]", "Show information for the given gem" desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem" method_option "path", type: :boolean, banner: "Print full path to gem"
method_option "version", :type => :boolean, :banner => "Print gem version" method_option "version", type: :boolean, banner: "Print gem version"
def info(gem_name) def info(gem_name)
require_relative "cli/info" require_relative "cli/info"
Info.new(options, gem_name).run 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]] or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]]
will create binstubs for all given gems. will create binstubs for all given gems.
D D
method_option "force", :type => :boolean, :default => false, :banner => method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist"
"Overwrite existing binstubs if they exist" method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)"
method_option "path", :type => :string, :lazy_default => "bin", :banner => method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
"Binstub destination directory (default bin)" method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime"
method_option "shebang", :type => :string, :banner => method_option "all", type: :boolean, banner: "Install binstubs for all gems"
"Specify a different shebang executable name than the default (usually 'ruby')" method_option "all-platforms", type: :boolean, default: false, banner: "Install binstubs for all platforms"
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) def binstubs(*gems)
require_relative "cli/binstubs" require_relative "cli/binstubs"
Binstubs.new(options, gems).run Binstubs.new(options, gems).run
@ -385,19 +338,18 @@ module Bundler
long_desc <<-D long_desc <<-D
Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step. Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
D D
method_option "version", :aliases => "-v", :type => :string method_option "version", aliases: "-v", type: :string
method_option "group", :aliases => "-g", :type => :string method_option "group", aliases: "-g", type: :string
method_option "source", :aliases => "-s", :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 "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 "path", type: :string
method_option "git", :type => :string method_option "git", type: :string
method_option "github", :type => :string method_option "github", type: :string
method_option "branch", :type => :string method_option "branch", type: :string
method_option "ref", :type => :string method_option "ref", type: :string
method_option "skip-install", :type => :boolean, :banner => method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it"
"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 "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 "strict", :type => :boolean, :banner => "Adds strict declaration of version to gem"
def add(*gems) def add(*gems)
require_relative "cli/add" require_relative "cli/add"
Add.new(options.dup, gems).run Add.new(options.dup, gems).run
@ -413,55 +365,46 @@ module Bundler
For more information on patch level options (--major, --minor, --patch, For more information on patch level options (--major, --minor, --patch,
--strict) see documentation on the same options on the update command. --strict) see documentation on the same options on the update command.
D D
method_option "group", :type => :string, :banner => "List gems from a specific group" 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 "groups", type: :boolean, banner: "List gems organized by groups"
method_option "local", :type => :boolean, :banner => method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
"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 "pre", :type => :boolean, :banner => "Check for newer pre-release gems" method_option "source", type: :array, banner: "Check against a specific source"
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 "filter-strict", :type => :boolean, :aliases => "--strict", :banner => method_option "update-strict", type: :boolean, banner: "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
"Only list newer versions allowed by your Gemfile requirements" method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
method_option "update-strict", :type => :boolean, :banner => method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
"Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major" 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 "filter-major", type: :boolean, banner: "Only list major newer versions"
method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)" method_option "filter-minor", type: :boolean, banner: "Only list minor newer versions"
method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version" method_option "filter-patch", type: :boolean, banner: "Only list patch newer versions"
method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions" method_option "parseable", aliases: "--porcelain", type: :boolean, banner: "Use minimal formatting for more parseable output"
method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions" method_option "json", type: :boolean, banner: "Produce parseable json output"
method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions" method_option "only-explicit", type: :boolean, banner: "Only list gems specified in your Gemfile, not their dependencies"
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) def outdated(*gems)
require_relative "cli/outdated" require_relative "cli/outdated"
Outdated.new(options, gems).run Outdated.new(options, gems).run
end end
desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance" desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
method_option "group", :aliases => "-g", :type => :array, :banner => method_option "group", aliases: "-g", type: :array, banner: "Fetch funding information for a specific group"
"Fetch funding information for a specific group"
def fund def fund
require_relative "cli/fund" require_relative "cli/fund"
Fund.new(options).run Fund.new(options).run
end end
desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
method_option "all", :type => :boolean, method_option "all", type: :boolean,
:default => Bundler.feature_flag.cache_all?, default: Bundler.feature_flag.cache_all?,
:banner => "Include all sources (including path and git)." 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 "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 => method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
"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 "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-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 "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 "path", :type => :string, :banner => method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
"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 "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
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 long_desc <<-D
The cache command will copy the .gem files for every gem in the bundle into the 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 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. " \ "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, " \ "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." "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 end
require_relative "cli/cache" require_relative "cli/cache"
@ -491,8 +434,8 @@ module Bundler
map aliases_for("cache") map aliases_for("cache")
desc "exec [OPTIONS]", "Run the command in context of the bundle" desc "exec [OPTIONS]", "Run the command in context of the bundle"
method_option :keep_file_descriptors, :type => :boolean, :default => true method_option :keep_file_descriptors, type: :boolean, default: true
method_option :gemfile, :type => :string, :required => false method_option :gemfile, type: :string, required: false
long_desc <<-D long_desc <<-D
Exec runs a command, providing it access to the gems in the bundle. While using 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 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") 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" 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" 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 end
require_relative "cli/exec" require_relative "cli/exec"
@ -527,7 +470,7 @@ module Bundler
subcommand "config", Config subcommand "config", Config
desc "open GEM", "Opens the source directory of the given bundled gem" 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) def open(name)
require_relative "cli/open" require_relative "cli/open"
Open.new(options, name).run Open.new(options, name).run
@ -572,17 +515,17 @@ module Bundler
end end
unless Bundler.feature_flag.bundler_3_mode? 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 long_desc <<-D
Viz generates a PNG file of the current Gemfile as a dependency graph. Viz generates a PNG file of the current Gemfile as a dependency graph.
Viz requires the ruby-graphviz gem (and its dependencies). Viz requires the ruby-graphviz gem (and its dependencies).
The associated gems must also be installed via 'bundle install'. The associated gems must also be installed via 'bundle install'.
D 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 :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 :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 :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 :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 :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group."
def viz 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" 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" require_relative "cli/viz"
@ -593,23 +536,23 @@ module Bundler
old_gem = instance_method(:gem) old_gem = instance_method(:gem)
desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem" 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 :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 :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", 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? }, 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)" 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 :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 :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 :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 :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 :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", 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)`." 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"] || "", 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)`" 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"] || "", 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)`" 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 :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) def gem(name)
end end
@ -640,29 +583,24 @@ module Bundler
File.expand_path("templates", __dir__) File.expand_path("templates", __dir__)
end end
desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true
method_option "dry-run", :type => :boolean, :default => false, :banner => method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems"
"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."
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 def clean
require_relative "cli/clean" require_relative "cli/clean"
Clean.new(options.dup).run Clean.new(options.dup).run
end end
desc "platform [OPTIONS]", "Displays platform compatibility information" desc "platform [OPTIONS]", "Displays platform compatibility information"
method_option "ruby", :type => :boolean, :default => false, :banner => method_option "ruby", type: :boolean, default: false, banner: "only display ruby related platform information"
"only display ruby related platform information"
def platform def platform
require_relative "cli/platform" require_relative "cli/platform"
Platform.new(options).run Platform.new(options).run
end end
desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
method_option "source", :type => :string, :banner => method_option "source", type: :string, banner: "Install gem from the given source"
"Install gem from the given source" method_option "group", type: :string, banner: "Install gem into a bundler group"
method_option "group", :type => :string, :banner =>
"Install gem into a bundler group"
def inject(name, version) def inject(name, version)
SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command" SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
require_relative "cli/inject" require_relative "cli/inject"
@ -670,36 +608,21 @@ module Bundler
end end
desc "lock", "Creates a lockfile without installing" desc "lock", "Creates a lockfile without installing"
method_option "update", :type => :array, :lazy_default => true, :banner => method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems"
"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 "local", :type => :boolean, :default => false, :banner => method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
"do not attempt to fetch remote gemspecs and use the local gem cache only" method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "print", :type => :boolean, :default => false, :banner => method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
"print the lockfile to STDOUT instead of writing to the file system" method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
method_option "gemfile", :type => :string, :banner => method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
"Use the specified gemfile instead of Gemfile" method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
method_option "lockfile", :type => :string, :default => nil, :banner => method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
"the path the lockfile should be written to" method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
method_option "full-index", :type => :boolean, :default => false, :banner => method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
"Fall back to using the single-file index of all gems" method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
method_option "add-platform", :type => :array, :default => [], :banner => method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
"Add a new platform to the lockfile" 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 "remove-platform", :type => :array, :default => [], :banner => method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
"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 def lock
require_relative "cli/lock" require_relative "cli/lock"
Lock.new(options).run Lock.new(options).run
@ -716,10 +639,8 @@ module Bundler
missing dependencies are detected, Bundler prints them and exits status 1. missing dependencies are detected, Bundler prints them and exits status 1.
Otherwise, Bundler prints a success message and exits with a status of 0. Otherwise, Bundler prints a success message and exits with a status of 0.
D D
method_option "gemfile", :type => :string, :banner => method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
"Use the specified gemfile instead of Gemfile" method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
def doctor def doctor
require_relative "cli/doctor" require_relative "cli/doctor"
Doctor.new(options).run Doctor.new(options).run
@ -783,7 +704,7 @@ module Bundler
if deprecated_ext_value?(arguments) 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." 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." 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" arguments[arguments.index("--ext")] = "--ext=c"
end end
end end
@ -918,7 +839,7 @@ module Bundler
"remembered across bundler invocations, which bundler will no longer " \ "remembered across bundler invocations, which bundler will no longer " \
"do. Instead please use `bundle config set #{option_name} " \ "do. Instead please use `bundle config set #{option_name} " \
"#{option_value}`, and stop using this flag" "#{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 end
end end

View File

@ -28,9 +28,9 @@ module Bundler
dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) } dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) }
Injector.inject(dependencies, Injector.inject(dependencies,
:conservative_versioning => options[:version].nil?, # Perform conservative versioning only when version is not specified conservative_versioning: options[:version].nil?, # Perform conservative versioning only when version is not specified
:optimistic => options[:optimistic], optimistic: options[:optimistic],
:strict => options[:strict]) strict: options[:strict])
end end
def validate_options! def validate_options!

View File

@ -17,9 +17,9 @@ module Bundler
installer = Installer.new(Bundler.root, Bundler.definition) installer = Installer.new(Bundler.root, Bundler.definition)
installer_opts = { installer_opts = {
:force => options[:force], force: options[:force],
:binstubs_cmd => true, binstubs_cmd: true,
:all_platforms => options["all-platforms"], all_platforms: options["all-platforms"],
} }
if options[:all] if options[:all]
@ -45,7 +45,7 @@ module Bundler
next next
end 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) installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
end end
else else

View File

@ -19,7 +19,7 @@ module Bundler
# TODO: move cache contents here now that all bundles are locked # TODO: move cache contents here now that all bundles are locked
custom_path = Bundler.settings[:path] if options[:path] 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) Bundler.load.cache(custom_path)
end end
end end

View File

@ -32,7 +32,7 @@ module Bundler
Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present" Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present"
exit 1 exit 1
else 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" Bundler.ui.info "The Gemfile's dependencies are satisfied"
end end
end end

View File

@ -2,17 +2,17 @@
module Bundler module Bundler
class CLI::Config < Thor 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 def self.scope_options
method_option :global, :type => :boolean, :banner => "Only change the global config" method_option :global, type: :boolean, banner: "Only change the global config"
method_option :local, :type => :boolean, :banner => "Only change the local config" method_option :local, type: :boolean, banner: "Only change the local config"
end end
private_class_method :scope_options 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 scope_options
method_option :delete, :type => :boolean, :banner => "delete" method_option :delete, type: :boolean, banner: "delete"
def base(name = nil, *value) def base(name = nil, *value)
new_args = new_args =
if ARGV.size == 1 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." 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." 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 Base.new(options, name, value, self).run
end end

View File

@ -11,7 +11,7 @@ module Bundler
def run def run
message = "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" 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>`" 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 group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require
ARGV.clear ARGV.clear

View File

@ -12,7 +12,7 @@ module Bundler
@options = options @options = options
@cmd = args.shift @cmd = args.shift
@args = args @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 end
def run def run

View File

@ -59,23 +59,23 @@ module Bundler
end end
config = { config = {
:name => name, name: name,
:underscored_name => underscored_name, underscored_name: underscored_name,
:namespaced_path => namespaced_path, namespaced_path: namespaced_path,
:makefile_path => "#{underscored_name}/#{underscored_name}", makefile_path: "#{underscored_name}/#{underscored_name}",
:constant_name => constant_name, constant_name: constant_name,
:constant_array => constant_array, constant_array: constant_array,
:author => git_author_name.empty? ? "TODO: Write your name" : git_author_name, 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, email: git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
:test => options[:test], test: options[:test],
:ext => extension, ext: extension,
:exe => options[:exe], exe: options[:exe],
:bundler_version => bundler_dependency_version, bundler_version: bundler_dependency_version,
:git => use_git, git: use_git,
:github_username => github_username.empty? ? "[USERNAME]" : github_username, github_username: github_username.empty? ? "[USERNAME]" : github_username,
:required_ruby_version => required_ruby_version, required_ruby_version: required_ruby_version,
:rust_builder_required_rubygems_version => rust_builder_required_rubygems_version, rust_builder_required_rubygems_version: rust_builder_required_rubygems_version,
:minitest_constant_name => minitest_constant_name, minitest_constant_name: minitest_constant_name,
} }
ensure_safe_gem_name(name, constant_array) ensure_safe_gem_name(name, constant_array)
@ -236,7 +236,7 @@ module Bundler
end end
if use_git if use_git
IO.popen(%w[git add .], { :chdir => target }, &:read) IO.popen(%w[git add .], { chdir: target }, &:read)
end end
# Open gemspec in editor # Open gemspec in editor
@ -382,18 +382,18 @@ module Bundler
if options[:rubocop] if options[:rubocop]
Bundler::SharedHelpers.major_deprecation 2, Bundler::SharedHelpers.major_deprecation 2,
"--rubocop is deprecated, use --linter=rubocop", "--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" "rubocop"
else else
Bundler::SharedHelpers.major_deprecation 2, Bundler::SharedHelpers.major_deprecation 2,
"--no-rubocop is deprecated, use --linter", "--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 false
end end
elsif !Bundler.settings["gem.rubocop"].nil? elsif !Bundler.settings["gem.rubocop"].nil?
Bundler::SharedHelpers.major_deprecation 2, Bundler::SharedHelpers.major_deprecation 2,
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead", "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 Bundler.settings["gem.rubocop"] ? "rubocop" : false
end end
end end

View File

@ -52,7 +52,7 @@ module Bundler
if options["binstubs"] if options["binstubs"]
Bundler::SharedHelpers.major_deprecation 2, Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs --all`", "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 end
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
@ -62,7 +62,7 @@ module Bundler
installer = Installer.install(Bundler.root, definition, options) 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? Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
end end
@ -96,7 +96,7 @@ module Bundler
def warn_if_root def warn_if_root
return if Bundler.settings[:silence_root_warning] || Gem.win_platform? || !Process.uid.zero? 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 " \ 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 end
def dependencies_count_for(definition) def dependencies_count_for(definition)
@ -149,7 +149,7 @@ module Bundler
Bundler.settings.set_command_option_if_given :path, options[:path] Bundler.settings.set_command_option_if_given :path, options[:path]
if options["standalone"] && Bundler.settings[:path].nil? && !options["local"] 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" Bundler.settings.set_command_option :path, "bundle"
end end
end end

View File

@ -26,14 +26,14 @@ module Bundler
if update.is_a?(Array) # unlocking specific gems if update.is_a?(Array) # unlocking specific gems
Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update) Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update)
update = { :gems => update, :conservative => conservative } update = { gems: update, conservative: conservative }
elsif update && conservative elsif update && conservative
update = { :conservative => conservative } update = { conservative: conservative }
elsif update && bundler elsif update && bundler
update = { :bundler => bundler } update = { bundler: bundler }
end end
Bundler.settings.temporary(:frozen => false) do Bundler.settings.temporary(frozen: false) do
definition = Bundler.definition(update) definition = Bundler.definition(update)
Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update] Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]

View File

@ -21,7 +21,7 @@ module Bundler
require "shellwords" require "shellwords"
command = Shellwords.split(editor) << File.join([root_path, path].compact) command = Shellwords.split(editor) << File.join([root_path, path].compact)
Bundler.with_original_env do 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 || Bundler.ui.info("Could not run '#{command.join(" ")}'")
end end
end end

View File

@ -41,12 +41,12 @@ module Bundler
# We're doing a full update # We're doing a full update
Bundler.definition(true) Bundler.definition(true)
else else
Bundler.definition(:gems => gems, :sources => sources) Bundler.definition(gems: gems, sources: sources)
end end
Bundler::CLI::Common.configure_gem_version_promoter( Bundler::CLI::Common.configure_gem_version_promoter(
Bundler.definition, Bundler.definition,
options.merge(:strict => @strict) options.merge(strict: @strict)
) )
definition_resolution = proc do definition_resolution = proc do
@ -90,10 +90,10 @@ module Bundler
end end
outdated_gems << { outdated_gems << {
:active_spec => active_spec, active_spec: active_spec,
:current_spec => current_spec, current_spec: current_spec,
:dependency => dependency, dependency: dependency,
:groups => groups, groups: groups,
} }
end end
@ -105,7 +105,7 @@ module Bundler
end end
else else
relevant_outdated_gems = if options_include_groups relevant_outdated_gems = if options_include_groups
by_group(outdated_gems, :filter => options[:group]) by_group(outdated_gems, filter: options[:group])
else else
outdated_gems outdated_gems
end end
@ -188,7 +188,7 @@ module Bundler
) )
end 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 Bundler.ui.info data.to_json
end end
@ -233,21 +233,21 @@ module Bundler
def gem_data_for(current_spec, active_spec, dependency, groups) def gem_data_for(current_spec, active_spec, dependency, groups)
{ {
:current_spec => spec_data_for(current_spec), current_spec: spec_data_for(current_spec),
:active_spec => spec_data_for(active_spec), active_spec: spec_data_for(active_spec),
:dependency => dependency&.to_s, dependency: dependency&.to_s,
:groups => (groups || "").split(", "), groups: (groups || "").split(", "),
} }
end end
def spec_data_for(spec) def spec_data_for(spec)
{ {
:name => spec.name, name: spec.name,
:version => spec.version.to_s, version: spec.version.to_s,
:platform => spec.platform, platform: spec.platform,
:source => spec.source.to_s, source: spec.source.to_s,
:required_ruby_version => spec.required_ruby_version.to_s, required_ruby_version: spec.required_ruby_version.to_s,
:required_rubygems_version => spec.required_rubygems_version.to_s, required_rubygems_version: spec.required_rubygems_version.to_s,
} }
end end

View File

@ -7,18 +7,12 @@ module Bundler
long_desc <<-D 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 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 D
method_option "source", :type => :string, :default => nil, :banner => method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
"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 "version", :type => :string, :default => nil, :banner => method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
"The version of the plugin to fetch" method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from"
method_option "git", :type => :string, :default => nil, :banner => method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
"URL of the git repo to fetch from" method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
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) def install(*plugins)
Bundler::Plugin.install(plugins, options) Bundler::Plugin.install(plugins, options)
end end
@ -27,8 +21,7 @@ module Bundler
long_desc <<-D long_desc <<-D
Uninstall given list of plugins. To uninstall all the plugins, use -all option. Uninstall given list of plugins. To uninstall all the plugins, use -all option.
D D
method_option "all", :type => :boolean, :default => nil, :banner => method_option "all", type: :boolean, default: nil, banner: "Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
"Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
def uninstall(*plugins) def uninstall(*plugins)
Bundler::Plugin.uninstall(plugins, options) Bundler::Plugin.uninstall(plugins, options)
end end

View File

@ -35,7 +35,7 @@ module Bundler
if full_update if full_update
if conservative if conservative
Bundler.definition(:conservative => conservative) Bundler.definition(conservative: conservative)
else else
Bundler.definition(true) Bundler.definition(true)
end end
@ -51,9 +51,9 @@ module Bundler
gems.concat(deps.map(&:name)) gems.concat(deps.map(&:name))
end end
Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby], Bundler.definition(gems: gems, sources: sources, ruby: options[:ruby],
:conservative => conservative, conservative: conservative,
:bundler => update_bundler) bundler: update_bundler)
end end
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options) Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@ -71,7 +71,7 @@ module Bundler
if locked_gems = Bundler.definition.locked_gems if locked_gems = Bundler.definition.locked_gems
previous_locked_info = locked_gems.specs.reduce({}) do |h, s| 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 h
end end
end end

View File

@ -528,7 +528,7 @@ module Bundler
@resolution_packages ||= begin @resolution_packages ||= begin
last_resolve = converge_locked_specs last_resolve = converge_locked_specs
remove_invalid_platforms!(current_dependencies) 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) additional_base_requirements_for_resolve(packages, last_resolve)
end end
end end
@ -916,9 +916,9 @@ module Bundler
source_requirements = if precompute_source_requirements_for_indirect_dependencies? source_requirements = if precompute_source_requirements_for_indirect_dependencies?
all_requirements = source_map.all_requirements all_requirements = source_map.all_requirements
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
{ :default => default_source }.merge(all_requirements) { default: default_source }.merge(all_requirements)
else 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 end
source_requirements.merge!(source_map.locked_requirements) unless @remote source_requirements.merge!(source_map.locked_requirements) unless @remote
metadata_dependencies.each do |dep| metadata_dependencies.each do |dep|

View File

@ -11,17 +11,17 @@ module Bundler
ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze
PLATFORM_MAP = { PLATFORM_MAP = {
:ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], ruby: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
:mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS], mri: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
:rbx => [Gem::Platform::RUBY], rbx: [Gem::Platform::RUBY],
:truffleruby => [Gem::Platform::RUBY], truffleruby: [Gem::Platform::RUBY],
:jruby => [Gem::Platform::JAVA, [18, 19]], jruby: [Gem::Platform::JAVA, [18, 19]],
:windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS], windows: [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
# deprecated # deprecated
:mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS], mswin: [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
:mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]], mswin64: [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
:mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS], mingw: [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
:x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]], x64_mingw: [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
}.each_with_object({}) do |(platform, spec), hash| }.each_with_object({}) do |(platform, spec), hash|
hash[platform] = spec[0] hash[platform] = spec[0]
spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] } spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }

View File

@ -76,11 +76,11 @@ module Bundler
@gemspecs << spec @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 group(development_group) do
spec.development_dependencies.each do |dep| 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
end end
when 0 when 0
@ -435,7 +435,7 @@ module Bundler
removed_message = removed_message =
"The source :#{source} is disallowed because HTTP requests are insecure.\n" \ "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." "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" "http://rubygems.org"
when String when String
source source
@ -490,7 +490,7 @@ module Bundler
"Using `source` more than once without a block is a security risk, and " \ "Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this error, use " \ "may result in installing unexpected gems. To resolve this error, use " \
"a block to indicate which gems should come from the secondary source." "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
end end

View File

@ -253,7 +253,7 @@ module Bundler
Bundler.settings[:ssl_client_cert] Bundler.settings[:ssl_client_cert]
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL) 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] if gem_proxy = Gem.configuration[:http_proxy]
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
end end

View File

@ -32,7 +32,7 @@ module Bundler
if Bundler.ui.debug? if Bundler.ui.debug?
Bundler.ui.trace error Bundler.ui.trace error
else else
Bundler.ui.error error.message, :wrap => true Bundler.ui.error error.message, wrap: true
end end
when Thor::Error when Thor::Error
Bundler.ui.error error.message Bundler.ui.error error.message
@ -40,7 +40,7 @@ module Bundler
Bundler.ui.error "\nQuitting..." Bundler.ui.error "\nQuitting..."
Bundler.ui.trace error Bundler.ui.trace error
when Gem::InvalidSpecificationException when Gem::InvalidSpecificationException
Bundler.ui.error error.message, :wrap => true Bundler.ui.error error.message, wrap: true
when SystemExit when SystemExit
when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \ Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \

View File

@ -215,7 +215,7 @@ module Bundler
def sh_with_status(cmd, &block) def sh_with_status(cmd, &block)
Bundler.ui.debug(cmd) Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do SharedHelpers.chdir(base) do
outbuf = IO.popen(cmd, :err => [:child, :out], &:read) outbuf = IO.popen(cmd, err: [:child, :out], &:read)
status = $? status = $?
block&.call(outbuf) if status.success? block&.call(outbuf) if status.success?
[outbuf, status] [outbuf, status]

View File

@ -84,7 +84,7 @@ module Bundler
else else
raise ArgumentError, "2nd argument is invalid" raise ArgumentError, "2nd argument is invalid"
end end
label.nil? ? {} : { :label => label } label.nil? ? {} : { label: label }
end end
def spec_for_dependency(dependency) def spec_for_dependency(dependency)
@ -103,7 +103,7 @@ module Bundler
end end
def g 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[:weight] = 2
g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif" g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif"
g.edge[:fontsize] = 12 g.edge[:fontsize] = 12
@ -114,10 +114,10 @@ module Bundler
@groups.each do |group| @groups.each do |group|
g.add_nodes( g.add_nodes(
group, { group, {
:style => "filled", style: "filled",
:fillcolor => "#B9B9D5", fillcolor: "#B9B9D5",
:shape => "box3d", shape: "box3d",
:fontsize => 16, fontsize: 16,
}.merge(@node_options[group]) }.merge(@node_options[group])
) )
end end
@ -125,8 +125,8 @@ module Bundler
@relations.each do |parent, children| @relations.each do |parent, children|
children.each do |child| children.each do |child|
if @groups.include?(parent) if @groups.include?(parent)
g.add_nodes(child, { :style => "filled", :fillcolor => "#B9B9D5" }.merge(@node_options[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}"])) g.add_edges(parent, child, { constraint: false }.merge(@edge_options["#{parent}_#{child}"]))
else else
g.add_nodes(child, @node_options[child]) g.add_nodes(child, @node_options[child])
g.add_edges(parent, child, @edge_options["#{parent}_#{child}"]) g.add_edges(parent, child, @edge_options["#{parent}_#{child}"])
@ -135,7 +135,7 @@ module Bundler
end end
if @output_format.to_s == "debug" if @output_format.to_s == "debug"
$stdout.puts g.output :none => String $stdout.puts g.output none: String
Bundler.ui.info "debugging bundle viz..." Bundler.ui.info "debugging bundle viz..."
else else
begin begin

View File

@ -29,7 +29,7 @@ module Bundler
end end
# temporarily unfreeze # temporarily unfreeze
Bundler.settings.temporary(:deployment => false, :frozen => false) do Bundler.settings.temporary(deployment: false, frozen: false) do
# evaluate the Gemfile we have now # evaluate the Gemfile we have now
builder = Dsl.new builder = Dsl.new
builder.eval_gemfile(gemfile_path) builder.eval_gemfile(gemfile_path)

View File

@ -48,14 +48,14 @@ def gemfile(install = false, options = {}, &gemfile)
builder.instance_eval(&gemfile) builder.instance_eval(&gemfile)
builder.check_primary_source_safety 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) definition = builder.to_definition(nil, true)
def definition.lock(*); end def definition.lock(*); end
definition.validate_runtime! definition.validate_runtime!
if install || definition.missing_specs? if install || definition.missing_specs?
Bundler.settings.temporary(:inline => true, :no_install => false) do Bundler.settings.temporary(inline: true, no_install: false) do
installer = Bundler::Installer.install(Bundler.root, definition, :system => true) installer = Bundler::Installer.install(Bundler.root, definition, system: true)
installer.post_install_messages.each do |name, message| installer.post_install_messages.each do |name, message|
Bundler.ui.info "Post-install message from #{name}:\n#{message}" Bundler.ui.info "Post-install message from #{name}:\n#{message}"
end end

View File

@ -136,12 +136,12 @@ module Bundler
mode = Gem.win_platform? ? "wb:UTF-8" : "w" mode = Gem.win_platform? ? "wb:UTF-8" : "w"
require "erb" 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] if Gem.win_platform? || options[:all_platforms]
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" 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
end end
@ -179,12 +179,12 @@ module Bundler
mode = Gem.win_platform? ? "wb:UTF-8" : "w" mode = Gem.win_platform? ? "wb:UTF-8" : "w"
require "erb" 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] if Gem.win_platform? || options[:all_platforms]
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" 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 end
end end

View File

@ -53,10 +53,10 @@ module Bundler
def install def install
spec.source.install( spec.source.install(
spec, spec,
:force => force, force: force,
:ensure_builtin_gems_cached => standalone, ensure_builtin_gems_cached: standalone,
:build_args => Array(spec_settings), build_args: Array(spec_settings),
:previous_spec => previous_spec, previous_spec: previous_spec,
) )
end end
@ -77,7 +77,7 @@ module Bundler
if Bundler.settings[:bin] && standalone if Bundler.settings[:bin] && standalone
installer.generate_standalone_bundler_executable_stubs(spec) installer.generate_standalone_bundler_executable_stubs(spec)
elsif Bundler.settings[:bin] elsif Bundler.settings[:bin]
installer.generate_bundler_executable_stubs(spec, :force => true) installer.generate_bundler_executable_stubs(spec, force: true)
end end
end end
end end

View File

@ -56,7 +56,7 @@ module Bundler
if spec.source.instance_of?(Source::Path) && spec.source.path.absolute? if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
full_path full_path
else 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 end
rescue TypeError rescue TypeError
error_message = "#{spec.name} #{spec.version} has an invalid gemspec" error_message = "#{spec.name} #{spec.version} has an invalid gemspec"

View File

@ -102,7 +102,7 @@ module Bundler
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform) 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? return specification unless specification.nil?
if target_platform != platform if target_platform != platform

View File

@ -101,7 +101,7 @@ module Bundler
# @param [Pathname] gemfile path # @param [Pathname] gemfile path
# @param [Proc] block that can be evaluated for (inline) Gemfile # @param [Proc] block that can be evaluated for (inline) Gemfile
def gemfile_install(gemfile = nil, &inline) 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 builder = DSL.new
if block_given? if block_given?
builder.instance_eval(&inline) builder.instance_eval(&inline)

View File

@ -96,7 +96,7 @@ module Bundler
# #
# Note: Do not override if you don't know what you are doing. # Note: Do not override if you don't know what you are doing.
def post_install(spec, disable_exts = false) 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 = Bundler::Source::Path::Installer.new(spec, opts)
installer.post_install installer.post_install
end end

View File

@ -83,7 +83,7 @@ module Bundler
Bundler.configure_gem_home_and_path(Plugin.root) 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) definition = Definition.new(nil, deps, source_list, true)
install_definition(definition) install_definition(definition)

View File

@ -29,7 +29,7 @@ module Bundler
Bundler.ui.info "Resolving dependencies...", true Bundler.ui.info "Resolving dependencies...", true
solve_versions(:root => root, :logger => logger) solve_versions(root: root, logger: logger)
end end
def setup_solver def setup_solver
@ -77,7 +77,7 @@ module Bundler
end end
def solve_versions(root:, logger:) 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 = solver.solve
result.map {|package, version| version.to_specs(package) }.flatten.uniq result.map {|package, version| version.to_specs(package) }.flatten.uniq
rescue PubGrub::SolveFailure => e rescue PubGrub::SolveFailure => e
@ -152,7 +152,7 @@ module Bundler
requirement_to_range(dependency) requirement_to_range(dependency)
end end
PubGrub::VersionConstraint.new(package, :range => range) PubGrub::VersionConstraint.new(package, range: range)
end end
def versions_for(package, range=VersionRange.any) 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? extended_explanation = other_specs_matching_message(specs_matching_other_platforms, label) if specs_matching_other_platforms.any?
end 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 end
def debug? def debug?
@ -220,9 +220,9 @@ module Bundler
sorted_versions[high] sorted_versions[high]
end 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) dep_term = PubGrub::Term.new(dep_constraint, false)
self_term = PubGrub::Term.new(self_constraint, true) self_term = PubGrub::Term.new(self_constraint, true)
@ -231,7 +231,7 @@ module Bundler
"current #{dep_package} version is #{dep_constraint.constraint_string}" "current #{dep_package} version is #{dep_constraint.constraint_string}"
end 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
end end
@ -266,11 +266,11 @@ module Bundler
platform_specs.flatten! platform_specs.flatten!
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY) 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? 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 groups
end end
@ -408,19 +408,19 @@ module Bundler
when "~>" when "~>"
name = "~> #{ver}" name = "~> #{ver}"
bump = Resolver::Candidate.new(version.bump.to_s + ".A") 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 ">" when ">"
PubGrub::VersionRange.new(:min => platform_ver) PubGrub::VersionRange.new(min: platform_ver)
when ">=" when ">="
PubGrub::VersionRange.new(:min => ver, :include_min => true) PubGrub::VersionRange.new(min: ver, include_min: true)
when "<" when "<"
PubGrub::VersionRange.new(:max => ver) PubGrub::VersionRange.new(max: ver)
when "<=" when "<="
PubGrub::VersionRange.new(:max => platform_ver, :include_max => true) PubGrub::VersionRange.new(max: platform_ver, include_max: true)
when "=" 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 "!=" 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 else
raise "bad version specifier: #{op}" raise "bad version specifier: #{op}"
end end

View File

@ -24,7 +24,7 @@ module Bundler
name = dep.name 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 dep
end.compact end.compact

View File

@ -8,7 +8,7 @@ module Bundler
def initialize(terms, cause:, custom_explanation: nil, extended_explanation: nil) def initialize(terms, cause:, custom_explanation: nil, extended_explanation: nil)
@extended_explanation = extended_explanation @extended_explanation = extended_explanation
super(terms, :cause => cause, :custom_explanation => custom_explanation) super(terms, cause: cause, custom_explanation: custom_explanation)
end end
end end
end end

View File

@ -376,7 +376,7 @@ module Gem
remove_method :glob_files_in_dir remove_method :glob_files_in_dir
def glob_files_in_dir(glob, base_path) 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 end
end end

View File

@ -20,7 +20,7 @@ module Bundler
strict_rm_rf spec.extension_dir strict_rm_rf spec.extension_dir
SharedHelpers.filesystem_access(gem_dir, :create) do SharedHelpers.filesystem_access(gem_dir, :create) do
FileUtils.mkdir_p gem_dir, :mode => 0o755 FileUtils.mkdir_p gem_dir, mode: 0o755
end end
extract_files extract_files

View File

@ -32,7 +32,7 @@ module Bundler
setup_manpath setup_manpath
lock(:preserve_unknown_sections => true) lock(preserve_unknown_sections: true)
self self
end end

View File

@ -335,11 +335,11 @@ module Bundler
def configs def configs
@configs ||= { @configs ||= {
:temporary => @temporary, temporary: @temporary,
:local => @local_config, local: @local_config,
:env => @env_config, env: @env_config,
:global => @global_config, global: @global_config,
:default => DEFAULT_CONFIG, default: DEFAULT_CONFIG,
} }
end end

View File

@ -203,7 +203,7 @@ module Bundler
SharedHelpers.filesystem_access(path, :read) do SharedHelpers.filesystem_access(path, :read) do
File.open(path, "rb") do |f| File.open(path, "rb") do |f|
digest = SharedHelpers.digest(digest).new 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 << buf while f.read(16_384, buf)
digest.hexdigest digest.hexdigest
end end

View File

@ -20,7 +20,7 @@ module Bundler
# Stringify options that could be set as symbols # Stringify options that could be set as symbols
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] } %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
@uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false) @uri = URINormalizer.normalize_suffix(options["uri"] || "", trailing_slash: false)
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri) @safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
@branch = options["branch"] @branch = options["branch"]
@ref = options["ref"] || options["branch"] || options["tag"] @ref = options["ref"] || options["branch"] || options["tag"]
@ -198,7 +198,7 @@ module Bundler
@copied = true @copied = true
end 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) generate_bin(spec, generate_bin_options)
requires_checkout? ? spec.post_install_message : nil requires_checkout? ? spec.post_install_message : nil

View File

@ -80,13 +80,13 @@ module Bundler
def current_branch def current_branch
@current_branch ||= with_path do @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
end end
def contains?(commit) def contains?(commit)
allowed_with_path do 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 =~ /^\* (.*)$/ status.success? && result =~ /^\* (.*)$/
end end
end end
@ -132,18 +132,18 @@ module Bundler
ref = @commit_ref || (locked_to_full_sha? && @revision) ref = @commit_ref || (locked_to_full_sha? && @revision)
if ref 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 end
git "reset", "--hard", @revision, :dir => destination git "reset", "--hard", @revision, dir: destination
if submodules 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") elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
inner_command = "git -C $toplevel submodule deinit --force $sm_path" 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
end end
@ -266,32 +266,32 @@ module Bundler
def git_null(*command, dir: nil) def git_null(*command, dir: nil)
check_allowed(command) check_allowed(command)
capture(command, dir, :ignore_err => true) capture(command, dir, ignore_err: true)
end end
def git_retry(*command, dir: nil) def git_retry(*command, dir: nil)
command_with_no_credentials = check_allowed(command) command_with_no_credentials = check_allowed(command)
Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do
git(*command, :dir => dir) git(*command, dir: dir)
end end
end end
def git(*command, dir: nil) 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) check_allowed(unredacted_command)
end end
end end
def git_local(*command, dir: nil) 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) redact_and_check_presence(unredacted_command)
end end
end end
def has_revision_cached? def has_revision_cached?
return unless @revision && path.exist? return unless @revision && path.exist?
git("cat-file", "-e", @revision, :dir => path) git("cat-file", "-e", @revision, dir: path)
true true
rescue GitError rescue GitError
false false
@ -314,7 +314,7 @@ module Bundler
end end
def verify(reference) def verify(reference)
git("rev-parse", "--verify", reference, :dir => path).strip git("rev-parse", "--verify", reference, dir: path).strip
end end
# Adds credentials to the URI # Adds credentials to the URI
@ -398,7 +398,7 @@ module Bundler
if Bundler.feature_flag.bundler_3_mode? || supports_minus_c? if Bundler.feature_flag.bundler_3_mode? || supports_minus_c?
["git", "-C", dir.to_s, *cmd] ["git", "-C", dir.to_s, *cmd]
else else
["git", *cmd, { :chdir => dir.to_s }] ["git", *cmd, { chdir: dir.to_s }]
end end
end end

View File

@ -86,7 +86,7 @@ module Bundler
using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}" using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
using_message += " and installing its executables" unless spec.executables.empty? using_message += " and installing its executables" unless spec.executables.empty?
print_using_message using_message print_using_message using_message
generate_bin(spec, :disable_extensions => true) generate_bin(spec, disable_extensions: true)
nil # no post-install message nil # no post-install message
end end
@ -237,10 +237,10 @@ module Bundler
installer = Path::Installer.new( installer = Path::Installer.new(
spec, spec,
:env_shebang => false, env_shebang: false,
:disable_extensions => options[:disable_extensions], disable_extensions: options[:disable_extensions],
:build_args => options[:build_args], build_args: options[:build_args],
:bundler_extension_cache_path => extension_cache_path(spec) bundler_extension_cache_path: extension_cache_path(spec)
) )
installer.post_install installer.post_install
rescue Gem::InvalidSpecificationException => e rescue Gem::InvalidSpecificationException => e

View File

@ -171,14 +171,14 @@ module Bundler
installer = Bundler::RubyGemsGemInstaller.at( installer = Bundler::RubyGemsGemInstaller.at(
path, path,
:security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]], security_policy: Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
:install_dir => install_path.to_s, install_dir: install_path.to_s,
:bin_dir => bin_path.to_s, bin_dir: bin_path.to_s,
:ignore_dependencies => true, ignore_dependencies: true,
:wrappers => true, wrappers: true,
:env_shebang => true, env_shebang: true,
:build_args => options[:build_args], build_args: options[:build_args],
:bundler_extension_cache_path => extension_cache_path(spec) bundler_extension_cache_path: extension_cache_path(spec)
) )
if spec.remote if spec.remote

View File

@ -13,5 +13,5 @@ require_relative "deployment"
include Rake::DSL if defined? Rake::DSL include Rake::DSL if defined? Rake::DSL
namespace :vlad do namespace :vlad do
Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app) Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, roles: :app)
end end

View File

@ -6,7 +6,7 @@ require_relative "../security"
class Gem::Commands::CertCommand < Gem::Command class Gem::Commands::CertCommand < Gem::Command
def initialize def initialize
super "cert", "Manage RubyGems certificates and signing settings", super "cert", "Manage RubyGems certificates and signing settings",
:add => [], :remove => [], :list => [], :build => [], :sign => [] add: [], remove: [], list: [], build: [], sign: []
add_option("-a", "--add CERT", add_option("-a", "--add CERT",
"Add a trusted certificate.") do |cert_file, options| "Add a trusted certificate.") do |cert_file, options|

View File

@ -10,7 +10,7 @@ class Gem::Commands::CheckCommand < Gem::Command
def initialize def initialize
super "check", "Check a gem repository for added or missing files", 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", add_option("-a", "--[no-]alien",
'Report "unmanaged" or rogue files in the', 'Report "unmanaged" or rogue files in the',

View File

@ -8,8 +8,8 @@ class Gem::Commands::CleanupCommand < Gem::Command
def initialize def initialize
super "cleanup", super "cleanup",
"Clean up old versions of installed gems", "Clean up old versions of installed gems",
:force => false, :install_dir => Gem.dir, force: false, install_dir: Gem.dir,
:check_dev => true check_dev: true
add_option("-n", "-d", "--dry-run", add_option("-n", "-d", "--dry-run",
"Do not uninstall gems") do |_value, options| "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}" say "Attempting to uninstall #{spec.full_name}"
uninstall_options = { uninstall_options = {
:executables => false, executables: false,
:version => "= #{spec.version}", version: "= #{spec.version}",
} }
uninstall_options[:user_install] = Gem.user_dir == spec.base_dir uninstall_options[:user_install] = Gem.user_dir == spec.base_dir

View File

@ -8,8 +8,8 @@ class Gem::Commands::ContentsCommand < Gem::Command
def initialize def initialize
super "contents", "Display the contents of the installed gems", super "contents", "Display the contents of the installed gems",
:specdirs => [], :lib_only => false, :prefix => true, specdirs: [], lib_only: false, prefix: true,
:show_install_dir => false show_install_dir: false
add_version_option add_version_option

View File

@ -11,7 +11,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
def initialize def initialize
super "dependency", super "dependency",
"Show the dependencies of an installed gem", "Show the dependencies of an installed gem",
:version => Gem::Requirement.default, :domain => :local version: Gem::Requirement.default, domain: :local
add_version_option add_version_option
add_platform_option add_platform_option

View File

@ -10,8 +10,8 @@ class Gem::Commands::FetchCommand < Gem::Command
def initialize def initialize
defaults = { defaults = {
:suggest_alternate => true, suggest_alternate: true,
:version => Gem::Requirement.default, version: Gem::Requirement.default,
} }
super "fetch", "Download a gem and place it in the current directory", defaults super "fetch", "Download a gem and place it in the current directory", defaults

View File

@ -12,7 +12,7 @@ class Gem::Commands::GenerateIndexCommand < Gem::Command
def initialize def initialize
super "generate_index", super "generate_index",
"Generates the index files for a gem server directory", "Generates the index files for a gem server directory",
:directory => ".", :build_modern => true directory: ".", build_modern: true
add_option "-d", "--directory=DIRNAME", add_option "-d", "--directory=DIRNAME",
"repository base dir containing gems subdir" do |dir, options| "repository base dir containing gems subdir" do |dir, options|

View File

@ -8,8 +8,8 @@ class Gem::Commands::InfoCommand < Gem::Command
def initialize def initialize
super "info", "Show information for the given gem", super "info", "Show information for the given gem",
:name => //, :domain => :local, :details => false, :versions => true, name: //, domain: :local, details: false, versions: true,
:installed => nil, :version => Gem::Requirement.default installed: nil, version: Gem::Requirement.default
add_query_options add_query_options

View File

@ -23,11 +23,11 @@ class Gem::Commands::InstallCommand < Gem::Command
def initialize def initialize
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({ defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
:format_executable => false, format_executable: false,
:lock => true, lock: true,
:suggest_alternate => true, suggest_alternate: true,
:version => Gem::Requirement.default, version: Gem::Requirement.default,
:without_groups => [], without_groups: [],
}) })
defaults.merge!(install_update_options) defaults.merge!(install_update_options)

View File

@ -11,8 +11,8 @@ class Gem::Commands::ListCommand < Gem::Command
def initialize def initialize
super "list", "Display local gems whose name matches REGEXP", super "list", "Display local gems whose name matches REGEXP",
:domain => :local, :details => false, :versions => true, domain: :local, details: false, versions: true,
:installed => nil, :version => Gem::Requirement.default installed: nil, version: Gem::Requirement.default
add_query_options add_query_options
end end

View File

@ -5,7 +5,7 @@ require_relative "../command"
class Gem::Commands::LockCommand < Gem::Command class Gem::Commands::LockCommand < Gem::Command
def initialize def initialize
super "lock", "Generate a lockdown list of gems", super "lock", "Generate a lockdown list of gems",
:strict => false strict: false
add_option "-s", "--[no-]strict", add_option "-s", "--[no-]strict",
"fail if unable to satisfy a dependency" do |strict, options| "fail if unable to satisfy a dependency" do |strict, options|

View File

@ -70,7 +70,7 @@ class Gem::Commands::OpenCommand < Gem::Command
end end
def open_editor(path) def open_editor(path)
system(*@editor.split(/\s+/) + [path], { :chdir => path }) system(*@editor.split(/\s+/) + [path], { chdir: path })
end end
def spec_for(name) def spec_for(name)

View File

@ -39,7 +39,7 @@ permission to.
add_proxy_option add_proxy_option
add_key_option add_key_option
add_otp_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| add_option "-a", "--add NEW_OWNER", "Add an owner by user identifier" do |value, options|
options[:add] << value options[:add] << value

View File

@ -11,10 +11,10 @@ class Gem::Commands::PristineCommand < Gem::Command
def initialize def initialize
super "pristine", super "pristine",
"Restores installed gems to pristine condition from files located in the gem cache", "Restores installed gems to pristine condition from files located in the gem cache",
:version => Gem::Requirement.default, version: Gem::Requirement.default,
:extensions => true, extensions: true,
:extensions_set => false, extensions_set: false,
:all => false all: false
add_option("--all", add_option("--all",
"Restore all installed gems to pristine", "Restore all installed gems to pristine",
@ -179,12 +179,12 @@ extensions will be restored.
install_dir = options[:install_dir] if options[:install_dir] install_dir = options[:install_dir] if options[:install_dir]
installer_options = { installer_options = {
:wrappers => true, wrappers: true,
:force => true, force: true,
:install_dir => install_dir || spec.base_dir, install_dir: install_dir || spec.base_dir,
:env_shebang => env_shebang, env_shebang: env_shebang,
:build_args => spec.build_args, build_args: spec.build_args,
:bin_dir => bin_dir, bin_dir: bin_dir,
} }
if options[:only_executables] if options[:only_executables]

View File

@ -30,7 +30,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
end end
def initialize 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 @user_defined_host = false

View File

@ -20,8 +20,8 @@ class Gem::Commands::QueryCommand < Gem::Command
def initialize(name = "query", summary = "Query gem information in local or remote repositories") def initialize(name = "query", summary = "Query gem information in local or remote repositories")
super name, summary, super name, summary,
:domain => :local, :details => false, :versions => true, domain: :local, details: false, versions: true,
:installed => nil, :version => Gem::Requirement.default installed: nil, version: Gem::Requirement.default
add_option("-n", "--name-matches REGEXP", add_option("-n", "--name-matches REGEXP",
"Name of gem(s) to query on matches the", "Name of gem(s) to query on matches the",

View File

@ -10,8 +10,8 @@ class Gem::Commands::RdocCommand < Gem::Command
def initialize def initialize
super "rdoc", "Generates RDoc for pre-installed gems", super "rdoc", "Generates RDoc for pre-installed gems",
:version => Gem::Requirement.default, version: Gem::Requirement.default,
:include_rdoc => false, :include_ri => true, :overwrite => false include_rdoc: false, include_ri: true, overwrite: false
add_option("--all", add_option("--all",
"Generate RDoc/RI documentation for all", "Generate RDoc/RI documentation for all",

View File

@ -8,8 +8,8 @@ class Gem::Commands::SearchCommand < Gem::Command
def initialize def initialize
super "search", "Display remote gems whose name matches REGEXP", super "search", "Display remote gems whose name matches REGEXP",
:domain => :remote, :details => false, :versions => true, domain: :remote, details: false, versions: true,
:installed => nil, :version => Gem::Requirement.default installed: nil, version: Gem::Requirement.default
add_query_options add_query_options
end end

View File

@ -14,12 +14,12 @@ class Gem::Commands::SetupCommand < Gem::Command
def initialize def initialize
super "setup", "Install RubyGems", super "setup", "Install RubyGems",
:format_executable => false, :document => %w[ri], format_executable: false, document: %w[ri],
:force => true, force: true,
:site_or_vendor => "sitelibdir", site_or_vendor: "sitelibdir",
:destdir => "", :prefix => "", :previous_version => "", destdir: "", prefix: "", previous_version: "",
:regenerate_binstubs => true, regenerate_binstubs: true,
:regenerate_plugins => true regenerate_plugins: true
add_option "--previous-version=VERSION", add_option "--previous-version=VERSION",
"Previous version of RubyGems", "Previous version of RubyGems",
@ -265,7 +265,7 @@ By default, this RubyGems will install gem as:
fp.puts bin.join fp.puts bin.join
end end
install bin_tmp_file, dest_file, :mode => prog_mode install bin_tmp_file, dest_file, mode: prog_mode
bin_file_names << dest_file bin_file_names << dest_file
ensure ensure
rm bin_tmp_file rm bin_tmp_file
@ -287,7 +287,7 @@ By default, this RubyGems will install gem as:
TEXT TEXT
end end
install bin_cmd_file, "#{dest_file}.bat", :mode => prog_mode install bin_cmd_file, "#{dest_file}.bat", mode: prog_mode
ensure ensure
rm bin_cmd_file rm bin_cmd_file
end end
@ -369,7 +369,7 @@ By default, this RubyGems will install gem as:
File.dirname(loaded_from) File.dirname(loaded_from)
else else
target_specs_dir = File.join(default_dir, "specifications", "default") 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 target_specs_dir
end end
@ -393,7 +393,7 @@ By default, this RubyGems will install gem as:
end end
bundler_bin_dir = bundler_spec.bin_dir 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| bundler_spec.executables.each do |e|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e) cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end end
@ -430,8 +430,8 @@ By default, this RubyGems will install gem as:
lib_dir, bin_dir = generate_default_dirs lib_dir, bin_dir = generate_default_dirs
end end
mkdir_p lib_dir, :mode => 0o755 mkdir_p lib_dir, mode: 0o755
mkdir_p bin_dir, :mode => 0o755 mkdir_p bin_dir, mode: 0o755
[lib_dir, bin_dir] [lib_dir, bin_dir]
end end
@ -576,8 +576,8 @@ abort "#{deprecation_message}"
def uninstall_old_gemcutter def uninstall_old_gemcutter
require_relative "../uninstaller" require_relative "../uninstaller"
ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true, ui = Gem::Uninstaller.new("gemcutter", all: true, ignore: true,
:version => "< 0.4") version: "< 0.4")
ui.uninstall ui.uninstall
rescue Gem::InstallError rescue Gem::InstallError
end end
@ -639,10 +639,10 @@ abort "#{deprecation_message}"
dest_file = File.join dest_dir, file dest_file = File.join dest_dir, file
dest_dir = File.dirname dest_file dest_dir = File.dirname dest_file
unless File.directory? dest_dir unless File.directory? dest_dir
mkdir_p dest_dir, :mode => 0o755 mkdir_p dest_dir, mode: 0o755
end end
install file, dest_file, :mode => options[:data_mode] || 0o644 install file, dest_file, mode: options[:data_mode] || 0o644
end end
def remove_file_list(files, dir) def remove_file_list(files, dir)

View File

@ -13,8 +13,8 @@ class Gem::Commands::SpecificationCommand < Gem::Command
Gem.load_yaml Gem.load_yaml
super "specification", "Display gem specification (in yaml)", super "specification", "Display gem specification (in yaml)",
:domain => :local, :version => Gem::Requirement.default, domain: :local, version: Gem::Requirement.default,
:format => :yaml format: :yaml
add_version_option("examine") add_version_option("examine")
add_platform_option add_platform_option

View File

@ -15,8 +15,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
def initialize def initialize
super "uninstall", "Uninstall gems from the local repository", super "uninstall", "Uninstall gems from the local repository",
:version => Gem::Requirement.default, :user_install => true, version: Gem::Requirement.default, user_install: true,
:check_dev => false, :vendor => false check_dev: false, vendor: false
add_option("-a", "--[no-]all", add_option("-a", "--[no-]all",
"Uninstall all matching versions") do |value, options| "Uninstall all matching versions") do |value, options|

View File

@ -21,8 +21,8 @@ class Gem::Commands::UnpackCommand < Gem::Command
require "fileutils" require "fileutils"
super "unpack", "Unpack an installed gem to the current directory", super "unpack", "Unpack an installed gem to the current directory",
:version => Gem::Requirement.default, version: Gem::Requirement.default,
:target => Dir.pwd target: Dir.pwd
add_option("--target=DIR", add_option("--target=DIR",
"target directory for unpacking") do |value, options| "target directory for unpacking") do |value, options|

View File

@ -21,7 +21,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
def initialize def initialize
options = { options = {
:force => false, force: false,
} }
options.merge!(install_update_options) options.merge!(install_update_options)

View File

@ -5,7 +5,7 @@ require_relative "../command"
class Gem::Commands::WhichCommand < Gem::Command class Gem::Commands::WhichCommand < Gem::Command
def initialize def initialize
super "which", "Find the location of a library file you can require", 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| add_option "-a", "--[no-]all", "show all matching files" do |show_all, options|
options[:show_all] = show_all options[:show_all] = show_all

View File

@ -17,18 +17,18 @@ class Gem::DependencyInstaller
extend Gem::Deprecate extend Gem::Deprecate
DEFAULT_OPTIONS = { # :nodoc: DEFAULT_OPTIONS = { # :nodoc:
:env_shebang => false, env_shebang: false,
:document => %w[ri], document: %w[ri],
:domain => :both, # HACK: dup domain: :both, # HACK: dup
:force => false, force: false,
:format_executable => false, # HACK: dup format_executable: false, # HACK: dup
:ignore_dependencies => false, ignore_dependencies: false,
:prerelease => false, prerelease: false,
:security_policy => nil, # HACK: NoSecurity requires OpenSSL. AlmostNo? Low? security_policy: nil, # HACK: NoSecurity requires OpenSSL. AlmostNo? Low?
:wrappers => true, wrappers: true,
:build_args => nil, build_args: nil,
:build_docs_in_background => false, build_docs_in_background: false,
:install_as_default => false, install_as_default: false,
}.freeze }.freeze
## ##
@ -228,22 +228,22 @@ class Gem::DependencyInstaller
@installed_gems = [] @installed_gems = []
options = { options = {
:bin_dir => @bin_dir, bin_dir: @bin_dir,
:build_args => @build_args, build_args: @build_args,
:document => @document, document: @document,
:env_shebang => @env_shebang, env_shebang: @env_shebang,
:force => @force, force: @force,
:format_executable => @format_executable, format_executable: @format_executable,
:ignore_dependencies => @ignore_dependencies, ignore_dependencies: @ignore_dependencies,
:prerelease => @prerelease, prerelease: @prerelease,
:security_policy => @security_policy, security_policy: @security_policy,
:user_install => @user_install, user_install: @user_install,
:wrappers => @wrappers, wrappers: @wrappers,
:build_root => @build_root, build_root: @build_root,
:install_as_default => @install_as_default, install_as_default: @install_as_default,
:dir_mode => @dir_mode, dir_mode: @dir_mode,
:data_mode => @data_mode, data_mode: @data_mode,
:prog_mode => @prog_mode, prog_mode: @prog_mode,
} }
options[:install_dir] = @install_dir if @only_install_dir options[:install_dir] = @install_dir if @only_install_dir

View File

@ -88,7 +88,7 @@ class Gem::Ext::Builder
# Set $SOURCE_DATE_EPOCH for the subprocess. # Set $SOURCE_DATE_EPOCH for the subprocess.
build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env) build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env)
output, status = begin output, status = begin
Open3.capture2e(build_env, *command, :chdir => dir) Open3.capture2e(build_env, *command, chdir: dir)
rescue StandardError => error rescue StandardError => error
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}" raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
end end

View File

@ -198,7 +198,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
output, status = output, status =
begin 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 rescue StandardError => error
raise Gem::InstallError, "cargo metadata failed #{error.message}" raise Gem::InstallError, "cargo metadata failed #{error.message}"
end end

View File

@ -48,7 +48,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
FileUtils.mkdir_p lib_dir FileUtils.mkdir_p lib_dir
entries = Dir.entries(full_tmp_dest) - %w[. ..] entries = Dir.entries(full_tmp_dest) - %w[. ..]
entries = entries.map {|entry| File.join full_tmp_dest, entry } 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 end
FileUtils::Entry_.new(full_tmp_dest).traverse do |ent| FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|

View File

@ -136,7 +136,7 @@ module Gem::GemcutterUtilities
sign_in_host, scope: scope) do |request| sign_in_host, scope: scope) do |request|
request.basic_auth email, password request.basic_auth email, password
request["OTP"] = otp if otp 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 end
with_response response do |_resp| with_response response do |_resp|

View File

@ -48,7 +48,7 @@ class Gem::Indexer
require "tmpdir" require "tmpdir"
require "zlib" require "zlib"
options = { :build_modern => true }.merge options options = { build_modern: true }.merge options
@build_modern = options[:build_modern] @build_modern = options[:build_modern]
@ -302,10 +302,10 @@ class Gem::Indexer
dst_name = File.join(@dest_directory, @quick_marshal_dir_base) dst_name = File.join(@dest_directory, @quick_marshal_dir_base)
FileUtils.mkdir_p File.dirname(dst_name), :verbose => verbose FileUtils.mkdir_p File.dirname(dst_name), verbose: verbose
FileUtils.rm_rf dst_name, :verbose => verbose FileUtils.rm_rf dst_name, verbose: verbose
FileUtils.mv(@quick_marshal_dir, dst_name, FileUtils.mv(@quick_marshal_dir, dst_name,
:verbose => verbose, :force => true) verbose: verbose, force: true)
end end
files = files.map do |path| files = files.map do |path|
@ -316,9 +316,9 @@ class Gem::Indexer
src_name = File.join @directory, file src_name = File.join @directory, file
dst_name = File.join @dest_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, FileUtils.mv(src_name, @dest_directory,
:verbose => verbose, :force => true) verbose: verbose, force: true)
end end
end end
@ -327,7 +327,7 @@ class Gem::Indexer
def make_temp_directories def make_temp_directories
FileUtils.rm_rf @directory FileUtils.rm_rf @directory
FileUtils.mkdir_p @directory, :mode => 0o700 FileUtils.mkdir_p @directory, mode: 0o700
FileUtils.mkdir_p @quick_marshal_dir FileUtils.mkdir_p @quick_marshal_dir
end end
@ -397,8 +397,8 @@ class Gem::Indexer
src_name = File.join @directory, file src_name = File.join @directory, file
dst_name = File.join @dest_directory, file # REFACTOR: duped above dst_name = File.join @dest_directory, file # REFACTOR: duped above
FileUtils.mv src_name, dst_name, :verbose => verbose, FileUtils.mv src_name, dst_name, verbose: verbose,
:force => true force: true
File.utime newest_mtime, newest_mtime, dst_name File.utime newest_mtime, newest_mtime, dst_name
end end

View File

@ -186,7 +186,7 @@ module Gem::InstallUpdateOptions
def install_update_options def install_update_options
{ {
:document => %w[ri], document: %w[ri],
} }
end end

View File

@ -319,7 +319,7 @@ class Gem::Installer
FileUtils.rm_rf spec.extension_dir FileUtils.rm_rf spec.extension_dir
dir_mode = options[:dir_mode] 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] if @options[:install_as_default]
extract_bin extract_bin
@ -569,7 +569,7 @@ class Gem::Installer
File.unlink dst File.unlink dst
end end
FileUtils.symlink src, dst, :verbose => Gem.configuration.really_verbose FileUtils.symlink src, dst, verbose: Gem.configuration.really_verbose
rescue NotImplementedError, SystemCallError rescue NotImplementedError, SystemCallError
alert_warning "Unable to use symlinks, installing wrapper" alert_warning "Unable to use symlinks, installing wrapper"
generate_bin_script filename, bindir generate_bin_script filename, bindir
@ -654,11 +654,11 @@ class Gem::Installer
def process_options # :nodoc: def process_options # :nodoc:
@options = { @options = {
:bin_dir => nil, bin_dir: nil,
:env_shebang => false, env_shebang: false,
:force => false, force: false,
:only_install_dir => false, only_install_dir: false,
:post_install_message => true, post_install_message: true,
}.merge options }.merge options
@env_shebang = options[:env_shebang] @env_shebang = options[:env_shebang]
@ -727,7 +727,7 @@ class Gem::Installer
end end
def verify_gem_home # :nodoc: 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 end
def verify_spec def verify_spec
@ -948,7 +948,7 @@ TEXT
build_info_dir = File.join gem_home, "build_info" build_info_dir = File.join gem_home, "build_info"
dir_mode = options[:dir_mode] 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" build_info_file = File.join build_info_dir, "#{spec.full_name}.info"

View File

@ -384,7 +384,7 @@ EOM
def extract_files(destination_dir, pattern = "*") def extract_files(destination_dir, pattern = "*")
verify unless @spec 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| @gem.with_read_io do |io|
reader = Gem::Package::TarReader.new io reader = Gem::Package::TarReader.new io

View File

@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
FileUtils.rm_rf destination 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| File.open destination, "wb", file_mode(entry["mode"]) do |out|
out.write file_data out.write file_data

View File

@ -106,24 +106,24 @@ class Gem::Package::TarHeader
fields = header.unpack UNPACK_FORMAT fields = header.unpack UNPACK_FORMAT
new :name => fields.shift, new name: fields.shift,
:mode => strict_oct(fields.shift), mode: strict_oct(fields.shift),
:uid => oct_or_256based(fields.shift), uid: oct_or_256based(fields.shift),
:gid => oct_or_256based(fields.shift), gid: oct_or_256based(fields.shift),
:size => strict_oct(fields.shift), size: strict_oct(fields.shift),
:mtime => strict_oct(fields.shift), mtime: strict_oct(fields.shift),
:checksum => strict_oct(fields.shift), checksum: strict_oct(fields.shift),
:typeflag => fields.shift, typeflag: fields.shift,
:linkname => fields.shift, linkname: fields.shift,
:magic => fields.shift, magic: fields.shift,
:version => strict_oct(fields.shift), version: strict_oct(fields.shift),
:uname => fields.shift, uname: fields.shift,
:gname => fields.shift, gname: fields.shift,
:devmajor => strict_oct(fields.shift), devmajor: strict_oct(fields.shift),
:devminor => strict_oct(fields.shift), devminor: strict_oct(fields.shift),
:prefix => fields.shift, prefix: fields.shift,
:empty => empty empty: empty
end end
def self.strict_oct(str) def self.strict_oct(str)

View File

@ -116,9 +116,9 @@ class Gem::Package::TarWriter
final_pos = @io.pos final_pos = @io.pos
@io.pos = init_pos @io.pos = init_pos
header = Gem::Package::TarHeader.new :name => name, :mode => mode, header = Gem::Package::TarHeader.new name: name, mode: mode,
:size => size, :prefix => prefix, size: size, prefix: prefix,
:mtime => Gem.source_date_epoch mtime: Gem.source_date_epoch
@io.write header @io.write header
@io.pos = final_pos @io.pos = final_pos
@ -209,9 +209,9 @@ class Gem::Package::TarWriter
name, prefix = split_name name name, prefix = split_name name
header = Gem::Package::TarHeader.new(:name => name, :mode => mode, header = Gem::Package::TarHeader.new(name: name, mode: mode,
:size => size, :prefix => prefix, size: size, prefix: prefix,
:mtime => Gem.source_date_epoch).to_s mtime: Gem.source_date_epoch).to_s
@io.write header @io.write header
os = BoundedStream.new @io, size os = BoundedStream.new @io, size
@ -235,11 +235,11 @@ class Gem::Package::TarWriter
name, prefix = split_name name name, prefix = split_name name
header = Gem::Package::TarHeader.new(:name => name, :mode => mode, header = Gem::Package::TarHeader.new(name: name, mode: mode,
:size => 0, :typeflag => "2", size: 0, typeflag: "2",
:linkname => target, linkname: target,
:prefix => prefix, prefix: prefix,
:mtime => Gem.source_date_epoch).to_s mtime: Gem.source_date_epoch).to_s
@io.write header @io.write header
@ -289,10 +289,10 @@ class Gem::Package::TarWriter
name, prefix = split_name(name) name, prefix = split_name(name)
header = Gem::Package::TarHeader.new :name => name, :mode => mode, header = Gem::Package::TarHeader.new name: name, mode: mode,
:typeflag => "5", :size => 0, typeflag: "5", size: 0,
:prefix => prefix, prefix: prefix,
:mtime => Gem.source_date_epoch mtime: Gem.source_date_epoch
@io.write header @io.write header

View File

@ -97,13 +97,13 @@ class Gem::PackageTask < Rake::PackageTask
gem_path = File.join package_dir, gem_file gem_path = File.join package_dir, gem_file
gem_dir = File.join package_dir, gem_spec.full_name gem_dir = File.join package_dir, gem_spec.full_name
task :package => [:gem] task package: [:gem]
directory package_dir directory package_dir
directory gem_dir directory gem_dir
desc "Build the gem file #{gem_file}" desc "Build the gem file #{gem_file}"
task :gem => [gem_path] task gem: [gem_path]
trace = Rake.application.options.trace trace = Rake.application.options.trace
Gem.configuration.verbose = trace Gem.configuration.verbose = trace

View File

@ -33,22 +33,22 @@
class Gem::RequestSet::GemDependencyAPI class Gem::RequestSet::GemDependencyAPI
ENGINE_MAP = { # :nodoc: ENGINE_MAP = { # :nodoc:
:jruby => %w[jruby], jruby: %w[jruby],
:jruby_18 => %w[jruby], jruby_18: %w[jruby],
:jruby_19 => %w[jruby], jruby_19: %w[jruby],
:maglev => %w[maglev], maglev: %w[maglev],
:mri => %w[ruby], mri: %w[ruby],
:mri_18 => %w[ruby], mri_18: %w[ruby],
:mri_19 => %w[ruby], mri_19: %w[ruby],
:mri_20 => %w[ruby], mri_20: %w[ruby],
:mri_21 => %w[ruby], mri_21: %w[ruby],
:rbx => %w[rbx], rbx: %w[rbx],
:truffleruby => %w[truffleruby], truffleruby: %w[truffleruby],
:ruby => %w[ruby rbx maglev truffleruby], ruby: %w[ruby rbx maglev truffleruby],
:ruby_18 => %w[ruby rbx maglev truffleruby], ruby_18: %w[ruby rbx maglev truffleruby],
:ruby_19 => %w[ruby rbx maglev truffleruby], ruby_19: %w[ruby rbx maglev truffleruby],
:ruby_20 => %w[ruby rbx maglev truffleruby], ruby_20: %w[ruby rbx maglev truffleruby],
:ruby_21 => %w[ruby rbx maglev truffleruby], ruby_21: %w[ruby rbx maglev truffleruby],
}.freeze }.freeze
mswin = Gem::Platform.new "x86-mswin32" mswin = Gem::Platform.new "x86-mswin32"
@ -57,39 +57,39 @@ class Gem::RequestSet::GemDependencyAPI
x64_mingw = Gem::Platform.new "x64-mingw32" x64_mingw = Gem::Platform.new "x64-mingw32"
PLATFORM_MAP = { # :nodoc: PLATFORM_MAP = { # :nodoc:
:jruby => Gem::Platform::RUBY, jruby: Gem::Platform::RUBY,
:jruby_18 => Gem::Platform::RUBY, jruby_18: Gem::Platform::RUBY,
:jruby_19 => Gem::Platform::RUBY, jruby_19: Gem::Platform::RUBY,
:maglev => Gem::Platform::RUBY, maglev: Gem::Platform::RUBY,
:mingw => x86_mingw, mingw: x86_mingw,
:mingw_18 => x86_mingw, mingw_18: x86_mingw,
:mingw_19 => x86_mingw, mingw_19: x86_mingw,
:mingw_20 => x86_mingw, mingw_20: x86_mingw,
:mingw_21 => x86_mingw, mingw_21: x86_mingw,
:mri => Gem::Platform::RUBY, mri: Gem::Platform::RUBY,
:mri_18 => Gem::Platform::RUBY, mri_18: Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY, mri_19: Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY, mri_20: Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY, mri_21: Gem::Platform::RUBY,
:mswin => mswin, mswin: mswin,
:mswin_18 => mswin, mswin_18: mswin,
:mswin_19 => mswin, mswin_19: mswin,
:mswin_20 => mswin, mswin_20: mswin,
:mswin_21 => mswin, mswin_21: mswin,
:mswin64 => mswin64, mswin64: mswin64,
:mswin64_19 => mswin64, mswin64_19: mswin64,
:mswin64_20 => mswin64, mswin64_20: mswin64,
:mswin64_21 => mswin64, mswin64_21: mswin64,
:rbx => Gem::Platform::RUBY, rbx: Gem::Platform::RUBY,
:ruby => Gem::Platform::RUBY, ruby: Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY, ruby_18: Gem::Platform::RUBY,
:ruby_19 => Gem::Platform::RUBY, ruby_19: Gem::Platform::RUBY,
:ruby_20 => Gem::Platform::RUBY, ruby_20: Gem::Platform::RUBY,
:ruby_21 => Gem::Platform::RUBY, ruby_21: Gem::Platform::RUBY,
:truffleruby => Gem::Platform::RUBY, truffleruby: Gem::Platform::RUBY,
:x64_mingw => x64_mingw, x64_mingw: x64_mingw,
:x64_mingw_20 => x64_mingw, x64_mingw_20: x64_mingw,
:x64_mingw_21 => x64_mingw, x64_mingw_21: x64_mingw,
}.freeze }.freeze
gt_eq_0 = Gem::Requirement.new ">= 0" 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" tilde_gt_2_1_0 = Gem::Requirement.new "~> 2.1.0"
VERSION_MAP = { # :nodoc: VERSION_MAP = { # :nodoc:
:jruby => gt_eq_0, jruby: gt_eq_0,
:jruby_18 => tilde_gt_1_8_0, jruby_18: tilde_gt_1_8_0,
:jruby_19 => tilde_gt_1_9_0, jruby_19: tilde_gt_1_9_0,
:maglev => gt_eq_0, maglev: gt_eq_0,
:mingw => gt_eq_0, mingw: gt_eq_0,
:mingw_18 => tilde_gt_1_8_0, mingw_18: tilde_gt_1_8_0,
:mingw_19 => tilde_gt_1_9_0, mingw_19: tilde_gt_1_9_0,
:mingw_20 => tilde_gt_2_0_0, mingw_20: tilde_gt_2_0_0,
:mingw_21 => tilde_gt_2_1_0, mingw_21: tilde_gt_2_1_0,
:mri => gt_eq_0, mri: gt_eq_0,
:mri_18 => tilde_gt_1_8_0, mri_18: tilde_gt_1_8_0,
:mri_19 => tilde_gt_1_9_0, mri_19: tilde_gt_1_9_0,
:mri_20 => tilde_gt_2_0_0, mri_20: tilde_gt_2_0_0,
:mri_21 => tilde_gt_2_1_0, mri_21: tilde_gt_2_1_0,
:mswin => gt_eq_0, mswin: gt_eq_0,
:mswin_18 => tilde_gt_1_8_0, mswin_18: tilde_gt_1_8_0,
:mswin_19 => tilde_gt_1_9_0, mswin_19: tilde_gt_1_9_0,
:mswin_20 => tilde_gt_2_0_0, mswin_20: tilde_gt_2_0_0,
:mswin_21 => tilde_gt_2_1_0, mswin_21: tilde_gt_2_1_0,
:mswin64 => gt_eq_0, mswin64: gt_eq_0,
:mswin64_19 => tilde_gt_1_9_0, mswin64_19: tilde_gt_1_9_0,
:mswin64_20 => tilde_gt_2_0_0, mswin64_20: tilde_gt_2_0_0,
:mswin64_21 => tilde_gt_2_1_0, mswin64_21: tilde_gt_2_1_0,
:rbx => gt_eq_0, rbx: gt_eq_0,
:ruby => gt_eq_0, ruby: gt_eq_0,
:ruby_18 => tilde_gt_1_8_0, ruby_18: tilde_gt_1_8_0,
:ruby_19 => tilde_gt_1_9_0, ruby_19: tilde_gt_1_9_0,
:ruby_20 => tilde_gt_2_0_0, ruby_20: tilde_gt_2_0_0,
:ruby_21 => tilde_gt_2_1_0, ruby_21: tilde_gt_2_1_0,
:truffleruby => gt_eq_0, truffleruby: gt_eq_0,
:x64_mingw => gt_eq_0, x64_mingw: gt_eq_0,
:x64_mingw_20 => tilde_gt_2_0_0, x64_mingw_20: tilde_gt_2_0_0,
:x64_mingw_21 => tilde_gt_2_1_0, x64_mingw_21: tilde_gt_2_1_0,
}.freeze }.freeze
WINDOWS = { # :nodoc: WINDOWS = { # :nodoc:
:mingw => :only, mingw: :only,
:mingw_18 => :only, mingw_18: :only,
:mingw_19 => :only, mingw_19: :only,
:mingw_20 => :only, mingw_20: :only,
:mingw_21 => :only, mingw_21: :only,
:mri => :never, mri: :never,
:mri_18 => :never, mri_18: :never,
:mri_19 => :never, mri_19: :never,
:mri_20 => :never, mri_20: :never,
:mri_21 => :never, mri_21: :never,
:mswin => :only, mswin: :only,
:mswin_18 => :only, mswin_18: :only,
:mswin_19 => :only, mswin_19: :only,
:mswin_20 => :only, mswin_20: :only,
:mswin_21 => :only, mswin_21: :only,
:mswin64 => :only, mswin64: :only,
:mswin64_19 => :only, mswin64_19: :only,
:mswin64_20 => :only, mswin64_20: :only,
:mswin64_21 => :only, mswin64_21: :only,
:rbx => :never, rbx: :never,
:ruby => :never, ruby: :never,
:ruby_18 => :never, ruby_18: :never,
:ruby_19 => :never, ruby_19: :never,
:ruby_20 => :never, ruby_20: :never,
:ruby_21 => :never, ruby_21: :never,
:x64_mingw => :only, x64_mingw: :only,
:x64_mingw_20 => :only, x64_mingw_20: :only,
:x64_mingw_21 => :only, x64_mingw_21: :only,
}.freeze }.freeze
## ##

View File

@ -6,12 +6,12 @@ module Gem::Security
NoSecurity = Policy.new( NoSecurity = Policy.new(
"No Security", "No Security",
:verify_data => false, verify_data: false,
:verify_signer => false, verify_signer: false,
:verify_chain => false, verify_chain: false,
:verify_root => false, verify_root: false,
:only_trusted => false, only_trusted: false,
:only_signed => false only_signed: false
) )
## ##
@ -24,12 +24,12 @@ module Gem::Security
AlmostNoSecurity = Policy.new( AlmostNoSecurity = Policy.new(
"Almost No Security", "Almost No Security",
:verify_data => true, verify_data: true,
:verify_signer => false, verify_signer: false,
:verify_chain => false, verify_chain: false,
:verify_root => false, verify_root: false,
:only_trusted => false, only_trusted: false,
:only_signed => false only_signed: false
) )
## ##
@ -41,12 +41,12 @@ module Gem::Security
LowSecurity = Policy.new( LowSecurity = Policy.new(
"Low Security", "Low Security",
:verify_data => true, verify_data: true,
:verify_signer => true, verify_signer: true,
:verify_chain => false, verify_chain: false,
:verify_root => false, verify_root: false,
:only_trusted => false, only_trusted: false,
:only_signed => false only_signed: false
) )
## ##
@ -60,12 +60,12 @@ module Gem::Security
MediumSecurity = Policy.new( MediumSecurity = Policy.new(
"Medium Security", "Medium Security",
:verify_data => true, verify_data: true,
:verify_signer => true, verify_signer: true,
:verify_chain => true, verify_chain: true,
:verify_root => true, verify_root: true,
:only_trusted => true, only_trusted: true,
:only_signed => false only_signed: false
) )
## ##
@ -79,12 +79,12 @@ module Gem::Security
HighSecurity = Policy.new( HighSecurity = Policy.new(
"High Security", "High Security",
:verify_data => true, verify_data: true,
:verify_signer => true, verify_signer: true,
:verify_chain => true, verify_chain: true,
:verify_root => true, verify_root: true,
:only_trusted => true, only_trusted: true,
:only_signed => true only_signed: true
) )
## ##
@ -92,12 +92,12 @@ module Gem::Security
SigningPolicy = Policy.new( SigningPolicy = Policy.new(
"Signing Policy", "Signing Policy",
:verify_data => false, verify_data: false,
:verify_signer => true, verify_signer: true,
:verify_chain => true, verify_chain: true,
:verify_root => true, verify_root: true,
:only_trusted => false, only_trusted: false,
:only_signed => false only_signed: false
) )
## ##

View File

@ -9,8 +9,8 @@ class Gem::Security::TrustDir
# Default permissions for the trust directory and its contents # Default permissions for the trust directory and its contents
DEFAULT_PERMISSIONS = { DEFAULT_PERMISSIONS = {
:trust_dir => 0o700, trust_dir: 0o700,
:trusted_cert => 0o600, trusted_cert: 0o600,
}.freeze }.freeze
## ##
@ -111,7 +111,7 @@ class Gem::Security::TrustDir
FileUtils.chmod 0o700, @dir FileUtils.chmod 0o700, @dir
else else
FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir] FileUtils.mkdir_p @dir, mode: @permissions[:trust_dir]
end end
end end
end end

View File

@ -12,9 +12,9 @@ class Gem::Source
include Gem::Text include Gem::Text
FILES = { # :nodoc: FILES = { # :nodoc:
:released => "specs", released: "specs",
:latest => "latest_specs", latest: "latest_specs",
:prerelease => "prerelease_specs", prerelease: "prerelease_specs",
}.freeze }.freeze
## ##

View File

@ -69,9 +69,9 @@ class Gem::SpecFetcher
@prerelease_specs = {} @prerelease_specs = {}
@caches = { @caches = {
:latest => @latest_specs, latest: @latest_specs,
:prerelease => @prerelease_specs, prerelease: @prerelease_specs,
:released => @specs, released: @specs,
} }
@fetcher = Gem::RemoteFetcher.fetcher @fetcher = Gem::RemoteFetcher.fetcher

View File

@ -127,35 +127,35 @@ class Gem::Specification < Gem::BasicSpecification
# Map of attribute names to default values. # Map of attribute names to default values.
@@default_value = { @@default_value = {
:authors => [], authors: [],
:autorequire => nil, autorequire: nil,
:bindir => "bin", bindir: "bin",
:cert_chain => [], cert_chain: [],
:date => nil, date: nil,
:dependencies => [], dependencies: [],
:description => nil, description: nil,
:email => nil, email: nil,
:executables => [], executables: [],
:extensions => [], extensions: [],
:extra_rdoc_files => [], extra_rdoc_files: [],
:files => [], files: [],
:homepage => nil, homepage: nil,
:licenses => [], licenses: [],
:metadata => {}, metadata: {},
:name => nil, name: nil,
:platform => Gem::Platform::RUBY, platform: Gem::Platform::RUBY,
:post_install_message => nil, post_install_message: nil,
:rdoc_options => [], rdoc_options: [],
:require_paths => ["lib"], require_paths: ["lib"],
:required_ruby_version => Gem::Requirement.default, required_ruby_version: Gem::Requirement.default,
:required_rubygems_version => Gem::Requirement.default, required_rubygems_version: Gem::Requirement.default,
:requirements => [], requirements: [],
:rubygems_version => Gem::VERSION, rubygems_version: Gem::VERSION,
:signing_key => nil, signing_key: nil,
:specification_version => CURRENT_SPECIFICATION_VERSION, specification_version: CURRENT_SPECIFICATION_VERSION,
:summary => nil, summary: nil,
:test_files => [], test_files: [],
:version => nil, version: nil,
}.freeze }.freeze
# rubocop:disable Style/MutableConstant # rubocop:disable Style/MutableConstant

View File

@ -60,7 +60,7 @@ module Gem::Util
# Invokes system, but silences all output. # Invokes system, but silences all output.
def self.silent_system(*command) def self.silent_system(*command)
opt = { :out => IO::NULL, :err => [:child, :out] } opt = { out: IO::NULL, err: [:child, :out] }
if Hash === command.last if Hash === command.last
opt.update(command.last) opt.update(command.last)
cmds = command[0...-1] cmds = command[0...-1]

View File

@ -25,5 +25,5 @@ Bundler.with_friendly_errors do
help_flag_used = ARGV.any? {|a| help_flags.include? a } help_flag_used = ARGV.any? {|a| help_flags.include? a }
args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
Bundler::CLI.start(args, :debug => true) Bundler::CLI.start(args, debug: true)
end end

View File

@ -88,7 +88,7 @@ RSpec.describe Bundler do
end end
end end
context "with correct YAML file", :if => defined?(Encoding) do context "with correct YAML file", if: defined?(Encoding) do
it "can load a gemspec with unicode characters with default ruby encoding" do it "can load a gemspec with unicode characters with default ruby encoding" do
# spec_helper forces the external encoding to UTF-8 but that's not the # spec_helper forces the external encoding to UTF-8 but that's not the
# default until Ruby 2.0 # default until Ruby 2.0
@ -139,7 +139,7 @@ RSpec.describe Bundler do
end end
GEMSPEC GEMSPEC
end end
expect(Bundler.rubygems).to receive(:validate).with have_attributes(:name => "validated") expect(Bundler.rubygems).to receive(:validate).with have_attributes(name: "validated")
subject subject
end end
end end

View File

@ -5,12 +5,12 @@ require "json"
RSpec.describe "bundle executable" do RSpec.describe "bundle executable" do
it "returns non-zero exit status when passed unrecognized options" do it "returns non-zero exit status when passed unrecognized options" do
bundle "--invalid_argument", :raise_on_error => false bundle "--invalid_argument", raise_on_error: false
expect(exitstatus).to_not be_zero expect(exitstatus).to_not be_zero
end end
it "returns non-zero exit status when passed unrecognized task" do it "returns non-zero exit status when passed unrecognized task" do
bundle "unrecognized-task", :raise_on_error => false bundle "unrecognized-task", raise_on_error: false
expect(exitstatus).to_not be_zero expect(exitstatus).to_not be_zero
end end
@ -88,7 +88,7 @@ RSpec.describe "bundle executable" do
end end
context "with no arguments" do context "with no arguments" do
it "prints a concise help message", :bundler => "3" do it "prints a concise help message", bundler: "3" do
bundle "" bundle ""
expect(err).to be_empty expect(err).to be_empty
expect(out).to include("Bundler version #{Bundler::VERSION}"). expect(out).to include("Bundler version #{Bundler::VERSION}").
@ -106,7 +106,7 @@ RSpec.describe "bundle executable" do
gem 'rack' gem 'rack'
G G
bundle :install, :env => { "BUNDLE_GEMFILE" => "" } bundle :install, env: { "BUNDLE_GEMFILE" => "" }
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
@ -115,17 +115,17 @@ RSpec.describe "bundle executable" do
context "with --verbose" do context "with --verbose" do
it "prints the running command" do it "prints the running command" do
gemfile "source \"#{file_uri_for(gem_repo1)}\"" gemfile "source \"#{file_uri_for(gem_repo1)}\""
bundle "info bundler", :verbose => true bundle "info bundler", verbose: true
expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}") expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}")
end end
it "doesn't print defaults" do it "doesn't print defaults" do
install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true
expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}")
end end
it "doesn't print defaults" do it "doesn't print defaults" do
install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true
expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}")
end end
end end
@ -134,7 +134,7 @@ RSpec.describe "bundle executable" do
let(:run_command) do let(:run_command) do
bundle "install" bundle "install"
bundle "outdated #{flags}", :raise_on_error => false bundle "outdated #{flags}", raise_on_error: false
end end
before do before do
@ -199,7 +199,7 @@ RSpec.describe "bundle executable" do
describe "printing the outdated warning" do describe "printing the outdated warning" do
shared_examples_for "no warning" do shared_examples_for "no warning" do
it "prints no warning" do it "prints no warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
expect(last_command.stdboth).to eq("Could not find command \"fail\".") expect(last_command.stdboth).to eq("Could not find command \"fail\".")
end end
end end
@ -234,7 +234,7 @@ RSpec.describe "bundle executable" do
context "when the latest version is greater than the current version" do context "when the latest version is greater than the current version" do
let(:latest_version) { "222.0" } let(:latest_version) { "222.0" }
it "prints the version warning" do it "prints the version warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
expect(err).to start_with(<<-EOS.strip) expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}. The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To update to the most recent version, run `bundle update --bundler` To update to the most recent version, run `bundle update --bundler`
@ -242,16 +242,16 @@ To update to the most recent version, run `bundle update --bundler`
end end
context "and disable_version_check is set" do context "and disable_version_check is set" do
before { bundle "config set disable_version_check true", :env => { "BUNDLER_VERSION" => bundler_version } } before { bundle "config set disable_version_check true", env: { "BUNDLER_VERSION" => bundler_version } }
include_examples "no warning" include_examples "no warning"
end end
context "running a parseable command" do context "running a parseable command" do
it "prints no warning" do it "prints no warning" do
bundle "config get --parseable foo", :env => { "BUNDLER_VERSION" => bundler_version } bundle "config get --parseable foo", env: { "BUNDLER_VERSION" => bundler_version }
expect(last_command.stdboth).to eq "" expect(last_command.stdboth).to eq ""
bundle "platform --ruby", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false bundle "platform --ruby", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
expect(last_command.stdboth).to eq "Could not locate Gemfile" expect(last_command.stdboth).to eq "Could not locate Gemfile"
end end
end end
@ -259,7 +259,7 @@ To update to the most recent version, run `bundle update --bundler`
context "and is a pre-release" do context "and is a pre-release" do
let(:latest_version) { "222.0.0.pre.4" } let(:latest_version) { "222.0.0.pre.4" }
it "prints the version warning" do it "prints the version warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
expect(err).to start_with(<<-EOS.strip) expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}. The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To update to the most recent version, run `bundle update --bundler` To update to the most recent version, run `bundle update --bundler`
@ -271,12 +271,12 @@ To update to the most recent version, run `bundle update --bundler`
end end
RSpec.describe "bundler executable" do RSpec.describe "bundler executable" do
it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do it "shows the bundler version just as the `bundle` executable does", bundler: "< 3" do
bundler "--version" bundler "--version"
expect(out).to eq("Bundler version #{Bundler::VERSION}") expect(out).to eq("Bundler version #{Bundler::VERSION}")
end end
it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do it "shows the bundler version just as the `bundle` executable does", bundler: "3" do
bundler "--version" bundler "--version"
expect(out).to eq(Bundler::VERSION) expect(out).to eq(Bundler::VERSION)
end end

View File

@ -14,7 +14,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
let(:remote_path) { double(:remote_path) } let(:remote_path) { double(:remote_path) }
let(:full_body) { "abc123" } let(:full_body) { "abc123" }
let(:response) { double(:response, :body => full_body, :is_a? => false) } let(:response) { double(:response, body: full_body, is_a?: false) }
let(:digest) { Digest::SHA256.base64digest(full_body) } let(:digest) { Digest::SHA256.base64digest(full_body) }
context "when the local path does not exist" do context "when the local path does not exist" do
@ -105,7 +105,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
allow(response).to receive(:is_a?).with(Net::HTTPPartialContent) { true } allow(response).to receive(:is_a?).with(Net::HTTPPartialContent) { true }
expect(fetcher).to receive(:call).once.with(remote_path, headers).and_return(response) expect(fetcher).to receive(:call).once.with(remote_path, headers).and_return(response)
full_response = double(:full_response, :body => full_body, :is_a? => false) full_response = double(:full_response, body: full_body, is_a?: false)
allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" } allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" }
allow(full_response).to receive(:[]).with("ETag") { "NewEtag" } allow(full_response).to receive(:[]).with("ETag") { "NewEtag" }
expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response) expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response)
@ -178,7 +178,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
response response
end end
full_response = double(:full_response, :body => full_body, :is_a? => false) full_response = double(:full_response, body: full_body, is_a?: false)
allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" } allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" }
allow(full_response).to receive(:[]).with("ETag") { "NewEtag" } allow(full_response).to receive(:[]).with("ETag") { "NewEtag" }
expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response) expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response)
@ -193,7 +193,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
context "when the ETag header is missing" do context "when the ETag header is missing" do
# Regression test for https://github.com/rubygems/bundler/issues/5463 # Regression test for https://github.com/rubygems/bundler/issues/5463
let(:response) { double(:response, :body => full_body) } let(:response) { double(:response, body: full_body) }
it "treats the response as an update" do it "treats the response as an update" do
allow(response).to receive(:[]).with("Repr-Digest") { nil } allow(response).to receive(:[]).with("Repr-Digest") { nil }
@ -206,7 +206,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end end
context "when the download is corrupt" do context "when the download is corrupt" do
let(:response) { double(:response, :body => "") } let(:response) { double(:response, body: "") }
it "raises HTTPError" do it "raises HTTPError" do
expect(fetcher).to receive(:call).and_raise(Zlib::GzipFile::Error) expect(fetcher).to receive(:call).and_raise(Zlib::GzipFile::Error)
@ -218,7 +218,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end end
context "when receiving non UTF-8 data and default internal encoding set to ASCII" do context "when receiving non UTF-8 data and default internal encoding set to ASCII" do
let(:response) { double(:response, :body => "\x8B".b) } let(:response) { double(:response, body: "\x8B".b) }
it "works just fine" do it "works just fine" do
old_verbose = $VERBOSE old_verbose = $VERBOSE

View File

@ -7,7 +7,7 @@ RSpec.describe Bundler::Definition do
before do before do
allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") } allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") }
allow(Bundler::SharedHelpers).to receive(:find_gemfile) { Pathname.new("Gemfile") } allow(Bundler::SharedHelpers).to receive(:find_gemfile) { Pathname.new("Gemfile") }
allow(Bundler).to receive(:ui) { double("UI", :info => "", :debug => "") } allow(Bundler).to receive(:ui) { double("UI", info: "", debug: "") }
end end
context "when it's not possible to write to the file" do context "when it's not possible to write to the file" do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
@ -45,14 +45,14 @@ RSpec.describe Bundler::Definition do
describe "detects changes" do describe "detects changes" do
it "for a path gem with changes" do it "for a path gem with changes" do
build_lib "foo", "1.0", :path => lib_path("foo") build_lib "foo", "1.0", path: lib_path("foo")
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}" gem "foo", :path => "#{lib_path("foo")}"
G G
build_lib "foo", "1.0", :path => lib_path("foo") do |s| build_lib "foo", "1.0", path: lib_path("foo") do |s|
s.add_dependency "rack", "1.0" s.add_dependency "rack", "1.0"
end end
@ -61,7 +61,7 @@ RSpec.describe Bundler::Definition do
c.checksum gem_repo1, "rack", "1.0.0" c.checksum gem_repo1, "rack", "1.0.0"
end end
bundle :install, :env => { "DEBUG" => "1" } bundle :install, env: { "DEBUG" => "1" }
expect(out).to match(/re-resolving dependencies/) expect(out).to match(/re-resolving dependencies/)
expect(lockfile).to eq <<~G expect(lockfile).to eq <<~G
@ -100,13 +100,13 @@ RSpec.describe Bundler::Definition do
bundle "lock --add-platform java" bundle "lock --add-platform java"
bundle "update ffi", :env => { "DEBUG" => "1" } bundle "update ffi", env: { "DEBUG" => "1" }
expect(out).to match(/because bundler is unlocking gems: \(ffi\)/) expect(out).to match(/because bundler is unlocking gems: \(ffi\)/)
end end
it "for a path gem with deps and no changes" do it "for a path gem with deps and no changes" do
build_lib "foo", "1.0", :path => lib_path("foo") do |s| build_lib "foo", "1.0", path: lib_path("foo") do |s|
s.add_dependency "rack", "1.0" s.add_dependency "rack", "1.0"
s.add_development_dependency "net-ssh", "1.0" s.add_development_dependency "net-ssh", "1.0"
end end
@ -121,7 +121,7 @@ RSpec.describe Bundler::Definition do
gem "foo", :path => "#{lib_path("foo")}" gem "foo", :path => "#{lib_path("foo")}"
G G
bundle :check, :env => { "DEBUG" => "1" } bundle :check, env: { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/) expect(out).to match(/using resolution from the lockfile/)
expect(lockfile).to eq <<~G expect(lockfile).to eq <<~G
@ -158,7 +158,7 @@ RSpec.describe Bundler::Definition do
G G
bundle "lock --add-platform java" bundle "lock --add-platform java"
bundle :check, :env => { "DEBUG" => "1" } bundle :check, env: { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/) expect(out).to match(/using resolution from the lockfile/)
expect(lockfile).to eq <<~G expect(lockfile).to eq <<~G
@ -188,7 +188,7 @@ RSpec.describe Bundler::Definition do
gem "foo" gem "foo"
G G
bundle :check, :env => { "DEBUG" => "1" } bundle :check, env: { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/) expect(out).to match(/using resolution from the lockfile/)
expect(lockfile).to eq <<~G expect(lockfile).to eq <<~G
@ -278,7 +278,7 @@ RSpec.describe Bundler::Definition do
bundled_app_lock, bundled_app_lock,
updated_deps_in_gemfile, updated_deps_in_gemfile,
source_list, source_list,
:gems => ["shared_owner_a"], :conservative => true gems: ["shared_owner_a"], conservative: true
) )
locked = definition.send(:converge_locked_specs).map(&:name) locked = definition.send(:converge_locked_specs).map(&:name)
expect(locked).to eq %w[isolated_dep isolated_owner shared_dep shared_owner_b] expect(locked).to eq %w[isolated_dep isolated_owner shared_dep shared_owner_b]

View File

@ -40,116 +40,116 @@ RSpec.describe Bundler::Dependency do
# rubocop:disable Naming/VariableNumber # rubocop:disable Naming/VariableNumber
let(:platforms) do let(:platforms) do
{ :ruby => Gem::Platform::RUBY, { ruby: Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY, ruby_18: Gem::Platform::RUBY,
:ruby_19 => Gem::Platform::RUBY, ruby_19: Gem::Platform::RUBY,
:ruby_20 => Gem::Platform::RUBY, ruby_20: Gem::Platform::RUBY,
:ruby_21 => Gem::Platform::RUBY, ruby_21: Gem::Platform::RUBY,
:ruby_22 => Gem::Platform::RUBY, ruby_22: Gem::Platform::RUBY,
:ruby_23 => Gem::Platform::RUBY, ruby_23: Gem::Platform::RUBY,
:ruby_24 => Gem::Platform::RUBY, ruby_24: Gem::Platform::RUBY,
:ruby_25 => Gem::Platform::RUBY, ruby_25: Gem::Platform::RUBY,
:ruby_26 => Gem::Platform::RUBY, ruby_26: Gem::Platform::RUBY,
:ruby_27 => Gem::Platform::RUBY, ruby_27: Gem::Platform::RUBY,
:ruby_30 => Gem::Platform::RUBY, ruby_30: Gem::Platform::RUBY,
:ruby_31 => Gem::Platform::RUBY, ruby_31: Gem::Platform::RUBY,
:ruby_32 => Gem::Platform::RUBY, ruby_32: Gem::Platform::RUBY,
:ruby_33 => Gem::Platform::RUBY, ruby_33: Gem::Platform::RUBY,
:mri => Gem::Platform::RUBY, mri: Gem::Platform::RUBY,
:mri_18 => Gem::Platform::RUBY, mri_18: Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY, mri_19: Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY, mri_20: Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY, mri_21: Gem::Platform::RUBY,
:mri_22 => Gem::Platform::RUBY, mri_22: Gem::Platform::RUBY,
:mri_23 => Gem::Platform::RUBY, mri_23: Gem::Platform::RUBY,
:mri_24 => Gem::Platform::RUBY, mri_24: Gem::Platform::RUBY,
:mri_25 => Gem::Platform::RUBY, mri_25: Gem::Platform::RUBY,
:mri_26 => Gem::Platform::RUBY, mri_26: Gem::Platform::RUBY,
:mri_27 => Gem::Platform::RUBY, mri_27: Gem::Platform::RUBY,
:mri_30 => Gem::Platform::RUBY, mri_30: Gem::Platform::RUBY,
:mri_31 => Gem::Platform::RUBY, mri_31: Gem::Platform::RUBY,
:mri_32 => Gem::Platform::RUBY, mri_32: Gem::Platform::RUBY,
:mri_33 => Gem::Platform::RUBY, mri_33: Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY, rbx: Gem::Platform::RUBY,
:truffleruby => Gem::Platform::RUBY, truffleruby: Gem::Platform::RUBY,
:jruby => Gem::Platform::JAVA, jruby: Gem::Platform::JAVA,
:jruby_18 => Gem::Platform::JAVA, jruby_18: Gem::Platform::JAVA,
:jruby_19 => Gem::Platform::JAVA, jruby_19: Gem::Platform::JAVA,
:windows => Gem::Platform::WINDOWS, windows: Gem::Platform::WINDOWS,
:windows_18 => Gem::Platform::WINDOWS, windows_18: Gem::Platform::WINDOWS,
:windows_19 => Gem::Platform::WINDOWS, windows_19: Gem::Platform::WINDOWS,
:windows_20 => Gem::Platform::WINDOWS, windows_20: Gem::Platform::WINDOWS,
:windows_21 => Gem::Platform::WINDOWS, windows_21: Gem::Platform::WINDOWS,
:windows_22 => Gem::Platform::WINDOWS, windows_22: Gem::Platform::WINDOWS,
:windows_23 => Gem::Platform::WINDOWS, windows_23: Gem::Platform::WINDOWS,
:windows_24 => Gem::Platform::WINDOWS, windows_24: Gem::Platform::WINDOWS,
:windows_25 => Gem::Platform::WINDOWS, windows_25: Gem::Platform::WINDOWS,
:windows_26 => Gem::Platform::WINDOWS, windows_26: Gem::Platform::WINDOWS,
:windows_27 => Gem::Platform::WINDOWS, windows_27: Gem::Platform::WINDOWS,
:windows_30 => Gem::Platform::WINDOWS, windows_30: Gem::Platform::WINDOWS,
:windows_31 => Gem::Platform::WINDOWS, windows_31: Gem::Platform::WINDOWS,
:windows_32 => Gem::Platform::WINDOWS, windows_32: Gem::Platform::WINDOWS,
:windows_33 => Gem::Platform::WINDOWS } windows_33: Gem::Platform::WINDOWS }
end end
let(:deprecated) do let(:deprecated) do
{ :mswin => Gem::Platform::MSWIN, { mswin: Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN, mswin_18: Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN, mswin_19: Gem::Platform::MSWIN,
:mswin_20 => Gem::Platform::MSWIN, mswin_20: Gem::Platform::MSWIN,
:mswin_21 => Gem::Platform::MSWIN, mswin_21: Gem::Platform::MSWIN,
:mswin_22 => Gem::Platform::MSWIN, mswin_22: Gem::Platform::MSWIN,
:mswin_23 => Gem::Platform::MSWIN, mswin_23: Gem::Platform::MSWIN,
:mswin_24 => Gem::Platform::MSWIN, mswin_24: Gem::Platform::MSWIN,
:mswin_25 => Gem::Platform::MSWIN, mswin_25: Gem::Platform::MSWIN,
:mswin_26 => Gem::Platform::MSWIN, mswin_26: Gem::Platform::MSWIN,
:mswin_27 => Gem::Platform::MSWIN, mswin_27: Gem::Platform::MSWIN,
:mswin_30 => Gem::Platform::MSWIN, mswin_30: Gem::Platform::MSWIN,
:mswin_31 => Gem::Platform::MSWIN, mswin_31: Gem::Platform::MSWIN,
:mswin_32 => Gem::Platform::MSWIN, mswin_32: Gem::Platform::MSWIN,
:mswin_33 => Gem::Platform::MSWIN, mswin_33: Gem::Platform::MSWIN,
:mswin64 => Gem::Platform::MSWIN64, mswin64: Gem::Platform::MSWIN64,
:mswin64_19 => Gem::Platform::MSWIN64, mswin64_19: Gem::Platform::MSWIN64,
:mswin64_20 => Gem::Platform::MSWIN64, mswin64_20: Gem::Platform::MSWIN64,
:mswin64_21 => Gem::Platform::MSWIN64, mswin64_21: Gem::Platform::MSWIN64,
:mswin64_22 => Gem::Platform::MSWIN64, mswin64_22: Gem::Platform::MSWIN64,
:mswin64_23 => Gem::Platform::MSWIN64, mswin64_23: Gem::Platform::MSWIN64,
:mswin64_24 => Gem::Platform::MSWIN64, mswin64_24: Gem::Platform::MSWIN64,
:mswin64_25 => Gem::Platform::MSWIN64, mswin64_25: Gem::Platform::MSWIN64,
:mswin64_26 => Gem::Platform::MSWIN64, mswin64_26: Gem::Platform::MSWIN64,
:mswin64_27 => Gem::Platform::MSWIN64, mswin64_27: Gem::Platform::MSWIN64,
:mswin64_30 => Gem::Platform::MSWIN64, mswin64_30: Gem::Platform::MSWIN64,
:mswin64_31 => Gem::Platform::MSWIN64, mswin64_31: Gem::Platform::MSWIN64,
:mswin64_32 => Gem::Platform::MSWIN64, mswin64_32: Gem::Platform::MSWIN64,
:mswin64_33 => Gem::Platform::MSWIN64, mswin64_33: Gem::Platform::MSWIN64,
:mingw => Gem::Platform::MINGW, mingw: Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW, mingw_18: Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW, mingw_19: Gem::Platform::MINGW,
:mingw_20 => Gem::Platform::MINGW, mingw_20: Gem::Platform::MINGW,
:mingw_21 => Gem::Platform::MINGW, mingw_21: Gem::Platform::MINGW,
:mingw_22 => Gem::Platform::MINGW, mingw_22: Gem::Platform::MINGW,
:mingw_23 => Gem::Platform::MINGW, mingw_23: Gem::Platform::MINGW,
:mingw_24 => Gem::Platform::MINGW, mingw_24: Gem::Platform::MINGW,
:mingw_25 => Gem::Platform::MINGW, mingw_25: Gem::Platform::MINGW,
:mingw_26 => Gem::Platform::MINGW, mingw_26: Gem::Platform::MINGW,
:mingw_27 => Gem::Platform::MINGW, mingw_27: Gem::Platform::MINGW,
:mingw_30 => Gem::Platform::MINGW, mingw_30: Gem::Platform::MINGW,
:mingw_31 => Gem::Platform::MINGW, mingw_31: Gem::Platform::MINGW,
:mingw_32 => Gem::Platform::MINGW, mingw_32: Gem::Platform::MINGW,
:mingw_33 => Gem::Platform::MINGW, mingw_33: Gem::Platform::MINGW,
:x64_mingw => Gem::Platform::X64_MINGW, x64_mingw: Gem::Platform::X64_MINGW,
:x64_mingw_20 => Gem::Platform::X64_MINGW, x64_mingw_20: Gem::Platform::X64_MINGW,
:x64_mingw_21 => Gem::Platform::X64_MINGW, x64_mingw_21: Gem::Platform::X64_MINGW,
:x64_mingw_22 => Gem::Platform::X64_MINGW, x64_mingw_22: Gem::Platform::X64_MINGW,
:x64_mingw_23 => Gem::Platform::X64_MINGW, x64_mingw_23: Gem::Platform::X64_MINGW,
:x64_mingw_24 => Gem::Platform::X64_MINGW, x64_mingw_24: Gem::Platform::X64_MINGW,
:x64_mingw_25 => Gem::Platform::X64_MINGW, x64_mingw_25: Gem::Platform::X64_MINGW,
:x64_mingw_26 => Gem::Platform::X64_MINGW, x64_mingw_26: Gem::Platform::X64_MINGW,
:x64_mingw_27 => Gem::Platform::X64_MINGW, x64_mingw_27: Gem::Platform::X64_MINGW,
:x64_mingw_30 => Gem::Platform::X64_MINGW, x64_mingw_30: Gem::Platform::X64_MINGW,
:x64_mingw_31 => Gem::Platform::X64_MINGW, x64_mingw_31: Gem::Platform::X64_MINGW,
:x64_mingw_32 => Gem::Platform::X64_MINGW, x64_mingw_32: Gem::Platform::X64_MINGW,
:x64_mingw_33 => Gem::Platform::X64_MINGW } x64_mingw_33: Gem::Platform::X64_MINGW }
end end
# rubocop:enable Naming/VariableNumber # rubocop:enable Naming/VariableNumber

View File

@ -10,7 +10,7 @@ RSpec.describe Bundler::Dsl do
it "registers custom hosts" do it "registers custom hosts" do
subject.git_source(:example) {|repo_name| "git@git.example.com:#{repo_name}.git" } subject.git_source(:example) {|repo_name| "git@git.example.com:#{repo_name}.git" }
subject.git_source(:foobar) {|repo_name| "git@foobar.com:#{repo_name}.git" } subject.git_source(:foobar) {|repo_name| "git@foobar.com:#{repo_name}.git" }
subject.gem("dobry-pies", :example => "strzalek/dobry-pies") subject.gem("dobry-pies", example: "strzalek/dobry-pies")
example_uri = "git@git.example.com:strzalek/dobry-pies.git" example_uri = "git@git.example.com:strzalek/dobry-pies.git"
expect(subject.dependencies.first.source.uri).to eq(example_uri) expect(subject.dependencies.first.source.uri).to eq(example_uri)
end end
@ -26,7 +26,7 @@ RSpec.describe Bundler::Dsl do
end end
it "converts :github PR to URI using https" do it "converts :github PR to URI using https" do
subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5") subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5")
github_uri = "https://github.com/indirect/sparks.git" github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
expect(subject.dependencies.first.source.ref).to eq("refs/pull/5/head") expect(subject.dependencies.first.source.ref).to eq("refs/pull/5/head")
@ -34,21 +34,21 @@ RSpec.describe Bundler::Dsl do
it "rejects :github PR URI with a branch, ref or tag" do it "rejects :github PR URI with a branch, ref or tag" do
expect do expect do
subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :branch => "foo") subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", branch: "foo")
end.to raise_error( end.to raise_error(
Bundler::GemfileError, Bundler::GemfileError,
%(The :branch option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), %(The :branch option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`),
) )
expect do expect do
subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :ref => "foo") subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", ref: "foo")
end.to raise_error( end.to raise_error(
Bundler::GemfileError, Bundler::GemfileError,
%(The :ref option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), %(The :ref option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`),
) )
expect do expect do
subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :tag => "foo") subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", tag: "foo")
end.to raise_error( end.to raise_error(
Bundler::GemfileError, Bundler::GemfileError,
%(The :tag option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), %(The :tag option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`),
@ -57,46 +57,46 @@ RSpec.describe Bundler::Dsl do
it "rejects :github with :git" do it "rejects :github with :git" do
expect do expect do
subject.gem("sparks", :github => "indirect/sparks", :git => "https://github.com/indirect/sparks.git") subject.gem("sparks", github: "indirect/sparks", git: "https://github.com/indirect/sparks.git")
end.to raise_error( end.to raise_error(
Bundler::GemfileError, Bundler::GemfileError,
%(The :git option can't be used with `github: "indirect/sparks"`), %(The :git option can't be used with `github: "indirect/sparks"`),
) )
end end
context "default hosts", :bundler => "< 3" do context "default hosts", bundler: "< 3" do
it "converts :github to URI using https" do it "converts :github to URI using https" do
subject.gem("sparks", :github => "indirect/sparks") subject.gem("sparks", github: "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git" github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
end end
it "converts :github shortcut to URI using https" do it "converts :github shortcut to URI using https" do
subject.gem("sparks", :github => "rails") subject.gem("sparks", github: "rails")
github_uri = "https://github.com/rails/rails.git" github_uri = "https://github.com/rails/rails.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
end end
it "converts numeric :gist to :git" do it "converts numeric :gist to :git" do
subject.gem("not-really-a-gem", :gist => 2_859_988) subject.gem("not-really-a-gem", gist: 2_859_988)
github_uri = "https://gist.github.com/2859988.git" github_uri = "https://gist.github.com/2859988.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
end end
it "converts :gist to :git" do it "converts :gist to :git" do
subject.gem("not-really-a-gem", :gist => "2859988") subject.gem("not-really-a-gem", gist: "2859988")
github_uri = "https://gist.github.com/2859988.git" github_uri = "https://gist.github.com/2859988.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
end end
it "converts :bitbucket to :git" do it "converts :bitbucket to :git" do
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") subject.gem("not-really-a-gem", bitbucket: "mcorp/flatlab-rails")
bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/flatlab-rails.git" bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/flatlab-rails.git"
expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri) expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri)
end end
it "converts 'mcorp' to 'mcorp/mcorp'" do it "converts 'mcorp' to 'mcorp/mcorp'" do
subject.gem("not-really-a-gem", :bitbucket => "mcorp") subject.gem("not-really-a-gem", bitbucket: "mcorp")
bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/mcorp.git" bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/mcorp.git"
expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri) expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri)
end end
@ -142,18 +142,18 @@ RSpec.describe Bundler::Dsl do
:ruby_30, :ruby_31, :ruby_32, :ruby_33, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :ruby_30, :ruby_31, :ruby_32, :ruby_33, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24,
:mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :jruby, :rbx, :truffleruby].each do |platform| :mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :jruby, :rbx, :truffleruby].each do |platform|
it "allows #{platform} as a valid platform" do it "allows #{platform} as a valid platform" do
subject.gem("foo", :platform => platform) subject.gem("foo", platform: platform)
end end
end end
# rubocop:enable Naming/VariableNumber # rubocop:enable Naming/VariableNumber
it "allows platforms matching the running Ruby version" do it "allows platforms matching the running Ruby version" do
platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}" platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}"
subject.gem("foo", :platform => platform) subject.gem("foo", platform: platform)
end end
it "rejects invalid platforms" do it "rejects invalid platforms" do
expect { subject.gem("foo", :platform => :bogus) }. expect { subject.gem("foo", platform: :bogus) }.
to raise_error(Bundler::GemfileError, /is not a valid platform/) to raise_error(Bundler::GemfileError, /is not a valid platform/)
end end
@ -203,19 +203,19 @@ RSpec.describe Bundler::Dsl do
end end
it "rejects branch option on non-git gems" do it "rejects branch option on non-git gems" do
expect { subject.gem("foo", :branch => "test") }. expect { subject.gem("foo", branch: "test") }.
to raise_error(Bundler::GemfileError, /The `branch` option for `gem 'foo'` is not allowed. Only gems with a git source can specify a branch/) to raise_error(Bundler::GemfileError, /The `branch` option for `gem 'foo'` is not allowed. Only gems with a git source can specify a branch/)
end end
it "allows specifying a branch on git gems" do it "allows specifying a branch on git gems" do
subject.gem("foo", :branch => "test", :git => "http://mytestrepo") subject.gem("foo", branch: "test", git: "http://mytestrepo")
dep = subject.dependencies.last dep = subject.dependencies.last
expect(dep.name).to eq "foo" expect(dep.name).to eq "foo"
end end
it "allows specifying a branch on git gems with a git_source" do it "allows specifying a branch on git gems with a git_source" do
subject.git_source(:test_source) {|n| "https://github.com/#{n}" } subject.git_source(:test_source) {|n| "https://github.com/#{n}" }
subject.gem("foo", :branch => "test", :test_source => "bundler/bundler") subject.gem("foo", branch: "test", test_source: "bundler/bundler")
dep = subject.dependencies.last dep = subject.dependencies.last
expect(dep.name).to eq "foo" expect(dep.name).to eq "foo"
end end
@ -280,7 +280,7 @@ RSpec.describe Bundler::Dsl do
allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile")) allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile"))
subject.source("https://other-source.org") do subject.source("https://other-source.org") do
subject.gem("dobry-pies", :path => "foo") subject.gem("dobry-pies", path: "foo")
subject.gem("foo") subject.gem("foo")
end end
@ -292,7 +292,7 @@ RSpec.describe Bundler::Dsl do
describe "#check_primary_source_safety" do describe "#check_primary_source_safety" do
context "when a global source is not defined implicitly" do context "when a global source is not defined implicitly" do
it "will raise a major deprecation warning" do it "will raise a major deprecation warning" do
not_a_global_source = double("not-a-global-source", :no_remotes? => true) not_a_global_source = double("not-a-global-source", no_remotes?: true)
allow(Bundler::Source::Rubygems).to receive(:new).and_return(not_a_global_source) allow(Bundler::Source::Rubygems).to receive(:new).and_return(not_a_global_source)
warning = "This Gemfile does not include an explicit global source. " \ warning = "This Gemfile does not include an explicit global source. " \

View File

@ -60,21 +60,21 @@ RSpec.describe Bundler::EndpointSpecification do
it "should return the remote spec value when not set on endpoint specification and remote spec has one" do it "should return the remote spec value when not set on endpoint specification and remote spec has one" do
remote_value = "remote_value" remote_value = "remote_value"
remote_spec = double(:remote_spec, :required_ruby_version => remote_value, :required_rubygems_version => nil) remote_spec = double(:remote_spec, required_ruby_version: remote_value, required_rubygems_version: nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)
expect(spec.required_ruby_version). eql?(remote_value) expect(spec.required_ruby_version). eql?(remote_value)
end end
it "should use the default Gem Requirement value when not set on endpoint specification and not set on remote spec" do it "should use the default Gem Requirement value when not set on endpoint specification and not set on remote spec" do
remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil) remote_spec = double(:remote_spec, required_ruby_version: nil, required_rubygems_version: nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)
expect(spec.required_ruby_version). eql?(Gem::Requirement.default) expect(spec.required_ruby_version). eql?(Gem::Requirement.default)
end end
end end
it "supports equality comparison" do it "supports equality comparison" do
remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil) remote_spec = double(:remote_spec, required_ruby_version: nil, required_rubygems_version: nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)
other_spec = described_class.new("bar", version, platform, spec_fetcher, dependencies, metadata) other_spec = described_class.new("bar", version, platform, spec_fetcher, dependencies, metadata)
expect(spec).to eql(spec) expect(spec).to eql(spec)

Some files were not shown because too many files have changed in this diff Show More