mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
This commit is contained in:
parent
6650899248
commit
8f37629519
155 changed files with 1366 additions and 1648 deletions
106
lib/bundler.rb
106
lib/bundler.rb
|
@ -1,20 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/compatibility_guard"
|
||||
require_relative "bundler/compatibility_guard"
|
||||
|
||||
require "bundler/vendored_fileutils"
|
||||
require_relative "bundler/vendored_fileutils"
|
||||
require "pathname"
|
||||
require "rbconfig"
|
||||
|
||||
require "bundler/errors"
|
||||
require "bundler/environment_preserver"
|
||||
require "bundler/plugin"
|
||||
require "bundler/rubygems_ext"
|
||||
require "bundler/rubygems_integration"
|
||||
require "bundler/version"
|
||||
require "bundler/constants"
|
||||
require "bundler/current_ruby"
|
||||
require "bundler/build_metadata"
|
||||
require_relative "bundler/errors"
|
||||
require_relative "bundler/environment_preserver"
|
||||
require_relative "bundler/plugin"
|
||||
require_relative "bundler/rubygems_ext"
|
||||
require_relative "bundler/rubygems_integration"
|
||||
require_relative "bundler/version"
|
||||
require_relative "bundler/constants"
|
||||
require_relative "bundler/current_ruby"
|
||||
require_relative "bundler/build_metadata"
|
||||
|
||||
module Bundler
|
||||
environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
|
||||
|
@ -22,43 +22,43 @@ module Bundler
|
|||
ENV.replace(environment_preserver.backup)
|
||||
SUDO_MUTEX = Mutex.new
|
||||
|
||||
autoload :Definition, "bundler/definition"
|
||||
autoload :Dependency, "bundler/dependency"
|
||||
autoload :DepProxy, "bundler/dep_proxy"
|
||||
autoload :Deprecate, "bundler/deprecate"
|
||||
autoload :Dsl, "bundler/dsl"
|
||||
autoload :EndpointSpecification, "bundler/endpoint_specification"
|
||||
autoload :Env, "bundler/env"
|
||||
autoload :Fetcher, "bundler/fetcher"
|
||||
autoload :FeatureFlag, "bundler/feature_flag"
|
||||
autoload :GemHelper, "bundler/gem_helper"
|
||||
autoload :GemHelpers, "bundler/gem_helpers"
|
||||
autoload :GemRemoteFetcher, "bundler/gem_remote_fetcher"
|
||||
autoload :GemVersionPromoter, "bundler/gem_version_promoter"
|
||||
autoload :Graph, "bundler/graph"
|
||||
autoload :Index, "bundler/index"
|
||||
autoload :Injector, "bundler/injector"
|
||||
autoload :Installer, "bundler/installer"
|
||||
autoload :LazySpecification, "bundler/lazy_specification"
|
||||
autoload :LockfileParser, "bundler/lockfile_parser"
|
||||
autoload :MatchPlatform, "bundler/match_platform"
|
||||
autoload :ProcessLock, "bundler/process_lock"
|
||||
autoload :RemoteSpecification, "bundler/remote_specification"
|
||||
autoload :Resolver, "bundler/resolver"
|
||||
autoload :Retry, "bundler/retry"
|
||||
autoload :RubyDsl, "bundler/ruby_dsl"
|
||||
autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer"
|
||||
autoload :RubyVersion, "bundler/ruby_version"
|
||||
autoload :Runtime, "bundler/runtime"
|
||||
autoload :Settings, "bundler/settings"
|
||||
autoload :SharedHelpers, "bundler/shared_helpers"
|
||||
autoload :Source, "bundler/source"
|
||||
autoload :SourceList, "bundler/source_list"
|
||||
autoload :SpecSet, "bundler/spec_set"
|
||||
autoload :StubSpecification, "bundler/stub_specification"
|
||||
autoload :UI, "bundler/ui"
|
||||
autoload :URICredentialsFilter, "bundler/uri_credentials_filter"
|
||||
autoload :VersionRanges, "bundler/version_ranges"
|
||||
autoload :Definition, File.expand_path("bundler/definition", __dir__)
|
||||
autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
|
||||
autoload :DepProxy, File.expand_path("bundler/dep_proxy", __dir__)
|
||||
autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
|
||||
autoload :Dsl, File.expand_path("bundler/dsl", __dir__)
|
||||
autoload :EndpointSpecification, File.expand_path("bundler/endpoint_specification", __dir__)
|
||||
autoload :Env, File.expand_path("bundler/env", __dir__)
|
||||
autoload :Fetcher, File.expand_path("bundler/fetcher", __dir__)
|
||||
autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
|
||||
autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
|
||||
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
||||
autoload :GemRemoteFetcher, File.expand_path("bundler/gem_remote_fetcher", __dir__)
|
||||
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
|
||||
autoload :Graph, File.expand_path("bundler/graph", __dir__)
|
||||
autoload :Index, File.expand_path("bundler/index", __dir__)
|
||||
autoload :Injector, File.expand_path("bundler/injector", __dir__)
|
||||
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
||||
autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
|
||||
autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
|
||||
autoload :MatchPlatform, File.expand_path("bundler/match_platform", __dir__)
|
||||
autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
|
||||
autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
|
||||
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
|
||||
autoload :Retry, File.expand_path("bundler/retry", __dir__)
|
||||
autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
|
||||
autoload :RubyGemsGemInstaller, File.expand_path("bundler/rubygems_gem_installer", __dir__)
|
||||
autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
|
||||
autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
|
||||
autoload :Settings, File.expand_path("bundler/settings", __dir__)
|
||||
autoload :SharedHelpers, File.expand_path("bundler/shared_helpers", __dir__)
|
||||
autoload :Source, File.expand_path("bundler/source", __dir__)
|
||||
autoload :SourceList, File.expand_path("bundler/source_list", __dir__)
|
||||
autoload :SpecSet, File.expand_path("bundler/spec_set", __dir__)
|
||||
autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
|
||||
autoload :UI, File.expand_path("bundler/ui", __dir__)
|
||||
autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
|
||||
autoload :VersionRanges, File.expand_path("bundler/version_ranges", __dir__)
|
||||
|
||||
class << self
|
||||
def configure
|
||||
|
@ -197,19 +197,19 @@ module Bundler
|
|||
def user_bundle_path(dir = "home")
|
||||
env_var, fallback = case dir
|
||||
when "home"
|
||||
["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
|
||||
["BUNDLE_USER_HOME", proc { Pathname.new(user_home).join(".bundle") }]
|
||||
when "cache"
|
||||
["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
|
||||
["BUNDLE_USER_CACHE", proc { user_bundle_path.join("cache") }]
|
||||
when "config"
|
||||
["BUNDLE_USER_CONFIG", user_bundle_path.join("config")]
|
||||
["BUNDLE_USER_CONFIG", proc { user_bundle_path.join("config") }]
|
||||
when "plugin"
|
||||
["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
|
||||
["BUNDLE_USER_PLUGIN", proc { user_bundle_path.join("plugin") }]
|
||||
else
|
||||
raise BundlerError, "Unknown user path requested: #{dir}"
|
||||
end
|
||||
# `fallback` will already be a Pathname, but Pathname.new() is
|
||||
# idempotent so it's OK
|
||||
Pathname.new(ENV.fetch(env_var, fallback))
|
||||
Pathname.new(ENV.fetch(env_var, &fallback))
|
||||
end
|
||||
|
||||
def user_cache
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require File.expand_path("../lib/bundler/version", __FILE__)
|
||||
require_relative "lib/bundler/version"
|
||||
rescue LoadError
|
||||
# for Ruby core repository
|
||||
require File.expand_path("../version", __FILE__)
|
||||
require_relative "version"
|
||||
end
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
@ -31,27 +31,23 @@ Gem::Specification.new do |s|
|
|||
}
|
||||
end
|
||||
|
||||
if s.version >= Gem::Version.new("2.a".dup)
|
||||
s.required_ruby_version = ">= 2.3.0"
|
||||
s.required_rubygems_version = ">= 2.5.0"
|
||||
else
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
s.required_rubygems_version = ">= 1.3.6"
|
||||
end
|
||||
s.required_ruby_version = ">= 2.3.0"
|
||||
s.required_rubygems_version = ">= 2.5.0"
|
||||
|
||||
s.add_development_dependency "automatiek", "~> 0.1.0"
|
||||
s.add_development_dependency "rake", "~> 12.0"
|
||||
s.add_development_dependency "ronn", "~> 0.7.3"
|
||||
s.add_development_dependency "rspec", "~> 3.6"
|
||||
s.add_development_dependency "rubocop", "= 0.65.0"
|
||||
s.add_development_dependency "rubocop", "= 0.68.1"
|
||||
s.add_development_dependency "rubocop-performance", "~> 1.1"
|
||||
|
||||
# s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
|
||||
s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
|
||||
|
||||
# we don't check in man pages, but we need to ship them because
|
||||
# we use them to generate the long-form help for each command.
|
||||
# s.files += Dir.glob("man/**/*")
|
||||
s.files += Dir.glob("man/**/*")
|
||||
# Include the CHANGELOG.md, LICENSE.md, README.md manually
|
||||
# s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
||||
s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
||||
# include the gemspec itself because warbler breaks w/o it
|
||||
s.files += %w[bundler.gemspec]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/shared_helpers"
|
||||
require_relative "shared_helpers"
|
||||
Bundler::SharedHelpers.major_deprecation 2,
|
||||
"The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"
|
||||
|
||||
|
@ -8,7 +8,7 @@ Bundler::SharedHelpers.major_deprecation 2,
|
|||
#
|
||||
# Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
|
||||
# Bundler will be activated after each new deployment.
|
||||
require "bundler/deployment"
|
||||
require_relative "deployment"
|
||||
require "capistrano/version"
|
||||
|
||||
if defined?(Capistrano::Version) && Gem::Version.new(Capistrano::Version).release >= Gem::Version.new("3.0")
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler"
|
||||
require "bundler/vendored_thor"
|
||||
require_relative "vendored_thor"
|
||||
|
||||
module Bundler
|
||||
class CLI < Thor
|
||||
require "bundler/cli/common"
|
||||
require_relative "cli/common"
|
||||
|
||||
package_name "Bundler"
|
||||
|
||||
|
@ -139,7 +138,7 @@ module Bundler
|
|||
D
|
||||
method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
|
||||
def init
|
||||
require "bundler/cli/init"
|
||||
require_relative "cli/init"
|
||||
Init.new(options.dup).run
|
||||
end
|
||||
|
||||
|
@ -157,7 +156,7 @@ module Bundler
|
|||
"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?}"
|
||||
map "c" => "check"
|
||||
def check
|
||||
require "bundler/cli/check"
|
||||
require_relative "cli/check"
|
||||
Check.new(options).run
|
||||
end
|
||||
|
||||
|
@ -168,7 +167,7 @@ module Bundler
|
|||
method_option "install", :type => :boolean, :banner =>
|
||||
"Runs 'bundle install' after removing the gems from the Gemfile"
|
||||
def remove(*gems)
|
||||
require "bundler/cli/remove"
|
||||
require_relative "cli/remove"
|
||||
Remove.new(gems, options).run
|
||||
end
|
||||
|
||||
|
@ -230,7 +229,7 @@ module Bundler
|
|||
remembered_flag_deprecation(option)
|
||||
end
|
||||
|
||||
require "bundler/cli/install"
|
||||
require_relative "cli/install"
|
||||
Bundler.settings.temporary(:no_install => false) do
|
||||
Install.new(options.dup).run
|
||||
end
|
||||
|
@ -276,7 +275,7 @@ module Bundler
|
|||
"Update everything."
|
||||
def update(*gems)
|
||||
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
|
||||
require "bundler/cli/update"
|
||||
require_relative "cli/update"
|
||||
Bundler.settings.temporary(:no_install => false) do
|
||||
Update.new(options, gems).run
|
||||
end
|
||||
|
@ -312,7 +311,7 @@ module Bundler
|
|||
Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
|
||||
end
|
||||
end
|
||||
require "bundler/cli/show"
|
||||
require_relative "cli/show"
|
||||
Show.new(options, gem_name).run
|
||||
end
|
||||
end
|
||||
|
@ -323,7 +322,7 @@ module Bundler
|
|||
method_option "without-group", :type => :string, :banner => "print all gems except from a group"
|
||||
method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
|
||||
def list
|
||||
require "bundler/cli/list"
|
||||
require_relative "cli/list"
|
||||
List.new(options).run
|
||||
end
|
||||
|
||||
|
@ -332,7 +331,7 @@ module Bundler
|
|||
desc "info GEM [OPTIONS]", "Show information for the given gem"
|
||||
method_option "path", :type => :boolean, :banner => "Print full path to gem"
|
||||
def info(gem_name)
|
||||
require "bundler/cli/info"
|
||||
require_relative "cli/info"
|
||||
Info.new(options, gem_name).run
|
||||
end
|
||||
|
||||
|
@ -353,7 +352,7 @@ module Bundler
|
|||
method_option "all", :type => :boolean, :banner =>
|
||||
"Install binstubs for all gems"
|
||||
def binstubs(*gems)
|
||||
require "bundler/cli/binstubs"
|
||||
require_relative "cli/binstubs"
|
||||
Binstubs.new(options, gems).run
|
||||
end
|
||||
|
||||
|
@ -364,12 +363,14 @@ module Bundler
|
|||
method_option "version", :aliases => "-v", :type => :string
|
||||
method_option "group", :aliases => "-g", :type => :string
|
||||
method_option "source", :aliases => "-s", :type => :string
|
||||
method_option "git", :type => :string
|
||||
method_option "branch", :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 "bundler/cli/add"
|
||||
require_relative "cli/add"
|
||||
Add.new(options.dup, gems).run
|
||||
end
|
||||
|
||||
|
@ -405,7 +406,7 @@ module Bundler
|
|||
method_option "only-explicit", :type => :boolean, :banner =>
|
||||
"Only list gems specified in your Gemfile, not their dependencies"
|
||||
def outdated(*gems)
|
||||
require "bundler/cli/outdated"
|
||||
require_relative "cli/outdated"
|
||||
Outdated.new(options, gems).run
|
||||
end
|
||||
|
||||
|
@ -420,7 +421,7 @@ module Bundler
|
|||
method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
|
||||
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
|
||||
def cache
|
||||
require "bundler/cli/cache"
|
||||
require_relative "cli/cache"
|
||||
Cache.new(options).run
|
||||
end
|
||||
end
|
||||
|
@ -448,7 +449,7 @@ module Bundler
|
|||
bundle without having to download any additional gems.
|
||||
D
|
||||
def package
|
||||
require "bundler/cli/package"
|
||||
require_relative "cli/package"
|
||||
Package.new(options).run
|
||||
end
|
||||
map %w[pack] => :package
|
||||
|
@ -463,7 +464,7 @@ module Bundler
|
|||
D
|
||||
map "e" => "exec"
|
||||
def exec(*args)
|
||||
require "bundler/cli/exec"
|
||||
require_relative "cli/exec"
|
||||
Exec.new(options, args).run
|
||||
end
|
||||
|
||||
|
@ -479,19 +480,19 @@ module Bundler
|
|||
will show the current value, as well as any superceded values and
|
||||
where they were specified.
|
||||
D
|
||||
require "bundler/cli/config"
|
||||
require_relative "cli/config"
|
||||
subcommand "config", Config
|
||||
|
||||
desc "open GEM", "Opens the source directory of the given bundled gem"
|
||||
def open(name)
|
||||
require "bundler/cli/open"
|
||||
require_relative "cli/open"
|
||||
Open.new(options, name).run
|
||||
end
|
||||
|
||||
unless Bundler.feature_flag.bundler_3_mode?
|
||||
desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
|
||||
def console(group = nil)
|
||||
require "bundler/cli/console"
|
||||
require_relative "cli/console"
|
||||
Console.new(options, group).run
|
||||
end
|
||||
end
|
||||
|
@ -539,7 +540,7 @@ module Bundler
|
|||
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 moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
|
||||
require "bundler/cli/viz"
|
||||
require_relative "cli/viz"
|
||||
Viz.new(options.dup).run
|
||||
end
|
||||
end
|
||||
|
@ -563,7 +564,7 @@ module Bundler
|
|||
def gem_command.run(instance, args = [])
|
||||
arity = 1 # name
|
||||
|
||||
require "bundler/cli/gem"
|
||||
require_relative "cli/gem"
|
||||
cmd_args = args + [instance]
|
||||
cmd_args.unshift(instance.options)
|
||||
|
||||
|
@ -591,7 +592,7 @@ module Bundler
|
|||
method_option "force", :type => :boolean, :default => false, :banner =>
|
||||
"Forces clean even if --path is not set"
|
||||
def clean
|
||||
require "bundler/cli/clean"
|
||||
require_relative "cli/clean"
|
||||
Clean.new(options.dup).run
|
||||
end
|
||||
|
||||
|
@ -599,7 +600,7 @@ module Bundler
|
|||
method_option "ruby", :type => :boolean, :default => false, :banner =>
|
||||
"only display ruby related platform information"
|
||||
def platform
|
||||
require "bundler/cli/platform"
|
||||
require_relative "cli/platform"
|
||||
Platform.new(options).run
|
||||
end
|
||||
|
||||
|
@ -610,7 +611,7 @@ module Bundler
|
|||
"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 "bundler/cli/inject"
|
||||
require_relative "cli/inject"
|
||||
Inject.new(options.dup, name, version).run
|
||||
end
|
||||
|
||||
|
@ -642,7 +643,7 @@ module Bundler
|
|||
method_option "conservative", :type => :boolean, :banner =>
|
||||
"If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
|
||||
def lock
|
||||
require "bundler/cli/lock"
|
||||
require_relative "cli/lock"
|
||||
Lock.new(options).run
|
||||
end
|
||||
|
||||
|
@ -662,13 +663,13 @@ module Bundler
|
|||
method_option "quiet", :type => :boolean, :banner =>
|
||||
"Only output warnings and errors."
|
||||
def doctor
|
||||
require "bundler/cli/doctor"
|
||||
require_relative "cli/doctor"
|
||||
Doctor.new(options).run
|
||||
end
|
||||
|
||||
desc "issue", "Learn how to report an issue in Bundler"
|
||||
def issue
|
||||
require "bundler/cli/issue"
|
||||
require_relative "cli/issue"
|
||||
Issue.new.run
|
||||
end
|
||||
|
||||
|
@ -679,12 +680,12 @@ module Bundler
|
|||
checkout --force`.
|
||||
D
|
||||
def pristine(*gems)
|
||||
require "bundler/cli/pristine"
|
||||
require_relative "cli/pristine"
|
||||
Pristine.new(gems).run
|
||||
end
|
||||
|
||||
if Bundler.feature_flag.plugins?
|
||||
require "bundler/cli/plugin"
|
||||
require_relative "cli/plugin"
|
||||
desc "plugin", "Manage the bundler plugins"
|
||||
subcommand "plugin", Plugin
|
||||
end
|
||||
|
|
|
@ -2,34 +2,45 @@
|
|||
|
||||
module Bundler
|
||||
class CLI::Add
|
||||
attr_reader :gems, :options, :version
|
||||
|
||||
def initialize(options, gems)
|
||||
@gems = gems
|
||||
@options = options
|
||||
@options[:group] = @options[:group].split(",").map(&:strip) if !@options[:group].nil? && !@options[:group].empty?
|
||||
@options[:group] = options[:group].split(",").map(&:strip) unless options[:group].nil?
|
||||
@version = options[:version].split(",").map(&:strip) unless options[:version].nil?
|
||||
end
|
||||
|
||||
def run
|
||||
raise InvalidOption, "You can not specify `--strict` and `--optimistic` at the same time." if @options[:strict] && @options[:optimistic]
|
||||
validate_options!
|
||||
inject_dependencies
|
||||
perform_bundle_install unless options["skip-install"]
|
||||
end
|
||||
|
||||
# raise error when no gems are specified
|
||||
raise InvalidOption, "Please specify gems to add." if @gems.empty?
|
||||
private
|
||||
|
||||
version = @options[:version].nil? ? nil : @options[:version].split(",").map(&:strip)
|
||||
def perform_bundle_install
|
||||
Installer.install(Bundler.root, Bundler.definition)
|
||||
end
|
||||
|
||||
unless version.nil?
|
||||
version.each do |v|
|
||||
raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN =~ v.to_s
|
||||
end
|
||||
end
|
||||
|
||||
dependencies = @gems.map {|g| Bundler::Dependency.new(g, version, @options) }
|
||||
def inject_dependencies
|
||||
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
|
||||
|
||||
Installer.install(Bundler.root, Bundler.definition) unless @options["skip-install"]
|
||||
def validate_options!
|
||||
raise InvalidOption, "You can not specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
|
||||
|
||||
# raise error when no gems are specified
|
||||
raise InvalidOption, "Please specify gems to add." if gems.empty?
|
||||
|
||||
version.to_a.each do |v|
|
||||
raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN =~ v.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,17 +14,18 @@ module Bundler
|
|||
Bundler.ui.info msg
|
||||
end
|
||||
|
||||
def self.output_without_groups_message
|
||||
def self.output_without_groups_message(command)
|
||||
return if Bundler.settings[:without].empty?
|
||||
Bundler.ui.confirm without_groups_message
|
||||
Bundler.ui.confirm without_groups_message(command)
|
||||
end
|
||||
|
||||
def self.without_groups_message
|
||||
def self.without_groups_message(command)
|
||||
command_in_past_tense = command == :install ? "installed" : "updated"
|
||||
groups = Bundler.settings[:without]
|
||||
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
|
||||
reject {|s| s.to_s.empty? }.join(" and ")
|
||||
group_str = groups.size == 1 ? "group" : "groups"
|
||||
"Gems in the #{group_str} #{group_list} were not installed."
|
||||
"Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
|
||||
end
|
||||
|
||||
def self.select_spec(name, regex_match = nil)
|
||||
|
@ -59,7 +60,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def self.gem_not_found_message(missing_gem_name, alternatives)
|
||||
require "bundler/similarity_detector"
|
||||
require_relative "../similarity_detector"
|
||||
message = "Could not find gem '#{missing_gem_name}'."
|
||||
alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
|
||||
suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
|
||||
|
|
|
@ -56,7 +56,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def check!
|
||||
require "bundler/cli/check"
|
||||
require_relative "check"
|
||||
Bundler::CLI::Check.new({}).run
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/current_ruby"
|
||||
require_relative "../current_ruby"
|
||||
|
||||
module Bundler
|
||||
class CLI::Exec
|
||||
|
@ -27,12 +27,7 @@ module Bundler
|
|||
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
|
||||
return kernel_load(bin_path, *args)
|
||||
end
|
||||
# First, try to exec directly to something in PATH
|
||||
if Bundler.current_ruby.jruby_18?
|
||||
kernel_exec(bin_path, *args)
|
||||
else
|
||||
kernel_exec([bin_path, cmd], *args)
|
||||
end
|
||||
kernel_exec(bin_path, *args)
|
||||
else
|
||||
# exec using the given command
|
||||
kernel_exec(cmd, *args)
|
||||
|
@ -69,7 +64,7 @@ module Bundler
|
|||
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
|
||||
ui = Bundler.ui
|
||||
Bundler.ui = nil
|
||||
require "bundler/setup"
|
||||
require_relative "../setup"
|
||||
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
|
||||
Kernel.load(file)
|
||||
rescue SystemExit, SignalException
|
||||
|
|
|
@ -66,7 +66,7 @@ module Bundler
|
|||
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
|
||||
|
||||
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
|
||||
Bundler::CLI::Common.output_without_groups_message
|
||||
Bundler::CLI::Common.output_without_groups_message(:install)
|
||||
|
||||
if Bundler.use_system_gems?
|
||||
Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed."
|
||||
|
@ -80,7 +80,7 @@ module Bundler
|
|||
warn_ambiguous_gems
|
||||
|
||||
if CLI::Common.clean_after_install?
|
||||
require "bundler/cli/clean"
|
||||
require_relative "clean"
|
||||
Bundler::CLI::Clean.new(options).run
|
||||
end
|
||||
rescue GemNotFound, VersionConflict => e
|
||||
|
|
|
@ -33,7 +33,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def doctor
|
||||
require "bundler/cli/doctor"
|
||||
require_relative "doctor"
|
||||
Bundler::CLI::Doctor.new({}).run
|
||||
end
|
||||
end
|
||||
|
|
|
@ -133,7 +133,7 @@ module Bundler
|
|||
|
||||
unless options[:parseable]
|
||||
if groups
|
||||
Bundler.ui.info "===== Group #{groups} ====="
|
||||
Bundler.ui.info "===== #{groups_text("Group", groups)} ====="
|
||||
else
|
||||
Bundler.ui.info "===== Without group ====="
|
||||
end
|
||||
|
@ -167,6 +167,10 @@ module Bundler
|
|||
|
||||
private
|
||||
|
||||
def groups_text(group_text, groups)
|
||||
"#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
|
||||
end
|
||||
|
||||
def retrieve_active_spec(strict, definition, current_spec)
|
||||
if strict
|
||||
active_spec = definition.find_resolved_spec(current_spec)
|
||||
|
@ -212,7 +216,7 @@ module Bundler
|
|||
elsif options_include_groups || !groups
|
||||
" * #{spec_outdated_info}"
|
||||
else
|
||||
" * #{spec_outdated_info} in groups \"#{groups}\""
|
||||
" * #{spec_outdated_info} in #{groups_text("group", groups)}"
|
||||
end
|
||||
|
||||
Bundler.ui.info output_message.rstrip
|
||||
|
|
|
@ -25,7 +25,7 @@ module Bundler
|
|||
private
|
||||
|
||||
def install
|
||||
require "bundler/cli/install"
|
||||
require_relative "install"
|
||||
options = self.options.dup
|
||||
if Bundler.settings[:cache_all_platforms]
|
||||
options["local"] = false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_thor"
|
||||
require_relative "../vendored_thor"
|
||||
module Bundler
|
||||
class CLI::Plugin < Thor
|
||||
desc "install PLUGINS", "Install the plugin from the source"
|
||||
|
|
|
@ -58,24 +58,44 @@ module Bundler
|
|||
Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
|
||||
|
||||
Bundler.definition.validate_runtime!
|
||||
|
||||
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.to_s }
|
||||
h
|
||||
end
|
||||
end
|
||||
|
||||
installer = Installer.install Bundler.root, Bundler.definition, opts
|
||||
Bundler.load.cache if Bundler.app_cache.exist?
|
||||
|
||||
if CLI::Common.clean_after_install?
|
||||
require "bundler/cli/clean"
|
||||
require_relative "clean"
|
||||
Bundler::CLI::Clean.new(options).run
|
||||
end
|
||||
|
||||
if locked_gems = Bundler.definition.locked_gems
|
||||
if locked_gems
|
||||
gems.each do |name|
|
||||
locked_version = locked_gems.specs.find {|s| s.name == name }
|
||||
locked_version &&= locked_version.version
|
||||
next unless locked_version
|
||||
new_version = Bundler.definition.specs[name].first
|
||||
new_version &&= new_version.version
|
||||
if !new_version
|
||||
Bundler.ui.warn "Bundler attempted to update #{name} but it was removed from the bundle"
|
||||
elsif new_version < locked_version
|
||||
locked_info = previous_locked_info[name]
|
||||
next unless locked_info
|
||||
|
||||
locked_spec = locked_info[:spec]
|
||||
new_spec = Bundler.definition.specs[name].first
|
||||
unless new_spec
|
||||
if Bundler.rubygems.platforms.none? {|p| locked_spec.match_platform(p) }
|
||||
Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
|
||||
end
|
||||
|
||||
next
|
||||
end
|
||||
|
||||
locked_source = locked_info[:source]
|
||||
new_source = new_spec.source.to_s
|
||||
next if locked_source != new_source
|
||||
|
||||
new_version = new_spec.version
|
||||
locked_version = locked_info[:version]
|
||||
if new_version < locked_version
|
||||
Bundler.ui.warn "Note: #{name} version regressed from #{locked_version} to #{new_version}"
|
||||
elsif new_version == locked_version
|
||||
Bundler.ui.warn "Bundler attempted to update #{name} but its version stayed the same"
|
||||
|
@ -84,7 +104,7 @@ module Bundler
|
|||
end
|
||||
|
||||
Bundler.ui.confirm "Bundle updated!"
|
||||
Bundler::CLI::Common.output_without_groups_message
|
||||
Bundler::CLI::Common.output_without_groups_message(:update)
|
||||
Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@ module Bundler
|
|||
|
||||
class Error < StandardError; end
|
||||
|
||||
require "bundler/compact_index_client/cache"
|
||||
require "bundler/compact_index_client/updater"
|
||||
require_relative "compact_index_client/cache"
|
||||
require_relative "compact_index_client/updater"
|
||||
|
||||
attr_reader :directory
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_fileutils"
|
||||
require_relative "../vendored_fileutils"
|
||||
require "stringio"
|
||||
require "zlib"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
require "bundler/version"
|
||||
require_relative "version"
|
||||
|
||||
if Bundler::VERSION.split(".").first.to_i >= 2
|
||||
if Gem::Version.new(Object::RUBY_VERSION.dup) < Gem::Version.new("2.3")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/lockfile_parser"
|
||||
require_relative "lockfile_parser"
|
||||
require "set"
|
||||
|
||||
module Bundler
|
||||
|
@ -385,7 +385,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def to_lock
|
||||
require "bundler/lockfile_generator"
|
||||
require_relative "lockfile_generator"
|
||||
LockfileGenerator.generate(self)
|
||||
end
|
||||
|
||||
|
@ -782,7 +782,7 @@ module Bundler
|
|||
|
||||
# Path sources have special logic
|
||||
if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
|
||||
other_sources_specs = begin
|
||||
new_specs = begin
|
||||
s.source.specs
|
||||
rescue PathError, GitError
|
||||
# if we won't need the source (according to the lockfile),
|
||||
|
@ -794,16 +794,18 @@ module Bundler
|
|||
raise
|
||||
end
|
||||
|
||||
other = other_sources_specs[s].first
|
||||
new_spec = new_specs[s].first
|
||||
|
||||
# If the spec is no longer in the path source, unlock it. This
|
||||
# commonly happens if the version changed in the gemspec
|
||||
next unless other
|
||||
next unless new_spec
|
||||
|
||||
deps2 = other.dependencies.select {|d| d.type != :development }
|
||||
runtime_dependencies = s.dependencies.select {|d| d.type != :development }
|
||||
# If the dependencies of the path source have changed, unlock it
|
||||
next unless runtime_dependencies.sort == deps2.sort
|
||||
new_runtime_deps = new_spec.dependencies.select {|d| d.type != :development }
|
||||
old_runtime_deps = s.dependencies.select {|d| d.type != :development }
|
||||
# If the dependencies of the path source have changed and locked spec can't satisfy new dependencies, unlock it
|
||||
next unless new_runtime_deps.sort == old_runtime_deps.sort || new_runtime_deps.all? {|d| satisfies_locked_spec?(d) }
|
||||
|
||||
s.dependencies.replace(new_spec.dependencies)
|
||||
end
|
||||
|
||||
converged << s
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "rubygems/dependency"
|
||||
require "bundler/shared_helpers"
|
||||
require "bundler/rubygems_ext"
|
||||
require_relative "shared_helpers"
|
||||
require_relative "rubygems_ext"
|
||||
|
||||
module Bundler
|
||||
class Dependency < Gem::Dependency
|
||||
attr_reader :autorequire
|
||||
attr_reader :groups, :platforms, :gemfile
|
||||
attr_reader :groups, :platforms, :gemfile, :git, :branch
|
||||
|
||||
PLATFORM_MAP = {
|
||||
:ruby => Gem::Platform::RUBY,
|
||||
|
@ -84,6 +84,8 @@ module Bundler
|
|||
@autorequire = nil
|
||||
@groups = Array(options["group"] || :default).map(&:to_sym)
|
||||
@source = options["source"]
|
||||
@git = options["git"]
|
||||
@branch = options["branch"]
|
||||
@platforms = Array(options["platforms"])
|
||||
@env = options["env"]
|
||||
@should_include = options.fetch("should_include", true)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/shared_helpers"
|
||||
require_relative "shared_helpers"
|
||||
Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
|
||||
"Capistrano, but Capistrano provides its own integration with " \
|
||||
"Bundler via the capistrano-bundler gem. Use it instead."
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/dependency"
|
||||
require "bundler/ruby_dsl"
|
||||
require_relative "dependency"
|
||||
require_relative "ruby_dsl"
|
||||
|
||||
module Bundler
|
||||
class Dsl
|
||||
|
@ -291,12 +291,7 @@ module Bundler
|
|||
"https://github.com/#{repo_name}.git"
|
||||
RUBY
|
||||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
||||
if Bundler.feature_flag.github_https?
|
||||
"https://github.com/#{repo_name}.git"
|
||||
else
|
||||
Bundler::SharedHelpers.major_deprecation 2, "Setting `github.https` to false is deprecated and won't be supported in the future."
|
||||
"git://github.com/#{repo_name}.git"
|
||||
end
|
||||
"https://github.com/#{repo_name}.git"
|
||||
end
|
||||
|
||||
git_source(:gist) do |repo_name|
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/rubygems_integration"
|
||||
require "bundler/source/git/git_proxy"
|
||||
require_relative "rubygems_integration"
|
||||
require_relative "source/git/git_proxy"
|
||||
|
||||
module Bundler
|
||||
class Env
|
||||
|
@ -100,8 +100,9 @@ module Bundler
|
|||
out << [" Full Path", Gem.ruby]
|
||||
out << [" Config Dir", Pathname.new(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE).dirname]
|
||||
out << ["RubyGems", Gem::VERSION]
|
||||
out << [" Gem Home", ENV.fetch("GEM_HOME") { Gem.dir }]
|
||||
out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }]
|
||||
out << [" Gem Home", Gem.dir]
|
||||
out << [" Gem Path", Gem.path.join(File::PATH_SEPARATOR)]
|
||||
out << [" User Home", Gem.user_home]
|
||||
out << [" User Path", Gem.user_dir]
|
||||
out << [" Bin Dir", Gem.bindir]
|
||||
if defined?(OpenSSL)
|
||||
|
|
|
@ -36,16 +36,14 @@ module Bundler
|
|||
settings_flag(:default_install_uses_path) { bundler_3_mode? }
|
||||
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
|
||||
settings_flag(:disable_multisource) { bundler_3_mode? }
|
||||
settings_flag(:error_on_stderr) { bundler_2_mode? }
|
||||
settings_flag(:forget_cli_options) { bundler_3_mode? }
|
||||
settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? }
|
||||
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
||||
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
|
||||
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
||||
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
||||
settings_flag(:print_only_version_number) { bundler_3_mode? }
|
||||
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
|
||||
settings_flag(:skip_default_git_sources) { bundler_4_mode? }
|
||||
settings_flag(:skip_default_git_sources) { bundler_3_mode? }
|
||||
settings_flag(:specific_platform) { bundler_3_mode? }
|
||||
settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
|
||||
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
|
||||
|
@ -54,8 +52,6 @@ module Bundler
|
|||
|
||||
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
|
||||
|
||||
settings_method(:github_https?, "github.https") { bundler_2_mode? }
|
||||
|
||||
def initialize(bundler_version)
|
||||
@bundler_version = Gem::Version.create(bundler_version)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_persistent"
|
||||
require_relative "vendored_persistent"
|
||||
require "cgi"
|
||||
require "securerandom"
|
||||
require "zlib"
|
||||
|
@ -9,10 +9,10 @@ require "rubygems/request"
|
|||
module Bundler
|
||||
# Handles all the fetching with the rubygems server
|
||||
class Fetcher
|
||||
autoload :CompactIndex, "bundler/fetcher/compact_index"
|
||||
autoload :Downloader, "bundler/fetcher/downloader"
|
||||
autoload :Dependency, "bundler/fetcher/dependency"
|
||||
autoload :Index, "bundler/fetcher/index"
|
||||
autoload :CompactIndex, File.expand_path("fetcher/compact_index", __dir__)
|
||||
autoload :Downloader, File.expand_path("fetcher/downloader", __dir__)
|
||||
autoload :Dependency, File.expand_path("fetcher/dependency", __dir__)
|
||||
autoload :Index, File.expand_path("fetcher/index", __dir__)
|
||||
|
||||
# This error is raised when it looks like the network is down
|
||||
class NetworkDownError < HTTPError; end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/fetcher/base"
|
||||
require "bundler/worker"
|
||||
require_relative "base"
|
||||
require_relative "../worker"
|
||||
|
||||
module Bundler
|
||||
autoload :CompactIndexClient, "bundler/compact_index_client"
|
||||
autoload :CompactIndexClient, File.expand_path("../compact_index_client", __dir__)
|
||||
|
||||
class Fetcher
|
||||
class CompactIndex < Base
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/fetcher/base"
|
||||
require_relative "base"
|
||||
require "cgi"
|
||||
|
||||
module Bundler
|
||||
|
|
|
@ -37,6 +37,7 @@ module Bundler
|
|||
when Net::HTTPTooManyRequests
|
||||
raise TooManyRequestsError, response.body
|
||||
when Net::HTTPUnauthorized
|
||||
raise BadAuthenticationError, uri.host if uri.userinfo
|
||||
raise AuthenticationRequiredError, uri.host
|
||||
when Net::HTTPNotFound
|
||||
raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/fetcher/base"
|
||||
require_relative "base"
|
||||
require "rubygems/remote_fetcher"
|
||||
|
||||
module Bundler
|
||||
|
@ -13,6 +13,7 @@ module Bundler
|
|||
when /certificate verify failed/
|
||||
raise CertificateFailureError.new(display_uri)
|
||||
when /401/
|
||||
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
|
||||
raise AuthenticationRequiredError, remote_uri
|
||||
when /403/
|
||||
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "cgi"
|
||||
require "bundler/vendored_thor"
|
||||
require_relative "vendored_thor"
|
||||
|
||||
module Bundler
|
||||
module FriendlyErrors
|
||||
module_function
|
||||
module_function # rubocop:disable Layout/AccessModifierIndentation
|
||||
|
||||
def log_error(error)
|
||||
case error
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_thor" unless defined?(Thor)
|
||||
require "bundler"
|
||||
require_relative "vendored_thor" unless defined?(Thor)
|
||||
require_relative "../bundler"
|
||||
require "shellwords"
|
||||
|
||||
module Bundler
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
require "rake/clean"
|
||||
CLOBBER.include "pkg"
|
||||
|
||||
require "bundler/gem_helper"
|
||||
require_relative "gem_helper"
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
|
|
@ -81,8 +81,8 @@ module Bundler
|
|||
sort_dep_specs(spec_groups, locked_spec)
|
||||
end.tap do |specs|
|
||||
if DEBUG
|
||||
STDERR.puts before_result
|
||||
STDERR.puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
|
||||
warn before_result
|
||||
warn " after sort_versions: #{debug_format_result(dep, specs).inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -111,8 +111,10 @@ module Bundler
|
|||
end
|
||||
|
||||
source = ", :source => \"#{d.source}\"" unless d.source.nil?
|
||||
git = ", :git => \"#{d.git}\"" unless d.git.nil?
|
||||
branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
|
||||
|
||||
%(gem #{name}#{requirement}#{group}#{source})
|
||||
%(gem #{name}#{requirement}#{group}#{source}#{git}#{branch})
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/compatibility_guard"
|
||||
require_relative "compatibility_guard"
|
||||
|
||||
# Allows for declaring a Gemfile inline in a ruby script, optionally installing
|
||||
# any gems that aren't already installed on the user's system.
|
||||
|
@ -32,7 +32,7 @@ require "bundler/compatibility_guard"
|
|||
# puts Pod::VERSION # => "0.34.4"
|
||||
#
|
||||
def gemfile(install = false, options = {}, &gemfile)
|
||||
require "bundler"
|
||||
require_relative "../bundler"
|
||||
|
||||
opts = options.dup
|
||||
ui = opts.delete(:ui) { Bundler::UI::Shell.new }
|
||||
|
@ -49,26 +49,28 @@ def gemfile(install = false, options = {}, &gemfile)
|
|||
builder = Bundler::Dsl.new
|
||||
builder.instance_eval(&gemfile)
|
||||
|
||||
definition = builder.to_definition(nil, true)
|
||||
def definition.lock(*); end
|
||||
definition.validate_runtime!
|
||||
Bundler.settings.temporary(:frozen => false) do
|
||||
definition = builder.to_definition(nil, true)
|
||||
def definition.lock(*); end
|
||||
definition.validate_runtime!
|
||||
|
||||
missing_specs = proc do
|
||||
definition.missing_specs?
|
||||
end
|
||||
missing_specs = proc do
|
||||
definition.missing_specs?
|
||||
end
|
||||
|
||||
Bundler.ui = ui if install
|
||||
if install || missing_specs.call
|
||||
Bundler.settings.temporary(:inline => true) 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}"
|
||||
Bundler.ui = ui if install
|
||||
if install || missing_specs.call
|
||||
Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) 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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
runtime = Bundler::Runtime.new(nil, definition)
|
||||
runtime.setup.require
|
||||
runtime = Bundler::Runtime.new(nil, definition)
|
||||
runtime.setup.require
|
||||
end
|
||||
ensure
|
||||
bundler_module = class << Bundler; self; end
|
||||
bundler_module.send(:define_method, :root, old_root) if old_root
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
require "erb"
|
||||
require "rubygems/dependency_installer"
|
||||
require "bundler/worker"
|
||||
require "bundler/installer/parallel_installer"
|
||||
require "bundler/installer/standalone"
|
||||
require "bundler/installer/gem_installer"
|
||||
require_relative "worker"
|
||||
require_relative "installer/parallel_installer"
|
||||
require_relative "installer/standalone"
|
||||
require_relative "installer/gem_installer"
|
||||
|
||||
module Bundler
|
||||
class Installer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/worker"
|
||||
require "bundler/installer/gem_installer"
|
||||
require_relative "../worker"
|
||||
require_relative "gem_installer"
|
||||
|
||||
module Bundler
|
||||
class ParallelInstaller
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "uri"
|
||||
require "bundler/match_platform"
|
||||
require_relative "match_platform"
|
||||
|
||||
module Bundler
|
||||
class LazySpecification
|
||||
|
|
|
@ -101,17 +101,11 @@ module Bundler
|
|||
return unless bundler_version
|
||||
prerelease_text = bundler_version.prerelease? ? " --pre" : ""
|
||||
current_version = Gem::Version.create(Bundler::VERSION)
|
||||
case current_version.segments.first <=> bundler_version.segments.first
|
||||
when -1
|
||||
raise LockfileError, "You must use Bundler #{bundler_version.segments.first} or greater with this lockfile."
|
||||
when 0
|
||||
if current_version < bundler_version
|
||||
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
|
||||
"than the version that created the lockfile (#{bundler_version}). We suggest you to " \
|
||||
"upgrade to the version that created the lockfile by running `gem install " \
|
||||
"bundler:#{bundler_version}#{prerelease_text}`.\n"
|
||||
end
|
||||
end
|
||||
return unless current_version < bundler_version
|
||||
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
|
||||
"than the version that created the lockfile (#{bundler_version}). We suggest you to " \
|
||||
"upgrade to the version that created the lockfile by running `gem install " \
|
||||
"bundler:#{bundler_version}#{prerelease_text}`.\n"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/gem_helpers"
|
||||
require_relative "gem_helpers"
|
||||
|
||||
module Bundler
|
||||
module MatchPlatform
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/plugin/api"
|
||||
require_relative "plugin/api"
|
||||
|
||||
module Bundler
|
||||
module Plugin
|
||||
|
@ -256,7 +256,7 @@ module Bundler
|
|||
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
|
||||
|
||||
load_paths = spec.load_paths
|
||||
add_to_load_path(load_paths)
|
||||
Bundler.rubygems.add_to_load_path(load_paths)
|
||||
path = Pathname.new spec.full_gem_path
|
||||
|
||||
begin
|
||||
|
@ -288,7 +288,7 @@ module Bundler
|
|||
# done to avoid conflicts
|
||||
path = index.plugin_path(name)
|
||||
|
||||
add_to_load_path(index.load_paths(name))
|
||||
Bundler.rubygems.add_to_load_path(index.load_paths(name))
|
||||
|
||||
load path.join(PLUGIN_FILE_NAME)
|
||||
|
||||
|
@ -298,17 +298,8 @@ module Bundler
|
|||
raise
|
||||
end
|
||||
|
||||
def add_to_load_path(load_paths)
|
||||
if insert_index = Bundler.rubygems.load_path_insert_index
|
||||
$LOAD_PATH.insert(insert_index, *load_paths)
|
||||
else
|
||||
$LOAD_PATH.unshift(*load_paths)
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!,
|
||||
:add_to_load_path
|
||||
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Bundler
|
|||
# and hooks).
|
||||
module Plugin
|
||||
class API
|
||||
autoload :Source, "bundler/plugin/api/source"
|
||||
autoload :Source, File.expand_path("api/source", __dir__)
|
||||
|
||||
# The plugins should declare that they handle a command through this helper.
|
||||
#
|
||||
|
|
|
@ -139,7 +139,7 @@ module Bundler
|
|||
|
||||
data = index_f.read
|
||||
|
||||
require "bundler/yaml_serializer"
|
||||
require_relative "../yaml_serializer"
|
||||
index = YAMLSerializer.load(data)
|
||||
|
||||
@commands.merge!(index["commands"])
|
||||
|
@ -162,7 +162,7 @@ module Bundler
|
|||
"sources" => @sources,
|
||||
}
|
||||
|
||||
require "bundler/yaml_serializer"
|
||||
require_relative "../yaml_serializer"
|
||||
SharedHelpers.filesystem_access(index_file) do |index_f|
|
||||
FileUtils.mkdir_p(index_f.dirname)
|
||||
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
|
||||
|
|
|
@ -8,8 +8,8 @@ module Bundler
|
|||
# are heavily dependent on the Gemfile.
|
||||
module Plugin
|
||||
class Installer
|
||||
autoload :Rubygems, "bundler/plugin/installer/rubygems"
|
||||
autoload :Git, "bundler/plugin/installer/git"
|
||||
autoload :Rubygems, File.expand_path("installer/rubygems", __dir__)
|
||||
autoload :Git, File.expand_path("installer/git", __dir__)
|
||||
|
||||
def install(names, options)
|
||||
check_sources_consistency!(options)
|
||||
|
|
|
@ -27,7 +27,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
require "bundler/deprecate"
|
||||
require_relative "deprecate"
|
||||
begin
|
||||
Bundler::Deprecate.skip_during do
|
||||
require "rubygems/safe_yaml"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
module Bundler
|
||||
class Resolver
|
||||
require "bundler/vendored_molinillo"
|
||||
require "bundler/resolver/spec_group"
|
||||
require_relative "vendored_molinillo"
|
||||
require_relative "resolver/spec_group"
|
||||
|
||||
# Figures out the best possible configuration of gems that satisfies
|
||||
# the list of passed dependencies and any child dependencies without
|
||||
|
@ -75,7 +75,7 @@ module Bundler
|
|||
return unless debug?
|
||||
debug_info = yield
|
||||
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
||||
STDERR.puts debug_info.split("\n").map {|s| " " * depth + s }
|
||||
warn debug_info.split("\n").map {|s| " " * depth + s }
|
||||
end
|
||||
|
||||
def debug?
|
||||
|
|
|
@ -4,40 +4,25 @@ require "pathname"
|
|||
|
||||
require "rubygems/specification"
|
||||
|
||||
begin
|
||||
# Possible use in Gem::Specification#source below and require
|
||||
# shouldn't be deferred.
|
||||
require "rubygems/source"
|
||||
rescue LoadError
|
||||
# Not available before RubyGems 2.0.0, ignore
|
||||
nil
|
||||
end
|
||||
# Possible use in Gem::Specification#source below and require
|
||||
# shouldn't be deferred.
|
||||
require "rubygems/source"
|
||||
|
||||
require "bundler/match_platform"
|
||||
require_relative "match_platform"
|
||||
|
||||
module Gem
|
||||
@loaded_stacks = Hash.new {|h, k| h[k] = [] }
|
||||
|
||||
class Specification
|
||||
attr_accessor :remote, :location, :relative_loaded_from
|
||||
|
||||
if instance_methods(false).include?(:source)
|
||||
remove_method :source
|
||||
attr_writer :source
|
||||
def source
|
||||
(defined?(@source) && @source) || Gem::Source::Installed.new
|
||||
end
|
||||
else
|
||||
# rubocop:disable Lint/DuplicateMethods
|
||||
attr_accessor :source
|
||||
# rubocop:enable Lint/DuplicateMethods
|
||||
remove_method :source
|
||||
attr_writer :source
|
||||
def source
|
||||
(defined?(@source) && @source) || Gem::Source::Installed.new
|
||||
end
|
||||
|
||||
alias_method :rg_full_gem_path, :full_gem_path
|
||||
alias_method :rg_loaded_from, :loaded_from
|
||||
|
||||
attr_writer :full_gem_path unless instance_methods.include?(:full_gem_path=)
|
||||
|
||||
def full_gem_path
|
||||
# this cannot check source.is_a?(Bundler::Plugin::API::Source)
|
||||
# because that _could_ trip the autoload, and if there are unresolved
|
||||
|
@ -59,15 +44,7 @@ module Gem
|
|||
end
|
||||
|
||||
def load_paths
|
||||
return full_require_paths if respond_to?(:full_require_paths)
|
||||
|
||||
require_paths.map do |require_path|
|
||||
if require_path.include?(full_gem_path)
|
||||
require_path
|
||||
else
|
||||
File.join(full_gem_path, require_path)
|
||||
end
|
||||
end
|
||||
full_require_paths
|
||||
end
|
||||
|
||||
if method_defined?(:extension_dir)
|
||||
|
@ -151,32 +128,6 @@ module Gem
|
|||
end
|
||||
out
|
||||
end
|
||||
|
||||
# Backport of performance enhancement added to RubyGems 1.4
|
||||
def matches_spec?(spec)
|
||||
# name can be a Regexp, so use ===
|
||||
return false unless name === spec.name
|
||||
return true if requirement.none?
|
||||
|
||||
requirement.satisfied_by?(spec.version)
|
||||
end unless allocate.respond_to?(:matches_spec?)
|
||||
end
|
||||
|
||||
class Requirement
|
||||
# Backport of performance enhancement added to RubyGems 1.4
|
||||
def none?
|
||||
# note that it might be tempting to replace with with RubyGems 2.0's
|
||||
# improved implementation. Don't. It requires `DefaultRequirement` to be
|
||||
# defined, and more importantantly, these overrides are not used when the
|
||||
# running RubyGems defines these methods
|
||||
to_s == ">= 0"
|
||||
end unless allocate.respond_to?(:none?)
|
||||
|
||||
# Backport of performance enhancement added to RubyGems 2.2
|
||||
def exact?
|
||||
return false unless @requirements.size == 1
|
||||
@requirements[0][0] == "="
|
||||
end unless allocate.respond_to?(:exact?)
|
||||
end
|
||||
|
||||
class Platform
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "monitor"
|
||||
|
||||
module Bundler
|
||||
class RubygemsIntegration
|
||||
if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
|
||||
EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR
|
||||
else
|
||||
require "monitor"
|
||||
|
||||
EXT_LOCK = Monitor.new
|
||||
end
|
||||
|
||||
|
@ -20,6 +20,7 @@ module Bundler
|
|||
|
||||
def initialize
|
||||
@replaced_methods = {}
|
||||
backport_ext_builder_monitor
|
||||
end
|
||||
|
||||
def version
|
||||
|
@ -38,14 +39,22 @@ module Bundler
|
|||
Gem::Command.build_args = args
|
||||
end
|
||||
|
||||
def load_path_insert_index
|
||||
Gem.load_path_insert_index
|
||||
end
|
||||
|
||||
def loaded_specs(name)
|
||||
Gem.loaded_specs[name]
|
||||
end
|
||||
|
||||
def add_to_load_path(paths)
|
||||
return Gem.add_to_load_path(*paths) if Gem.respond_to?(:add_to_load_path)
|
||||
|
||||
if insert_index = Gem.load_path_insert_index
|
||||
# Gem directories must come after -I and ENV['RUBYLIB']
|
||||
$LOAD_PATH.insert(insert_index, *paths)
|
||||
else
|
||||
# We are probably testing in core, -I and RUBYLIB don't apply
|
||||
$LOAD_PATH.unshift(*paths)
|
||||
end
|
||||
end
|
||||
|
||||
def mark_loaded(spec)
|
||||
if spec.respond_to?(:activated=)
|
||||
current = Gem.loaded_specs[spec.name]
|
||||
|
@ -110,7 +119,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def configuration
|
||||
require "bundler/psyched_yaml"
|
||||
require_relative "psyched_yaml"
|
||||
Gem.configuration
|
||||
rescue Gem::SystemExitException, LoadError => e
|
||||
Bundler.ui.error "#{e.class}: #{e.message}"
|
||||
|
@ -198,10 +207,6 @@ module Bundler
|
|||
Gem::ConfigMap
|
||||
end
|
||||
|
||||
def repository_subdirectories
|
||||
%w[cache doc gems specifications]
|
||||
end
|
||||
|
||||
def clear_paths
|
||||
Gem.clear_paths
|
||||
end
|
||||
|
@ -210,26 +215,14 @@ module Bundler
|
|||
Gem.bin_path(gem, bin, ver)
|
||||
end
|
||||
|
||||
def path_separator
|
||||
File::PATH_SEPARATOR
|
||||
end
|
||||
|
||||
def preserve_paths
|
||||
# this is a no-op outside of RubyGems 1.8
|
||||
yield
|
||||
end
|
||||
|
||||
def loaded_gem_paths
|
||||
# RubyGems 2.2+ can put binary extension into dedicated folders,
|
||||
# therefore use RubyGems facilities to obtain their load paths.
|
||||
if Gem::Specification.method_defined? :full_require_paths
|
||||
loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
|
||||
loaded_gem_paths.flatten
|
||||
else
|
||||
$LOAD_PATH.select do |p|
|
||||
Bundler.rubygems.gem_path.any? {|gp| p =~ /^#{Regexp.escape(gp)}/ }
|
||||
end
|
||||
end
|
||||
loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
|
||||
loaded_gem_paths.flatten
|
||||
end
|
||||
|
||||
def load_plugins
|
||||
|
@ -248,36 +241,12 @@ module Bundler
|
|||
EXT_LOCK
|
||||
end
|
||||
|
||||
def fetch_specs(all, pre, &blk)
|
||||
require "rubygems/spec_fetcher"
|
||||
specs = Gem::SpecFetcher.new.list(all, pre)
|
||||
specs.each { yield } if block_given?
|
||||
specs
|
||||
end
|
||||
|
||||
def fetch_prerelease_specs
|
||||
fetch_specs(false, true)
|
||||
rescue Gem::RemoteFetcher::FetchError
|
||||
{} # if we can't download them, there aren't any
|
||||
end
|
||||
|
||||
# TODO: This is for older versions of RubyGems... should we support the
|
||||
# X-Gemfile-Source header on these old versions?
|
||||
# Maybe the newer implementation will work on older RubyGems?
|
||||
# It seems difficult to keep this implementation and still send the header.
|
||||
def fetch_all_remote_specs(remote)
|
||||
old_sources = Bundler.rubygems.sources
|
||||
Bundler.rubygems.sources = [remote.uri.to_s]
|
||||
# Fetch all specs, minus prerelease specs
|
||||
spec_list = fetch_specs(true, false)
|
||||
# Then fetch the prerelease specs
|
||||
fetch_prerelease_specs.each {|k, v| spec_list[k].concat(v) }
|
||||
|
||||
spec_list.values.first
|
||||
ensure
|
||||
Bundler.rubygems.sources = old_sources
|
||||
end
|
||||
|
||||
def with_build_args(args)
|
||||
ext_lock.synchronize do
|
||||
old_args = build_args
|
||||
|
@ -290,18 +259,9 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def install_with_build_args(args)
|
||||
with_build_args(args) { yield }
|
||||
end
|
||||
|
||||
def gem_from_path(path, policy = nil)
|
||||
require "rubygems/format"
|
||||
Gem::Format.from_file_by_path(path, policy)
|
||||
end
|
||||
|
||||
def spec_from_gem(path, policy = nil)
|
||||
require "rubygems/security"
|
||||
require "bundler/psyched_yaml"
|
||||
require_relative "psyched_yaml"
|
||||
gem_from_path(path, security_policies[policy]).spec
|
||||
rescue Gem::Package::FormatError
|
||||
raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
|
||||
|
@ -317,23 +277,10 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def build(spec, skip_validation = false)
|
||||
require "rubygems/builder"
|
||||
Gem::Builder.new(spec).build
|
||||
end
|
||||
|
||||
def build_gem(gem_dir, spec)
|
||||
build(spec)
|
||||
end
|
||||
|
||||
def download_gem(spec, uri, path)
|
||||
uri = Bundler.settings.mirror_for(uri)
|
||||
fetcher = Gem::RemoteFetcher.new(configuration[:http_proxy])
|
||||
Bundler::Retry.new("download gem from #{uri}").attempts do
|
||||
fetcher.download(spec, uri, path)
|
||||
end
|
||||
end
|
||||
|
||||
def security_policy_keys
|
||||
%w[High Medium Low AlmostNo No].map {|level| "#{level}Security" }
|
||||
end
|
||||
|
@ -357,12 +304,17 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
# RubyGems-generated binstubs call Kernel#gem
|
||||
def binstubs_call_gem?
|
||||
true
|
||||
!provides?(">= 2.5.2")
|
||||
end
|
||||
|
||||
# only 2.5.2+ has all of the stub methods we want to use, and since this
|
||||
# is a performance optimization _only_,
|
||||
# we'll restrict ourselves to the most
|
||||
# recent RG versions instead of all versions that have stubs
|
||||
def stubs_provide_full_functionality?
|
||||
false
|
||||
provides?(">= 2.5.2")
|
||||
end
|
||||
|
||||
def replace_gem(specs, specs_by_name)
|
||||
|
@ -411,26 +363,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def stub_source_index(specs)
|
||||
Gem::SourceIndex.send(:alias_method, :old_initialize, :initialize)
|
||||
redefine_method(Gem::SourceIndex, :initialize) do |*args|
|
||||
@gems = {}
|
||||
# You're looking at this thinking: Oh! This is how I make those
|
||||
# rubygems deprecations go away!
|
||||
#
|
||||
# You'd be correct BUT using of this method in production code
|
||||
# must be approved by the rubygems team itself!
|
||||
#
|
||||
# This is your warning. If you use this and don't have approval
|
||||
# we can't protect you.
|
||||
#
|
||||
Deprecate.skip_during do
|
||||
self.spec_dirs = *args
|
||||
add_specs(*specs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Used to make bin stubs that are not created by bundler work
|
||||
# under bundler. The new Gem.bin_path only considers gems in
|
||||
# +specs+
|
||||
|
@ -531,25 +463,6 @@ module Bundler
|
|||
Gem.clear_paths
|
||||
end
|
||||
|
||||
# This backports the correct segment generation code from RubyGems 1.4+
|
||||
# by monkeypatching it into the method in RubyGems 1.3.6 and 1.3.7.
|
||||
def backport_segment_generation
|
||||
redefine_method(Gem::Version, :segments) do
|
||||
@segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
|
||||
/^\d+$/ =~ s ? s.to_i : s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This backport fixes the marshaling of @segments.
|
||||
def backport_yaml_initialize
|
||||
redefine_method(Gem::Version, :yaml_initialize) do |_, map|
|
||||
@version = map["version"]
|
||||
@segments = nil
|
||||
@hash = nil
|
||||
end
|
||||
end
|
||||
|
||||
# This backports base_dir which replaces installation path
|
||||
# RubyGems 1.8+
|
||||
def backport_base_dir
|
||||
|
@ -622,296 +535,129 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
# RubyGems 1.4 through 1.6
|
||||
class Legacy < RubygemsIntegration
|
||||
def initialize
|
||||
super
|
||||
backport_base_dir
|
||||
backport_cache_file
|
||||
backport_spec_file
|
||||
backport_yaml_initialize
|
||||
def stub_rubygems(specs)
|
||||
Gem::Specification.all = specs
|
||||
|
||||
Gem.post_reset do
|
||||
Gem::Specification.all = specs
|
||||
end
|
||||
|
||||
def stub_rubygems(specs)
|
||||
# RubyGems versions lower than 1.7 use SourceIndex#from_gems_in
|
||||
source_index_class = (class << Gem::SourceIndex; self; end)
|
||||
redefine_method(source_index_class, :from_gems_in) do |*args|
|
||||
Gem::SourceIndex.new.tap do |source_index|
|
||||
source_index.spec_dirs = *args
|
||||
source_index.add_specs(*specs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def all_specs
|
||||
Gem.source_index.gems.values
|
||||
end
|
||||
|
||||
def find_name(name)
|
||||
Gem.source_index.find_name(name)
|
||||
end
|
||||
|
||||
def validate(spec)
|
||||
# These versions of RubyGems always validate in "packaging" mode,
|
||||
# which is too strict for the kinds of checks we care about. As a
|
||||
# result, validation is disabled on versions of RubyGems below 1.7.
|
||||
end
|
||||
|
||||
def post_reset_hooks
|
||||
redefine_method((class << Gem; self; end), :finish_resolve) do |*|
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def reset
|
||||
def fetch_specs(source, remote, name)
|
||||
path = source + "#{name}.#{Gem.marshal_version}.gz"
|
||||
fetcher = gem_remote_fetcher
|
||||
fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
|
||||
string = fetcher.fetch_path(path)
|
||||
Bundler.load_marshal(string)
|
||||
rescue Gem::RemoteFetcher::FetchError => e
|
||||
# it's okay for prerelease to fail
|
||||
raise e unless name == "prerelease_specs"
|
||||
end
|
||||
|
||||
def fetch_all_remote_specs(remote)
|
||||
source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)
|
||||
|
||||
specs = fetch_specs(source, remote, "specs")
|
||||
pres = fetch_specs(source, remote, "prerelease_specs") || []
|
||||
|
||||
specs.concat(pres)
|
||||
end
|
||||
|
||||
def download_gem(spec, uri, path)
|
||||
uri = Bundler.settings.mirror_for(uri)
|
||||
fetcher = gem_remote_fetcher
|
||||
fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
|
||||
Bundler::Retry.new("download gem from #{uri}").attempts do
|
||||
fetcher.download(spec, uri, path)
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems versions 1.3.6 and 1.3.7
|
||||
class Ancient < Legacy
|
||||
def initialize
|
||||
super
|
||||
backport_segment_generation
|
||||
def gem_remote_fetcher
|
||||
require "resolv"
|
||||
proxy = configuration[:http_proxy]
|
||||
dns = Resolv::DNS.new
|
||||
Bundler::GemRemoteFetcher.new(proxy, dns)
|
||||
end
|
||||
|
||||
def gem_from_path(path, policy = nil)
|
||||
require "rubygems/package"
|
||||
p = Gem::Package.new(path)
|
||||
p.security_policy = policy if policy
|
||||
p
|
||||
end
|
||||
|
||||
def build(spec, skip_validation = false)
|
||||
require "rubygems/package"
|
||||
Gem::Package.build(spec, skip_validation)
|
||||
end
|
||||
|
||||
def repository_subdirectories
|
||||
Gem::REPOSITORY_SUBDIRECTORIES
|
||||
end
|
||||
|
||||
def install_with_build_args(args)
|
||||
yield
|
||||
end
|
||||
|
||||
def path_separator
|
||||
Gem.path_separator
|
||||
end
|
||||
|
||||
def all_specs
|
||||
require_relative "remote_specification"
|
||||
Gem::Specification.stubs.map do |stub|
|
||||
StubSpecification.from_stub(stub)
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 1.7
|
||||
class Transitional < Legacy
|
||||
def stub_rubygems(specs)
|
||||
stub_source_index(specs)
|
||||
end
|
||||
def backport_ext_builder_monitor
|
||||
# So we can avoid requiring "rubygems/ext" in its entirety
|
||||
Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
|
||||
module Ext
|
||||
end
|
||||
RB
|
||||
|
||||
def validate(spec)
|
||||
# Missing summary is downgraded to a warning in later versions,
|
||||
# so we set it to an empty string to prevent an exception here.
|
||||
spec.summary ||= ""
|
||||
RubygemsIntegration.instance_method(:validate).bind(self).call(spec)
|
||||
require "rubygems/ext/builder"
|
||||
|
||||
Gem::Ext::Builder.class_eval do
|
||||
unless const_defined?(:CHDIR_MONITOR)
|
||||
const_set(:CHDIR_MONITOR, EXT_LOCK)
|
||||
end
|
||||
|
||||
remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
|
||||
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 1.8.5-1.8.19
|
||||
class Modern < RubygemsIntegration
|
||||
def stub_rubygems(specs)
|
||||
Gem::Specification.all = specs
|
||||
def find_name(name)
|
||||
Gem::Specification.stubs_for(name).map(&:to_spec)
|
||||
end
|
||||
|
||||
Gem.post_reset do
|
||||
Gem::Specification.all = specs
|
||||
end
|
||||
|
||||
stub_source_index(specs)
|
||||
if Gem::Specification.respond_to?(:default_stubs)
|
||||
def default_stubs
|
||||
Gem::Specification.default_stubs("*.gemspec")
|
||||
end
|
||||
|
||||
def all_specs
|
||||
Gem::Specification.to_a
|
||||
end
|
||||
|
||||
def find_name(name)
|
||||
Gem::Specification.find_all_by_name name
|
||||
else
|
||||
def default_stubs
|
||||
Gem::Specification.send(:default_stubs, "*.gemspec")
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 1.8.0 to 1.8.4
|
||||
class AlmostModern < Modern
|
||||
# RubyGems [>= 1.8.0, < 1.8.5] has a bug that changes Gem.dir whenever
|
||||
# you call Gem::Installer#install with an :install_dir set. We have to
|
||||
# change it back for our sudo mode to work.
|
||||
def preserve_paths
|
||||
old_dir = gem_dir
|
||||
old_path = gem_path
|
||||
yield
|
||||
Gem.use_paths(old_dir, old_path)
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 1.8.20+
|
||||
class MoreModern < Modern
|
||||
# RubyGems 1.8.20 and adds the skip_validation parameter, so that's
|
||||
# when we start passing it through.
|
||||
def build(spec, skip_validation = false)
|
||||
require "rubygems/builder"
|
||||
Gem::Builder.new(spec).build(skip_validation)
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 2.0
|
||||
class Future < RubygemsIntegration
|
||||
def stub_rubygems(specs)
|
||||
Gem::Specification.all = specs
|
||||
|
||||
Gem.post_reset do
|
||||
Gem::Specification.all = specs
|
||||
end
|
||||
|
||||
redefine_method((class << Gem; self; end), :finish_resolve) do |*|
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def all_specs
|
||||
Gem::Specification.to_a
|
||||
end
|
||||
|
||||
def find_name(name)
|
||||
Gem::Specification.find_all_by_name name
|
||||
end
|
||||
|
||||
def fetch_specs(source, remote, name)
|
||||
path = source + "#{name}.#{Gem.marshal_version}.gz"
|
||||
fetcher = gem_remote_fetcher
|
||||
fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
|
||||
string = fetcher.fetch_path(path)
|
||||
Bundler.load_marshal(string)
|
||||
rescue Gem::RemoteFetcher::FetchError => e
|
||||
# it's okay for prerelease to fail
|
||||
raise e unless name == "prerelease_specs"
|
||||
end
|
||||
|
||||
def fetch_all_remote_specs(remote)
|
||||
source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)
|
||||
|
||||
specs = fetch_specs(source, remote, "specs")
|
||||
pres = fetch_specs(source, remote, "prerelease_specs") || []
|
||||
|
||||
specs.concat(pres)
|
||||
end
|
||||
|
||||
def download_gem(spec, uri, path)
|
||||
uri = Bundler.settings.mirror_for(uri)
|
||||
fetcher = gem_remote_fetcher
|
||||
fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
|
||||
Bundler::Retry.new("download gem from #{uri}").attempts do
|
||||
fetcher.download(spec, uri, path)
|
||||
end
|
||||
end
|
||||
|
||||
def gem_remote_fetcher
|
||||
require "resolv"
|
||||
proxy = configuration[:http_proxy]
|
||||
dns = Resolv::DNS.new
|
||||
Bundler::GemRemoteFetcher.new(proxy, dns)
|
||||
end
|
||||
|
||||
def gem_from_path(path, policy = nil)
|
||||
require "rubygems/package"
|
||||
p = Gem::Package.new(path)
|
||||
p.security_policy = policy if policy
|
||||
p
|
||||
end
|
||||
|
||||
def build(spec, skip_validation = false)
|
||||
require "rubygems/package"
|
||||
Gem::Package.build(spec, skip_validation)
|
||||
end
|
||||
|
||||
def repository_subdirectories
|
||||
Gem::REPOSITORY_SUBDIRECTORIES
|
||||
end
|
||||
|
||||
def install_with_build_args(args)
|
||||
yield
|
||||
end
|
||||
|
||||
def path_separator
|
||||
Gem.path_separator
|
||||
end
|
||||
end
|
||||
|
||||
# RubyGems 2.1.0
|
||||
class MoreFuture < Future
|
||||
def initialize
|
||||
super
|
||||
backport_ext_builder_monitor
|
||||
end
|
||||
|
||||
def all_specs
|
||||
require "bundler/remote_specification"
|
||||
Gem::Specification.stubs.map do |stub|
|
||||
StubSpecification.from_stub(stub)
|
||||
end
|
||||
end
|
||||
|
||||
def backport_ext_builder_monitor
|
||||
# So we can avoid requiring "rubygems/ext" in its entirety
|
||||
Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
|
||||
module Ext
|
||||
end
|
||||
RB
|
||||
|
||||
require "rubygems/ext/builder"
|
||||
|
||||
Gem::Ext::Builder.class_eval do
|
||||
unless const_defined?(:CHDIR_MONITOR)
|
||||
const_set(:CHDIR_MONITOR, EXT_LOCK)
|
||||
end
|
||||
|
||||
remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
|
||||
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
|
||||
end
|
||||
end
|
||||
|
||||
if Gem::Specification.respond_to?(:stubs_for)
|
||||
def find_name(name)
|
||||
Gem::Specification.stubs_for(name).map(&:to_spec)
|
||||
end
|
||||
else
|
||||
def find_name(name)
|
||||
Gem::Specification.stubs.find_all do |spec|
|
||||
spec.name == name
|
||||
end.map(&:to_spec)
|
||||
end
|
||||
end
|
||||
|
||||
if Gem::Specification.respond_to?(:default_stubs)
|
||||
def default_stubs
|
||||
Gem::Specification.default_stubs("*.gemspec")
|
||||
end
|
||||
else
|
||||
def default_stubs
|
||||
Gem::Specification.send(:default_stubs, "*.gemspec")
|
||||
end
|
||||
end
|
||||
|
||||
def use_gemdeps(gemfile)
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
|
||||
require "bundler/gemdeps"
|
||||
runtime = Bundler.setup
|
||||
Bundler.ui = nil
|
||||
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
||||
[Gemdeps.new(runtime), activated_spec_names]
|
||||
end
|
||||
|
||||
if provides?(">= 2.5.2")
|
||||
# RubyGems-generated binstubs call Kernel#gem
|
||||
def binstubs_call_gem?
|
||||
false
|
||||
end
|
||||
|
||||
# only 2.5.2+ has all of the stub methods we want to use, and since this
|
||||
# is a performance optimization _only_,
|
||||
# we'll restrict ourselves to the most
|
||||
# recent RG versions instead of all versions that have stubs
|
||||
def stubs_provide_full_functionality?
|
||||
true
|
||||
end
|
||||
end
|
||||
def use_gemdeps(gemfile)
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
|
||||
require_relative "gemdeps"
|
||||
runtime = Bundler.setup
|
||||
Bundler.ui = nil
|
||||
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
||||
[Gemdeps.new(runtime), activated_spec_names]
|
||||
end
|
||||
end
|
||||
|
||||
def self.rubygems
|
||||
@rubygems ||= if RubygemsIntegration.provides?(">= 2.1.0")
|
||||
RubygemsIntegration::MoreFuture.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.99.99")
|
||||
RubygemsIntegration::Future.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.8.20")
|
||||
RubygemsIntegration::MoreModern.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.8.5")
|
||||
RubygemsIntegration::Modern.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.8.0")
|
||||
RubygemsIntegration::AlmostModern.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.7.0")
|
||||
RubygemsIntegration::Transitional.new
|
||||
elsif RubygemsIntegration.provides?(">= 1.4.0")
|
||||
RubygemsIntegration::Legacy.new
|
||||
else # RubyGems 1.3.6 and 1.3.7
|
||||
RubygemsIntegration::Ancient.new
|
||||
end
|
||||
@rubygems ||= RubygemsIntegration.new
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,14 +34,7 @@ module Bundler
|
|||
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
|
||||
end.reverse.flatten
|
||||
|
||||
# See Gem::Specification#add_self_to_load_path (since RubyGems 1.8)
|
||||
if insert_index = Bundler.rubygems.load_path_insert_index
|
||||
# Gem directories must come after -I and ENV['RUBYLIB']
|
||||
$LOAD_PATH.insert(insert_index, *load_paths)
|
||||
else
|
||||
# We are probably testing in core, -I and RUBYLIB don't apply
|
||||
$LOAD_PATH.unshift(*load_paths)
|
||||
end
|
||||
Bundler.rubygems.add_to_load_path(load_paths)
|
||||
|
||||
setup_manpath
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ require "uri"
|
|||
|
||||
module Bundler
|
||||
class Settings
|
||||
autoload :Mirror, "bundler/mirror"
|
||||
autoload :Mirrors, "bundler/mirror"
|
||||
autoload :Validator, "bundler/settings/validator"
|
||||
autoload :Mirror, File.expand_path("mirror", __dir__)
|
||||
autoload :Mirrors, File.expand_path("mirror", __dir__)
|
||||
autoload :Validator, File.expand_path("settings/validator", __dir__)
|
||||
|
||||
BOOL_KEYS = %w[
|
||||
allow_bundler_dependency_conflicts
|
||||
|
@ -28,14 +28,11 @@ module Bundler
|
|||
disable_platform_warnings
|
||||
disable_shared_gems
|
||||
disable_version_check
|
||||
error_on_stderr
|
||||
force_ruby_platform
|
||||
forget_cli_options
|
||||
frozen
|
||||
gem.coc
|
||||
gem.mit
|
||||
github.https
|
||||
global_path_appends_ruby_scope
|
||||
global_gem_cache
|
||||
ignore_messages
|
||||
init_gems_rb
|
||||
|
@ -207,23 +204,22 @@ module Bundler
|
|||
locations
|
||||
end
|
||||
|
||||
# for legacy reasons, in Bundler 1, the ruby scope isnt appended when the setting comes from ENV or the global config,
|
||||
# nor do we respect :disable_shared_gems
|
||||
# for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
|
||||
def path
|
||||
key = key_for(:path)
|
||||
path = ENV[key] || @global_config[key]
|
||||
if path && !@temporary.key?(key) && !@local_config.key?(key)
|
||||
return Path.new(path, Bundler.feature_flag.global_path_appends_ruby_scope?, false, false)
|
||||
return Path.new(path, false, false)
|
||||
end
|
||||
|
||||
system_path = self["path.system"] || (self[:disable_shared_gems] == false)
|
||||
Path.new(self[:path], true, system_path, Bundler.feature_flag.default_install_uses_path?)
|
||||
Path.new(self[:path], system_path, Bundler.feature_flag.default_install_uses_path?)
|
||||
end
|
||||
|
||||
Path = Struct.new(:explicit_path, :append_ruby_scope, :system_path, :default_install_uses_path) do
|
||||
Path = Struct.new(:explicit_path, :system_path, :default_install_uses_path) do
|
||||
def path
|
||||
path = base_path
|
||||
path = File.join(path, Bundler.ruby_scope) if append_ruby_scope && !use_system_gems?
|
||||
path = File.join(path, Bundler.ruby_scope) unless use_system_gems?
|
||||
path
|
||||
end
|
||||
|
||||
|
@ -358,7 +354,7 @@ module Bundler
|
|||
return unless file
|
||||
SharedHelpers.filesystem_access(file) do |p|
|
||||
FileUtils.mkdir_p(p.dirname)
|
||||
require "bundler/yaml_serializer"
|
||||
require_relative "yaml_serializer"
|
||||
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
||||
end
|
||||
end
|
||||
|
@ -398,7 +394,7 @@ module Bundler
|
|||
SharedHelpers.filesystem_access(config_file, :read) do |file|
|
||||
valid_file = file.exist? && !file.size.zero?
|
||||
return {} unless valid_file
|
||||
require "bundler/yaml_serializer"
|
||||
require_relative "yaml_serializer"
|
||||
YAMLSerializer.load file.read
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/shared_helpers"
|
||||
require_relative "shared_helpers"
|
||||
|
||||
if Bundler::SharedHelpers.in_bundle?
|
||||
require "bundler"
|
||||
require_relative "../bundler"
|
||||
|
||||
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
|
||||
Bundler.ui = Bundler::UI::Shell.new
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/compatibility_guard"
|
||||
require_relative "compatibility_guard"
|
||||
|
||||
require "pathname"
|
||||
require "rbconfig"
|
||||
require "rubygems"
|
||||
|
||||
require "bundler/version"
|
||||
require "bundler/constants"
|
||||
require "bundler/rubygems_integration"
|
||||
require "bundler/current_ruby"
|
||||
require_relative "version"
|
||||
require_relative "constants"
|
||||
require_relative "rubygems_integration"
|
||||
require_relative "current_ruby"
|
||||
|
||||
module Bundler
|
||||
module SharedHelpers
|
||||
|
@ -103,9 +103,7 @@ module Bundler
|
|||
#
|
||||
# @see {Bundler::PermissionError}
|
||||
def filesystem_access(path, action = :write, &block)
|
||||
# Use block.call instead of yield because of a bug in Ruby 2.2.2
|
||||
# See https://github.com/bundler/bundler/issues/5341 for details
|
||||
block.call(path.dup.untaint)
|
||||
yield(path.dup.untaint)
|
||||
rescue Errno::EACCES
|
||||
raise PermissionError.new(path, action)
|
||||
rescue Errno::EAGAIN
|
||||
|
@ -132,7 +130,7 @@ module Bundler
|
|||
def major_deprecation(major_version, message)
|
||||
bundler_major_version = Bundler.bundler_major_version
|
||||
if bundler_major_version > major_version
|
||||
require "bundler/errors"
|
||||
require_relative "errors"
|
||||
raise DeprecatedError, "[REMOVED] #{message}"
|
||||
end
|
||||
|
||||
|
@ -289,20 +287,10 @@ module Bundler
|
|||
public :set_env
|
||||
|
||||
def set_bundle_variables
|
||||
begin
|
||||
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
|
||||
unless File.exist?(exe_file)
|
||||
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
||||
end
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
||||
rescue Gem::GemNotFoundException
|
||||
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
||||
# for Ruby core repository
|
||||
exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file)
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
||||
end
|
||||
|
||||
# Set BUNDLE_GEMFILE
|
||||
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
||||
# for Ruby core repository
|
||||
exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file)
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile(:order_matters).to_s
|
||||
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
||||
end
|
||||
|
@ -316,8 +304,9 @@ module Bundler
|
|||
|
||||
def set_rubyopt
|
||||
rubyopt = [ENV["RUBYOPT"]].compact
|
||||
return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
|
||||
rubyopt.unshift %(-rbundler/setup)
|
||||
setup_require = "-r#{File.expand_path("setup", __dir__)}"
|
||||
return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
|
||||
rubyopt.unshift %(#{setup_require})
|
||||
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
||||
end
|
||||
|
||||
|
@ -351,9 +340,9 @@ module Bundler
|
|||
end
|
||||
|
||||
def prints_major_deprecations?
|
||||
require "bundler"
|
||||
require_relative "../bundler"
|
||||
return false if Bundler.settings[:silence_deprecations]
|
||||
require "bundler/deprecate"
|
||||
require_relative "deprecate"
|
||||
return false if Bundler::Deprecate.skip
|
||||
true
|
||||
end
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
module Bundler
|
||||
class Source
|
||||
autoload :Gemspec, "bundler/source/gemspec"
|
||||
autoload :Git, "bundler/source/git"
|
||||
autoload :Metadata, "bundler/source/metadata"
|
||||
autoload :Path, "bundler/source/path"
|
||||
autoload :Rubygems, "bundler/source/rubygems"
|
||||
autoload :Gemspec, File.expand_path("source/gemspec", __dir__)
|
||||
autoload :Git, File.expand_path("source/git", __dir__)
|
||||
autoload :Metadata, File.expand_path("source/metadata", __dir__)
|
||||
autoload :Path, File.expand_path("source/path", __dir__)
|
||||
autoload :Rubygems, File.expand_path("source/rubygems", __dir__)
|
||||
|
||||
attr_accessor :dependency_names
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_fileutils"
|
||||
require_relative "../vendored_fileutils"
|
||||
require "uri"
|
||||
|
||||
module Bundler
|
||||
class Source
|
||||
class Git < Path
|
||||
autoload :GitProxy, "bundler/source/git/git_proxy"
|
||||
autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
|
||||
|
||||
attr_reader :uri, :ref, :branch, :options, :submodules
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@ module Bundler
|
|||
idx << Gem::Specification.new do |s|
|
||||
s.name = "bundler"
|
||||
s.version = VERSION
|
||||
s.license = "MIT"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.source = self
|
||||
s.authors = ["bundler team"]
|
||||
s.bindir = "exe"
|
||||
s.homepage = "https://bundler.io"
|
||||
s.summary = "The best way to manage your application's dependencies"
|
||||
s.executables = %w[bundle]
|
||||
# can't point to the actual gemspec or else the require paths will be wrong
|
||||
s.loaded_from = File.expand_path("..", __FILE__)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
module Bundler
|
||||
class Source
|
||||
class Path < Source
|
||||
autoload :Installer, "bundler/source/path/installer"
|
||||
autoload :Installer, File.expand_path("path/installer", __dir__)
|
||||
|
||||
attr_reader :path, :options, :root_path, :original_path
|
||||
attr_writer :name
|
||||
|
|
|
@ -6,7 +6,7 @@ require "rubygems/user_interaction"
|
|||
module Bundler
|
||||
class Source
|
||||
class Rubygems < Source
|
||||
autoload :Remote, "bundler/source/rubygems/remote"
|
||||
autoload :Remote, File.expand_path("rubygems/remote", __dir__)
|
||||
|
||||
# Use the API when installing less than X gems
|
||||
API_REQUEST_LIMIT = 500
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/remote_specification"
|
||||
require_relative "remote_specification"
|
||||
|
||||
module Bundler
|
||||
class StubSpecification < RemoteSpecification
|
||||
|
@ -55,8 +55,6 @@ module Bundler
|
|||
stub.full_require_paths
|
||||
end
|
||||
|
||||
# This is what we do in bundler/rubygems_ext
|
||||
# full_require_paths is always implemented
|
||||
def load_paths
|
||||
full_require_paths
|
||||
end
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "<%= config[:namespaced_path] %>/version"
|
||||
require_relative 'lib/<%=config[:namespaced_path]%>/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = <%= config[:name].inspect %>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
module Bundler
|
||||
module UI
|
||||
autoload :RGProxy, "bundler/ui/rg_proxy"
|
||||
autoload :Shell, "bundler/ui/shell"
|
||||
autoload :Silent, "bundler/ui/silent"
|
||||
autoload :RGProxy, File.expand_path("ui/rg_proxy", __dir__)
|
||||
autoload :Shell, File.expand_path("ui/shell", __dir__)
|
||||
autoload :Silent, File.expand_path("ui/silent", __dir__)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/ui"
|
||||
require_relative "../ui"
|
||||
require "rubygems/user_interaction"
|
||||
|
||||
module Bundler
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/vendored_thor"
|
||||
require_relative "../vendored_thor"
|
||||
|
||||
module Bundler
|
||||
module UI
|
||||
|
@ -35,14 +35,12 @@ module Bundler
|
|||
return if @warning_history.include? msg
|
||||
@warning_history << msg
|
||||
|
||||
return tell_err(msg, :yellow, newline) if Bundler.feature_flag.error_on_stderr?
|
||||
tell_me(msg, :yellow, newline)
|
||||
tell_err(msg, :yellow, newline)
|
||||
end
|
||||
|
||||
def error(msg, newline = nil)
|
||||
return unless level("error")
|
||||
return tell_err(msg, :red, newline) if Bundler.feature_flag.error_on_stderr?
|
||||
tell_me(msg, :red, newline)
|
||||
tell_err(msg, :red, newline)
|
||||
end
|
||||
|
||||
def debug(msg, newline = nil)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Bundler
|
||||
module URICredentialsFilter
|
||||
module_function
|
||||
module_function # rubocop:disable Layout/AccessModifierIndentation
|
||||
|
||||
def credential_filtered_uri(uri_to_anonymize)
|
||||
return uri_to_anonymize if uri_to_anonymize.nil?
|
||||
|
|
|
@ -6,7 +6,7 @@ rescue LoadError
|
|||
# for make mjit-headers
|
||||
end
|
||||
|
||||
require "bundler/vendor/fileutils/lib/fileutils/version"
|
||||
require_relative "fileutils/version"
|
||||
|
||||
#
|
||||
# = fileutils.rb
|
||||
|
|
12
lib/bundler/vendor/molinillo/lib/molinillo.rb
vendored
12
lib/bundler/vendor/molinillo/lib/molinillo.rb
vendored
|
@ -1,11 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/compatibility'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/gem_metadata'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/errors'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/resolver'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/modules/ui'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/modules/specification_provider'
|
||||
require_relative 'molinillo/compatibility'
|
||||
require_relative 'molinillo/gem_metadata'
|
||||
require_relative 'molinillo/errors'
|
||||
require_relative 'molinillo/resolver'
|
||||
require_relative 'molinillo/modules/ui'
|
||||
require_relative 'molinillo/modules/specification_provider'
|
||||
|
||||
# Bundler::Molinillo is a generic dependency resolution algorithm.
|
||||
module Bundler::Molinillo
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require 'set'
|
||||
require 'tsort'
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/log'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex'
|
||||
require_relative 'dependency_graph/log'
|
||||
require_relative 'dependency_graph/vertex'
|
||||
|
||||
module Bundler::Molinillo
|
||||
# A directed acyclic graph that is tuned to hold named dependencies
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag'
|
||||
require_relative 'add_edge_no_circular'
|
||||
require_relative 'add_vertex'
|
||||
require_relative 'delete_edge'
|
||||
require_relative 'detach_vertex_named'
|
||||
require_relative 'set_payload'
|
||||
require_relative 'tag'
|
||||
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
||||
require_relative 'action'
|
||||
module Bundler::Molinillo
|
||||
class DependencyGraph
|
||||
# @!visibility private
|
||||
|
|
|
@ -80,7 +80,7 @@ module Bundler::Molinillo
|
|||
@specification_provider = specification_provider
|
||||
end
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider'
|
||||
require_relative 'delegates/specification_provider'
|
||||
include Delegates::SpecificationProvider
|
||||
|
||||
# @return [String] An error message that includes requirement trees,
|
||||
|
|
|
@ -238,11 +238,11 @@ module Bundler::Molinillo
|
|||
debug { 'Activated: ' + Hash[activated.vertices.select { |_n, v| v.payload }].keys.join(', ') } if state
|
||||
end
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/state'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/modules/specification_provider'
|
||||
require_relative 'state'
|
||||
require_relative 'modules/specification_provider'
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state'
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider'
|
||||
require_relative 'delegates/resolution_state'
|
||||
require_relative 'delegates/specification_provider'
|
||||
|
||||
include Bundler::Molinillo::Delegates::ResolutionState
|
||||
include Bundler::Molinillo::Delegates::SpecificationProvider
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph'
|
||||
require_relative 'dependency_graph'
|
||||
|
||||
module Bundler::Molinillo
|
||||
# This class encapsulates a dependency resolver.
|
||||
|
@ -9,7 +9,7 @@ module Bundler::Molinillo
|
|||
#
|
||||
#
|
||||
class Resolver
|
||||
require 'bundler/vendor/molinillo/lib/molinillo/resolution'
|
||||
require_relative 'resolution'
|
||||
|
||||
# @return [SpecificationProvider] the specification provider used
|
||||
# in the resolution process
|
||||
|
|
6
lib/bundler/vendor/thor/lib/thor/base.rb
vendored
6
lib/bundler/vendor/thor/lib/thor/base.rb
vendored
|
@ -9,9 +9,9 @@ require "bundler/vendor/thor/lib/thor/line_editor"
|
|||
require "bundler/vendor/thor/lib/thor/util"
|
||||
|
||||
class Bundler::Thor
|
||||
autoload :Actions, "bundler/vendor/thor/lib/thor/actions"
|
||||
autoload :RakeCompat, "bundler/vendor/thor/lib/thor/rake_compat"
|
||||
autoload :Group, "bundler/vendor/thor/lib/thor/group"
|
||||
autoload :Actions, File.expand_path("actions", __dir__)
|
||||
autoload :RakeCompat, File.expand_path("rake_compat", __dir__)
|
||||
autoload :Group, File.expand_path("group", __dir__)
|
||||
|
||||
# Shortcuts for help.
|
||||
HELP_MAPPINGS = %w(-h -? --help -D)
|
||||
|
|
6
lib/bundler/vendor/thor/lib/thor/shell.rb
vendored
6
lib/bundler/vendor/thor/lib/thor/shell.rb
vendored
|
@ -24,9 +24,9 @@ class Bundler::Thor
|
|||
SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
|
||||
attr_writer :shell
|
||||
|
||||
autoload :Basic, "bundler/vendor/thor/lib/thor/shell/basic"
|
||||
autoload :Color, "bundler/vendor/thor/lib/thor/shell/color"
|
||||
autoload :HTML, "bundler/vendor/thor/lib/thor/shell/html"
|
||||
autoload :Basic, File.expand_path("shell/basic", __dir__)
|
||||
autoload :Color, File.expand_path("shell/color", __dir__)
|
||||
autoload :HTML, File.expand_path("shell/html", __dir__)
|
||||
|
||||
# Add shell to initialize config values.
|
||||
#
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Bundler; end
|
||||
if RUBY_VERSION >= "2.4"
|
||||
require "bundler/vendor/fileutils/lib/fileutils"
|
||||
require_relative "vendor/fileutils/lib/fileutils"
|
||||
else
|
||||
# the version we vendor is 2.4+
|
||||
require "fileutils"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Bundler; end
|
||||
require "bundler/vendor/molinillo/lib/molinillo"
|
||||
require_relative "vendor/molinillo/lib/molinillo"
|
||||
|
|
|
@ -15,7 +15,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
end
|
||||
require "bundler/vendor/net-http-persistent/lib/net/http/persistent"
|
||||
require_relative "vendor/net-http-persistent/lib/net/http/persistent"
|
||||
|
||||
module Bundler
|
||||
class PersistentHTTP < Persistent::Net::HTTP::Persistent
|
||||
|
|
|
@ -5,4 +5,4 @@ module Bundler
|
|||
Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
|
||||
end
|
||||
end
|
||||
require "bundler/vendor/thor/lib/thor"
|
||||
require_relative "vendor/thor/lib/thor"
|
||||
|
|
|
@ -1,23 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
# We're doing this because we might write tests that deal
|
||||
# with other versions of bundler and we are unsure how to
|
||||
# handle this better.
|
||||
VERSION = "2.1.0.pre.1".freeze unless defined?(::Bundler::VERSION)
|
||||
|
||||
def self.overwrite_loaded_gem_version
|
||||
begin
|
||||
require "rubygems"
|
||||
rescue LoadError
|
||||
return
|
||||
end
|
||||
return unless bundler_spec = Gem.loaded_specs["bundler"]
|
||||
return if bundler_spec.version == VERSION
|
||||
bundler_spec.version = Bundler::VERSION
|
||||
end
|
||||
private_class_method :overwrite_loaded_gem_version
|
||||
overwrite_loaded_gem_version
|
||||
VERSION = "2.1.0.pre.1".freeze
|
||||
|
||||
def self.bundler_major_version
|
||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/shared_helpers"
|
||||
require_relative "shared_helpers"
|
||||
Bundler::SharedHelpers.major_deprecation 2,
|
||||
"The Bundler task for Vlad"
|
||||
|
||||
|
@ -8,7 +8,7 @@ Bundler::SharedHelpers.major_deprecation 2,
|
|||
#
|
||||
# Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
|
||||
# include the vlad:bundle:install task in your vlad:deploy task.
|
||||
require "bundler/deployment"
|
||||
require_relative "deployment"
|
||||
|
||||
include Rake::DSL if defined? Rake::DSL
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
module Bundler
|
||||
# A stub yaml serializer that can handle only hashes and strings (as of now).
|
||||
module YAMLSerializer
|
||||
module_function
|
||||
module_function # rubocop:disable Layout/AccessModifierIndentation
|
||||
|
||||
def dump(hash)
|
||||
yaml = String.new("---")
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-ADD" "1" "March 2019" "" ""
|
||||
.TH "BUNDLE\-ADD" "1" "May 2019" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
|
||||
.
|
||||
.SH "SYNOPSIS"
|
||||
\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
|
||||
\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-branch=BRANCH] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
|
||||
|
@ -45,6 +45,14 @@ Specify the group(s) for the added gem\. Multiple groups should be separated by
|
|||
Specify the source for the added gem\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-git\fR
|
||||
Specify the git source for the added gem\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-branch\fR
|
||||
Specify the git branch for the added gem\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-skip\-install\fR
|
||||
Adds the gem to the Gemfile but does not install it\.
|
||||
.
|
||||
|
|
|
@ -7,10 +7,11 @@ NAME
|
|||
|
||||
SYNOPSIS
|
||||
bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
|
||||
[--source=SOURCE] [--skip-install] [--strict] [--optimistic]
|
||||
[--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install]
|
||||
[--strict] [--optimistic]
|
||||
|
||||
DESCRIPTION
|
||||
Adds the named gem to the Gemfile and run bundle install. bundle
|
||||
Adds the named gem to the Gemfile and run bundle install. bundle
|
||||
install can be avoided by using the flag --skip-install.
|
||||
|
||||
Example:
|
||||
|
@ -19,7 +20,7 @@ DESCRIPTION
|
|||
|
||||
bundle add rails --version "< 3.0, > 1.1"
|
||||
|
||||
bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
|
||||
bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
|
||||
ple.com" --group "development"
|
||||
|
||||
bundle add rails --skip-install
|
||||
|
@ -31,12 +32,17 @@ OPTIONS
|
|||
Specify version requirements(s) for the added gem.
|
||||
|
||||
--group, -g
|
||||
Specify the group(s) for the added gem. Multiple groups should
|
||||
Specify the group(s) for the added gem. Multiple groups should
|
||||
be separated by commas.
|
||||
|
||||
--source, , -s
|
||||
Specify the source for the added gem.
|
||||
|
||||
--git Specify the git source for the added gem.
|
||||
|
||||
--branch
|
||||
Specify the git branch for the added gem.
|
||||
|
||||
--skip-install
|
||||
Adds the gem to the Gemfile but does not install it.
|
||||
|
||||
|
@ -49,4 +55,4 @@ OPTIONS
|
|||
|
||||
|
||||
|
||||
March 2019 BUNDLE-ADD(1)
|
||||
May 2019 BUNDLE-ADD(1)
|
||||
|
|
|
@ -3,7 +3,7 @@ bundle-add(1) -- Add gem to the Gemfile and run bundle install
|
|||
|
||||
## SYNOPSIS
|
||||
|
||||
`bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--skip-install] [--strict] [--optimistic]
|
||||
`bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install] [--strict] [--optimistic]
|
||||
|
||||
## DESCRIPTION
|
||||
Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
|
||||
|
@ -30,6 +30,12 @@ bundle add rails --group "development, test"
|
|||
* `--source`, , `-s`:
|
||||
Specify the source for the added gem.
|
||||
|
||||
* `--git`:
|
||||
Specify the git source for the added gem.
|
||||
|
||||
* `--branch`:
|
||||
Specify the git branch for the added gem.
|
||||
|
||||
* `--skip-install`:
|
||||
Adds the gem to the Gemfile but does not install it.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-CONFIG" "1" "April 2019" "" ""
|
||||
.TH "BUNDLE\-CONFIG" "1" "May 2019" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-config\fR \- Set bundler configuration options
|
||||
|
@ -193,9 +193,6 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|||
\fBdisable_version_check\fR (\fBBUNDLE_DISABLE_VERSION_CHECK\fR): Stop Bundler from checking if a newer Bundler version is available on rubygems\.org\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBerror_on_stderr\fR (\fBBUNDLE_ERROR_ON_STDERR\fR): Print Bundler errors to stderr\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBforce_ruby_platform\fR (\fBBUNDLE_FORCE_RUBY_PLATFORM\fR): Ignore the current machine\'s platform and install only \fBruby\fR platform gems\. As a result, gems with native extensions will be compiled from source\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
@ -211,9 +208,6 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|||
\fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBglobal_path_appends_ruby_scope\fR (\fBBUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE\fR): Whether Bundler should append the Ruby scope (e\.g\. engine and ABI version) to a globally\-configured path\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
@ -244,9 +238,6 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|||
\fBplugins\fR (\fBBUNDLE_PLUGINS\fR): Enable Bundler\'s experimental plugin system\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBprefer_gems_rb\fR (\fBBUNDLE_PREFER_GEMS_RB\fR) Prefer \fBgems\.rb\fR to \fBGemfile\fR when Bundler is searching for a Gemfile\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
|
|
@ -221,37 +221,29 @@ LIST OF AVAILABLE KEYS
|
|||
from checking if a newer Bundler version is available on
|
||||
rubygems.org.
|
||||
|
||||
o error_on_stderr (BUNDLE_ERROR_ON_STDERR): Print Bundler errors to
|
||||
stderr.
|
||||
|
||||
o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
|
||||
rent machine's platform and install only ruby platform gems. As a
|
||||
o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
|
||||
rent machine's platform and install only ruby platform gems. As a
|
||||
result, gems with native extensions will be compiled from source.
|
||||
|
||||
o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
|
||||
Gemfile is changed and the lockfile has not been updated, running
|
||||
Bundler commands will be blocked. Defaults to true when --deploy-
|
||||
o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
|
||||
Gemfile is changed and the lockfile has not been updated, running
|
||||
Bundler commands will be blocked. Defaults to true when --deploy-
|
||||
ment is used.
|
||||
|
||||
o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
|
||||
gem push when using the rake release command with a private gem-
|
||||
o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
|
||||
gem push when using the rake release command with a private gem-
|
||||
stash server.
|
||||
|
||||
o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
|
||||
use as the Gemfile. This location of this file also sets the root
|
||||
o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
|
||||
use as the Gemfile. This location of this file also sets the root
|
||||
of the project, which is used to resolve relative paths in the Gem-
|
||||
file, among other things. By default, bundler will search up from
|
||||
file, among other things. By default, bundler will search up from
|
||||
the current working directory until it finds a Gemfile.
|
||||
|
||||
o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
|
||||
o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
|
||||
cache all gems globally, rather than locally to the installing Ruby
|
||||
installation.
|
||||
|
||||
o global_path_appends_ruby_scope (BUN-
|
||||
DLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE): Whether Bundler should append
|
||||
the Ruby scope (e.g. engine and ABI version) to a globally-config-
|
||||
ured path.
|
||||
|
||||
o ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
|
||||
messages will be printed. To silence a single gem, use dot notation
|
||||
like ignore_messages.httparty true.
|
||||
|
@ -287,52 +279,49 @@ LIST OF AVAILABLE KEYS
|
|||
o plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin sys-
|
||||
tem.
|
||||
|
||||
o prefer_gems_rb (BUNDLE_PREFER_GEMS_RB) Prefer gems.rb to Gemfile
|
||||
when Bundler is searching for a Gemfile.
|
||||
|
||||
o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
|
||||
patch version during updates. Makes bundle update calls equivalent
|
||||
o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
|
||||
patch version during updates. Makes bundle update calls equivalent
|
||||
to bundler update --patch.
|
||||
|
||||
o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
|
||||
o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
|
||||
only version number from bundler --version.
|
||||
|
||||
o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
|
||||
o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
|
||||
network requests. Defaults to 5.
|
||||
|
||||
o retry (BUNDLE_RETRY): The number of times to retry failed network
|
||||
o retry (BUNDLE_RETRY): The number of times to retry failed network
|
||||
requests. Defaults to 3.
|
||||
|
||||
o setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB-
|
||||
LIC): Have Bundler.setup make the Kernel#gem method public, even
|
||||
LIC): Have Bundler.setup make the Kernel#gem method public, even
|
||||
though RubyGems declares it as private.
|
||||
|
||||
o shebang (BUNDLE_SHEBANG): The program name that should be invoked
|
||||
for generated binstubs. Defaults to the ruby install name used to
|
||||
o shebang (BUNDLE_SHEBANG): The program name that should be invoked
|
||||
for generated binstubs. Defaults to the ruby install name used to
|
||||
generate the binstub.
|
||||
|
||||
o silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
|
||||
should silence deprecation warnings for behavior that will be
|
||||
should silence deprecation warnings for behavior that will be
|
||||
changed in the next major version.
|
||||
|
||||
o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
|
||||
o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
|
||||
warning Bundler prints when installing gems as root.
|
||||
|
||||
o skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether
|
||||
Bundler should skip adding default git source shortcuts to the Gem-
|
||||
file DSL.
|
||||
|
||||
o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
|
||||
o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
|
||||
resolve for the specific running platform and store it in the lock-
|
||||
file, instead of only using a generic platform. A specific platform
|
||||
is the exact platform triple reported by Gem::Platform.local, such
|
||||
as x86_64-darwin-16 or universal-java-1.8. On the other hand,
|
||||
generic platforms are those such as ruby, mswin, or java. In this
|
||||
example, x86_64-darwin-16 would map to ruby and universal-java-1.8
|
||||
is the exact platform triple reported by Gem::Platform.local, such
|
||||
as x86_64-darwin-16 or universal-java-1.8. On the other hand,
|
||||
generic platforms are those such as ruby, mswin, or java. In this
|
||||
example, x86_64-darwin-16 would map to ruby and universal-java-1.8
|
||||
to java.
|
||||
|
||||
o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
|
||||
cate file or folder containing multiple certificates for trusted
|
||||
o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
|
||||
cate file or folder containing multiple certificates for trusted
|
||||
CAs in PEM format.
|
||||
|
||||
o ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
|
||||
|
@ -342,44 +331,44 @@ LIST OF AVAILABLE KEYS
|
|||
Bundler uses when making HTTPS requests. Defaults to verify peer.
|
||||
|
||||
o suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES-
|
||||
SAGES): Avoid printing Using ... messages during installation when
|
||||
SAGES): Avoid printing Using ... messages during installation when
|
||||
the version of a gem has not changed.
|
||||
|
||||
o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
|
||||
o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
|
||||
installs binstubs. Defaults to Gem.bindir.
|
||||
|
||||
o timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
|
||||
network requests. Defaults to 10.
|
||||
|
||||
o unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC):
|
||||
Whether running bundle update --source NAME unlocks a gem with the
|
||||
Whether running bundle update --source NAME unlocks a gem with the
|
||||
given name. Defaults to true.
|
||||
|
||||
o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
|
||||
passing --all to bundle update when everything should be updated,
|
||||
o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
|
||||
passing --all to bundle update when everything should be updated,
|
||||
and disallow passing no options to bundle update.
|
||||
|
||||
o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
|
||||
o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
|
||||
Bundler includes in API requests.
|
||||
|
||||
o with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
|
||||
should install.
|
||||
|
||||
o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
|
||||
o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
|
||||
bundler should not install.
|
||||
|
||||
|
||||
|
||||
In general, you should set these settings per-application by using the
|
||||
applicable flag to the bundle install(1) bundle-install.1.html or bun-
|
||||
In general, you should set these settings per-application by using the
|
||||
applicable flag to the bundle install(1) bundle-install.1.html or bun-
|
||||
dle package(1) bundle-package.1.html command.
|
||||
|
||||
You can set them globally either via environment variables or bundle
|
||||
config, whichever is preferable for your setup. If you use both, envi-
|
||||
You can set them globally either via environment variables or bundle
|
||||
config, whichever is preferable for your setup. If you use both, envi-
|
||||
ronment variables will take preference over global settings.
|
||||
|
||||
LOCAL GIT REPOS
|
||||
Bundler also allows you to work against a git repository locally
|
||||
Bundler also allows you to work against a git repository locally
|
||||
instead of using the remote version. This can be achieved by setting up
|
||||
a local override:
|
||||
|
||||
|
@ -398,30 +387,30 @@ LOCAL GIT REPOS
|
|||
|
||||
|
||||
|
||||
Now instead of checking out the remote git repository, the local over-
|
||||
ride will be used. Similar to a path source, every time the local git
|
||||
repository change, changes will be automatically picked up by Bundler.
|
||||
This means a commit in the local git repo will update the revision in
|
||||
Now instead of checking out the remote git repository, the local over-
|
||||
ride will be used. Similar to a path source, every time the local git
|
||||
repository change, changes will be automatically picked up by Bundler.
|
||||
This means a commit in the local git repo will update the revision in
|
||||
the Gemfile.lock to the local git repo revision. This requires the same
|
||||
attention as git submodules. Before pushing to the remote, you need to
|
||||
attention as git submodules. Before pushing to the remote, you need to
|
||||
ensure the local override was pushed, otherwise you may point to a com-
|
||||
mit that only exists in your local machine. You'll also need to CGI
|
||||
mit that only exists in your local machine. You'll also need to CGI
|
||||
escape your usernames and passwords as well.
|
||||
|
||||
Bundler does many checks to ensure a developer won't work with invalid
|
||||
references. Particularly, we force a developer to specify a branch in
|
||||
the Gemfile in order to use this feature. If the branch specified in
|
||||
the Gemfile and the current branch in the local git repository do not
|
||||
match, Bundler will abort. This ensures that a developer is always
|
||||
working against the correct branches, and prevents accidental locking
|
||||
Bundler does many checks to ensure a developer won't work with invalid
|
||||
references. Particularly, we force a developer to specify a branch in
|
||||
the Gemfile in order to use this feature. If the branch specified in
|
||||
the Gemfile and the current branch in the local git repository do not
|
||||
match, Bundler will abort. This ensures that a developer is always
|
||||
working against the correct branches, and prevents accidental locking
|
||||
to a different branch.
|
||||
|
||||
Finally, Bundler also ensures that the current revision in the Gem-
|
||||
file.lock exists in the local git repository. By doing this, Bundler
|
||||
Finally, Bundler also ensures that the current revision in the Gem-
|
||||
file.lock exists in the local git repository. By doing this, Bundler
|
||||
forces you to fetch the latest changes in the remotes.
|
||||
|
||||
MIRRORS OF GEM SOURCES
|
||||
Bundler supports overriding gem sources with mirrors. This allows you
|
||||
Bundler supports overriding gem sources with mirrors. This allows you
|
||||
to configure rubygems.org as the gem source in your Gemfile while still
|
||||
using your mirror to fetch gems.
|
||||
|
||||
|
@ -431,7 +420,7 @@ MIRRORS OF GEM SOURCES
|
|||
|
||||
|
||||
|
||||
For example, to use a mirror of rubygems.org hosted at rubygems-mir-
|
||||
For example, to use a mirror of rubygems.org hosted at rubygems-mir-
|
||||
ror.org:
|
||||
|
||||
|
||||
|
@ -440,8 +429,8 @@ MIRRORS OF GEM SOURCES
|
|||
|
||||
|
||||
|
||||
Each mirror also provides a fallback timeout setting. If the mirror
|
||||
does not respond within the fallback timeout, Bundler will try to use
|
||||
Each mirror also provides a fallback timeout setting. If the mirror
|
||||
does not respond within the fallback timeout, Bundler will try to use
|
||||
the original server instead of the mirror.
|
||||
|
||||
|
||||
|
@ -458,11 +447,11 @@ MIRRORS OF GEM SOURCES
|
|||
|
||||
|
||||
|
||||
The default fallback timeout is 0.1 seconds, but the setting can cur-
|
||||
The default fallback timeout is 0.1 seconds, but the setting can cur-
|
||||
rently only accept whole seconds (for example, 1, 15, or 30).
|
||||
|
||||
CREDENTIALS FOR GEM SOURCES
|
||||
Bundler allows you to configure credentials for any gem source, which
|
||||
Bundler allows you to configure credentials for any gem source, which
|
||||
allows you to avoid putting secrets into your Gemfile.
|
||||
|
||||
|
||||
|
@ -471,7 +460,7 @@ CREDENTIALS FOR GEM SOURCES
|
|||
|
||||
|
||||
|
||||
For example, to save the credentials of user claudette for the gem
|
||||
For example, to save the credentials of user claudette for the gem
|
||||
source at gems.longerous.com, you would run:
|
||||
|
||||
|
||||
|
@ -505,7 +494,7 @@ CREDENTIALS FOR GEM SOURCES
|
|||
|
||||
|
||||
|
||||
This is especially useful for private repositories on hosts such as
|
||||
This is especially useful for private repositories on hosts such as
|
||||
Github, where you can use personal OAuth tokens:
|
||||
|
||||
|
||||
|
@ -515,9 +504,9 @@ CREDENTIALS FOR GEM SOURCES
|
|||
|
||||
|
||||
CONFIGURE BUNDLER DIRECTORIES
|
||||
Bundler's home, config, cache and plugin directories are able to be
|
||||
configured through environment variables. The default location for
|
||||
Bundler's home directory is ~/.bundle, which all directories inherit
|
||||
Bundler's home, config, cache and plugin directories are able to be
|
||||
configured through environment variables. The default location for
|
||||
Bundler's home directory is ~/.bundle, which all directories inherit
|
||||
from by default. The following outlines the available environment vari-
|
||||
ables and their default values
|
||||
|
||||
|
@ -533,4 +522,4 @@ CONFIGURE BUNDLER DIRECTORIES
|
|||
|
||||
|
||||
|
||||
April 2019 BUNDLE-CONFIG(1)
|
||||
May 2019 BUNDLE-CONFIG(1)
|
||||
|
|
|
@ -183,8 +183,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|||
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
|
||||
Stop Bundler from checking if a newer Bundler version is available on
|
||||
rubygems.org.
|
||||
* `error_on_stderr` (`BUNDLE_ERROR_ON_STDERR`):
|
||||
Print Bundler errors to stderr.
|
||||
* `force_ruby_platform` (`BUNDLE_FORCE_RUBY_PLATFORM`):
|
||||
Ignore the current machine's platform and install only `ruby` platform gems.
|
||||
As a result, gems with native extensions will be compiled from source.
|
||||
|
@ -204,9 +202,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|||
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
|
||||
Whether Bundler should cache all gems globally, rather than locally to the
|
||||
installing Ruby installation.
|
||||
* `global_path_appends_ruby_scope` (`BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE`):
|
||||
Whether Bundler should append the Ruby scope (e.g. engine and ABI version)
|
||||
to a globally-configured path.
|
||||
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install
|
||||
messages will be printed. To silence a single gem, use dot notation like
|
||||
`ignore_messages.httparty true`.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE" "1" "April 2019" "" ""
|
||||
.TH "BUNDLE" "1" "May 2019" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\fR \- Ruby Dependency Management
|
||||
|
@ -89,7 +89,7 @@ Start an IRB session in the current bundle
|
|||
Open an installed gem in the editor
|
||||
.
|
||||
.TP
|
||||
\fBbundle lock(1)\fR \fIbundle\-lock\.1\.hmtl\fR
|
||||
\fBbundle lock(1)\fR \fIbundle\-lock\.1\.html\fR
|
||||
Generate a lockfile for your dependencies
|
||||
.
|
||||
.TP
|
||||
|
|
|
@ -71,7 +71,7 @@ UTILITIES
|
|||
bundle open(1) bundle-open.1.html
|
||||
Open an installed gem in the editor
|
||||
|
||||
bundle lock(1) bundle-lock.1.hmtl
|
||||
bundle lock(1) bundle-lock.1.html
|
||||
Generate a lockfile for your dependencies
|
||||
|
||||
bundle viz(1) bundle-viz.1.html
|
||||
|
@ -113,4 +113,4 @@ OBSOLETE
|
|||
|
||||
|
||||
|
||||
April 2019 BUNDLE(1)
|
||||
May 2019 BUNDLE(1)
|
||||
|
|
|
@ -73,7 +73,7 @@ We divide `bundle` subcommands into primary commands and utilities:
|
|||
* [`bundle open(1)`](bundle-open.1.html):
|
||||
Open an installed gem in the editor
|
||||
|
||||
* [`bundle lock(1)`](bundle-lock.1.hmtl):
|
||||
* [`bundle lock(1)`](bundle-lock.1.html):
|
||||
Generate a lockfile for your dependencies
|
||||
|
||||
* [`bundle viz(1)`](bundle-viz.1.html):
|
||||
|
|
|
@ -370,54 +370,51 @@ EOF
|
|||
it { should be true }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#requires_sudo?" do
|
||||
before do
|
||||
allow(Bundler).to receive(:which).with("sudo").and_return("/usr/bin/sudo")
|
||||
FileUtils.mkdir_p("tmp/vendor/bundle")
|
||||
FileUtils.mkdir_p("tmp/vendor/bin_dir")
|
||||
end
|
||||
after do
|
||||
FileUtils.rm_rf("tmp/vendor/bundle")
|
||||
FileUtils.rm_rf("tmp/vendor/bin_dir")
|
||||
Bundler.remove_instance_variable(:@requires_sudo_ran)
|
||||
Bundler.remove_instance_variable(:@requires_sudo)
|
||||
end
|
||||
context "writable paths" do
|
||||
it "should return false and display nothing" do
|
||||
allow(Bundler).to receive(:bundle_path).and_return(Pathname("tmp/vendor/bundle"))
|
||||
expect(Bundler.ui).to_not receive(:warn)
|
||||
expect(Bundler.requires_sudo?).to eq(false)
|
||||
end
|
||||
end
|
||||
context "unwritable paths" do
|
||||
context "path writability" do
|
||||
before do
|
||||
FileUtils.touch("tmp/vendor/bundle/unwritable1.txt")
|
||||
FileUtils.touch("tmp/vendor/bundle/unwritable2.txt")
|
||||
FileUtils.touch("tmp/vendor/bin_dir/unwritable3.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable1.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable2.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bin_dir/unwritable3.txt")
|
||||
FileUtils.mkdir_p("tmp/vendor/bundle")
|
||||
FileUtils.mkdir_p("tmp/vendor/bin_dir")
|
||||
end
|
||||
it "should return true and display warn message" do
|
||||
allow(Bundler).to receive(:bundle_path).and_return(Pathname("tmp/vendor/bundle"))
|
||||
bin_dir = Pathname("tmp/vendor/bin_dir/")
|
||||
after do
|
||||
FileUtils.rm_rf("tmp/vendor/bundle")
|
||||
FileUtils.rm_rf("tmp/vendor/bin_dir")
|
||||
end
|
||||
context "writable paths" do
|
||||
it "should return false and display nothing" do
|
||||
allow(Bundler).to receive(:bundle_path).and_return(Pathname("tmp/vendor/bundle"))
|
||||
expect(Bundler.ui).to_not receive(:warn)
|
||||
expect(Bundler.requires_sudo?).to eq(false)
|
||||
end
|
||||
end
|
||||
context "unwritable paths" do
|
||||
before do
|
||||
FileUtils.touch("tmp/vendor/bundle/unwritable1.txt")
|
||||
FileUtils.touch("tmp/vendor/bundle/unwritable2.txt")
|
||||
FileUtils.touch("tmp/vendor/bin_dir/unwritable3.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable1.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bundle/unwritable2.txt")
|
||||
FileUtils.chmod(0o400, "tmp/vendor/bin_dir/unwritable3.txt")
|
||||
end
|
||||
it "should return true and display warn message" do
|
||||
allow(Bundler).to receive(:bundle_path).and_return(Pathname("tmp/vendor/bundle"))
|
||||
bin_dir = Pathname("tmp/vendor/bin_dir/")
|
||||
|
||||
# allow File#writable? to be called with args other than the stubbed on below
|
||||
allow(File).to receive(:writable?).and_call_original
|
||||
# allow File#writable? to be called with args other than the stubbed on below
|
||||
allow(File).to receive(:writable?).and_call_original
|
||||
|
||||
# fake make the directory unwritable
|
||||
allow(File).to receive(:writable?).with(bin_dir).and_return(false)
|
||||
allow(Bundler).to receive(:system_bindir).and_return(Pathname("tmp/vendor/bin_dir/"))
|
||||
message = <<-MESSAGE.chomp
|
||||
# fake make the directory unwritable
|
||||
allow(File).to receive(:writable?).with(bin_dir).and_return(false)
|
||||
allow(Bundler).to receive(:system_bindir).and_return(Pathname("tmp/vendor/bin_dir/"))
|
||||
message = <<-MESSAGE.chomp
|
||||
Following files may not be writable, so sudo is needed:
|
||||
tmp/vendor/bin_dir/
|
||||
tmp/vendor/bundle/unwritable1.txt
|
||||
tmp/vendor/bundle/unwritable2.txt
|
||||
MESSAGE
|
||||
expect(Bundler.ui).to receive(:warn).with(message)
|
||||
expect(Bundler.requires_sudo?).to eq(true)
|
||||
expect(Bundler.ui).to receive(:warn).with(message)
|
||||
expect(Bundler.requires_sudo?).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -457,6 +454,7 @@ MESSAGE
|
|||
|
||||
it "should use custom home path as root for other paths" do
|
||||
ENV["BUNDLE_USER_HOME"] = bundle_user_home_custom.to_s
|
||||
allow(Bundler.rubygems).to receive(:user_home).and_raise
|
||||
expect(Bundler.user_bundle_path).to eq(bundle_user_home_custom)
|
||||
expect(Bundler.user_bundle_path("home")).to eq(bundle_user_home_custom)
|
||||
expect(Bundler.user_bundle_path("cache")).to eq(bundle_user_home_custom.join("cache"))
|
||||
|
|
|
@ -30,8 +30,8 @@ RSpec.describe "bundle executable" do
|
|||
context "with no arguments" do
|
||||
it "prints a concise help message", :bundler => "3" do
|
||||
bundle! ""
|
||||
expect(last_command.stderr).to be_empty
|
||||
expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}").
|
||||
expect(err).to be_empty
|
||||
expect(out).to include("Bundler version #{Bundler::VERSION}").
|
||||
and include("\n\nBundler commands:\n\n").
|
||||
and include("\n\n Primary commands:\n").
|
||||
and include("\n\n Utilities:\n").
|
||||
|
@ -72,17 +72,17 @@ RSpec.describe "bundle executable" do
|
|||
it "prints the running command" do
|
||||
gemfile ""
|
||||
bundle! "info bundler", :verbose => true
|
||||
expect(last_command.stdout).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}")
|
||||
expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}")
|
||||
end
|
||||
|
||||
it "doesn't print defaults" do
|
||||
install_gemfile! "", :verbose => true
|
||||
expect(last_command.stdout).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}")
|
||||
expect(out).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}")
|
||||
end
|
||||
|
||||
it "doesn't print defaults" do
|
||||
install_gemfile! "", :verbose => true
|
||||
expect(last_command.stdout).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}")
|
||||
expect(out).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ RSpec.describe "bundle executable" do
|
|||
let(:latest_version) { "222.0" }
|
||||
it "prints the version warning" do
|
||||
bundle "fail"
|
||||
expect(last_command.stdout).to start_with(<<-EOS.strip)
|
||||
expect(err).to start_with(<<-EOS.strip)
|
||||
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
|
||||
To install the latest version, run `gem install bundler`
|
||||
EOS
|
||||
|
@ -150,7 +150,7 @@ To install the latest version, run `gem install bundler`
|
|||
let(:latest_version) { "222.0.0.pre.4" }
|
||||
it "prints the version warning" do
|
||||
bundle "fail"
|
||||
expect(last_command.stdout).to start_with(<<-EOS.strip)
|
||||
expect(err).to start_with(<<-EOS.strip)
|
||||
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
|
||||
To install the latest version, run `gem install bundler --pre`
|
||||
EOS
|
||||
|
|
|
@ -25,60 +25,17 @@ RSpec.describe Bundler::Dsl do
|
|||
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
|
||||
end
|
||||
|
||||
context "github_https feature flag" do
|
||||
it "is true when github.https is true" do
|
||||
bundle "config set github.https true"
|
||||
expect(Bundler.feature_flag.github_https?).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "the github DSL" do |protocol|
|
||||
context "when full repo is used" do
|
||||
let(:repo) { "indirect/sparks" }
|
||||
|
||||
it "converts :github to URI using #{protocol}" do
|
||||
subject.gem("sparks", :github => repo)
|
||||
github_uri = "#{protocol}://github.com/#{repo}.git"
|
||||
expect(subject.dependencies.first.source.uri).to eq(github_uri)
|
||||
end
|
||||
context "default hosts", :bundler => "2" do
|
||||
it "converts :github to URI using https" do
|
||||
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
|
||||
|
||||
context "when shortcut repo is used" do
|
||||
let(:repo) { "rails" }
|
||||
|
||||
it "converts :github to URI using #{protocol}" do
|
||||
subject.gem("sparks", :github => repo)
|
||||
github_uri = "#{protocol}://github.com/#{repo}/#{repo}.git"
|
||||
expect(subject.dependencies.first.source.uri).to eq(github_uri)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "default hosts (git, gist)" do
|
||||
context "when github.https config is true" do
|
||||
before { bundle "config set github.https true" }
|
||||
|
||||
it_behaves_like "the github DSL", "https"
|
||||
end
|
||||
|
||||
context "when github.https config is false", :bundler => "2" do
|
||||
before { bundle "config set github.https false" }
|
||||
|
||||
it_behaves_like "the github DSL", "git"
|
||||
end
|
||||
|
||||
context "when github.https config is false", :bundler => "3" do
|
||||
before { bundle "config set github.https false" }
|
||||
|
||||
pending "should show a proper message about the removed setting"
|
||||
end
|
||||
|
||||
context "by default", :bundler => "2" do
|
||||
it_behaves_like "the github DSL", "https"
|
||||
end
|
||||
|
||||
context "by default", :bundler => "3" do
|
||||
it_behaves_like "the github DSL", "https"
|
||||
it "converts :github shortcut to URI using https" do
|
||||
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
|
||||
|
@ -106,7 +63,7 @@ RSpec.describe Bundler::Dsl do
|
|||
end
|
||||
end
|
||||
|
||||
context "default git sources", :bundler => "4" do
|
||||
context "default git sources", :bundler => "3" do
|
||||
it "has none" do
|
||||
expect(subject.instance_variable_get(:@git_sources)).to eq({})
|
||||
end
|
||||
|
@ -285,7 +242,7 @@ RSpec.describe Bundler::Dsl do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#github", :bundler => "3" do
|
||||
describe "#github", :bundler => "2" do
|
||||
it "from github" do
|
||||
spree_gems = %w[spree_core spree_api spree_backend]
|
||||
subject.github "spree" do
|
||||
|
@ -299,19 +256,6 @@ RSpec.describe Bundler::Dsl do
|
|||
end
|
||||
|
||||
describe "#github", :bundler => "3" do
|
||||
it "from github" do
|
||||
spree_gems = %w[spree_core spree_api spree_backend]
|
||||
subject.github "spree" do
|
||||
spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
|
||||
end
|
||||
|
||||
subject.dependencies.each do |d|
|
||||
expect(d.source.uri).to eq("https://github.com/spree/spree.git")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#github", :bundler => "4" do
|
||||
it "from github" do
|
||||
expect do
|
||||
spree_gems = %w[spree_core spree_api spree_backend]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "openssl"
|
||||
require "bundler/settings"
|
||||
|
||||
RSpec.describe Bundler::Env do
|
||||
|
@ -17,6 +18,54 @@ RSpec.describe Bundler::Env do
|
|||
expect(out).to include(OpenSSL::OPENSSL_VERSION)
|
||||
end
|
||||
|
||||
describe "rubygems paths" do
|
||||
it "prints gem home" do
|
||||
with_clear_paths("GEM_HOME", "/a/b/c") do
|
||||
out = described_class.report
|
||||
expect(out).to include("Gem Home /a/b/c")
|
||||
end
|
||||
end
|
||||
|
||||
it "prints gem path" do
|
||||
with_clear_paths("GEM_PATH", "/a/b/c:/d/e/f") do
|
||||
out = described_class.report
|
||||
expect(out).to include("Gem Path /a/b/c:/d/e/f")
|
||||
end
|
||||
end
|
||||
|
||||
it "prints user home" do
|
||||
with_clear_paths("HOME", "/a/b/c") do
|
||||
out = described_class.report
|
||||
expect(out).to include("User Home /a/b/c")
|
||||
end
|
||||
end
|
||||
|
||||
it "prints user path" do
|
||||
with_clear_paths("HOME", "/a/b/c") do
|
||||
out = described_class.report
|
||||
expect(out).to include("User Path /a/b/c/.gem")
|
||||
end
|
||||
end
|
||||
|
||||
it "prints bin dir" do
|
||||
with_clear_paths("GEM_HOME", "/a/b/c") do
|
||||
out = described_class.report
|
||||
expect(out).to include("Bin Dir /a/b/c/bin")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_clear_paths(env_var, env_value)
|
||||
old_env_var = ENV[env_var]
|
||||
ENV[env_var] = env_value
|
||||
Gem.clear_paths
|
||||
yield
|
||||
ensure
|
||||
ENV[env_var] = old_env_var
|
||||
end
|
||||
end
|
||||
|
||||
context "when there is a Gemfile and a lockfile and print_gemfile is true" do
|
||||
before do
|
||||
gemfile "gem 'rack', '1.0.0'"
|
||||
|
|
|
@ -11,11 +11,14 @@ RSpec.describe Bundler::Fetcher::CompactIndex do
|
|||
end
|
||||
|
||||
describe "#specs_for_names" do
|
||||
let(:thread_list) { Thread.list.select {|thread| thread.status == "run" } }
|
||||
let(:thread_inspection) { thread_list.map {|th| " * #{th}:\n #{th.backtrace_locations.join("\n ")}" }.join("\n") }
|
||||
|
||||
it "has only one thread open at the end of the run" do
|
||||
compact_index.specs_for_names(["lskdjf"])
|
||||
|
||||
thread_count = Thread.list.count {|thread| thread.status == "run" }
|
||||
expect(thread_count).to eq 1
|
||||
thread_count = thread_list.count
|
||||
expect(thread_count).to eq(1), "Expected 1 active thread after `#specs_for_names`, but found #{thread_count}. In particular, found:\n#{thread_inspection}"
|
||||
end
|
||||
|
||||
it "calls worker#stop during the run" do
|
||||
|
|
|
@ -82,6 +82,15 @@ RSpec.describe Bundler::Fetcher::Downloader do
|
|||
expect { subject.fetch(uri, options, counter) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
|
||||
/Authentication is required for www.uri-to-fetch.com/)
|
||||
end
|
||||
|
||||
context "when the there are credentials provided in the request" do
|
||||
let(:uri) { URI("http://user:password@www.uri-to-fetch.com") }
|
||||
|
||||
it "should raise a Bundler::Fetcher::BadAuthenticationError that doesn't contain the password" do
|
||||
expect { subject.fetch(uri, options, counter) }.
|
||||
to raise_error(Bundler::Fetcher::BadAuthenticationError, /Bad username or password for www.uri-to-fetch.com/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the request response is a Net::HTTPNotFound" do
|
||||
|
|
|
@ -35,9 +35,26 @@ RSpec.describe Bundler::Fetcher::Index do
|
|||
context "when a 401 response occurs" do
|
||||
let(:error_message) { "401" }
|
||||
|
||||
it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
|
||||
expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
|
||||
%r{Authentication is required for http://remote-uri.org})
|
||||
before do
|
||||
allow(remote_uri).to receive(:userinfo).and_return(userinfo)
|
||||
end
|
||||
|
||||
context "and there was userinfo" do
|
||||
let(:userinfo) { double(:userinfo) }
|
||||
|
||||
it "should raise a Bundler::Fetcher::BadAuthenticationError" do
|
||||
expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError,
|
||||
%r{Bad username or password for http://remote-uri.org})
|
||||
end
|
||||
end
|
||||
|
||||
context "and there was no userinfo" do
|
||||
let(:userinfo) { nil }
|
||||
|
||||
it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do
|
||||
expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
|
||||
%r{Authentication is required for http://remote-uri.org})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue