[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 коммит произвёл git
Родитель 9d696aa204
Коммит 2755cb1b2f
262 изменённых файлов: 3027 добавлений и 3113 удалений

Просмотреть файл

@ -194,7 +194,7 @@ module Bundler
end
def environment
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", :print_caller_location => true
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", print_caller_location: true
load
end
@ -353,7 +353,7 @@ module Bundler
removed_message =
"`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true)
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
unbundled_env
end
@ -396,7 +396,7 @@ module Bundler
removed_message =
"`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true)
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
with_env(unbundled_env) { yield }
end
@ -418,7 +418,7 @@ module Bundler
removed_message =
"`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true)
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
with_env(unbundled_env) { Kernel.system(*args) }
end
@ -440,7 +440,7 @@ module Bundler
removed_message =
"`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true)
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
with_env(unbundled_env) { Kernel.exec(*args) }
end
@ -517,7 +517,7 @@ module Bundler
raise MarshalError, "#{e.class}: #{e.message}"
end
else
load_marshal(data, :marshal_proc => SafeMarshal.proc)
load_marshal(data, marshal_proc: SafeMarshal.proc)
end
end

Просмотреть файл

@ -29,7 +29,7 @@ module Bundler
# commit instance variable then we can't determine its commits SHA.
git_dir = File.expand_path("../../../.git", __dir__)
if File.directory?(git_dir)
return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { :chdir => git_dir }, &:read).strip.freeze
return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { chdir: git_dir }, &:read).strip.freeze
end
@git_commit_sha ||= "unknown"

Просмотреть файл

@ -17,6 +17,6 @@ end
Capistrano::Configuration.instance(:must_exist).load do
before "deploy:finalize_update", "bundle:install"
Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
Bundler::Deployment.define_task(self, :task, except: { no_release: true })
set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
end

Просмотреть файл

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

Просмотреть файл

@ -80,10 +80,10 @@ module Bundler
unprinted_warnings.each {|w| Bundler.ui.warn(w) }
end
check_unknown_options!(:except => [:config, :exec])
check_unknown_options!(except: [:config, :exec])
stop_on_unknown_option! :exec
desc "cli_help", "Prints a summary of bundler commands", :hide => true
desc "cli_help", "Prints a summary of bundler commands", hide: true
def cli_help
version
Bundler.ui.info "\n"
@ -99,19 +99,19 @@ module Bundler
shell.say "Bundler commands:\n\n"
shell.say " Primary commands:\n"
shell.print_table(primary_commands, :indent => 4, :truncate => true)
shell.print_table(primary_commands, indent: 4, truncate: true)
shell.say
shell.say " Utilities:\n"
shell.print_table(utilities, :indent => 4, :truncate => true)
shell.print_table(utilities, indent: 4, truncate: true)
shell.say
self.class.send(:class_options_help, shell)
end
default_task(Bundler.feature_flag.default_cli_command)
class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM",
:desc => "Specify the number of times you wish to attempt network commands"
class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V"
class_option "no-color", type: :boolean, desc: "Disable colorization in output"
class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
desc: "Specify the number of times you wish to attempt network commands"
class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
def help(cli = nil)
case cli
@ -155,8 +155,8 @@ module Bundler
Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
dependency listed in the gemspec file to the newly created Gemfile.
D
method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
method_option "gemfile", :type => :string, :banner => "Use the specified name for the gemfile instead of 'Gemfile'"
method_option "gemspec", type: :string, banner: "Use the specified .gemspec to create the Gemfile"
method_option "gemfile", type: :string, banner: "Use the specified name for the gemfile instead of 'Gemfile'"
def init
require_relative "cli/init"
Init.new(options.dup).run
@ -168,12 +168,9 @@ module Bundler
all gems are found, Bundler prints a success message and exits with a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
D
method_option "dry-run", :type => :boolean, :default => false, :banner =>
"Lock the Gemfile"
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile"
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
def check
remembered_flag_deprecation("path")
@ -187,13 +184,12 @@ module Bundler
long_desc <<-D
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning.
D
method_option "install", :type => :boolean, :banner =>
"Runs 'bundle install' after removing the gems from the Gemfile"
method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
def remove(*gems)
if ARGV.include?("--install")
message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
SharedHelpers.major_deprecation(2, message, :removed_message => removed_message)
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
end
require_relative "cli/remove"
@ -211,47 +207,27 @@ module Bundler
If the bundle has already been installed, bundler will tell you so and then exit.
D
method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
"Generate bin stubs for bundled gems to ./bin"
method_option "clean", :type => :boolean, :banner =>
"Run bundle clean automatically after install"
method_option "deployment", :type => :boolean, :banner =>
"Install using defaults tuned for deployment environments"
method_option "frozen", :type => :boolean, :banner =>
"Do not allow the Gemfile.lock to be updated after this install"
method_option "full-index", :type => :boolean, :banner =>
"Fall back to using the single-file index of all gems"
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
"Specify the number of jobs to run in parallel"
method_option "local", :type => :boolean, :banner =>
"Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "prefer-local", :type => :boolean, :banner =>
"Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
method_option "no-cache", :type => :boolean, :banner =>
"Don't update the existing gem cache."
method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
"Force downloading every gem."
method_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
method_option "shebang", :type => :string, :banner =>
"Specify a different shebang executable name than the default (usually 'ruby')"
method_option "standalone", :type => :array, :lazy_default => [], :banner =>
"Make a bundle that can work without the Bundler runtime"
method_option "system", :type => :boolean, :banner =>
"Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
method_option "trust-policy", :alias => "P", :type => :string, :banner =>
"Gem trust policy (like gem install -P). Must be one of " +
Bundler.rubygems.security_policy_keys.join("|")
method_option "without", :type => :array, :banner =>
"Exclude gems that are part of the specified named group."
method_option "with", :type => :array, :banner =>
"Include gems that are part of the specified named group."
method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin"
method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install"
method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments"
method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install"
method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime"
method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of " +
Bundler.rubygems.security_policy_keys.join("|")
method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
def install
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
@ -264,7 +240,7 @@ module Bundler
remembered_negative_flag_deprecation("no-deployment")
require_relative "cli/install"
Bundler.settings.temporary(:no_install => false) do
Bundler.settings.temporary(no_install: false) do
Install.new(options.dup).run
end
end
@ -277,44 +253,27 @@ module Bundler
update when you have changed the Gemfile, or if you want to get the newest
possible versions of the gems in the bundle.
D
method_option "full-index", :type => :boolean, :banner =>
"Fall back to using the single-file index of all gems"
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "group", :aliases => "-g", :type => :array, :banner =>
"Update a specific group"
method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
"Specify the number of jobs to run in parallel"
method_option "local", :type => :boolean, :banner =>
"Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
method_option "source", :type => :array, :banner =>
"Update a specific source (and all gems associated with it)"
method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
"Force downloading every gem."
method_option "ruby", :type => :boolean, :banner =>
"Update ruby specified in Gemfile.lock"
method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
"Update the locked version of bundler"
method_option "patch", :type => :boolean, :banner =>
"Prefer updating only to next patch version"
method_option "minor", :type => :boolean, :banner =>
"Prefer updating only to next minor version"
method_option "major", :type => :boolean, :banner =>
"Prefer updating to next major version (default)"
method_option "pre", :type => :boolean, :banner =>
"Always choose the highest allowed version when updating gems, regardless of prerelease status"
method_option "strict", :type => :boolean, :banner =>
"Do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "conservative", :type => :boolean, :banner =>
"Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
method_option "all", :type => :boolean, :banner =>
"Update everything."
method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "group", aliases: "-g", type: :array, banner: "Update a specific group"
method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
method_option "all", type: :boolean, banner: "Update everything."
def update(*gems)
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require_relative "cli/update"
Bundler.settings.temporary(:no_install => false) do
Bundler.settings.temporary(no_install: false) do
Update.new(options, gems).run
end
end
@ -324,25 +283,25 @@ module Bundler
Show lists the names and versions of all gems that are required by your Gemfile.
Calling show with [GEM] will list the exact location of that gem on your machine.
D
method_option "paths", :type => :boolean,
:banner => "List the paths of all gems that are required by your Gemfile."
method_option "outdated", :type => :boolean,
:banner => "Show verbose output including whether gems are outdated."
method_option "paths", type: :boolean,
banner: "List the paths of all gems that are required by your Gemfile."
method_option "outdated", type: :boolean,
banner: "Show verbose output including whether gems are outdated."
def show(gem_name = nil)
if ARGV.include?("--outdated")
message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement"
SharedHelpers.major_deprecation(2, message, :removed_message => removed_message)
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
end
require_relative "cli/show"
Show.new(options, gem_name).run
end
desc "list", "List all gems in the bundle"
method_option "name-only", :type => :boolean, :banner => "print only the gem names"
method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
method_option "name-only", type: :boolean, banner: "print only the gem names"
method_option "only-group", type: :array, default: [], banner: "print gems from a given set of groups"
method_option "without-group", type: :array, default: [], banner: "print all gems except from a given set of groups"
method_option "paths", type: :boolean, banner: "print the path to each gem in the bundle"
def list
require_relative "cli/list"
List.new(options).run
@ -351,8 +310,8 @@ module Bundler
map aliases_for("list")
desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem"
method_option "version", :type => :boolean, :banner => "Print gem version"
method_option "path", type: :boolean, banner: "Print full path to gem"
method_option "version", type: :boolean, banner: "Print gem version"
def info(gem_name)
require_relative "cli/info"
Info.new(options, gem_name).run
@ -364,18 +323,12 @@ module Bundler
or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]]
will create binstubs for all given gems.
D
method_option "force", :type => :boolean, :default => false, :banner =>
"Overwrite existing binstubs if they exist"
method_option "path", :type => :string, :lazy_default => "bin", :banner =>
"Binstub destination directory (default bin)"
method_option "shebang", :type => :string, :banner =>
"Specify a different shebang executable name than the default (usually 'ruby')"
method_option "standalone", :type => :boolean, :banner =>
"Make binstubs that can work without the Bundler runtime"
method_option "all", :type => :boolean, :banner =>
"Install binstubs for all gems"
method_option "all-platforms", :type => :boolean, :default => false, :banner =>
"Install binstubs for all platforms"
method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist"
method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)"
method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime"
method_option "all", type: :boolean, banner: "Install binstubs for all gems"
method_option "all-platforms", type: :boolean, default: false, banner: "Install binstubs for all platforms"
def binstubs(*gems)
require_relative "cli/binstubs"
Binstubs.new(options, gems).run
@ -385,19 +338,18 @@ module Bundler
long_desc <<-D
Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
D
method_option "version", :aliases => "-v", :type => :string
method_option "group", :aliases => "-g", :type => :string
method_option "source", :aliases => "-s", :type => :string
method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
method_option "path", :type => :string
method_option "git", :type => :string
method_option "github", :type => :string
method_option "branch", :type => :string
method_option "ref", :type => :string
method_option "skip-install", :type => :boolean, :banner =>
"Adds gem to the Gemfile but does not install it"
method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
method_option "strict", :type => :boolean, :banner => "Adds strict declaration of version to gem"
method_option "version", aliases: "-v", type: :string
method_option "group", aliases: "-g", type: :string
method_option "source", aliases: "-s", type: :string
method_option "require", aliases: "-r", type: :string, banner: "Adds require path to gem. Provide false, or a path as a string."
method_option "path", type: :string
method_option "git", type: :string
method_option "github", type: :string
method_option "branch", type: :string
method_option "ref", type: :string
method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it"
method_option "optimistic", type: :boolean, banner: "Adds optimistic declaration of version to gem"
method_option "strict", type: :boolean, banner: "Adds strict declaration of version to gem"
def add(*gems)
require_relative "cli/add"
Add.new(options.dup, gems).run
@ -413,55 +365,46 @@ module Bundler
For more information on patch level options (--major, --minor, --patch,
--strict) see documentation on the same options on the update command.
D
method_option "group", :type => :string, :banner => "List gems from a specific group"
method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
method_option "local", :type => :boolean, :banner =>
"Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
method_option "source", :type => :array, :banner => "Check against a specific source"
method_option "filter-strict", :type => :boolean, :aliases => "--strict", :banner =>
"Only list newer versions allowed by your Gemfile requirements"
method_option "update-strict", :type => :boolean, :banner =>
"Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version"
method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions"
method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions"
method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions"
method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner =>
"Use minimal formatting for more parseable output"
method_option "json", :type => :boolean, :banner => "Produce parseable json output"
method_option "only-explicit", :type => :boolean, :banner =>
"Only list gems specified in your Gemfile, not their dependencies"
method_option "group", type: :string, banner: "List gems from a specific group"
method_option "groups", type: :boolean, banner: "List gems organized by groups"
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "pre", type: :boolean, banner: "Check for newer pre-release gems"
method_option "source", type: :array, banner: "Check against a specific source"
method_option "filter-strict", type: :boolean, aliases: "--strict", banner: "Only list newer versions allowed by your Gemfile requirements"
method_option "update-strict", type: :boolean, banner: "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
method_option "filter-major", type: :boolean, banner: "Only list major newer versions"
method_option "filter-minor", type: :boolean, banner: "Only list minor newer versions"
method_option "filter-patch", type: :boolean, banner: "Only list patch newer versions"
method_option "parseable", aliases: "--porcelain", type: :boolean, banner: "Use minimal formatting for more parseable output"
method_option "json", type: :boolean, banner: "Produce parseable json output"
method_option "only-explicit", type: :boolean, banner: "Only list gems specified in your Gemfile, not their dependencies"
def outdated(*gems)
require_relative "cli/outdated"
Outdated.new(options, gems).run
end
desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
method_option "group", :aliases => "-g", :type => :array, :banner =>
"Fetch funding information for a specific group"
method_option "group", aliases: "-g", type: :array, banner: "Fetch funding information for a specific group"
def fund
require_relative "cli/fund"
Fund.new(options).run
end
desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
method_option "all", :type => :boolean,
:default => Bundler.feature_flag.cache_all?,
:banner => "Include all sources (including path and git)."
method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
method_option "cache-path", :type => :string, :banner =>
"Specify a different cache path than the default (vendor/cache)."
method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only update the cache."
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
method_option "frozen", :type => :boolean, :banner =>
"Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
method_option "all", type: :boolean,
default: Bundler.feature_flag.cache_all?,
banner: "Include all sources (including path and git)."
method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
long_desc <<-D
The cache command will copy the .gem files for every gem in the bundle into the
directory ./vendor/cache. If you then check that directory into your source
@ -481,7 +424,7 @@ module Bundler
"The `--path` flag has been removed because its semantics were unclear. " \
"Use `bundle config cache_path` to configure the path of your cache of gems, " \
"and `bundle config path` to configure the path where your gems are installed."
SharedHelpers.major_deprecation 2, message, :removed_message => removed_message
SharedHelpers.major_deprecation 2, message, removed_message: removed_message
end
require_relative "cli/cache"
@ -491,8 +434,8 @@ module Bundler
map aliases_for("cache")
desc "exec [OPTIONS]", "Run the command in context of the bundle"
method_option :keep_file_descriptors, :type => :boolean, :default => true
method_option :gemfile, :type => :string, :required => false
method_option :keep_file_descriptors, type: :boolean, default: true
method_option :gemfile, type: :string, required: false
long_desc <<-D
Exec runs a command, providing it access to the gems in the bundle. While using
bundle exec you can require and call the bundled gems as if they were installed
@ -502,7 +445,7 @@ module Bundler
if ARGV.include?("--no-keep-file-descriptors")
message = "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
removed_message = "The `--no-keep-file-descriptors` has been removed. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
SharedHelpers.major_deprecation(2, message, :removed_message => removed_message)
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
end
require_relative "cli/exec"
@ -527,7 +470,7 @@ module Bundler
subcommand "config", Config
desc "open GEM", "Opens the source directory of the given bundled gem"
method_option "path", :type => :string, :lazy_default => "", :banner => "Open relative path of the gem source."
method_option "path", type: :string, lazy_default: "", banner: "Open relative path of the gem source."
def open(name)
require_relative "cli/open"
Open.new(options, name).run
@ -572,17 +515,17 @@ module Bundler
end
unless Bundler.feature_flag.bundler_3_mode?
desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
long_desc <<-D
Viz generates a PNG file of the current Gemfile as a dependency graph.
Viz requires the ruby-graphviz gem (and its dependencies).
The associated gems must also be installed via 'bundle install'.
D
method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option"
method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..."
method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency."
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
method_option :file, type: :string, default: "gem_graph", aliases: "-f", desc: "The name to use for the generated file. see format option"
method_option :format, type: :string, default: "png", aliases: "-F", desc: "This is output format option. Supported format is png, jpg, svg, dot ..."
method_option :requirements, type: :boolean, default: false, aliases: "-R", desc: "Set to show the version of each required dependency."
method_option :version, type: :boolean, default: false, aliases: "-v", desc: "Set to show each gem version."
method_option :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group."
def viz
SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
require_relative "cli/viz"
@ -593,23 +536,23 @@ module Bundler
old_gem = instance_method(:gem)
desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
:lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
:desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
method_option :ext, :type => :string, :desc => "Generate the boilerplate for C extension code.", :enum => EXTENSIONS
method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
:desc => "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
:desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library."
method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR",
lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library."
method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library",
desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "",
desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "",
desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
def gem(name)
end
@ -640,29 +583,24 @@ module Bundler
File.expand_path("templates", __dir__)
end
desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
method_option "dry-run", :type => :boolean, :default => false, :banner =>
"Only print out changes, do not clean gems"
method_option "force", :type => :boolean, :default => false, :banner =>
"Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application."
desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true
method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems"
method_option "force", type: :boolean, default: false, banner: "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application."
def clean
require_relative "cli/clean"
Clean.new(options.dup).run
end
desc "platform [OPTIONS]", "Displays platform compatibility information"
method_option "ruby", :type => :boolean, :default => false, :banner =>
"only display ruby related platform information"
method_option "ruby", type: :boolean, default: false, banner: "only display ruby related platform information"
def platform
require_relative "cli/platform"
Platform.new(options).run
end
desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true
method_option "source", :type => :string, :banner =>
"Install gem from the given source"
method_option "group", :type => :string, :banner =>
"Install gem into a bundler group"
desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
method_option "source", type: :string, banner: "Install gem from the given source"
method_option "group", type: :string, banner: "Install gem into a bundler group"
def inject(name, version)
SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
require_relative "cli/inject"
@ -670,36 +608,21 @@ module Bundler
end
desc "lock", "Creates a lockfile without installing"
method_option "update", :type => :array, :lazy_default => true, :banner =>
"ignore the existing lockfile, update all gems by default, or update list of given gems"
method_option "local", :type => :boolean, :default => false, :banner =>
"do not attempt to fetch remote gemspecs and use the local gem cache only"
method_option "print", :type => :boolean, :default => false, :banner =>
"print the lockfile to STDOUT instead of writing to the file system"
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "lockfile", :type => :string, :default => nil, :banner =>
"the path the lockfile should be written to"
method_option "full-index", :type => :boolean, :default => false, :banner =>
"Fall back to using the single-file index of all gems"
method_option "add-platform", :type => :array, :default => [], :banner =>
"Add a new platform to the lockfile"
method_option "remove-platform", :type => :array, :default => [], :banner =>
"Remove a platform from the lockfile"
method_option "patch", :type => :boolean, :banner =>
"If updating, prefer updating only to next patch version"
method_option "minor", :type => :boolean, :banner =>
"If updating, prefer updating only to next minor version"
method_option "major", :type => :boolean, :banner =>
"If updating, prefer updating to next major version (default)"
method_option "pre", :type => :boolean, :banner =>
"If updating, always choose the highest allowed version, regardless of prerelease status"
method_option "strict", :type => :boolean, :banner =>
"If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "conservative", :type => :boolean, :banner =>
"If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
"Update the locked version of bundler"
method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems"
method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only"
method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
def lock
require_relative "cli/lock"
Lock.new(options).run
@ -716,10 +639,8 @@ module Bundler
missing dependencies are detected, Bundler prints them and exits status 1.
Otherwise, Bundler prints a success message and exits with a status of 0.
D
method_option "gemfile", :type => :string, :banner =>
"Use the specified gemfile instead of Gemfile"
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
def doctor
require_relative "cli/doctor"
Doctor.new(options).run
@ -783,7 +704,7 @@ module Bundler
if deprecated_ext_value?(arguments)
message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used."
removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension."
SharedHelpers.major_deprecation 2, message, :removed_message => removed_message
SharedHelpers.major_deprecation 2, message, removed_message: removed_message
arguments[arguments.index("--ext")] = "--ext=c"
end
end
@ -918,7 +839,7 @@ module Bundler
"remembered across bundler invocations, which bundler will no longer " \
"do. Instead please use `bundle config set #{option_name} " \
"#{option_value}`, and stop using this flag"
Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
end
end
end

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -19,7 +19,7 @@ module Bundler
# TODO: move cache contents here now that all bundles are locked
custom_path = Bundler.settings[:path] if options[:path]
Bundler.settings.temporary(:cache_all_platforms => options["all-platforms"]) do
Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
Bundler.load.cache(custom_path)
end
end

Просмотреть файл

@ -32,7 +32,7 @@ module Bundler
Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present"
exit 1
else
Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"]
Bundler.load.lock(preserve_unknown_sections: true) unless options[:"dry-run"]
Bundler.ui.info "The Gemfile's dependencies are satisfied"
end
end

Просмотреть файл

@ -2,17 +2,17 @@
module Bundler
class CLI::Config < Thor
class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output"
class_option :parseable, type: :boolean, banner: "Use minimal formatting for more parseable output"
def self.scope_options
method_option :global, :type => :boolean, :banner => "Only change the global config"
method_option :local, :type => :boolean, :banner => "Only change the local config"
method_option :global, type: :boolean, banner: "Only change the global config"
method_option :local, type: :boolean, banner: "Only change the local config"
end
private_class_method :scope_options
desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true
desc "base NAME [VALUE]", "The Bundler 1 config interface", hide: true
scope_options
method_option :delete, :type => :boolean, :banner => "delete"
method_option :delete, type: :boolean, banner: "delete"
def base(name = nil, *value)
new_args =
if ARGV.size == 1
@ -27,7 +27,7 @@ module Bundler
message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead."
SharedHelpers.major_deprecation 3, message, :removed_message => removed_message
SharedHelpers.major_deprecation 3, message, removed_message: removed_message
Base.new(options, name, value, self).run
end

Просмотреть файл

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

Просмотреть файл

@ -12,7 +12,7 @@ module Bundler
@options = options
@cmd = args.shift
@args = args
@args << { :close_others => !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby?
@args << { close_others: !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby?
end
def run

Просмотреть файл

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

Просмотреть файл

@ -52,7 +52,7 @@ module Bundler
if options["binstubs"]
Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs --all`",
:removed_message => "The --binstubs option have been removed in favor of `bundle binstubs --all`"
removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`"
end
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
@ -62,7 +62,7 @@ module Bundler
installer = Installer.install(Bundler.root, definition, options)
Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
Bundler.settings.temporary(cache_all_platforms: options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
end
@ -96,7 +96,7 @@ module Bundler
def warn_if_root
return if Bundler.settings[:silence_root_warning] || Gem.win_platform? || !Process.uid.zero?
Bundler.ui.warn "Don't run Bundler as root. Installing your bundle as root " \
"will break this application for all non-root users on this machine.", :wrap => true
"will break this application for all non-root users on this machine.", wrap: true
end
def dependencies_count_for(definition)
@ -149,7 +149,7 @@ module Bundler
Bundler.settings.set_command_option_if_given :path, options[:path]
if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
Bundler.settings.temporary(:path_relative_to_cwd => false) do
Bundler.settings.temporary(path_relative_to_cwd: false) do
Bundler.settings.set_command_option :path, "bundle"
end
end

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -528,7 +528,7 @@ module Bundler
@resolution_packages ||= begin
last_resolve = converge_locked_specs
remove_invalid_platforms!(current_dependencies)
packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlock[:gems], prerelease: gem_version_promoter.pre?)
additional_base_requirements_for_resolve(packages, last_resolve)
end
end
@ -916,9 +916,9 @@ module Bundler
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
all_requirements = source_map.all_requirements
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
{ :default => default_source }.merge(all_requirements)
{ default: default_source }.merge(all_requirements)
else
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
{ default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
end
source_requirements.merge!(source_map.locked_requirements) unless @remote
metadata_dependencies.each do |dep|

Просмотреть файл

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

Просмотреть файл

@ -76,11 +76,11 @@ module Bundler
@gemspecs << spec
gem spec.name, :name => spec.name, :path => path, :glob => glob
gem spec.name, name: spec.name, path: path, glob: glob
group(development_group) do
spec.development_dependencies.each do |dep|
gem dep.name, *(dep.requirement.as_list + [:type => :development])
gem dep.name, *(dep.requirement.as_list + [type: :development])
end
end
when 0
@ -435,7 +435,7 @@ module Bundler
removed_message =
"The source :#{source} is disallowed because HTTP requests are insecure.\n" \
"Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not."
Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
"http://rubygems.org"
when String
source
@ -490,7 +490,7 @@ module Bundler
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this error, use " \
"a block to indicate which gems should come from the secondary source."
Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
end
end

Просмотреть файл

@ -253,7 +253,7 @@ module Bundler
Bundler.settings[:ssl_client_cert]
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
con = PersistentHTTP.new name: "bundler", proxy: :ENV
if gem_proxy = Gem.configuration[:http_proxy]
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
end

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -136,12 +136,12 @@ module Bundler
mode = Gem.win_platform? ? "wb:UTF-8" : "w"
require "erb"
content = ERB.new(template, :trim_mode => "-").result(binding)
content = ERB.new(template, trim_mode: "-").result(binding)
File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
File.write(binstub_path, content, mode: mode, perm: 0o777 & ~File.umask)
if Gem.win_platform? || options[:all_platforms]
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
File.write("#{binstub_path}.cmd", prefix + content, :mode => mode)
File.write("#{binstub_path}.cmd", prefix + content, mode: mode)
end
end
@ -179,12 +179,12 @@ module Bundler
mode = Gem.win_platform? ? "wb:UTF-8" : "w"
require "erb"
content = ERB.new(template, :trim_mode => "-").result(binding)
content = ERB.new(template, trim_mode: "-").result(binding)
File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
File.write("#{bin_path}/#{executable}", content, mode: mode, perm: 0o755)
if Gem.win_platform? || options[:all_platforms]
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode)
File.write("#{bin_path}/#{executable}.cmd", prefix + content, mode: mode)
end
end
end

Просмотреть файл

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

Просмотреть файл

@ -56,7 +56,7 @@ module Bundler
if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
full_path
else
SharedHelpers.relative_path_to(full_path, :from => Bundler.root.join(bundler_path))
SharedHelpers.relative_path_to(full_path, from: Bundler.root.join(bundler_path))
end
rescue TypeError
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"

Просмотреть файл

@ -102,7 +102,7 @@ module Bundler
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
specification = __materialize__(installable_candidates, fallback_to_non_installable: false)
return specification unless specification.nil?
if target_platform != platform

Просмотреть файл

@ -101,7 +101,7 @@ module Bundler
# @param [Pathname] gemfile path
# @param [Proc] block that can be evaluated for (inline) Gemfile
def gemfile_install(gemfile = nil, &inline)
Bundler.settings.temporary(:frozen => false, :deployment => false) do
Bundler.settings.temporary(frozen: false, deployment: false) do
builder = DSL.new
if block_given?
builder.instance_eval(&inline)

Просмотреть файл

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

Просмотреть файл

@ -83,7 +83,7 @@ module Bundler
Bundler.configure_gem_home_and_path(Plugin.root)
Bundler.settings.temporary(:deployment => false, :frozen => false) do
Bundler.settings.temporary(deployment: false, frozen: false) do
definition = Definition.new(nil, deps, source_list, true)
install_definition(definition)

Просмотреть файл

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

Просмотреть файл

@ -24,7 +24,7 @@ module Bundler
name = dep.name
@packages[name] = Package.new(name, dep_platforms, **options.merge(:dependency => dep))
@packages[name] = Package.new(name, dep_platforms, **options.merge(dependency: dep))
dep
end.compact

Просмотреть файл

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

Просмотреть файл

@ -376,7 +376,7 @@ module Gem
remove_method :glob_files_in_dir
def glob_files_in_dir(glob, base_path)
Dir.glob(glob, :base => base_path).map! {|f| File.expand_path(f, base_path) }
Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) }
end
end
end

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -39,7 +39,7 @@ permission to.
add_proxy_option
add_key_option
add_otp_option
defaults.merge! :add => [], :remove => []
defaults.merge! add: [], remove: []
add_option "-a", "--add NEW_OWNER", "Add an owner by user identifier" do |value, options|
options[:add] << value

Просмотреть файл

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

Просмотреть файл

@ -30,7 +30,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
end
def initialize
super "push", "Push a gem up to the gem server", :host => host
super "push", "Push a gem up to the gem server", host: host
@user_defined_host = false

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -198,7 +198,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
output, status =
begin
Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", :chdir => cargo_dir)
Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", chdir: cargo_dir)
rescue StandardError => error
raise Gem::InstallError, "cargo metadata failed #{error.message}"
end

Просмотреть файл

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

Просмотреть файл

@ -136,7 +136,7 @@ module Gem::GemcutterUtilities
sign_in_host, scope: scope) do |request|
request.basic_auth email, password
request["OTP"] = otp if otp
request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params))
request.body = URI.encode_www_form({ api_key: api_key }.merge(update_scope_params))
end
with_response response do |_resp|

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -384,7 +384,7 @@ EOM
def extract_files(destination_dir, pattern = "*")
verify unless @spec
FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0o755
FileUtils.mkdir_p destination_dir, mode: dir_mode && 0o755
@gem.with_read_io do |io|
reader = Gem::Package::TarReader.new io

Просмотреть файл

@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
FileUtils.rm_rf destination
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0o755
FileUtils.mkdir_p File.dirname(destination), mode: dir_mode && 0o755
File.open destination, "wb", file_mode(entry["mode"]) do |out|
out.write file_data

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -88,7 +88,7 @@ RSpec.describe Bundler do
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
# spec_helper forces the external encoding to UTF-8 but that's not the
# default until Ruby 2.0
@ -139,7 +139,7 @@ RSpec.describe Bundler do
end
GEMSPEC
end
expect(Bundler.rubygems).to receive(:validate).with have_attributes(:name => "validated")
expect(Bundler.rubygems).to receive(:validate).with have_attributes(name: "validated")
subject
end
end

Просмотреть файл

@ -5,12 +5,12 @@ require "json"
RSpec.describe "bundle executable" 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
end
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
end
@ -88,7 +88,7 @@ RSpec.describe "bundle executable" do
end
context "with no arguments" do
it "prints a concise help message", :bundler => "3" do
it "prints a concise help message", bundler: "3" do
bundle ""
expect(err).to be_empty
expect(out).to include("Bundler version #{Bundler::VERSION}").
@ -106,7 +106,7 @@ RSpec.describe "bundle executable" do
gem 'rack'
G
bundle :install, :env => { "BUNDLE_GEMFILE" => "" }
bundle :install, env: { "BUNDLE_GEMFILE" => "" }
expect(the_bundle).to include_gems "rack 1.0.0"
end
@ -115,17 +115,17 @@ RSpec.describe "bundle executable" do
context "with --verbose" do
it "prints the running command" do
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}")
end
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}")
end
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}")
end
end
@ -134,7 +134,7 @@ RSpec.describe "bundle executable" do
let(:run_command) do
bundle "install"
bundle "outdated #{flags}", :raise_on_error => false
bundle "outdated #{flags}", raise_on_error: false
end
before do
@ -199,7 +199,7 @@ RSpec.describe "bundle executable" do
describe "printing the outdated warning" do
shared_examples_for "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\".")
end
end
@ -234,7 +234,7 @@ RSpec.describe "bundle executable" do
context "when the latest version is greater than the current version" do
let(:latest_version) { "222.0" }
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)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
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
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"
end
context "running a parseable command" 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 ""
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"
end
end
@ -259,7 +259,7 @@ To update to the most recent version, run `bundle update --bundler`
context "and is a pre-release" do
let(:latest_version) { "222.0.0.pre.4" }
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)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
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
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"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
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"
expect(out).to eq(Bundler::VERSION)
end

Просмотреть файл

@ -14,7 +14,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
let(:remote_path) { double(:remote_path) }
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) }
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 }
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("ETag") { "NewEtag" }
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
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("ETag") { "NewEtag" }
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
# 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
allow(response).to receive(:[]).with("Repr-Digest") { nil }
@ -206,7 +206,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end
context "when the download is corrupt" do
let(:response) { double(:response, :body => "") }
let(:response) { double(:response, body: "") }
it "raises HTTPError" do
expect(fetcher).to receive(:call).and_raise(Zlib::GzipFile::Error)
@ -218,7 +218,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end
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
old_verbose = $VERBOSE

Просмотреть файл

@ -7,7 +7,7 @@ RSpec.describe Bundler::Definition do
before do
allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") }
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
context "when it's not possible to write to the file" do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
@ -45,14 +45,14 @@ RSpec.describe Bundler::Definition do
describe "detects 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
source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
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"
end
@ -61,7 +61,7 @@ RSpec.describe Bundler::Definition do
c.checksum gem_repo1, "rack", "1.0.0"
end
bundle :install, :env => { "DEBUG" => "1" }
bundle :install, env: { "DEBUG" => "1" }
expect(out).to match(/re-resolving dependencies/)
expect(lockfile).to eq <<~G
@ -100,13 +100,13 @@ RSpec.describe Bundler::Definition do
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\)/)
end
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_development_dependency "net-ssh", "1.0"
end
@ -121,7 +121,7 @@ RSpec.describe Bundler::Definition do
gem "foo", :path => "#{lib_path("foo")}"
G
bundle :check, :env => { "DEBUG" => "1" }
bundle :check, env: { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/)
expect(lockfile).to eq <<~G
@ -158,7 +158,7 @@ RSpec.describe Bundler::Definition do
G
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(lockfile).to eq <<~G
@ -188,7 +188,7 @@ RSpec.describe Bundler::Definition do
gem "foo"
G
bundle :check, :env => { "DEBUG" => "1" }
bundle :check, env: { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/)
expect(lockfile).to eq <<~G
@ -278,7 +278,7 @@ RSpec.describe Bundler::Definition do
bundled_app_lock,
updated_deps_in_gemfile,
source_list,
:gems => ["shared_owner_a"], :conservative => true
gems: ["shared_owner_a"], conservative: true
)
locked = definition.send(:converge_locked_specs).map(&:name)
expect(locked).to eq %w[isolated_dep isolated_owner shared_dep shared_owner_b]

Просмотреть файл

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

Просмотреть файл

@ -10,7 +10,7 @@ RSpec.describe Bundler::Dsl do
it "registers custom hosts" do
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.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"
expect(subject.dependencies.first.source.uri).to eq(example_uri)
end
@ -26,7 +26,7 @@ RSpec.describe Bundler::Dsl do
end
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"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
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
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(
Bundler::GemfileError,
%(The :branch option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`),
)
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(
Bundler::GemfileError,
%(The :ref option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`),
)
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(
Bundler::GemfileError,
%(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
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(
Bundler::GemfileError,
%(The :git option can't be used with `github: "indirect/sparks"`),
)
end
context "default hosts", :bundler => "< 3" do
context "default hosts", bundler: "< 3" 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"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
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"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
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"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
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"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
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"
expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri)
end
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"
expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri)
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,
: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
subject.gem("foo", :platform => platform)
subject.gem("foo", platform: platform)
end
end
# rubocop:enable Naming/VariableNumber
it "allows platforms matching the running Ruby version" do
platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}"
subject.gem("foo", :platform => platform)
subject.gem("foo", platform: platform)
end
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/)
end
@ -203,19 +203,19 @@ RSpec.describe Bundler::Dsl do
end
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/)
end
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
expect(dep.name).to eq "foo"
end
it "allows specifying a branch on git gems with a git_source" do
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
expect(dep.name).to eq "foo"
end
@ -280,7 +280,7 @@ RSpec.describe Bundler::Dsl do
allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile"))
subject.source("https://other-source.org") do
subject.gem("dobry-pies", :path => "foo")
subject.gem("dobry-pies", path: "foo")
subject.gem("foo")
end
@ -292,7 +292,7 @@ RSpec.describe Bundler::Dsl do
describe "#check_primary_source_safety" do
context "when a global source is not defined implicitly" 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)
warning = "This Gemfile does not include an explicit global source. " \

Просмотреть файл

@ -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
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)
expect(spec.required_ruby_version). eql?(remote_value)
end
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)
expect(spec.required_ruby_version). eql?(Gem::Requirement.default)
end
end
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)
other_spec = described_class.new("bar", version, platform, spec_fetcher, dependencies, metadata)
expect(spec).to eql(spec)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше