From 473f9d2df0ddd7fdb5cc73fa3ad49b2f19f22b06 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 8 Dec 2020 16:36:29 +0900 Subject: Merge prepare version of Bundler 2.2.0 --- lib/bundler.rb | 4 + lib/bundler/cli.rb | 7 +- lib/bundler/cli/binstubs.rb | 8 +- lib/bundler/cli/exec.rb | 6 +- lib/bundler/cli/outdated.rb | 6 +- lib/bundler/compact_index_client/updater.rb | 10 +- lib/bundler/definition.rb | 13 +- lib/bundler/env.rb | 2 +- lib/bundler/feature_flag.rb | 1 - lib/bundler/fetcher/index.rb | 5 +- lib/bundler/friendly_errors.rb | 15 + lib/bundler/index.rb | 6 +- lib/bundler/injector.rb | 11 +- lib/bundler/installer.rb | 12 +- lib/bundler/lazy_specification.rb | 12 +- lib/bundler/man/.document | 1 + lib/bundler/man/bundle-add.1.ronn | 46 ++ lib/bundler/man/bundle-binstubs.1.ronn | 41 ++ lib/bundler/man/bundle-cache.1.ronn | 72 +++ lib/bundler/man/bundle-check.1.ronn | 26 ++ lib/bundler/man/bundle-clean.1.ronn | 18 + lib/bundler/man/bundle-config.1.ronn | 388 ++++++++++++++++ lib/bundler/man/bundle-doctor.1.ronn | 33 ++ lib/bundler/man/bundle-exec.1.ronn | 152 ++++++ lib/bundler/man/bundle-gem.1.ronn | 101 ++++ lib/bundler/man/bundle-info.1.ronn | 17 + lib/bundler/man/bundle-init.1.ronn | 29 ++ lib/bundler/man/bundle-inject.1.ronn | 22 + lib/bundler/man/bundle-install.1.ronn | 405 ++++++++++++++++ lib/bundler/man/bundle-list.1.ronn | 33 ++ lib/bundler/man/bundle-lock.1.ronn | 94 ++++ lib/bundler/man/bundle-open.1.ronn | 19 + lib/bundler/man/bundle-outdated.1.ronn | 111 +++++ lib/bundler/man/bundle-platform.1.ronn | 42 ++ lib/bundler/man/bundle-pristine.1.ronn | 34 ++ lib/bundler/man/bundle-remove.1.ronn | 23 + lib/bundler/man/bundle-show.1.ronn | 21 + lib/bundler/man/bundle-update.1.ronn | 350 ++++++++++++++ lib/bundler/man/bundle-viz.1.ronn | 30 ++ lib/bundler/man/bundle.1.ronn | 111 +++++ lib/bundler/man/gemfile.5.ronn | 517 +++++++++++++++++++++ lib/bundler/plugin/api/source.rb | 2 +- lib/bundler/plugin/dsl.rb | 2 +- lib/bundler/resolver.rb | 5 +- lib/bundler/rubygems_integration.rb | 4 + lib/bundler/settings.rb | 1 - lib/bundler/source/git/git_proxy.rb | 2 +- lib/bundler/spec_set.rb | 1 + lib/bundler/templates/newgem/README.md.tt | 1 - lib/bundler/templates/newgem/lib/newgem.rb.tt | 4 +- lib/bundler/templates/newgem/newgem.gemspec.tt | 6 + lib/bundler/uri_credentials_filter.rb | 2 + lib/bundler/vendor/molinillo/lib/molinillo.rb | 1 - .../molinillo/lib/molinillo/compatibility.rb | 26 -- .../molinillo/lib/molinillo/dependency_graph.rb | 35 +- .../lib/molinillo/dependency_graph/tag.rb | 4 +- .../vendor/molinillo/lib/molinillo/errors.rb | 2 +- .../vendor/molinillo/lib/molinillo/gem_metadata.rb | 2 +- .../vendor/molinillo/lib/molinillo/resolution.rb | 78 ++-- .../net-http-persistent/lib/net/http/persistent.rb | 11 +- lib/bundler/vendor/tmpdir/lib/tmpdir.rb | 154 ++++++ lib/bundler/vendored_tmpdir.rb | 4 + lib/bundler/version.rb | 2 +- man/bundle-add.1 | 2 +- man/bundle-add.1.ronn | 46 -- man/bundle-binstubs.1 | 2 +- man/bundle-binstubs.1.ronn | 41 -- man/bundle-cache.1 | 2 +- man/bundle-cache.1.ronn | 72 --- man/bundle-check.1 | 2 +- man/bundle-check.1.ronn | 26 -- man/bundle-clean.1 | 2 +- man/bundle-clean.1.ronn | 18 - man/bundle-config.1 | 7 +- man/bundle-config.1.ronn | 396 ---------------- man/bundle-doctor.1 | 2 +- man/bundle-doctor.1.ronn | 33 -- man/bundle-exec.1 | 2 +- man/bundle-exec.1.ronn | 152 ------ man/bundle-gem.1 | 2 +- man/bundle-gem.1.ronn | 101 ---- man/bundle-info.1 | 2 +- man/bundle-info.1.ronn | 17 - man/bundle-init.1 | 2 +- man/bundle-init.1.ronn | 29 -- man/bundle-inject.1 | 2 +- man/bundle-inject.1.ronn | 22 - man/bundle-install.1 | 4 +- man/bundle-install.1.ronn | 405 ---------------- man/bundle-list.1 | 2 +- man/bundle-list.1.ronn | 33 -- man/bundle-lock.1 | 2 +- man/bundle-lock.1.ronn | 94 ---- man/bundle-open.1 | 2 +- man/bundle-open.1.ronn | 19 - man/bundle-outdated.1 | 2 +- man/bundle-outdated.1.ronn | 111 ----- man/bundle-platform.1 | 2 +- man/bundle-platform.1.ronn | 42 -- man/bundle-pristine.1 | 2 +- man/bundle-pristine.1.ronn | 34 -- man/bundle-remove.1 | 2 +- man/bundle-remove.1.ronn | 23 - man/bundle-show.1 | 2 +- man/bundle-show.1.ronn | 21 - man/bundle-update.1 | 2 +- man/bundle-update.1.ronn | 350 -------------- man/bundle-viz.1 | 2 +- man/bundle-viz.1.ronn | 30 -- man/bundle.1 | 2 +- man/bundle.1.ronn | 111 ----- man/gemfile.5 | 2 +- man/gemfile.5.ronn | 517 --------------------- spec/bundler/bundler/cli_spec.rb | 16 +- .../bundler/compact_index_client/updater_spec.rb | 22 +- spec/bundler/bundler/env_spec.rb | 1 - spec/bundler/bundler/fetcher/index_spec.rb | 117 ++--- spec/bundler/bundler/plugin/api/source_spec.rb | 6 + spec/bundler/bundler/source/git/git_proxy_spec.rb | 10 +- spec/bundler/cache/gems_spec.rb | 7 +- spec/bundler/commands/binstubs_spec.rb | 34 +- spec/bundler/commands/check_spec.rb | 10 +- spec/bundler/commands/clean_spec.rb | 5 +- spec/bundler/commands/console_spec.rb | 41 +- spec/bundler/commands/exec_spec.rb | 87 +++- spec/bundler/commands/fund_spec.rb | 43 +- spec/bundler/commands/info_spec.rb | 17 +- spec/bundler/commands/install_spec.rb | 27 +- spec/bundler/commands/licenses_spec.rb | 10 +- spec/bundler/commands/list_spec.rb | 4 + spec/bundler/commands/lock_spec.rb | 6 +- spec/bundler/commands/newgem_spec.rb | 7 +- spec/bundler/commands/remove_spec.rb | 84 +++- spec/bundler/commands/update_spec.rb | 31 +- spec/bundler/install/bundler_spec.rb | 24 + spec/bundler/install/deploy_spec.rb | 10 +- spec/bundler/install/gemfile/gemspec_spec.rb | 2 - spec/bundler/install/gemfile/git_spec.rb | 14 +- spec/bundler/install/gemfile/path_spec.rb | 4 +- spec/bundler/install/gemfile/platform_spec.rb | 43 +- spec/bundler/install/gemfile/sources_spec.rb | 4 + .../install/gemfile/specific_platform_spec.rb | 159 +++++-- spec/bundler/install/gems/compact_index_spec.rb | 69 ++- spec/bundler/install/gems/dependency_api_spec.rb | 20 +- spec/bundler/install/gems/flex_spec.rb | 3 +- spec/bundler/install/gems/fund_spec.rb | 37 +- spec/bundler/install/gems/resolving_spec.rb | 63 ++- spec/bundler/install/prereleases_spec.rb | 15 +- spec/bundler/lock/lockfile_spec.rb | 256 ++++------ spec/bundler/other/platform_spec.rb | 8 + spec/bundler/plugins/install_spec.rb | 13 + spec/bundler/plugins/source/example_spec.rb | 57 +-- spec/bundler/quality_spec.rb | 4 +- spec/bundler/realworld/mirror_probe_spec.rb | 28 +- spec/bundler/runtime/inline_spec.rb | 30 ++ spec/bundler/runtime/setup_spec.rb | 5 +- .../endopint_marshal_fail_basic_authentication.rb | 15 - .../endpoint_marshal_fail_basic_authentication.rb | 15 + spec/bundler/support/builders.rb | 136 +----- spec/bundler/support/platforms.rb | 6 +- spec/bundler/update/gems/fund_spec.rb | 29 +- 161 files changed, 4041 insertions(+), 3616 deletions(-) create mode 100644 lib/bundler/man/.document create mode 100644 lib/bundler/man/bundle-add.1.ronn create mode 100644 lib/bundler/man/bundle-binstubs.1.ronn create mode 100644 lib/bundler/man/bundle-cache.1.ronn create mode 100644 lib/bundler/man/bundle-check.1.ronn create mode 100644 lib/bundler/man/bundle-clean.1.ronn create mode 100644 lib/bundler/man/bundle-config.1.ronn create mode 100644 lib/bundler/man/bundle-doctor.1.ronn create mode 100644 lib/bundler/man/bundle-exec.1.ronn create mode 100644 lib/bundler/man/bundle-gem.1.ronn create mode 100644 lib/bundler/man/bundle-info.1.ronn create mode 100644 lib/bundler/man/bundle-init.1.ronn create mode 100644 lib/bundler/man/bundle-inject.1.ronn create mode 100644 lib/bundler/man/bundle-install.1.ronn create mode 100644 lib/bundler/man/bundle-list.1.ronn create mode 100644 lib/bundler/man/bundle-lock.1.ronn create mode 100644 lib/bundler/man/bundle-open.1.ronn create mode 100644 lib/bundler/man/bundle-outdated.1.ronn create mode 100644 lib/bundler/man/bundle-platform.1.ronn create mode 100644 lib/bundler/man/bundle-pristine.1.ronn create mode 100644 lib/bundler/man/bundle-remove.1.ronn create mode 100644 lib/bundler/man/bundle-show.1.ronn create mode 100644 lib/bundler/man/bundle-update.1.ronn create mode 100644 lib/bundler/man/bundle-viz.1.ronn create mode 100644 lib/bundler/man/bundle.1.ronn create mode 100644 lib/bundler/man/gemfile.5.ronn delete mode 100644 lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb create mode 100644 lib/bundler/vendor/tmpdir/lib/tmpdir.rb create mode 100644 lib/bundler/vendored_tmpdir.rb delete mode 100644 man/bundle-add.1.ronn delete mode 100644 man/bundle-binstubs.1.ronn delete mode 100644 man/bundle-cache.1.ronn delete mode 100644 man/bundle-check.1.ronn delete mode 100644 man/bundle-clean.1.ronn delete mode 100644 man/bundle-config.1.ronn delete mode 100644 man/bundle-doctor.1.ronn delete mode 100644 man/bundle-exec.1.ronn delete mode 100644 man/bundle-gem.1.ronn delete mode 100644 man/bundle-info.1.ronn delete mode 100644 man/bundle-init.1.ronn delete mode 100644 man/bundle-inject.1.ronn delete mode 100644 man/bundle-install.1.ronn delete mode 100644 man/bundle-list.1.ronn delete mode 100644 man/bundle-lock.1.ronn delete mode 100644 man/bundle-open.1.ronn delete mode 100644 man/bundle-outdated.1.ronn delete mode 100644 man/bundle-platform.1.ronn delete mode 100644 man/bundle-pristine.1.ronn delete mode 100644 man/bundle-remove.1.ronn delete mode 100644 man/bundle-show.1.ronn delete mode 100644 man/bundle-update.1.ronn delete mode 100644 man/bundle-viz.1.ronn delete mode 100644 man/bundle.1.ronn delete mode 100644 man/gemfile.5.ronn delete mode 100644 spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb create mode 100644 spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb diff --git a/lib/bundler.rb b/lib/bundler.rb index f6ad7ccaef..0ddd2c7f88 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -602,6 +602,10 @@ EOF reset_rubygems! end + def reset_settings! + @settings = nil + end + def reset_paths! @bin_path = nil @bundler_major_version = nil diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index b4196621e5..e2dceb98d5 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -57,7 +57,7 @@ module Bundler custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] if custom_gemfile && !custom_gemfile.empty? Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile) - Bundler.reset_paths! + Bundler.reset_settings! end Bundler.settings.set_command_option_if_given :retry, options[:retry] @@ -134,7 +134,8 @@ module Bundler if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{man_page}" else - puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.ronn") + fallback_man_path = File.expand_path("../man", __FILE__) + puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") @@ -380,6 +381,8 @@ module Bundler "Make binstubs that can work without the Bundler runtime" method_option "all", :type => :boolean, :banner => "Install binstubs for all gems" + method_option "all-platforms", :type => :boolean, :default => false, :banner => + "Install binstubs for all platforms" def binstubs(*gems) require_relative "cli/binstubs" Binstubs.new(options, gems).run diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb index 266396eedc..639c01ff39 100644 --- a/lib/bundler/cli/binstubs.rb +++ b/lib/bundler/cli/binstubs.rb @@ -16,7 +16,11 @@ module Bundler Bundler.settings.set_command_option_if_given :shebang, options["shebang"] installer = Installer.new(Bundler.root, Bundler.definition) - installer_opts = { :force => options[:force], :binstubs_cmd => true } + installer_opts = { + :force => options[:force], + :binstubs_cmd => true, + :all_platforms => options["all-platforms"], + } if options[:all] raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty? @@ -38,7 +42,7 @@ module Bundler if options[:standalone] next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler" Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do - installer.generate_standalone_bundler_executable_stubs(spec) + installer.generate_standalone_bundler_executable_stubs(spec, installer_opts) end else installer.generate_bundler_executable_stubs(spec, installer_opts) diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 0412d3adb0..318d57fb06 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -63,10 +63,10 @@ module Bundler Kernel.load(file) rescue SystemExit, SignalException raise - rescue Exception => e # rubocop:disable Lint/RescueException + rescue Exception # rubocop:disable Lint/RescueException Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})" - backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : [] - abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}" + Bundler::FriendlyErrors.disable! + raise end def process_title(file, args) diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 109c5f417f..b8d9be20b6 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -76,8 +76,6 @@ module Bundler next unless gems.empty? || gems.include?(current_spec.name) active_spec = retrieve_active_spec(definition, current_spec) - next unless active_spec - next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options) gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version) @@ -146,8 +144,6 @@ module Bundler end def retrieve_active_spec(definition, current_spec) - return unless current_spec.match_platform(Bundler.local_platform) - if strict active_spec = definition.find_resolved_spec(current_spec) else @@ -233,6 +229,8 @@ module Bundler end def update_present_via_semver_portions(current_spec, active_spec, options) + return false if active_spec.nil? + current_major = current_spec.version.segments.first active_major = active_spec.version.segments.first diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb index 40232019bc..66d1735583 100644 --- a/lib/bundler/compact_index_client/updater.rb +++ b/lib/bundler/compact_index_client/updater.rb @@ -22,13 +22,13 @@ module Bundler def initialize(fetcher) @fetcher = fetcher - require "tmpdir" + require_relative "../vendored_tmpdir" end def update(local_path, remote_path, retrying = nil) headers = {} - Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| + Bundler::Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename) # first try to fetch any new bytes on the existing file @@ -66,8 +66,8 @@ module Bundler end end - response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "") - if etag_for(local_temp_path) == response_etag + etag = (response["ETag"] || "").gsub(%r{\AW/}, "") + if etag.length.zero? || etag_for(local_temp_path) == etag SharedHelpers.filesystem_access(local_path) do FileUtils.mv(local_temp_path, local_path) end @@ -75,7 +75,7 @@ module Bundler end if retrying - raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path)) + raise MisMatchedChecksumError.new(remote_path, etag, etag_for(local_temp_path)) end update(local_path, remote_path, :retrying) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 1a4b703aa5..4cf4f76084 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -118,7 +118,7 @@ module Bundler end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - add_platforms unless Bundler.frozen_bundle? + add_current_platform unless Bundler.frozen_bundle? converge_path_sources_to_gemspec_sources @path_changes = converge_paths @@ -547,17 +547,12 @@ module Bundler private - def add_platforms - (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform| - add_platform(platform) - end + def add_current_platform + current_platforms.each {|platform| add_platform(platform) } end def current_platforms - [].tap do |platforms| - platforms << local_platform if Bundler.feature_flag.specific_platform? - platforms << generic_local_platform - end + [local_platform, generic_local_platform].uniq end def change_reason diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index 17624b4fe9..00d4ef2196 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -105,7 +105,7 @@ module Bundler out << [" User Home", Gem.user_home] out << [" User Path", Gem.user_dir] out << [" Bin Dir", Gem.bindir] - if defined?(OpenSSL) + if defined?(OpenSSL::SSL) out << ["OpenSSL"] out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION) out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION) diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index fd76d9e5ba..a92ec8756d 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -41,7 +41,6 @@ module Bundler 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(:specific_platform) { bundler_3_mode? } settings_flag(:suppress_install_using_messages) { bundler_3_mode? } settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? } settings_flag(:update_requires_all_flag) { bundler_4_mode? } diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index 7e07eaea7b..08b041897e 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -8,7 +8,7 @@ module Bundler class Index < Base def specs(_gem_names) Bundler.rubygems.fetch_all_remote_specs(remote) - rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e + rescue Gem::RemoteFetcher::FetchError => e case e.message when /certificate verify failed/ raise CertificateFailureError.new(display_uri) @@ -19,8 +19,7 @@ module Bundler raise BadAuthenticationError, remote_uri if remote_uri.userinfo raise AuthenticationRequiredError, remote_uri else - Bundler.ui.trace e - raise HTTPError, "Could not fetch specs from #{display_uri}" + raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>" end end diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index 8273064699..5d0bb905bc 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -6,6 +6,18 @@ module Bundler module FriendlyErrors module_function + def enable! + @disabled = false + end + + def disabled? + @disabled + end + + def disable! + @disabled = true + end + def log_error(error) case error when YamlSyntaxError @@ -114,10 +126,13 @@ module Bundler end def self.with_friendly_errors + FriendlyErrors.enable! yield rescue SignalException raise rescue Exception => e # rubocop:disable Lint/RescueException + raise if FriendlyErrors.disabled? + FriendlyErrors.log_error(e) exit FriendlyErrors.exit_status(e) end diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index fa48df738c..f26f542fde 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -195,7 +195,11 @@ module Bundler if base # allow all platforms when searching from a lockfile dependency.matches_spec?(spec) else - dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) + if Gem::Platform.respond_to? :match_spec? + dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec) + else + dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) + end end end diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index 02c3e6189f..e9aa13a357 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -179,11 +179,11 @@ module Bundler # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies. def remove_gems_from_gemfile(gems, gemfile_path) patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/ - new_gemfile = [] multiline_removal = false IO.readlines(gemfile_path).each do |line| - if line.match(patterns) + match_data = line.match(patterns) + if match_data && is_not_within_comment?(line, match_data) multiline_removal = line.rstrip.end_with?(",") # skip lines which match the regex next @@ -207,6 +207,13 @@ module Bundler new_gemfile.join.chomp end + # @param [String] line Individual line of gemfile content. + # @param [MatchData] match_data Data about Regex match. + def is_not_within_comment?(line, match_data) + match_start_index = match_data.offset(0).first + !line[0..match_start_index].include?("#") + end + # @param [Array] gemfile Array of gemfile contents. # @param [String] block_name Name of block name to look for. def remove_nested_blocks(gemfile, block_name) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index e08cc9722b..048b0786a7 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "erb" require "rubygems/dependency_installer" require_relative "worker" require_relative "installer/parallel_installer" @@ -136,6 +135,7 @@ module Bundler end mode = Bundler::WINDOWS ? "wb:UTF-8" : "w" + require "erb" content = if RUBY_VERSION >= "2.6" ERB.new(template, :trim_mode => "-").result(binding) else @@ -143,7 +143,7 @@ module Bundler end File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask) - if Bundler::WINDOWS + if Bundler::WINDOWS || options[:all_platforms] prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" File.write("#{binstub_path}.cmd", prefix + content, :mode => mode) end @@ -164,7 +164,7 @@ module Bundler end end - def generate_standalone_bundler_executable_stubs(spec) + def generate_standalone_bundler_executable_stubs(spec, options = {}) # double-assignment to avoid warnings about variables that will be used by ERB bin_path = Bundler.bin_path unless path = Bundler.settings[:path] @@ -182,6 +182,7 @@ module Bundler executable_path = executable_path mode = Bundler::WINDOWS ? "wb:UTF-8" : "w" + require "erb" content = if RUBY_VERSION >= "2.6" ERB.new(template, :trim_mode => "-").result(binding) else @@ -189,7 +190,7 @@ module Bundler end File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755) - if Bundler::WINDOWS + if Bundler::WINDOWS || options[:all_platforms] prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode) end @@ -243,6 +244,7 @@ module Bundler end end.flatten Bundler.rubygems.load_plugin_files(path_plugin_files) + Bundler.rubygems.load_env_plugins end def ensure_specs_are_compatible! @@ -297,7 +299,7 @@ module Bundler # returns whether or not a re-resolve was needed def resolve_if_needed(options) - if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file? + if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file? return false if @definition.nothing_changed? && !@definition.missing_specs? end diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 546b8d9b09..22bf0f3f6f 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -79,19 +79,17 @@ module Bundler @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else - search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version) + search_object = if source.is_a?(Source::Path) + Dependency.new(name, version) + else + self + end platform_object = Gem::Platform.new(platform) candidates = source.specs.search(search_object) same_platform_candidates = candidates.select do |spec| MatchPlatform.platforms_match?(spec.platform, platform_object) end search = same_platform_candidates.last || candidates.last - if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? - Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \ - "because it has different dependencies from the #{platform} version. " \ - "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again." - search = source.specs.search(self).last - end search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search end diff --git a/lib/bundler/man/.document b/lib/bundler/man/.document new file mode 100644 index 0000000000..fb66f13c33 --- /dev/null +++ b/lib/bundler/man/.document @@ -0,0 +1 @@ +# Ignore all files in this directory diff --git a/lib/bundler/man/bundle-add.1.ronn b/lib/bundler/man/bundle-add.1.ronn new file mode 100644 index 0000000000..26cbe55647 --- /dev/null +++ b/lib/bundler/man/bundle-add.1.ronn @@ -0,0 +1,46 @@ +bundle-add(1) -- Add gem to the Gemfile and run bundle install +================================================================ + +## SYNOPSIS + +`bundle add` [--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`. + +Example: + +bundle add rails + +bundle add rails --version "< 3.0, > 1.1" + +bundle add rails --version "~> 5.0.0" --source "https://gems.example.com" --group "development" + +bundle add rails --skip-install + +bundle add rails --group "development, test" + +## OPTIONS +* `--version`, `-v`: + Specify version requirements(s) for the added gem. + +* `--group`, `-g`: + 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. + +* `--optimistic`: + Adds optimistic declaration of version + +* `--strict`: + Adds strict declaration of version diff --git a/lib/bundler/man/bundle-binstubs.1.ronn b/lib/bundler/man/bundle-binstubs.1.ronn new file mode 100644 index 0000000000..a96186929f --- /dev/null +++ b/lib/bundler/man/bundle-binstubs.1.ronn @@ -0,0 +1,41 @@ +bundle-binstubs(1) -- Install the binstubs of the listed gems +============================================================= + +## SYNOPSIS + +`bundle binstubs` [--force] [--path PATH] [--standalone] + +## DESCRIPTION + +Binstubs are scripts that wrap around executables. Bundler creates a +small Ruby file (a binstub) that loads Bundler, runs the command, +and puts it into `bin/`. Binstubs are a shortcut-or alternative- +to always using `bundle exec`. This gives you a file that can be run +directly, and one that will always run the correct gem version +used by the application. + +For example, if you run `bundle binstubs rspec-core`, Bundler will create +the file `bin/rspec`. That file will contain enough code to load Bundler, +tell it to load the bundled gems, and then run rspec. + +This command generates binstubs for executables in `GEM_NAME`. +Binstubs are put into `bin`, or the `--path` directory if one has been set. +Calling binstubs with [GEM [GEM]] will create binstubs for all given gems. + +## OPTIONS + +* `--force`: + Overwrite existing binstubs if they exist. + +* `--path`: + The location to install the specified binstubs to. This defaults to `bin`. + +* `--standalone`: + Makes binstubs that can work without depending on Rubygems or Bundler at + runtime. + +* `--shebang`: + Specify a different shebang executable name than the default (default 'ruby') + +* `--all`: + Create binstubs for all gems in the bundle. diff --git a/lib/bundler/man/bundle-cache.1.ronn b/lib/bundler/man/bundle-cache.1.ronn new file mode 100644 index 0000000000..383adb2ba3 --- /dev/null +++ b/lib/bundler/man/bundle-cache.1.ronn @@ -0,0 +1,72 @@ +bundle-cache(1) -- Package your needed `.gem` files into your application +=========================================================================== + +## SYNOPSIS + +`bundle cache` + +## DESCRIPTION + +Copy all of the `.gem` files needed to run the application into the +`vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install], +use the gems in the cache in preference to the ones on `rubygems.org`. + +## GIT AND PATH GEMS + +The `bundle cache` command can also package `:git` and `:path` dependencies +besides .gem files. This needs to be explicitly enabled via the `--all` option. +Once used, the `--all` option will be remembered. + +## SUPPORT FOR MULTIPLE PLATFORMS + +When using gems that have different packages for different platforms, Bundler +supports caching of gems for other platforms where the Gemfile has been resolved +(i.e. present in the lockfile) in `vendor/cache`. This needs to be enabled via +the `--all-platforms` option. This setting will be remembered in your local +bundler configuration. + +## REMOTE FETCHING + +By default, if you run `bundle install(1)`](bundle-install.1.html) after running +[bundle cache(1)](bundle-cache.1.html), bundler will still connect to `rubygems.org` +to check whether a platform-specific gem exists for any of the gems +in `vendor/cache`. + +For instance, consider this Gemfile(5): + + source "https://rubygems.org" + + gem "nokogiri" + +If you run `bundle cache` under C Ruby, bundler will retrieve +the version of `nokogiri` for the `"ruby"` platform. If you deploy +to JRuby and run `bundle install`, bundler is forced to check to +see whether a `"java"` platformed `nokogiri` exists. + +Even though the `nokogiri` gem for the Ruby platform is +_technically_ acceptable on JRuby, it has a C extension +that does not run on JRuby. As a result, bundler will, by default, +still connect to `rubygems.org` to check whether it has a version +of one of your gems more specific to your platform. + +This problem is also not limited to the `"java"` platform. +A similar (common) problem can happen when developing on Windows +and deploying to Linux, or even when developing on OSX and +deploying to Linux. + +If you know for sure that the gems packaged in `vendor/cache` +are appropriate for the platform you are on, you can run +`bundle install --local` to skip checking for more appropriate +gems, and use the ones in `vendor/cache`. + +One way to be sure that you have the right platformed versions +of all your gems is to run `bundle cache` on an identical +machine and check in the gems. For instance, you can run +`bundle cache` on an identical staging box during your +staging process, and check in the `vendor/cache` before +deploying to production. + +By default, [bundle cache(1)](bundle-cache.1.html) fetches and also +installs the gems to the default location. To package the +dependencies to `vendor/cache` without installing them to the +local install location, you can run `bundle cache --no-install`. diff --git a/lib/bundler/man/bundle-check.1.ronn b/lib/bundler/man/bundle-check.1.ronn new file mode 100644 index 0000000000..f2846b8ff2 --- /dev/null +++ b/lib/bundler/man/bundle-check.1.ronn @@ -0,0 +1,26 @@ +bundle-check(1) -- Verifies if dependencies are satisfied by installed gems +=========================================================================== + +## SYNOPSIS + +`bundle check` [--dry-run] + [--gemfile=FILE] + [--path=PATH] + +## DESCRIPTION + +`check` searches the local machine for each of the gems requested in the +Gemfile. If all gems are found, Bundler prints a success message and exits with +a status of 0. + +If not, the first missing gem is listed and Bundler exits status 1. + +## OPTIONS + +* `--dry-run`: + Locks the [`Gemfile(5)`][Gemfile(5)] before running the command. +* `--gemfile`: + Use the specified gemfile instead of the [`Gemfile(5)`][Gemfile(5)]. +* `--path`: + Specify a different path than the system default (`$BUNDLE_PATH` or `$GEM_HOME`). + Bundler will remember this value for future installs on this machine. diff --git a/lib/bundler/man/bundle-clean.1.ronn b/lib/bundler/man/bundle-clean.1.ronn new file mode 100644 index 0000000000..de23991782 --- /dev/null +++ b/lib/bundler/man/bundle-clean.1.ronn @@ -0,0 +1,18 @@ +bundle-clean(1) -- Cleans up unused gems in your bundler directory +================================================================== + +## SYNOPSIS + +`bundle clean` [--dry-run] [--force] + +## DESCRIPTION + +This command will remove all unused gems in your bundler directory. This is +useful when you have made many changes to your gem dependencies. + +## OPTIONS + +* `--dry-run`: + Print the changes, but do not clean the unused gems. +* `--force`: + Force a clean even if `--path` is not set. diff --git a/lib/bundler/man/bundle-config.1.ronn b/lib/bundler/man/bundle-config.1.ronn new file mode 100644 index 0000000000..462edf7844 --- /dev/null +++ b/lib/bundler/man/bundle-config.1.ronn @@ -0,0 +1,388 @@ +bundle-config(1) -- Set bundler configuration options +===================================================== + +## SYNOPSIS + +`bundle config` [list|get|set|unset] [ []] + +## DESCRIPTION + +This command allows you to interact with Bundler's configuration system. + +Bundler loads configuration settings in this order: + +1. Local config (`/.bundle/config` or `$BUNDLE_APP_CONFIG/config`) +2. Environmental variables (`ENV`) +3. Global config (`~/.bundle/config`) +4. Bundler default config + +Executing `bundle config list` with will print a list of all bundler +configuration for the current bundle, and where that configuration +was set. + +Executing `bundle config get ` will print the value of that configuration +setting, and where it was set. + +Executing `bundle config set ` will set that configuration to the +value specified for all bundles executed as the current user. The configuration +will be stored in `~/.bundle/config`. If already is set, will be +overridden and user will be warned. + +Executing `bundle config set --global ` works the same as above. + +Executing `bundle config set --local ` will set that configuration +in the directory for the local application. The configuration will be stored in +`/.bundle/config`. If `BUNDLE_APP_CONFIG` is set, the configuration +will be stored in `$BUNDLE_APP_CONFIG/config`. + +Executing `bundle config unset ` will delete the configuration in both +local and global sources. + +Executing `bundle config unset --global ` will delete the configuration +only from the user configuration. + +Executing `bundle config unset --local ` will delete the +configuration only from the local application. + +Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will +cause it to ignore all configuration. + +Executing `bundle config set --local disable_multisource true` upgrades the warning about +the Gemfile containing multiple primary sources to an error. Executing `bundle +config unset disable_multisource` downgrades this error to a warning. + +## REMEMBERING OPTIONS + +Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or +`--without production`, are remembered between commands and saved to your local +application's configuration (normally, `./.bundle/config`). + +However, this will be changed in bundler 3, so it's better not to rely on this +behavior. If these options must be remembered, it's better to set them using +`bundle config` (e.g., `bundle config set --local path foo`). + +The options that can be configured are: + +* `bin`: + Creates a directory (defaults to `~/bin`) and place any executables from the + gem there. These executables run in Bundler's context. If used, you might add + this directory to your environment's `PATH` variable. For instance, if the + `rails` gem comes with a `rails` executable, this flag will create a + `bin/rails` executable that ensures that all referred dependencies will be + resolved using the bundled gems. + +* `deployment`: + In deployment mode, Bundler will 'roll-out' the bundle for + `production` use. Please check carefully if you want to have this option + enabled in `development` or `test` environments. + +* `path`: + The location to install the specified gems to. This defaults to Rubygems' + setting. Bundler shares this location with Rubygems, `gem install ...` will + have gem installed there, too. Therefore, gems installed without a + `--path ...` setting will show up by calling `gem list`. Accordingly, gems + installed to other locations will not get listed. + +* `without`: + A space-separated list of groups referencing gems to skip during installation. + +* `with`: + A space-separated list of groups referencing gems to include during installation. + +## BUILD OPTIONS + +You can use `bundle config` to give Bundler the flags to pass to the gem +installer every time bundler tries to install a particular gem. + +A very common example, the `mysql` gem, requires Snow Leopard users to +pass configuration flags to `gem install` to specify where to find the +`mysql_config` executable. + + gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config + +Since the specific location of that executable can change from machine +to machine, you can specify these flags on a per-machine basis. + + bundle config set --global build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config + +After running this command, every time bundler needs to install the +`mysql` gem, it will pass along the flags you specified. + +## CONFIGURATION KEYS + +Configuration keys in bundler have two forms: the canonical form and the +environment variable form. + +For instance, passing the `--without` flag to [bundle install(1)](bundle-install.1.html) +prevents Bundler from installing certain groups specified in the Gemfile(5). Bundler +persists this value in `app/.bundle/config` so that calls to `Bundler.setup` +do not try to find gems from the `Gemfile` that you didn't install. Additionally, +subsequent calls to [bundle install(1)](bundle-install.1.html) remember this setting +and skip those groups. + +The canonical form of this configuration is `"without"`. To convert the canonical +form to the environment variable form, capitalize it, and prepend `BUNDLE_`. The +environment variable form of `"without"` is `BUNDLE_WITHOUT`. + +Any periods in the configuration keys must be replaced with two underscores when +setting it via environment variables. The configuration key `local.rack` becomes +the environment variable `BUNDLE_LOCAL__RACK`. + +## LIST OF AVAILABLE KEYS + +The following is a list of all configuration keys and their purpose. You can +learn more about their operation in [bundle install(1)](bundle-install.1.html). + +* `allow_bundler_dependency_conflicts` (`BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS`): + Allow resolving to specifications that have dependencies on `bundler` that + are incompatible with the running Bundler version. +* `allow_deployment_source_credential_changes` (`BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES`): + When in deployment mode, allow changing the credentials to a gem's source. + Ex: `https://some.host.com/gems/path/` -> `https://user_name:password@some.host.com/gems/path` +* `allow_offline_install` (`BUNDLE_ALLOW_OFFLINE_INSTALL`): + Allow Bundler to use cached data when installing without network access. +* `auto_clean_without_path` (`BUNDLE_AUTO_CLEAN_WITHOUT_PATH`): + Automatically run `bundle clean` after installing when an explicit `path` + has not been set and Bundler is not installing into the system gems. +* `auto_install` (`BUNDLE_AUTO_INSTALL`): + Automatically run `bundle install` when gems are missing. +* `bin` (`BUNDLE_BIN`): + Install executables from gems in the bundle to the specified directory. + Defaults to `false`. +* `cache_all` (`BUNDLE_CACHE_ALL`): + Cache all gems, including path and git gems. This needs to be explicitly + configured on bundler 1 and bundler 2, but will be the default on bundler 3. +* `cache_all_platforms` (`BUNDLE_CACHE_ALL_PLATFORMS`): + Cache gems for all platforms. +* `cache_path` (`BUNDLE_CACHE_PATH`): + The directory that bundler will place cached gems in when running + bundle package, and that bundler will look in when installing gems. + Defaults to `vendor/cache`. +* `clean` (`BUNDLE_CLEAN`): + Whether Bundler should run `bundle clean` automatically after + `bundle install`. +* `console` (`BUNDLE_CONSOLE`): + The console that `bundle console` starts. Defaults to `irb`. +* `default_install_uses_path` (`BUNDLE_DEFAULT_INSTALL_USES_PATH`): + Whether a `bundle install` without an explicit `--path` argument defaults + to installing gems in `.bundle`. +* `deployment` (`BUNDLE_DEPLOYMENT`): + Disallow changes to the `Gemfile`. When the `Gemfile` is changed and the + lockfile has not been updated, running Bundler commands will be blocked. +* `disable_checksum_validation` (`BUNDLE_DISABLE_CHECKSUM_VALIDATION`): + Allow installing gems even if they do not match the checksum provided by + RubyGems. +* `disable_exec_load` (`BUNDLE_DISABLE_EXEC_LOAD`): + Stop Bundler from using `load` to launch an executable in-process in + `bundle exec`. +* `disable_local_branch_check` (`BUNDLE_DISABLE_LOCAL_BRANCH_CHECK`): + Allow Bundler to use a local git override without a branch specified in the + Gemfile. +* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`): + When set, Gemfiles containing multiple sources will produce errors + instead of warnings. + Use `bundle config unset disable_multisource` to unset. +* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`): + Stop Bundler from accessing gems installed to RubyGems' normal location. +* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`): + Stop Bundler from checking if a newer Bundler version is available on + rubygems.org. +* `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. +* `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 `--deployment` is used. +* `gem.push_key` (`BUNDLE_GEM__PUSH_KEY`): + Sets the `--key` parameter for `gem push` when using the `rake release` + command with a private gemstash server. +* `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 `Gemfile`, among other things. By default, bundler + will search up from the current working directory until it finds a + `Gemfile`. +* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`): + Whether Bundler should cache all gems globally, rather than locally to the + installing Ruby installation. +* `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`. +* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`) + Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`. +* `jobs` (`BUNDLE_JOBS`): + The number of gems Bundler can install in parallel. Defaults to 1. +* `no_install` (`BUNDLE_NO_INSTALL`): + Whether `bundle package` should skip installing gems. +* `no_prune` (`BUNDLE_NO_PRUNE`): + Whether Bundler should leave outdated gems unpruned when caching. +* `only_update_to_newer_versions` (`BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS`): + During `bundle update`, only resolve to newer versions of the gems in the + lockfile. +* `path` (`BUNDLE_PATH`): + The location on disk where all gems in your bundle will be located regardless + of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location + will be installed by `bundle install`. Defaults to `Gem.dir`. When --deployment + is used, defaults to vendor/bundle. +* `path.system` (`BUNDLE_PATH__SYSTEM`): + Whether Bundler will install gems into the default system path (`Gem.dir`). +* `path_relative_to_cwd` (`BUNDLE_PATH_RELATIVE_TO_CWD`) + Makes `--path` relative to the CWD instead of the `Gemfile`. +* `plugins` (`BUNDLE_PLUGINS`): + Enable Bundler's experimental plugin system. +* `prefer_patch` (BUNDLE_PREFER_PATCH): + Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`. +* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`) + Print only version number from `bundler --version`. +* `redirect` (`BUNDLE_REDIRECT`): + The number of redirects allowed for network requests. Defaults to `5`. +* `retry` (`BUNDLE_RETRY`): + The number of times to retry failed network requests. Defaults to `3`. +* `setup_makes_kernel_gem_public` (`BUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC`): + Have `Bundler.setup` make the `Kernel#gem` method public, even though + RubyGems declares it as private. +* `shebang` (`BUNDLE_SHEBANG`): + The program name that should be invoked for generated binstubs. Defaults to + the ruby install name used to generate the binstub. +* `silence_deprecations` (`BUNDLE_SILENCE_DEPRECATIONS`): + Whether Bundler should silence deprecation warnings for behavior that will + be changed in the next major version. +* `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`): + Silence the warning Bundler prints when installing gems as root. +* `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`): + Path to a designated CA certificate file or folder containing multiple + certificates for trusted CAs in PEM format. +* `ssl_client_cert` (`BUNDLE_SSL_CLIENT_CERT`): + Path to a designated file containing a X.509 client certificate + and key in PEM format. +* `ssl_verify_mode` (`BUNDLE_SSL_VERIFY_MODE`): + The SSL verification mode Bundler uses when making HTTPS requests. + Defaults to verify peer. +* `suppress_install_using_messages` (`BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES`): + Avoid printing `Using ...` messages during installation when the version of + a gem has not changed. +* `system_bindir` (`BUNDLE_SYSTEM_BINDIR`): + The location where RubyGems installs binstubs. Defaults to `Gem.bindir`. +* `timeout` (`BUNDLE_TIMEOUT`): + The seconds allowed before timing out for network requests. Defaults to `10`. +* `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`): + Whether running `bundle update --source NAME` unlocks a gem with the given + name. Defaults to `true`. +* `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`. +* `user_agent` (`BUNDLE_USER_AGENT`): + The custom user agent fragment Bundler includes in API requests. +* `with` (`BUNDLE_WITH`): + A `:`-separated list of groups whose gems bundler should install. +* `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 [bundle 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, environment variables +will take preference over global settings. + +## LOCAL GIT REPOS + +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: + + bundle config set --local local.GEM_NAME /path/to/local/git/repository + +For example, in order to use a local Rack repository, a developer could call: + + bundle config set --local local.rack ~/Work/git/rack + +Now instead of checking out the remote git repository, the local +override 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 ensure the local override was pushed, otherwise +you may point to a commit 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 to a different branch. + +Finally, Bundler also ensures that the current revision in the +`Gemfile.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 to +configure rubygems.org as the gem source in your Gemfile while still using your +mirror to fetch gems. + + bundle config set --global mirror.SOURCE_URL MIRROR_URL + +For example, to use a mirror of rubygems.org hosted at rubygems-mirror.org: + + bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org + +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. + + bundle config set --global mirror.SOURCE_URL.fallback_timeout TIMEOUT + +For example, to fall back to rubygems.org after 3 seconds: + + bundle config set --global mirror.https://rubygems.org.fallback_timeout 3 + +The default fallback timeout is 0.1 seconds, but the setting can currently +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 allows +you to avoid putting secrets into your Gemfile. + + bundle config set --global SOURCE_HOSTNAME USERNAME:PASSWORD + +For example, to save the credentials of user `claudette` for the gem source at +`gems.longerous.com`, you would run: + + bundle config set --global gems.longerous.com claudette:s00pers3krit + +Or you can set the credentials as an environment variable like this: + + export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit" + +For gems with a git source with HTTP(S) URL you can specify credentials like so: + + bundle config set --global https://github.com/rubygems/rubygems.git username:password + +Or you can set the credentials as an environment variable like so: + + export BUNDLE_GITHUB__COM=username:password + +This is especially useful for private repositories on hosts such as Github, +where you can use personal OAuth tokens: + + export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic + + +## 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 from by default. The following +outlines the available environment variables and their default values + + BUNDLE_USER_HOME : $HOME/.bundle + BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache + BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config + BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin diff --git a/lib/bundler/man/bundle-doctor.1.ronn b/lib/bundler/man/bundle-doctor.1.ronn new file mode 100644 index 0000000000..271ee800ad --- /dev/null +++ b/lib/bundler/man/bundle-doctor.1.ronn @@ -0,0 +1,33 @@ +bundle-doctor(1) -- Checks the bundle for common problems +========================================================= + +## SYNOPSIS + +`bundle doctor` [--quiet] + [--gemfile=GEMFILE] + +## DESCRIPTION + +Checks your Gemfile and gem environment for common problems. If issues +are detected, Bundler prints them and exits status 1. Otherwise, +Bundler prints a success message and exits status 0. + +Examples of common problems caught by bundle-doctor include: + +* Invalid Bundler settings +* Mismatched Ruby versions +* Mismatched platforms +* Uninstalled gems +* Missing dependencies + +## OPTIONS + +* `--quiet`: + Only output warnings and errors. + +* `--gemfile=`: + The location of the Gemfile(5) which Bundler should use. This defaults + to a Gemfile(5) in the current working directory. In general, Bundler + will assume that the location of the Gemfile(5) is also the project's + root and will try to find `Gemfile.lock` and `vendor/cache` relative + to this location. diff --git a/lib/bundler/man/bundle-exec.1.ronn b/lib/bundler/man/bundle-exec.1.ronn new file mode 100644 index 0000000000..dec3c7cb82 --- /dev/null +++ b/lib/bundler/man/bundle-exec.1.ronn @@ -0,0 +1,152 @@ +bundle-exec(1) -- Execute a command in the context of the bundle +================================================================ + +## SYNOPSIS + +`bundle exec` [--keep-file-descriptors] + +## DESCRIPTION + +This command executes the command, making all gems specified in the +[`Gemfile(5)`][Gemfile(5)] available to `require` in Ruby programs. + +Essentially, if you would normally have run something like +`rspec spec/my_spec.rb`, and you want to use the gems specified +in the [`Gemfile(5)`][Gemfile(5)] and installed via [bundle install(1)](bundle-install.1.html), you +should run `bundle exec rspec spec/my_spec.rb`. + +Note that `bundle exec` does not require that an executable is +available on your shell's `$PATH`. + +## OPTIONS + +* `--keep-file-descriptors`: + Exec in Ruby 2.0 began discarding non-standard file descriptors. When this + flag is passed, exec will revert to the 1.9 behaviour of passing all file + descriptors to the new process. + +## BUNDLE INSTALL --BINSTUBS + +If you use the `--binstubs` flag in [bundle install(1)](bundle-install.1.html), Bundler will +automatically create a directory (which defaults to `app_root/bin`) +containing all of the executables available from gems in the bundle. + +After using `--binstubs`, `bin/rspec spec/my_spec.rb` is identical +to `bundle exec rspec spec/my_spec.rb`. + +## ENVIRONMENT MODIFICATIONS + +`bundle exec` makes a number of changes to the shell environment, +then executes the command you specify in full. + +* make sure that it's still possible to shell out to `bundle` + from inside a command invoked by `bundle exec` (using + `$BUNDLE_BIN_PATH`) +* put the directory containing executables (like `rails`, `rspec`, + `rackup`) for your bundle on `$PATH` +* make sure that if bundler is invoked in the subshell, it uses + the same `Gemfile` (by setting `BUNDLE_GEMFILE`) +* add `-rbundler/setup` to `$RUBYOPT`, which makes sure that + Ruby programs invoked in the subshell can see the gems in + the bundle + +It also modifies Rubygems: + +* disallow loading additional gems not in the bundle +* modify the `gem` method to be a no-op if a gem matching + the requirements is in the bundle, and to raise a + `Gem::LoadError` if it's not +* Define `Gem.refresh` to be a no-op, since the source + index is always frozen when using bundler, and to + prevent gems from the system leaking into the environment +* Override `Gem.bin_path` to use the gems in the bundle, + making system executables work +* Add all gems in the bundle into Gem.loaded_specs + +Finally, `bundle exec` also implicitly modifies `Gemfile.lock` if the lockfile +and the Gemfile do not match. Bundler needs the Gemfile to determine things +such as a gem's groups, `autorequire`, and platforms, etc., and that +information isn't stored in the lockfile. The Gemfile and lockfile must be +synced in order to `bundle exec` successfully, so `bundle exec` +updates the lockfile beforehand. + +### Loading + +By default, when attempting to `bundle exec` to a file with a ruby shebang, +Bundler will `Kernel.load` that file instead of using `Kernel.exec`. For the +vast majority of cases, this is a performance improvement. In a rare few cases, +this could cause some subtle side-effects (such as dependence on the exact +contents of `$0` or `__FILE__`) and the optimization can be disabled by enabling +the `disable_exec_load` setting. + +### Shelling out + +Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will +automatically use the current Bundler environment. If you need to shell out to +a Ruby command that is not part of your current bundle, use the +`with_clean_env` method with a block. Any subshells created inside the block +will be given the environment present before Bundler was activated. For +example, Homebrew commands run Ruby, but don't work inside a bundle: + + Bundler.with_clean_env do + `brew install wget` + end + +Using `with_clean_env` is also necessary if you are shelling out to a different +bundle. Any Bundler commands run in a subshell will inherit the current +Gemfile, so commands that need to run in the context of a different bundle also +need to use `with_clean_env`. + + Bundler.with_clean_env do + Dir.chdir "/other/bundler/project" do + `bundle exec ./script` + end + end + +Bundler provides convenience helpers that wrap `system` and `exec`, and they +can be used like this: + + Bundler.clean_system('brew install wget') + Bundler.clean_exec('brew install wget') + + +## RUBYGEMS PLUGINS + +At present, the Rubygems plugin system requires all files +named `rubygems_plugin.rb` on the load path of _any_ installed +gem when any Ruby code requires `rubygems.rb`. This includes +executables installed into the system, like `rails`, `rackup`, +and `rspec`. + +Since Rubygems plugins can contain arbitrary Ruby code, they +commonly end up activating themselves or their dependencies. + +For instance, the `gemcutter 0.5` gem depended on `json_pure`. +If you had that version of gemcutter installed (even if +you _also_ had a newer version without this problem), Rubygems +would activate `gemcutter 0.5` and `json_pure `. + +If your Gemfile(5) also contained `json_pure` (or a gem +with a dependency on `json_pure`), the latest version on +your system might conflict with the version in your +Gemfile(5), or the snapshot version in your `Gemfile.lock`. + +If this happens, bundler will say: + + You have already activated json_pure 1.4.6 but your Gemfile + requires json_pure 1.4.3. Consider using bundle exec. + +In this situation, you almost certainly want to remove the +underlying gem with the problematic gem plugin. In general, +the authors of these plugins (in this case, the `gemcutter` +gem) have released newer versions that are more careful in +their plugins. + +You can find a list of all the gems containing gem plugins +by running + + ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')" + +At the very least, you should remove all but the newest +version of each gem plugin, and also remove all gem plugins +that you aren't using (`gem uninstall gem_name`). diff --git a/lib/bundler/man/bundle-gem.1.ronn b/lib/bundler/man/bundle-gem.1.ronn new file mode 100644 index 0000000000..a997cb907a --- /dev/null +++ b/lib/bundler/man/bundle-gem.1.ronn @@ -0,0 +1,101 @@ +bundle-gem(1) -- Generate a project skeleton for creating a rubygem +==================================================================== + +## SYNOPSIS + +`bundle gem` [OPTIONS] + +## DESCRIPTION + +Generates a directory named `GEM_NAME` with a `Rakefile`, `GEM_NAME.gemspec`, +and other supporting files and directories that can be used to develop a +rubygem with that name. + +Run `rake -T` in the resulting project for a list of Rake tasks that can be used +to test and publish the gem to rubygems.org. + +The generated project skeleton can be customized with OPTIONS, as explained +below. Note that these options can also be specified via Bundler's global +configuration file using the following names: + +* `gem.coc` +* `gem.mit` +* `gem.test` + +## OPTIONS + +* `--exe` or `-b` or `--bin`: + Specify that Bundler should create a binary executable (as `exe/GEM_NAME`) + in the generated rubygem project. This binary will also be added to the + `GEM_NAME.gemspec` manifest. This behavior is disabled by default. + +* `--no-exe`: + Do not create a binary (overrides `--exe` specified in the global config). + +* `--coc`: + Add a `CODE_OF_CONDUCT.md` file to the root of the generated project. If + this option is unspecified, an interactive prompt will be displayed and the + answer will be saved in Bundler's global config for future `bundle gem` use. + +* `--no-coc`: + Do not create a `CODE_OF_CONDUCT.md` (overrides `--coc` specified in the + global config). + +* `--ext`: + Add boilerplate for C extension code to the generated project. This behavior + is disabled by default. + +* `--no-ext`: + Do not add C extension code (overrides `--ext` specified in the global + config). + +* `--mit`: + Add an MIT license to a `LICENSE.txt` file in the root of the generated + project. Your name from the global git config is used for the copyright + statement. If this option is unspecified, an interactive prompt will be + displayed and the answer will be saved in Bundler's global config for future + `bundle gem` use. + +* `--no-mit`: + Do not create a `LICENSE.txt` (overrides `--mit` specified in the global + config). + +* `-t`, `--test=minitest`, `--test=rspec`, `--test=test-unit`: + Specify the test framework that Bundler should use when generating the + project. Acceptable values are `minitest`, `rspec` and `test-unit`. The + `GEM_NAME.gemspec` will be configured and a skeleton test/spec directory will + be created based on this option. Given no option is specified: + + When Bundler is configured to generate tests, this defaults to Bundler's + global config setting `gem.test`. + + When Bundler is configured to not generate tests, an interactive prompt will + be displayed and the answer will be used for the current rubygem project. + + When Bundler is unconfigured, an interactive prompt will be displayed and + the answer will be saved in Bundler's global config for future `bundle gem` + use. + +* `--ci`, `--ci=github`, `--ci=travis`, `--ci=gitlab`, `--ci=circle`: + Specify the continuous integration service that Bundler should use when + generating the project. Acceptable values are `github`, `travis`, `gitlab` + and `circle`. A configuration file will be generated in the project directory. + Given no option is specified: + + When Bundler is configured to generate CI files, this defaults to Bundler's + global config setting `gem.ci`. + + When Bundler is configured to not generate CI files, an interactive prompt + will be displayed and the answer will be used for the current rubygem project. + + When Bundler is unconfigured, an interactive prompt will be displayed and + the answer will be saved in Bundler's global config for future `bundle gem` + use. + +* `-e`, `--edit[=EDITOR]`: + Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not + specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`. + +## SEE ALSO + +* [bundle config(1)](bundle-config.1.html) diff --git a/lib/bundler/man/bundle-info.1.ronn b/lib/bundler/man/bundle-info.1.ronn new file mode 100644 index 0000000000..47e457aa3c --- /dev/null +++ b/lib/bundler/man/bundle-info.1.ronn @@ -0,0 +1,17 @@ +bundle-info(1) -- Show information for the given gem in your bundle +========================================================================= + +## SYNOPSIS + +`bundle info` [GEM] + [--path] + +## DESCRIPTION + +Print the basic information about the provided GEM such as homepage, version, +path and summary. + +## OPTIONS + +* `--path`: +Print the path of the given gem diff --git a/lib/bundler/man/bundle-init.1.ronn b/lib/bundler/man/bundle-init.1.ronn new file mode 100644 index 0000000000..9d3d97deea --- /dev/null +++ b/lib/bundler/man/bundle-init.1.ronn @@ -0,0 +1,29 @@ +bundle-init(1) -- Generates a Gemfile into the current working directory +======================================================================== + +## SYNOPSIS + +`bundle init` [--gemspec=FILE] + +## DESCRIPTION + +Init generates a default [`Gemfile(5)`][Gemfile(5)] in the current working directory. When +adding a [`Gemfile(5)`][Gemfile(5)] to a gem with a gemspec, the `--gemspec` option will +automatically add each dependency listed in the gemspec file to the newly +created [`Gemfile(5)`][Gemfile(5)]. + +## OPTIONS + +* `--gemspec`: + Use the specified .gemspec to create the [`Gemfile(5)`][Gemfile(5)] + +## FILES + +Included in the default [`Gemfile(5)`][Gemfile(5)] +generated is the line `# frozen_string_literal: true`. This is a magic comment +supported for the first time in Ruby 2.3. The presence of this line +results in all string literals in the file being implicitly frozen. + +## SEE ALSO + +[Gemfile(5)](https://bundler.io/man/gemfile.5.html) diff --git a/lib/bundler/man/bundle-inject.1.ronn b/lib/bundler/man/bundle-inject.1.ronn new file mode 100644 index 0000000000..f454341896 --- /dev/null +++ b/lib/bundler/man/bundle-inject.1.ronn @@ -0,0 +1,22 @@ +bundle-inject(1) -- Add named gem(s) with version requirements to Gemfile +========================================================================= + +## SYNOPSIS + +`bundle inject` [GEM] [VERSION] + +## DESCRIPTION + +Adds the named gem(s) with their version requirements to the resolved +[`Gemfile(5)`][Gemfile(5)]. + +This command will add the gem to both your [`Gemfile(5)`][Gemfile(5)] and Gemfile.lock if it +isn't listed yet. + +Example: + + bundle install + bundle inject 'rack' '> 0' + +This will inject the 'rack' gem with a version greater than 0 in your +[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock diff --git a/lib/bundler/man/bundle-install.1.ronn b/lib/bundler/man/bundle-install.1.ronn new file mode 100644 index 0000000000..5ea777f1d4 --- /dev/null +++ b/lib/bundler/man/bundle-install.1.ronn @@ -0,0 +1,405 @@ +bundle-install(1) -- Install the dependencies specified in your Gemfile +======================================================================= + +## SYNOPSIS + +`bundle install` [--binstubs[=DIRECTORY]] + [--clean] + [--deployment] + [--frozen] + [--full-index] + [--gemfile=GEMFILE] + [--jobs=NUMBER] + [--local] + [--no-cache] + [--no-prune] + [--path PATH] + [--quiet] + [--redownload] + [--retry=NUMBER] + [--shebang] + [--standalone[=GROUP[ GROUP...]]] + [--system] + [--trust-policy=POLICY] + [--with=GROUP[ GROUP...]] + [--without=GROUP[ GROUP...]] + +## DESCRIPTION + +Install the gems specified in your Gemfile(5). If this is the first +time you run bundle install (and a `Gemfile.lock` does not exist), +Bundler will fetch all remote sources, resolve dependencies and +install all needed gems. + +If a `Gemfile.lock` does exist, and you have not updated your Gemfile(5), +Bundler will fetch all remote sources, but use the dependencies +specified in the `Gemfile.lock` instead of resolving dependencies. + +If a `Gemfile.lock` does exist, and you have updated your Gemfile(5), +Bundler will use the dependencies in the `Gemfile.lock` for all gems +that you did not update, but will re-resolve the dependencies of +gems that you did update. You can find more information about this +update process below under [CONSERVATIVE UPDATING][]. + +## OPTIONS + +The `--clean`, `--deployment`, `--frozen`, `--no-prune`, `--path`, `--shebang`, +`--system`, `--without` and `--with` options are deprecated because they only +make sense if they are applied to every subsequent `bundle install` run +automatically and that requires `bundler` to silently remember them. Since +`bundler` will no longer remember CLI flags in future versions, `bundle config` +(see bundle-config(1)) should be used to apply them permanently. + +* `--binstubs[=]`: + Binstubs are scripts that wrap around executables. Bundler creates a small Ruby + file (a binstub) that loads Bundler, runs the command, and puts it in `bin/`. + This lets you link the binstub inside of an application to the exact gem + version the application needs. + + Creates a directory (defaults to `~/bin`) and places any executables from the + gem there. These executables run in Bundler's context. If used, you might add + this directory to your environment's `PATH` variable. For instance, if the + `rails` gem comes with a `rails` executable, this flag will create a + `bin/rails` executable that ensures that all referred dependencies will be + resolved using the bundled gems. + +* `--clean`: + On finishing the installation Bundler is going to remove any gems not present + in the current Gemfile(5). Don't worry, gems currently in use will not be + removed. + + This option is deprecated in favor of the `clean` setting. + +* `--deployment`: + In [deployment mode][DEPLOYMENT MODE], Bundler will 'roll-out' the bundle for + production or CI use. Please check carefully if you want to have this option + enabled in your development environment. + + This option is deprecated in favor of the `deployment` setting. + +* `--redownload`: + Force download every gem, even if the required versions are already available + locally. + +* `--frozen`: + Do not allow the Gemfile.lock to be updated after this install. Exits + non-zero if there are going to be changes to the Gemfile.lock. + + This option is deprecated in favor of the `frozen` setting. + +* `--full-index`: + Bundler will not call Rubygems' API endpoint (default) but download and cache + a (currently big) index file of all gems. Performance can be improved for + large bundles that seldom change by enabling this option. + +* `--gemfile=`: + The location of the Gemfile(5) which Bundler should use. This defaults + to a Gemfile(5) in the current working directory. In general, Bundler + will assume that the location of the Gemfile(5) is also the project's + root and will try to find `Gemfile.lock` and `vendor/cache` relative + to this location. + +* `--jobs=[]`, `-j[]`: + The maximum number of parallel download and install jobs. The default + is `1`. + +* `--local`: + Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the + gems already present in Rubygems' cache or in `vendor/cache`. Note that if an + appropriate platform-specific gem exists on `rubygems.org` it will not be + found. + +* `--no-cache`: + Do not update the cache in `vendor/cache` with the newly bundled gems. This + does not remove any gems in the cache but keeps the newly bundled gems from + being cached during the install. + +* `--no-prune`: + Don't remove stale gems from the cache when the installation finishes. + + This option is deprecated in favor of the `no_prune` setting. + +* `--path=`: + The location to install the specified gems to. This defaults to Rubygems' + setting. Bundler shares this location with Rubygems, `gem install ...` will + have gem installed there, too. Therefore, gems installed without a + `--path ...` setting will show up by calling `gem list`. Accordingly, gems + installed to other locations will not get listed. + + This option is deprecated in favor of the `path` setting. + +* `--quiet`: + Do not print progress information to the standard output. Instead, Bundler + will exit using a status code (`$?`). + +* `--retry=[]`: + Retry failed network or git requests for times. + +* `--shebang=`: + Uses the specified ruby executable (usually `ruby`) to execute the scripts + created with `--binstubs`. In addition, if you use `--binstubs` together with + `--shebang jruby` these executables will be changed to execute `jruby` + instead. + + This option is deprecated in favor of the `shebang` setting. + +* `--standalone[=]`: + Makes a bundle that can work without depending on Rubygems or Bundler at + runtime. A space separated list of groups to install has to be specified. + Bundler creates a directory named `bundle` and installs the bundle there. It + also generates a `bundle/bundler/setup.rb` file to replace Bundler's own setup + in the manner required. Using this option implicitly sets `path`, which is a + [remembered option][REMEMBERED OPTIONS]. + +* `--system`: + Installs the gems specified in the bundle to the system's Rubygems location. + This overrides any previous configuration of `--path`. + + This option is deprecated in favor of the `system` setting. + +* `--trust-policy=[]`: + Apply the Rubygems security policy , where policy is one of + `HighSecurity`, `MediumSecurity`, `LowSecurity`, `AlmostNoSecurity`, or + `NoSecurity`. For more details, please see the Rubygems signing documentation + linked below in [SEE ALSO][]. + +* `--with=`: + A space-separated list of groups referencing gems to install. If an + optional group is given it is installed. If a group is given that is + in the remembered list of groups given to --without, it is removed + from that list. + + This option is deprecated in favor of the `with` setting. + +* `--without=`: + A space-separated list of groups referencing gems to skip during installation. + If a group is given that is in the remembered list of groups given + to --with, it is removed from that list. + + This option is deprecated in favor of the `without` setting. + +## DEPLOYMENT MODE + +Bundler's defaults are optimized for development. To switch to +defaults optimized for deployment and for CI, use the `--deployment` +flag. Do not activate deployment mode on development machines, as it +will cause an error when the Gemfile(5) is modified. + +1. A `Gemfile.lock` is required. + + To ensure that the same versions of the gems you developed with + and tested with are also used in deployments, a `Gemfile.lock` + is required. + + This is mainly to ensure that you remember to check your + `Gemfile.lock` into version control. + +2. The `Gemfile.lock` must be up to date + + In development, you can modify your Gemfile(5) and re-run + `bundle install` to [conservatively update][CONSERVATIVE UPDATING] + your `Gemfile.lock` snapshot. + + In deployment, your `Gemfile.lock` should be up-to-date with + changes made in your Gemfile(5). + +3. Gems are installed to `vendor/bundle` not your default system location + + In development, it's convenient to share the gems used in your + application with other applications and other scripts that run on + the system. + + In deployment, isolation is a more important default. In addition, + the user deploying the application may not have permission to install + gems to the system, or the web server may not have permission to + read them. + + As a result, `bundle install --deployment` installs gems to + the `vendor/bundle` directory in the application. This may be + overridden using the `--path` option. + +## SUDO USAGE + +By default, Bundler installs gems to the same location as `gem install`. + +In some cases, that location may not be writable by your Unix user. In +that case, Bundler will stage everything in a temporary directory, +then ask you for your `sudo` password in order to copy the gems into +their system location. + +From your perspective, this is identical to installing the gems +directly into the system. + +You should never use `sudo bundle install`. This is because several +other steps in `bundle install` must be performed as the current user: + +* Updating your `Gemfile.lock` +* Updating your `vendor/cache`, if necessary +* Checking out private git repositories using your user's SSH keys + +Of these three, the first two could theoretically be performed by +`chown`ing the resulting files to `$SUDO_USER`. The third, however, +can only be performed by invoking the `git` command as +the current user. Therefore, git gems are downloaded and installed +into `~/.bundle` rather than $GEM_HOME or $BUNDLE_PATH. + +As a result, you should run `bundle install` as the current user, +and Bundler will ask for your password if it is needed to put the +gems into their final location. + +## INSTALLING GROUPS + +By default, `bundle install` will install all gems in all groups +in your Gemfile(5), except those declared for a different platform. + +However, you can explicitly tell Bundler to skip installing +certain groups with the `--without` option. This option takes +a space-separated list of groups. + +While the `--without` option will skip _installing_ the gems in the +specified groups, it will still _download_ those gems and use them to +resolve the dependencies of every gem in your Gemfile(5). + +This is so that installing a different set of groups on another + machine (such as a production server) will not change the +gems and versions that you have already developed and tested against. + +`Bundler offers a rock-solid guarantee that the third-party +code you are running in development and testing is also the +third-party code you are running in production. You can choose +to exclude some of that code in different environments, but you +will never be caught flat-footed by different versions of +third-party code being used in different environments.` + +For a simple illustration, consider the following Gemfile(5): + + source 'https://rubygems.org' + + gem 'sinatra' + + group :production do + gem 'rack-perftools-profiler' + end + +In this case, `sinatra` depends on any version of Rack (`>= 1.0`), while +`rack-perftools-profiler` depends on 1.x (`~> 1.0`). + +When you run `bundle install --without production` in development, we +look at the dependencies of `rack-perftools-profiler` as well. That way, +you do not spend all your time developing against Rack 2.0, using new +APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2 +when the `production` group _is_ used. + +This should not cause any problems in practice, because we do not +attempt to `install` the gems in the excluded groups, and only evaluate +as part of the dependency resolution process. + +This also means that you cannot include different versions of the same +gem in different groups, because doing so would result in different +sets of dependencies used in development and production. Because of +the vagaries of the dependency resolution process, this usually +affects more than the gems you list in your Gemfile(5), and can +(surprisingly) radically change the gems you are using. + +## THE GEMFILE.LOCK + +When you run `bundle install`, Bundler will persist the full names +and versions of all gems that you used (including dependencies of +the gems specified in the Gemfile(5)) into a file called `Gemfile.lock`. + +Bundler uses this file in all subsequent calls to `bundle install`, +which guarantees that you always use the same exact code, even +as your application moves across machines. + +Because of the way dependency resolution works, even a +seemingly small change (for instance, an update to a point-release +of a dependency of a gem in your Gemfile(5)) can result in radically +different gems being needed to satisfy all dependencies. + +As a result, you `SHOULD` check your `Gemfile.lock` into version +control, in both applications and gems. If you do not, every machine that +checks out your repository (including your production server) will resolve all +dependencies again, which will result in different versions of +third-party code being used if `any` of the gems in the Gemfile(5) +or any of their dependencies have been updated. + +When Bundler first shipped, the `Gemfile.lock` was included in the `.gitignore` +file included with generated gems. Over time, however, it became clear that +this practice forces the pain of broken dependencies onto new contributors, +while leaving existing contributors potentially unaware of the problem. Since +`bundle install` is usually the first step towards a contribution, the pain of +broken dependencies would discourage new contributors from contributing. As a +result, we have revised our guidance for gem authors to now recommend checking +in the lock for gems. + +## CONSERVATIVE UPDATING + +When you make a change to the Gemfile(5) and then run `bundle install`, +Bundler will update only the gems that you modified. + +In other words, if a gem that you `did not modify` worked before +you called `bundle install`, it will continue to use the exact +same versions of all dependencies as it used before the update. + +Let's take a look at an example. Here's your original Gemfile(5): + + source 'https://rubygems.org' + + gem 'actionpack', '2.3.8' + gem 'activemerchant' + +In this case, both `actionpack` and `activemerchant` depend on +`activesupport`. The `actionpack` gem depends on `activesupport 2.3.8` +and `rack ~> 1.1.0`, while the `activemerchant` gem depends on +`activesupport >= 2.3.2`, `braintree >= 2.0.0`, and `builder >= 2.0.0`. + +When the dependencies are first resolved, Bundler will select +`activesupport 2.3.8`, which satisfies the requirements of both +gems in your Gemfile(5). + +Next, you modify your Gemfile(5) to: + + source 'https://rubygems.org' + + gem 'actionpack', '3.0.0.rc' + gem 'activemerchant' + +The `actionpack 3.0.0.rc` gem has a number of new dependencies, +and updates the `activesupport` dependency to `= 3.0.0.rc` and +the `rack` dependency to `~> 1.2.1`. + +When you run `bundle install`, Bundler notices that you changed +the `actionpack` gem, but not the `activemerchant` gem. It +evaluates the gems currently being used to satisfy its requirements: + + * `activesupport 2.3.8`: + also used to satisfy a dependency in `activemerchant`, + which is not being updated + * `rack ~> 1.1.0`: + not currently being used to satisfy another dependency + +Because you did not explicitly ask to update `activemerchant`, +you would not expect it to suddenly stop working after updating +`actionpack`. However, satisfying the new `activesupport 3.0.0.rc` +dependency of actionpack requires updating one of its dependencies. + +Even though `activemerchant` declares a very loose dependency +that theoretically matches `activesupport 3.0.0.rc`, Bundler treats +gems in your Gemfile(5) that have not changed as an atomic unit +together with their dependencies. In this case, the `activemerchant` +dependency is treated as `activemerchant 1.7.1 + activesupport 2.3.8`, +so `bundle install` will report that it cannot update `actionpack`. + +To explicitly update `actionpack`, including its dependencies +which other gems in the Gemfile(5) still depend on, run +`bundle update actionpack` (see `bundle update(1)`). + +`Summary`: In general, after making a change to the Gemfile(5) , you +should first try to run `bundle install`, which will guarantee that no +other gem in the Gemfile(5) is impacted by the change. If that +does not work, run [bundle update(1)](bundle-update.1.html). + +## SEE ALSO + +* [Gem install docs](http://guides.rubygems.org/rubygems-basics/#installing-gems) +* [Rubygems signing docs](http://guides.rubygems.org/security/) diff --git a/lib/bundler/man/bundle-list.1.ronn b/lib/bundler/man/bundle-list.1.ronn new file mode 100644 index 0000000000..dc058ecd5f --- /dev/null +++ b/lib/bundler/man/bundle-list.1.ronn @@ -0,0 +1,33 @@ +bundle-list(1) -- List all the gems in the bundle +========================================================================= + +## SYNOPSIS + +`bundle list` [--name-only] [--paths] [--without-group=GROUP[ GROUP...]] [--only-group=GROUP[ GROUP...]] + +## DESCRIPTION + +Prints a list of all the gems in the bundle including their version. + +Example: + +bundle list --name-only + +bundle list --paths + +bundle list --without-group test + +bundle list --only-group dev + +bundle list --only-group dev test --paths + +## OPTIONS + +* `--name-only`: + Print only the name of each gem. +* `--paths`: + Print the path to each gem in the bundle. +* `--without-group=`: + A space-separated list of groups of gems to skip during printing. +* `--only-group=`: + A space-separated list of groups of gems to print. diff --git a/lib/bundler/man/bundle-lock.1.ronn b/lib/bundler/man/bundle-lock.1.ronn new file mode 100644 index 0000000000..3aa5920f5a --- /dev/null +++ b/lib/bundler/man/bundle-lock.1.ronn @@ -0,0 +1,94 @@ +bundle-lock(1) -- Creates / Updates a lockfile without installing +================================================================= + +## SYNOPSIS + +`bundle lock` [--update] + [--local] + [--print] + [--lockfile=PATH] + [--full-index] + [--add-platform] + [--remove-platform] + [--patch] + [--minor] + [--major] + [--strict] + [--conservative] + +## DESCRIPTION + +Lock the gems specified in Gemfile. + +## OPTIONS + +* `--update=<*gems>`: + Ignores the existing lockfile. Resolve then updates lockfile. Taking a list + of gems or updating all gems if no list is given. + +* `--local`: + Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the + gems already present in Rubygems' cache or in `vendor/cache`. Note that if a + appropriate platform-specific gem exists on `rubygems.org` it will not be + found. + +* `--print`: + Prints the lockfile to STDOUT instead of writing to the file system. + +* `--lockfile=`: + The path where the lockfile should be written to. + +* `--full-index`: + Fall back to using the single-file index of all gems. + +* `--add-platform`: + Add a new platform to the lockfile, re-resolving for the addition of that + platform. + +* `--remove-platform`: + Remove a platform from the lockfile. + +* `--patch`: + If updating, prefer updating only to next patch version. + +* `--minor`: + If updating, prefer updating only to next minor version. + +* `--major`: + If updating, prefer updating to next major version (default). + +* `--strict`: + If updating, do not allow any gem to be updated past latest --patch | --minor | --major. + +* `--conservative`: + If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated. + +## UPDATING ALL GEMS + +If you run `bundle lock` with `--update` option without list of gems, bundler will +ignore any previously installed gems and resolve all dependencies again based +on the latest versions of all gems available in the sources. + +## UPDATING A LIST OF GEMS + +Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of +the gems that you specified locked to the versions in the `Gemfile.lock`. + +For instance, you only want to update `nokogiri`, run `bundle lock --update nokogiri`. + +Bundler will update `nokogiri` and any of its dependencies, but leave the rest of the +gems that you specified locked to the versions in the `Gemfile.lock`. + +## SUPPORTING OTHER PLATFORMS + +If you want your bundle to support platforms other than the one you're running +locally, you can run `bundle lock --add-platform PLATFORM` to add PLATFORM to +the lockfile, force bundler to re-resolve and consider the new platform when +picking gems, all without needing to have a machine that matches PLATFORM handy +to install those platform-specific gems on. + +For a full explanation of gem platforms, see `gem help platform`. + +## PATCH LEVEL OPTIONS + +See [bundle update(1)](bundle-update.1.html) for details. diff --git a/lib/bundler/man/bundle-open.1.ronn b/lib/bundler/man/bundle-open.1.ronn new file mode 100644 index 0000000000..497beac93f --- /dev/null +++ b/lib/bundler/man/bundle-open.1.ronn @@ -0,0 +1,19 @@ +bundle-open(1) -- Opens the source directory for a gem in your bundle +===================================================================== + +## SYNOPSIS + +`bundle open` [GEM] + +## DESCRIPTION + +Opens the source directory of the provided GEM in your editor. + +For this to work the `EDITOR` or `BUNDLER_EDITOR` environment variable has to +be set. + +Example: + + bundle open 'rack' + +Will open the source directory for the 'rack' gem in your bundle. diff --git a/lib/bundler/man/bundle-outdated.1.ronn b/lib/bundler/man/bundle-outdated.1.ronn new file mode 100644 index 0000000000..a991d23789 --- /dev/null +++ b/lib/bundler/man/bundle-outdated.1.ronn @@ -0,0 +1,111 @@ +bundle-outdated(1) -- List installed gems with newer versions available +======================================================================= + +## SYNOPSIS + +`bundle outdated` [GEM] [--local] + [--pre] + [--source] + [--strict] + [--parseable | --porcelain] + [--group=GROUP] + [--groups] + [--update-strict] + [--patch|--minor|--major] + [--filter-major] + [--filter-minor] + [--filter-patch] + [--only-explicit] + +## DESCRIPTION + +Outdated lists the names and versions of gems that have a newer version available +in the given source. Calling outdated with [GEM [GEM]] will only check for newer +versions of the given gems. Prerelease gems are ignored by default. If your gems +are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1. + +## OPTIONS + +* `--local`: + Do not attempt to fetch gems remotely and use the gem cache instead. + +* `--pre`: + Check for newer pre-release gems. + +* `--source`: + Check against a specific source. + +* `--strict`: + Only list newer versions allowed by your Gemfile requirements. + +* `--parseable`, `--porcelain`: + Use minimal formatting for more parseable output. + +* `--group`: + List gems from a specific group. + +* `--groups`: + List gems organized by groups. + +* `--update-strict`: + Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor| --major. + +* `--minor`: + Prefer updating only to next minor version. + +* `--major`: + Prefer updating to next major version (default). + +* `--patch`: + Prefer updating only to next patch version. + +* `--filter-major`: + Only list major newer versions. + +* `--filter-minor`: + Only list minor newer versions. + +* `--filter-patch`: + Only list patch newer versions. + +* `--only-explicit`: + Only list gems specified in your Gemfile, not their dependencies. + +## PATCH LEVEL OPTIONS + +See [bundle update(1)](bundle-update.1.html) for details. + +One difference between the patch level options in `bundle update` and here is the `--strict` option. +`--strict` was already an option on outdated before the patch level options were added. `--strict` +wasn't altered, and the `--update-strict` option on `outdated` reflects what `--strict` does on +`bundle update`. + +## FILTERING OUTPUT + +The 3 filtering options do not affect the resolution of versions, merely what versions are shown +in the output. + +If the regular output shows the following: + + * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" + * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default" + * headless (newest 2.3.1, installed 2.2.3) in groups "test" + +`--filter-major` would only show: + + * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default" + +`--filter-minor` would only show: + + * headless (newest 2.3.1, installed 2.2.3) in groups "test" + +`--filter-patch` would only show: + + * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" + +Filter options can be combined. `--filter-minor` and `--filter-patch` would show: + + * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" + * headless (newest 2.3.1, installed 2.2.3) in groups "test" + +Combining all three `filter` options would be the same result as providing none of them. diff --git a/lib/bundler/man/bundle-platform.1.ronn b/lib/bundler/man/bundle-platform.1.ronn new file mode 100644 index 0000000000..b5d3283fb6 --- /dev/null +++ b/lib/bundler/man/bundle-platform.1.ronn @@ -0,0 +1,42 @@ +bundle-platform(1) -- Displays platform compatibility information +================================================================= + +## SYNOPSIS + +`bundle platform` [--ruby] + +## DESCRIPTION + +`platform` will display information from your Gemfile, Gemfile.lock, and Ruby +VM about your platform. + +For instance, using this Gemfile(5): + + source "https://rubygems.org" + + ruby "1.9.3" + + gem "rack" + +If you run `bundle platform` on Ruby 1.9.3, it will display the following output: + + Your platform is: x86_64-linux + + Your app has gems that work on these platforms: + * ruby + + Your Gemfile specifies a Ruby version requirement: + * ruby 1.9.3 + + Your current platform satisfies the Ruby version requirement. + +`platform` will list all the platforms in your `Gemfile.lock` as well as the +`ruby` directive if applicable from your Gemfile(5). It will also let you know +if the `ruby` directive requirement has been met. If `ruby` directive doesn't +match the running Ruby VM, it will tell you what part does not. + +## OPTIONS + +* `--ruby`: + It will display the ruby directive information, so you don't have to + parse it from the Gemfile(5). diff --git a/lib/bundler/man/bundle-pristine.1.ronn b/lib/bundler/man/bundle-pristine.1.ronn new file mode 100644 index 0000000000..e2d6b6a348 --- /dev/null +++ b/lib/bundler/man/bundle-pristine.1.ronn @@ -0,0 +1,34 @@ +bundle-pristine(1) -- Restores installed gems to their pristine condition +=========================================================================== + +## SYNOPSIS + +`bundle pristine` + +## DESCRIPTION + +`pristine` restores the installed gems in the bundle to their pristine condition +using the local gem cache from RubyGems. For git gems, a forced checkout will be performed. + +For further explanation, `bundle pristine` ignores unpacked files on disk. In other +words, this command utilizes the local `.gem` cache or the gem's git repository +as if one were installing from scratch. + +Note: the Bundler gem cannot be restored to its original state with `pristine`. +One also cannot use `bundle pristine` on gems with a 'path' option in the Gemfile, +because bundler has no original copy it can restore from. + +When is it practical to use `bundle pristine`? + +It comes in handy when a developer is debugging a gem. `bundle pristine` is a +great way to get rid of experimental changes to a gem that one may not want. + +Why use `bundle pristine` over `gem pristine --all`? + +Both commands are very similar. +For context: `bundle pristine`, without arguments, cleans all gems from the lockfile. +Meanwhile, `gem pristine --all` cleans all installed gems for that Ruby version. + +If a developer forgets which gems in their project they might +have been debugging, the Rubygems `gem pristine [GEMNAME]` command may be inconvenient. +One can avoid waiting for `gem pristine --all`, and instead run `bundle pristine`. diff --git a/lib/bundler/man/bundle-remove.1.ronn b/lib/bundler/man/bundle-remove.1.ronn new file mode 100644 index 0000000000..40a239b4a2 --- /dev/null +++ b/lib/bundler/man/bundle-remove.1.ronn @@ -0,0 +1,23 @@ +bundle-remove(1) -- Removes gems from the Gemfile +=========================================================================== + +## SYNOPSIS + +`bundle remove [GEM [GEM ...]] [--install]` + +## DESCRIPTION + +Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised. + +## OPTIONS + +* `--install`: + Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s). + +Example: + +bundle remove rails + +bundle remove rails rack + +bundle remove rails rack --install diff --git a/lib/bundler/man/bundle-show.1.ronn b/lib/bundler/man/bundle-show.1.ronn new file mode 100644 index 0000000000..a6a59a1445 --- /dev/null +++ b/lib/bundler/man/bundle-show.1.ronn @@ -0,0 +1,21 @@ +bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem +========================================================================= + +## SYNOPSIS + +`bundle show` [GEM] + [--paths] + +## DESCRIPTION + +Without the [GEM] option, `show` will print a list of the names and versions of +all gems that are required by your [`Gemfile(5)`][Gemfile(5)], sorted by name. + +Calling show with [GEM] will list the exact location of that gem on your +machine. + +## OPTIONS + +* `--paths`: + List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)], + sorted by gem name. diff --git a/lib/bundler/man/bundle-update.1.ronn b/lib/bundler/man/bundle-update.1.ronn new file mode 100644 index 0000000000..397fecadcb --- /dev/null +++ b/lib/bundler/man/bundle-update.1.ronn @@ -0,0 +1,350 @@ +bundle-update(1) -- Update your gems to the latest available versions +===================================================================== + +## SYNOPSIS + +`bundle update` <*gems> [--all] + [--group=NAME] + [--source=NAME] + [--local] + [--ruby] + [--bundler[=VERSION]] + [--full-index] + [--jobs=JOBS] + [--quiet] + [--patch|--minor|--major] + [--redownload] + [--strict] + [--conservative] + +## DESCRIPTION + +Update the gems specified (all gems, if `--all` flag is used), ignoring +the previously installed gems specified in the `Gemfile.lock`. In +general, you should use [bundle install(1)](bundle-install.1.html) to install the same exact +gems and versions across machines. + +You would use `bundle update` to explicitly update the version of a +gem. + +## OPTIONS + +* `--all`: + Update all gems specified in Gemfile. + +* `--group=`, `-g=[]`: + Only update the gems in the specified group. For instance, you can update all gems + in the development group with `bundle update --group development`. You can also + call `bundle update rails --group test` to update the rails gem and all gems in + the test group, for example. + +* `--source=`: + The name of a `:git` or `:path` source used in the Gemfile(5). For + instance, with a `:git` source of `http://github.com/rails/rails.git`, + you would call `bundle update --source rails` + +* `--local`: + Do not attempt to fetch gems remotely and use the gem cache instead. + +* `--ruby`: + Update the locked version of Ruby to the current version of Ruby. + +* `--bundler`: + Update the locked version of bundler to the invoked bundler version. + +* `--full-index`: + Fall back to using the single-file index of all gems. + +* `--jobs=[]`, `-j[]`: + Specify the number of jobs to run in parallel. The default is `1`. + +* `--retry=[]`: + Retry failed network or git requests for times. + +* `--quiet`: + Only output warnings and errors. + +* `--redownload`: + Force downloading every gem. + +* `--patch`: + Prefer updating only to next patch version. + +* `--minor`: + Prefer updating only to next minor version. + +* `--major`: + Prefer updating to next major version (default). + +* `--strict`: + Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`. + +* `--conservative`: + Use bundle install conservative update behavior and do not allow shared dependencies to be updated. + +## UPDATING ALL GEMS + +If you run `bundle update --all`, bundler will ignore +any previously installed gems and resolve all dependencies again +based on the latest versions of all gems available in the sources. + +Consider the following Gemfile(5): + + source "https://rubygems.org" + + gem "rails", "3.0.0.rc" + gem "nokogiri" + +When you run [bundle install(1)](bundle-install.1.html) the first time, bundler will resolve +all of the dependencies, all the way down, and install what you need: + + Fetching gem metadata from https://rubygems.org/......... + Resolving dependencies... + Installing builder 2.1.2 + Installing abstract 1.0.0 + Installing rack 1.2.8 + Using bundler 1.7.6 + Installing rake 10.4.0 + Installing polyglot 0.3.5 + Installing mime-types 1.25.1 + Installing i18n 0.4.2 + Installing mini_portile 0.6.1 + Installing tzinfo 0.3.42 + Installing rack-mount 0.6.14 + Installing rack-test 0.5.7 + Installing treetop 1.4.15 + Installing thor 0.14.6 + Installing activesupport 3.0.0.rc + Installing erubis 2.6.6 + Installing activemodel 3.0.0.rc + Installing arel 0.4.0 + Installing mail 2.2.20 + Installing activeresource 3.0.0.rc + Installing actionpack 3.0.0.rc + Installing activerecord 3.0.0.rc + Installing actionmailer 3.0.0.rc + Installing railties 3.0.0.rc + Installing rails 3.0.0.rc + Installing nokogiri 1.6.5 + + Bundle complete! 2 Gemfile dependencies, 26 gems total. + Use `bundle show [gemname]` to see where a bundled gem is installed. + +As you can see, even though you have two gems in the Gemfile(5), your application +needs 26 different gems in order to run. Bundler remembers the exact versions +it installed in `Gemfile.lock`. The next time you run [bundle install(1)](bundle-install.1.html), bundler skips +the dependency resolution and installs the same gems as it installed last time. + +After checking in the `Gemfile.lock` into version control and cloning it on another +machine, running [bundle install(1)](bundle-install.1.html) will _still_ install the gems that you installed +last time. You don't need to worry that a new release of `erubis` or `mail` changes +the gems you use. + +However, from time to time, you might want to update the gems you are using to the +newest versions that still match the gems in your Gemfile(5). + +To do this, run `bundle update --all`, which will ignore the `Gemfile.lock`, and resolve +all the dependencies again. Keep in mind that this process can result in a significantly +different set of the 25 gems, based on the requirements of new gems that the gem +authors released since the last time you ran `bundle update --all`. + +## UPDATING A LIST OF GEMS + +Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the +gems that you specified locked to the versions in the `Gemfile.lock`. + +For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and +you want to update it _without_ updating Rails and all of its dependencies. To do this, +run `bundle update nokogiri`. + +Bundler will update `nokogiri` and any of its dependencies, but leave alone Rails and +its dependencies. + +## OVERLAPPING DEPENDENCIES + +Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same +second-level dependency. For instance, consider the case of `thin` and +`rack-perftools-profiler`. + + source "https://rubygems.org" + + gem "thin" + gem "rack-perftools-profiler" + +The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends +on `rack ~> 1.0`. If you run bundle install, you get: + + Fetching source index for https://rubygems.org/ + Installing daemons (1.1.0) + Installing eventmachine (0.12.10) with native extensions + Installing open4 (1.0.1) + Installing perftools.rb (0.4.7) with native extensions + Installing rack (1.2.1) + Installing rack-perftools_profiler (0.0.2) + Installing thin (1.2.7) with native extensions + Using bundler (1.0.0.rc.3) + +In this case, the two gems have their own set of dependencies, but they share +`rack` in common. If you run `bundle update thin`, bundler will update `daemons`, +`eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or +`perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that +`bundle update thin` will update `rack` even though it's _also_ a dependency of +`rack-perftools_profiler`. + +In short, by default, when you update a gem using `bundle update`, bundler will +update all dependencies of that gem, including those that are also dependencies +of another gem. + +To prevent updating shared dependencies, prior to version 1.14 the only option +was the `CONSERVATIVE UPDATING` behavior in [bundle install(1)](bundle-install.1.html): + +In this scenario, updating the `thin` version manually in the Gemfile(5), +and then running [bundle install(1)](bundle-install.1.html) will only update `daemons` and `eventmachine`, +but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section +of [bundle install(1)](bundle-install.1.html). + +Starting with 1.14, specifying the `--conservative` option will also prevent shared +dependencies from being updated. + +## PATCH LEVEL OPTIONS + +Version 1.14 introduced 4 patch-level options that will influence how gem +versions are resolved. One of the following options can be used: `--patch`, +`--minor` or `--major`. `--strict` can be added to further influence resolution. + +* `--patch`: + Prefer updating only to next patch version. + +* `--minor`: + Prefer updating only to next minor version. + +* `--major`: + Prefer updating to next major version (default). + +* `--strict`: + Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`. + +When Bundler is resolving what versions to use to satisfy declared +requirements in the Gemfile or in parent gems, it looks up all +available versions, filters out any versions that don't satisfy +the requirement, and then, by default, sorts them from newest to +oldest, considering them in that order. + +Providing one of the patch level options (e.g. `--patch`) changes the +sort order of the satisfying versions, causing Bundler to consider the +latest `--patch` or `--minor` version available before other versions. +Note that versions outside the stated patch level could still be +resolved to if necessary to find a suitable dependency graph. + +For example, if gem 'foo' is locked at 1.0.2, with no gem requirement +defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0 +all exist, the default order of preference by default (`--major`) will +be "2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2". + +If the `--patch` option is used, the order of preference will change to +"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0". + +If the `--minor` option is used, the order of preference will change to +"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0". + +Combining the `--strict` option with any of the patch level options +will remove any versions beyond the scope of the patch level option, +to ensure that no gem is updated that far. + +To continue the previous example, if both `--patch` and `--strict` +options are used, the available versions for resolution would be +"1.0.4, 1.0.3, 1.0.2". If `--minor` and `--strict` are used, it would +be "1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2". + +Gem requirements as defined in the Gemfile will still be the first +determining factor for what versions are available. If the gem +requirement for `foo` in the Gemfile is '~> 1.0', that will accomplish +the same thing as providing the `--minor` and `--strict` options. + +## PATCH LEVEL EXAMPLES + +Given the following gem specifications: + + foo 1.4.3, requires: ~> bar 2.0 + foo 1.4.4, requires: ~> bar 2.0 + foo 1.4.5, requires: ~> bar 2.1 + foo 1.5.0, requires: ~> bar 2.1 + foo 1.5.1, requires: ~> bar 3.0 + bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0 + +Gemfile: + + gem 'foo' + +Gemfile.lock: + + foo (1.4.3) + bar (~> 2.0) + bar (2.0.3) + +Cases: + + # Command Line Result + ------------------------------------------------------------ + 1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1' + 2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1' + 3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0' + 4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1' + 5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4' + +In case 1, bar is upgraded to 2.1.1, a minor version increase, because +the dependency from foo 1.4.5 required it. + +In case 2, only foo is requested to be unlocked, but bar is also +allowed to move because it's not a declared dependency in the Gemfile. + +In case 3, bar goes up a whole major release, because a minor increase +is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0 +of bar. + +In case 4, foo is preferred up to a minor version, but 1.5.1 won't work +because the --strict flag removes bar 3.0.0 from consideration since +it's a major increment. + +In case 5, both foo and bar have any minor or major increments removed +from consideration because of the --strict flag, so the most they can +move is up to 1.4.4 and 2.0.4. + +## RECOMMENDED WORKFLOW + +In general, when working with an application managed with bundler, you should +use the following workflow: + +* After you create your Gemfile(5) for the first time, run + + $ bundle install + +* Check the resulting `Gemfile.lock` into version control + + $ git add Gemfile.lock + +* When checking out this repository on another development machine, run + + $ bundle install + +* When checking out this repository on a deployment machine, run + + $ bundle install --deployment + +* After changing the Gemfile(5) to reflect a new or update dependency, run + + $ bundle install + +* Make sure to check the updated `Gemfile.lock` into version control + + $ git add Gemfile.lock + +* If [bundle install(1)](bundle-install.1.html) reports a conflict, manually update the specific + gems that you changed in the Gemfile(5) + + $ bundle update rails thin + +* If you want to update all the gems to the latest possible versions that + still match the gems listed in the Gemfile(5), run + + $ bundle update --all diff --git a/lib/bundler/man/bundle-viz.1.ronn b/lib/bundler/man/bundle-viz.1.ronn new file mode 100644 index 0000000000..701df5415e --- /dev/null +++ b/lib/bundler/man/bundle-viz.1.ronn @@ -0,0 +1,30 @@ +bundle-viz(1) -- Generates a visual dependency graph for your Gemfile +===================================================================== + +## SYNOPSIS + +`bundle viz` [--file=FILE] + [--format=FORMAT] + [--requirements] + [--version] + [--without=GROUP GROUP] + +## DESCRIPTION + +`viz` generates a PNG file of the current `Gemfile(5)` as a dependency graph. +`viz` requires the ruby-graphviz gem (and its dependencies). + +The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html). + +## OPTIONS + +* `--file`, `-f`: + The name to use for the generated file. See `--format` option +* `--format`, `-F`: + This is output format option. Supported format is png, jpg, svg, dot ... +* `--requirements`, `-R`: + Set to show the version of each required dependency. +* `--version`, `-v`: + Set to show each gem version. +* `--without`, `-W`: + Exclude gems that are part of the specified named group. diff --git a/lib/bundler/man/bundle.1.ronn b/lib/bundler/man/bundle.1.ronn new file mode 100644 index 0000000000..5b1712394a --- /dev/null +++ b/lib/bundler/man/bundle.1.ronn @@ -0,0 +1,111 @@ +bundle(1) -- Ruby Dependency Management +======================================= + +## SYNOPSIS + +`bundle` COMMAND [--no-color] [--verbose] [ARGS] + +## DESCRIPTION + +Bundler manages an `application's dependencies` through its entire life +across many machines systematically and repeatably. + +See [the bundler website](https://bundler.io) for information on getting +started, and Gemfile(5) for more information on the `Gemfile` format. + +## OPTIONS + +* `--no-color`: + Print all output without color + +* `--retry`, `-r`: + Specify the number of times you wish to attempt network commands + +* `--verbose`, `-V`: + Print out additional logging information + +## BUNDLE COMMANDS + +We divide `bundle` subcommands into primary commands and utilities: + +## PRIMARY COMMANDS + +* [`bundle install(1)`](bundle-install.1.html): + Install the gems specified by the `Gemfile` or `Gemfile.lock` + +* [`bundle update(1)`](bundle-update.1.html): + Update dependencies to their latest versions + +* [`bundle package(1)`](bundle-package.1.html): + Package the .gem files required by your application into the + `vendor/cache` directory + +* [`bundle exec(1)`](bundle-exec.1.html): + Execute a script in the current bundle + +* [`bundle config(1)`](bundle-config.1.html): + Specify and read configuration options for Bundler + +* `bundle help(1)`: + Display detailed help for each subcommand + +## UTILITIES + +* [`bundle add(1)`](bundle-add.1.html): + Add the named gem to the Gemfile and run `bundle install` + +* [`bundle binstubs(1)`](bundle-binstubs.1.html): + Generate binstubs for executables in a gem + +* [`bundle check(1)`](bundle-check.1.html): + Determine whether the requirements for your application are installed + and available to Bundler + +* [`bundle show(1)`](bundle-show.1.html): + Show the source location of a particular gem in the bundle + +* [`bundle outdated(1)`](bundle-outdated.1.html): + Show all of the outdated gems in the current bundle + +* `bundle console(1)`: + Start an IRB session in the current bundle + +* [`bundle open(1)`](bundle-open.1.html): + Open an installed gem in the editor + +* [`bundle lock(1)`](bundle-lock.1.html): + Generate a lockfile for your dependencies + +* [`bundle viz(1)`](bundle-viz.1.html): + Generate a visual representation of your dependencies + +* [`bundle init(1)`](bundle-init.1.html): + Generate a simple `Gemfile`, placed in the current directory + +* [`bundle gem(1)`](bundle-gem.1.html): + Create a simple gem, suitable for development with Bundler + +* [`bundle platform(1)`](bundle-platform.1.html): + Display platform compatibility information + +* [`bundle clean(1)`](bundle-clean.1.html): + Clean up unused gems in your Bundler directory + +* [`bundle doctor(1)`](bundle-doctor.1.html): + Display warnings about common problems + +* [`bundle remove(1)`](bundle-remove.1.html): + Removes gems from the Gemfile + +## PLUGINS + +When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, +Bundler will try to find an executable on your path named `bundler-` +and execute it, passing down any extra arguments to it. + +## OBSOLETE + +These commands are obsolete and should no longer be used: + +* `bundle cache(1)` +* `bundle show(1)` diff --git a/lib/bundler/man/gemfile.5.ronn b/lib/bundler/man/gemfile.5.ronn new file mode 100644 index 0000000000..994f0d66bd --- /dev/null +++ b/lib/bundler/man/gemfile.5.ronn @@ -0,0 +1,517 @@ +Gemfile(5) -- A format for describing gem dependencies for Ruby programs +======================================================================== + +## SYNOPSIS + +A `Gemfile` describes the gem dependencies required to execute associated +Ruby code. + +Place the `Gemfile` in the root of the directory containing the associated +code. For instance, in a Rails application, place the `Gemfile` in the same +directory as the `Rakefile`. + +## SYNTAX + +A `Gemfile` is evaluated as Ruby code, in a context which makes available +a number of methods used to describe the gem requirements. + +## GLOBAL SOURCES + +At the top of the `Gemfile`, add a line for the `Rubygems` source that contains +the gems listed in the `Gemfile`. + + source "https://rubygems.org" + +It is possible, but not recommended as of Bundler 1.7, to add multiple global +`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository. + +Sources are checked for gems following the heuristics described in +[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler +will print a warning after installing the gem indicating which source was used, +and listing the other sources where the gem is available. A specific source can +be selected for gems that need to use a non-standard repository, suppressing +this warning, by using the [`:source` option](#SOURCE) or a +[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS). + +### CREDENTIALS + +Some gem sources require a username and password. Use [bundle config(1)](bundle-config.1.html) to set +the username and password for any of the sources that need it. The command must +be run once on each computer that will install the Gemfile, but this keeps the +credentials from being stored in plain text in version control. + + bundle config gems.example.com user:password + +For some sources, like a company Gemfury account, it may be easier to +include the credentials in the Gemfile as part of the source URL. + + source "https://user:password@gems.example.com" + +Credentials in the source URL will take precedence over credentials set using +`config`. + +## RUBY + +If your application requires a specific Ruby version or engine, specify your +requirements using the `ruby` method, with the following arguments. +All parameters are `OPTIONAL` unless otherwise specified. + +### VERSION (required) + +The version of Ruby that your application requires. If your application +requires an alternate Ruby engine, such as JRuby, Rubinius or TruffleRuby, this +should be the Ruby version that the engine is compatible with. + + ruby "1.9.3" + +### ENGINE + +Each application _may_ specify a Ruby engine. If an engine is specified, an +engine version _must_ also be specified. + +What exactly is an Engine? + - A Ruby engine is an implementation of the Ruby language. + + - For background: the reference or original implementation of the Ruby + programming language is called + [Matz's Ruby Interpreter](https://en.wikipedia.org/wiki/Ruby_MRI), or MRI + for short. This is named after Ruby creator Yukihiro Matsumoto, + also known as Matz. MRI is also known as CRuby, because it is written in C. + MRI is the most widely used Ruby engine. + + - [Other implementations](https://www.ruby-lang.org/en/about/) of Ruby exist. + Some of the more well-known implementations include + [Rubinius](https://rubinius.com/), and [JRuby](http://jruby.org/). + Rubinius is an alternative implementation of Ruby written in Ruby. + JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine. + +### ENGINE VERSION + +Each application _may_ specify a Ruby engine version. If an engine version is +specified, an engine _must_ also be specified. If the engine is "ruby" the +engine version specified _must_ match the Ruby version. + + ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7" + +### PATCHLEVEL + +Each application _may_ specify a Ruby patchlevel. + + ruby "2.0.0", :patchlevel => "247" + +## GEMS + +Specify gem requirements using the `gem` method, with the following arguments. +All parameters are `OPTIONAL` unless otherwise specified. + +### NAME (required) + +For each gem requirement, list a single _gem_ line. + + gem "nokogiri" + +### VERSION + +Each _gem_ `MAY` have one or more version specifiers. + + gem "nokogiri", ">= 1.4.2" + gem "RedCloth", ">= 4.1.0", "< 4.2.0" + +### REQUIRE AS + +Each _gem_ `MAY` specify files that should be used when autorequiring via +`Bundler.require`. You may pass an array with multiple files or `true` if the file +you want `required` has the same name as _gem_ or `false` to +prevent any file from being autorequired. + + gem "redis", :require => ["redis/connection/hiredis", "redis"] + gem "webmock", :require => false + gem "byebug", :require => true + +The argument defaults to the name of the gem. For example, these are identical: + + gem "nokogiri" + gem "nokogiri", :require => "nokogiri" + gem "nokogiri", :require => true + +### GROUPS + +Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does +not specify membership in any group is placed in the `default` group. + + gem "rspec", :group => :test + gem "wirble", :groups => [:development, :test] + +The Bundler runtime allows its two main methods, `Bundler.setup` and +`Bundler.require`, to limit their impact to particular groups. + + # setup adds gems to Ruby's load path + Bundler.setup # defaults to all groups + require "bundler/setup" # same as Bundler.setup + Bundler.setup(:default) # only set up the _default_ group + Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) + Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others + + # require requires all of the gems in the specified groups + Bundler.require # defaults to the _default_ group + Bundler.require(:default) # identical + Bundler.require(:default, :test) # requires the _default_ and _test_ groups + Bundler.require(:test) # requires the _test_ group + +The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should +not install with the `without` configuration. + +To specify multiple groups to ignore, specify a list of groups separated by spaces. + + bundle config set --local without test + bundle config set --local without development test + +Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"` +will setup all groups except for the ones you excluded via `--without` (since they +are not available). + +Note that on `bundle install`, bundler downloads and evaluates all gems, in order to +create a single canonical list of all of the required gems and their dependencies. +This means that you cannot list different versions of the same gems in different +groups. For more details, see [Understanding Bundler](https://bundler.io/rationale.html). + +### PLATFORMS + +If a gem should only be used in a particular platform or set of platforms, you can +specify them. Platforms are essentially identical to groups, except that you do not +need to use the `--without` install-time flag to exclude groups of gems for other +platforms. + +There are a number of `Gemfile` platforms: + + * `ruby`: + C Ruby (MRI), Rubinius or TruffleRuby, but `NOT` Windows + * `mri`: + Same as _ruby_, but only C Ruby (MRI) + * `mingw`: + Windows 32 bit 'mingw32' platform (aka RubyInstaller) + * `x64_mingw`: + Windows 64 bit 'mingw32' platform (aka RubyInstaller x64) + * `rbx`: + Rubinius + * `jruby`: + JRuby + * `truffleruby`: + TruffleRuby + * `mswin`: + Windows + +You can restrict further by platform and version for all platforms *except* for +`rbx`, `jruby`, `truffleruby` and `mswin`. + +To specify a version in addition to a platform, append the version number without +the delimiter to the platform. For example, to specify that a gem should only be +used on platforms with Ruby 2.3, use: + + ruby_23 + +The full list of platforms and supported versions includes: + + * `ruby`: + 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 + * `mri`: + 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 + * `mingw`: + 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 + * `x64_mingw`: + 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 + +As with groups, you can specify one or more platforms: + + gem "weakling", :platforms => :jruby + gem "ruby-debug", :platforms => :mri_18 + gem "nokogiri", :platforms => [:mri_18, :jruby] + +All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`, +`Bundler.require`) behave exactly the same as if any groups not +matching the current platform were explicitly excluded. + +### SOURCE + +You can select an alternate Rubygems repository for a gem using the ':source' +option. + + gem "some_internal_gem", :source => "https://gems.example.com" + +This forces the gem to be loaded from this source and ignores any global sources +declared at the top level of the file. If the gem does not exist in this source, +it will not be installed. + +Bundler will search for child dependencies of this gem by first looking in the +source selected for the parent, but if they are not found there, it will fall +back on global sources using the ordering described in [SOURCE PRIORITY][]. + +Selecting a specific source repository this way also suppresses the ambiguous +gem warning described above in +[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES). + +Using the `:source` option for an individual gem will also make that source +available as a possible global source for any other gems which do not specify +explicit sources. Thus, when adding gems with explicit sources, it is +recommended that you also ensure all other gems in the Gemfile are using +explicit sources. + +### GIT + +If necessary, you can specify that a gem is located at a particular +git repository using the `:git` parameter. The repository can be accessed via +several protocols: + + * `HTTP(S)`: + gem "rails", :git => "https://github.com/rails/rails.git" + * `SSH`: + gem "rails", :git => "git@github.com:rails/rails.git" + * `git`: + gem "rails", :git => "git://github.com/rails/rails.git" + +If using SSH, the user that you use to run `bundle install` `MUST` have the +appropriate keys available in their `$HOME/.ssh`. + +`NOTE`: `http://` and `git://` URLs should be avoided if at all possible. These +protocols are unauthenticated, so a man-in-the-middle attacker can deliver +malicious code and compromise your system. HTTPS and SSH are strongly +preferred. + +The `group`, `platforms`, and `require` options are available and behave +exactly the same as they would for a normal gem. + +A git repository `SHOULD` have at least one file, at the root of the +directory containing the gem, with the extension `.gemspec`. This file +`MUST` contain a valid gem specification, as expected by the `gem build` +command. + +If a git repository does not have a `.gemspec`, bundler will attempt to +create one, but it will not contain any dependencies, executables, or +C extension compilation instructions. As a result, it may fail to properly +integrate into your application. + +If a git repository does have a `.gemspec` for the gem you attached it +to, a version specifier, if provided, means that the git repository is +only valid if the `.gemspec` specifies a version matching the version +specifier. If not, bundler will print a warning. + + gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git" + # bundle install will fail, because the .gemspec in the rails + # repository's master branch specifies version 3.0.0 + +If a git repository does `not` have a `.gemspec` for the gem you attached +it to, a version specifier `MUST` be provided. Bundler will use this +version in the simple `.gemspec` it creates. + +Git repositories support a number of additional options. + + * `branch`, `tag`, and `ref`: + You `MUST` only specify at most one of these options. The default + is `:branch => "master"`. For example: + + gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-0-stable" + + gem "rails", :git => "https://github.com/rails/rails.git", :tag => "v5.0.0" + + gem "rails", :git => "https://github.com/rails/rails.git", :ref => "4aded" + + * `submodules`: + For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) + lets you have another git repository within a subfolder of your repository. + Specify `:submodules => true` to cause bundler to expand any + submodules included in the git repository + +If a git repository contains multiple `.gemspecs`, each `.gemspec` +represents a gem located at the same place in the file system as +the `.gemspec`. + + |~rails [git root] + | |-rails.gemspec [rails gem located here] + |~actionpack + | |-actionpack.gemspec [actionpack gem located here] + |~activesupport + | |-activesupport.gemspec [activesupport gem located here] + |... + +To install a gem located in a git repository, bundler changes to +the directory containing the gemspec, runs `gem build name.gemspec` +and then installs the resulting gem. The `gem build` command, +which comes standard with Rubygems, evaluates the `.gemspec` in +the context of the directory in which it is located. + +### GIT SOURCE + +A custom git source can be defined via the `git_source` method. Provide the source's name +as an argument, and a block which receives a single argument and interpolates it into a +string to return the full repo address: + + git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" } + gem 'rails', :stash => 'forks/rails' + +In addition, if you wish to choose a specific branch: + + gem "rails", :stash => "forks/rails", :branch => "branch_name" + +### GITHUB + +`NOTE`: This shorthand should be avoided until Bundler 2.0, since it +currently expands to an insecure `git://` URL. This allows a +man-in-the-middle attacker to compromise your system. + +If the git repository you want to use is hosted on GitHub and is public, you can use the +:github shorthand to specify the github username and repository name (without the +trailing ".git"), separated by a slash. If both the username and repository name are the +same, you can omit one. + + gem "rails", :github => "rails/rails" + gem "rails", :github => "rails" + +Are both equivalent to + + gem "rails", :git => "git://github.com/rails/rails.git" + +Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument. + +### GIST + +If the git repository you want to use is hosted as a Github Gist and is public, you can use +the :gist shorthand to specify the gist identifier (without the trailing ".git"). + + gem "the_hatch", :gist => "4815162342" + +Is equivalent to: + + gem "the_hatch", :git => "https://gist.github.com/4815162342.git" + +Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument. + +### BITBUCKET + +If the git repository you want to use is hosted on Bitbucket and is public, you can use the +:bitbucket shorthand to specify the bitbucket username and repository name (without the +trailing ".git"), separated by a slash. If both the username and repository name are the +same, you can omit one. + + gem "rails", :bitbucket => "rails/rails" + gem "rails", :bitbucket => "rails" + +Are both equivalent to + + gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git" + +Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument. + +### PATH + +You can specify that a gem is located in a particular location +on the file system. Relative paths are resolved relative to the +directory containing the `Gemfile`. + +Similar to the semantics of the `:git` option, the `:path` +option requires that the directory in question either contains +a `.gemspec` for the gem, or that you specify an explicit +version that bundler should use. + +Unlike `:git`, bundler does not compile C extensions for +gems specified as paths. + + gem "rails", :path => "vendor/rails" + +If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories. + + path 'components' do + gem 'admin_ui' + gem 'public_ui' + end + +## BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS + +The `:source`, `:git`, `:path`, `:group`, and `:platforms` options may be +applied to a group of gems by using block form. + + source "https://gems.example.com" do + gem "some_internal_gem" + gem "another_internal_gem" + end + + git "https://github.com/rails/rails.git" do + gem "activesupport" + gem "actionpack" + end + + platforms :ruby do + gem "ruby-debug" + gem "sqlite3" + end + + group :development, :optional => true do + gem "wirble" + gem "faker" + end + +In the case of the group block form the :optional option can be given +to prevent a group from being installed unless listed in the `--with` +option given to the `bundle install` command. + +In the case of the `git` block form, the `:ref`, `:branch`, `:tag`, +and `:submodules` options may be passed to the `git` method, and +all gems in the block will inherit those options. + +The presence of a `source` block in a Gemfile also makes that source +available as a possible global source for any other gems which do not specify +explicit sources. Thus, when defining source blocks, it is +recommended that you also ensure all other gems in the Gemfile are using +explicit sources, either via source blocks or `:source` directives on +individual gems. + +## INSTALL_IF + +The `install_if` method allows gems to be installed based on a proc or lambda. +This is especially useful for optional gems that can only be used if certain +software is installed or some other conditions are met. + + install_if -> { RUBY_PLATFORM =~ /darwin/ } do + gem "pasteboard" + end + +## GEMSPEC + +The [`.gemspec`](http://guides.rubygems.org/specification-reference/) file is where + you provide metadata about your gem to Rubygems. Some required Gemspec + attributes include the name, description, and homepage of your gem. This is + also where you specify the dependencies your gem needs to run. + +If you wish to use Bundler to help install dependencies for a gem while it is +being developed, use the `gemspec` method to pull in the dependencies listed in +the `.gemspec` file. + +The `gemspec` method adds any runtime dependencies as gem requirements in the +default group. It also adds development dependencies as gem requirements in the +`development` group. Finally, it adds a gem requirement on your project (`:path +=> '.'`). In conjunction with `Bundler.setup`, this allows you to require project +files in your test code as you would if the project were installed as a gem; you +need not manipulate the load path manually or require project files via relative +paths. + +The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group` +options, which control where bundler looks for the `.gemspec`, the glob it uses to look +for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses +(if more than one is present), and which group development dependencies are included in. + +When a `gemspec` dependency encounters version conflicts during resolution, the +local version under development will always be selected -- even if there are +remote versions that better match other requirements for the `gemspec` gem. + +## SOURCE PRIORITY + +When attempting to locate a gem to satisfy a gem requirement, +bundler uses the following priority order: + + 1. The source explicitly attached to the gem (using `:source`, `:path`, or + `:git`) + 2. For implicit gems (dependencies of explicit gems), any source, git, or path + repository declared on the parent. This results in bundler prioritizing the + ActiveSupport gem from the Rails git repository over ones from + `rubygems.org` + 3. The sources specified via global `source` lines, searching each source in + your `Gemfile` from last added to first added. diff --git a/lib/bundler/plugin/api/source.rb b/lib/bundler/plugin/api/source.rb index 56e97f4aa4..e1f0826874 100644 --- a/lib/bundler/plugin/api/source.rb +++ b/lib/bundler/plugin/api/source.rb @@ -260,7 +260,7 @@ module Bundler end def to_s - "plugin source for #{options[:type]} with uri #{uri}" + "plugin source for #{@type} with uri #{@uri}" end # Note: Do not override if you don't know what you are doing. diff --git a/lib/bundler/plugin/dsl.rb b/lib/bundler/plugin/dsl.rb index 4bfc8437e0..da751d1774 100644 --- a/lib/bundler/plugin/dsl.rb +++ b/lib/bundler/plugin/dsl.rb @@ -10,7 +10,7 @@ module Bundler # So that we don't have to override all there methods to dummy ones # explicitly. # They will be handled by method_missing - [:gemspec, :gem, :path, :install_if, :platforms, :env].each {|m| undef_method m } + [:gemspec, :gem, :install_if, :platforms, :env].each {|m| undef_method m } # This lists the plugins that was added automatically and not specified by # the user. diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 926c08c4c9..327c170fbe 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -158,9 +158,8 @@ module Bundler # spec group. sg_ruby = sg.copy_for(Gem::Platform::RUBY) selected_sgs << sg_ruby if sg_ruby - all_platforms = @platforms + [platform] - next if all_platforms.to_a == [Gem::Platform::RUBY] sg_all_platforms = nil + all_platforms = @platforms + [platform] self.class.sort_platforms(all_platforms).reverse_each do |other_platform| if sg_all_platforms.nil? sg_all_platforms = sg.copy_for(other_platform) @@ -302,7 +301,7 @@ module Bundler versions_with_platforms = specs.map {|s| [s.version, s.platform] } message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n") message << if versions_with_platforms.any? - "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" + "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" else "The source does not contain any versions of '#{name}'" end diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 17402f16f2..9125a24172 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -227,6 +227,10 @@ module Bundler Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files) end + def load_env_plugins + Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) + end + def ui=(obj) Gem::DefaultUserInteraction.ui = obj end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 6ce81b5006..1c669491f6 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -42,7 +42,6 @@ module Bundler setup_makes_kernel_gem_public silence_deprecations silence_root_warning - specific_platform suppress_install_using_messages unlock_source_unlocks_spec update_requires_all_flag diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 5dc1c8de32..7ac47044b3 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -118,7 +118,7 @@ module Bundler git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}") File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination) rescue Errno::EEXIST => e - file_path = e.message[%r{.*?(/.*)}, 1] + file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1] raise GitError, "Bundler could not install a gem because it needs to " \ "create a directory, but a file exists - #{file_path}. Please delete " \ "this file and try again." diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 46e023de87..aef854ce0c 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -100,6 +100,7 @@ module Bundler @specs.map do |s| next s unless s.is_a?(LazySpecification) s.source.dependency_names = names if s.source.respond_to?(:dependency_names=) + s.source.remote! spec = s.__materialize__ raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec spec diff --git a/lib/bundler/templates/newgem/README.md.tt b/lib/bundler/templates/newgem/README.md.tt index f81b85ca97..315bc745a3 100644 --- a/lib/bundler/templates/newgem/README.md.tt +++ b/lib/bundler/templates/newgem/README.md.tt @@ -33,7 +33,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %> - <% if config[:mit] -%> ## License diff --git a/lib/bundler/templates/newgem/lib/newgem.rb.tt b/lib/bundler/templates/newgem/lib/newgem.rb.tt index a182b964be..caf6e32f4a 100644 --- a/lib/bundler/templates/newgem/lib/newgem.rb.tt +++ b/lib/bundler/templates/newgem/lib/newgem.rb.tt @@ -1,8 +1,8 @@ # frozen_string_literal: true -require "<%= config[:namespaced_path] %>/version" +require_relative "<%= File.basename(config[:namespaced_path]) %>/version" <%- if config[:ext] -%> -require "<%= config[:namespaced_path] %>/<%= config[:underscored_name] %>" +require_relative "<%= File.basename(config[:namespaced_path]) %>/<%= config[:underscored_name] %>" <%- end -%> <%- config[:constant_array].each_with_index do |c, i| -%> diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index 5b34f64346..97c3b6c5ab 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -33,4 +33,10 @@ Gem::Specification.new do |spec| <%- if config[:ext] -%> spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"] <%- end -%> + + # Uncomment to register a new dependency of your gem + # spec.add_dependency "example-gem", "~> 1.0" + + # For more information and examples about making a new gem, checkout our + # guide at: https://bundler.io/guides/creating_gem.html end diff --git a/lib/bundler/uri_credentials_filter.rb b/lib/bundler/uri_credentials_filter.rb index 3f49254e71..ccfaf0bc5d 100644 --- a/lib/bundler/uri_credentials_filter.rb +++ b/lib/bundler/uri_credentials_filter.rb @@ -8,6 +8,8 @@ module Bundler return uri_to_anonymize if uri_to_anonymize.nil? uri = uri_to_anonymize.dup if uri.is_a?(String) + return uri if File.exist?(uri) + require_relative "vendored_uri" uri = Bundler::URI(uri) end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo.rb b/lib/bundler/vendor/molinillo/lib/molinillo.rb index baedefe98b..a52b96deaf 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require_relative 'molinillo/compatibility' require_relative 'molinillo/gem_metadata' require_relative 'molinillo/errors' require_relative 'molinillo/resolver' diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb b/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb deleted file mode 100644 index 3eba8e4083..0000000000 --- a/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Bundler::Molinillo - # Hacks needed for old Ruby versions. - module Compatibility - module_function - - if [].respond_to?(:flat_map) - # Flat map - # @param [Enumerable] enum an enumerable object - # @block the block to flat-map with - # @return The enum, flat-mapped - def flat_map(enum, &blk) - enum.flat_map(&blk) - end - else - # Flat map - # @param [Enumerable] enum an enumerable object - # @block the block to flat-map with - # @return The enum, flat-mapped - def flat_map(enum, &blk) - enum.map(&blk).flatten(1) - end - end - end -end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb index 31578bb5bf..d1d7045daf 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb @@ -124,6 +124,7 @@ module Bundler::Molinillo dot.join("\n") end + # @param [DependencyGraph] other # @return [Boolean] whether the two dependency graphs are equal, determined # by a recursive traversal of each {#root_vertices} and its # {Vertex#successors} @@ -190,7 +191,7 @@ module Bundler::Molinillo # @return [Edge] the added edge def add_edge(origin, destination, requirement) if destination.path_to?(origin) - raise CircularDependencyError.new([origin, destination]) + raise CircularDependencyError.new(path(destination, origin)) end add_edge_no_circular(origin, destination, requirement) end @@ -219,5 +220,37 @@ module Bundler::Molinillo def add_edge_no_circular(origin, destination, requirement) log.add_edge_no_circular(self, origin.name, destination.name, requirement) end + + # Returns the path between two vertices + # @raise [ArgumentError] if there is no path between the vertices + # @param [Vertex] from + # @param [Vertex] to + # @return [Array] the shortest path from `from` to `to` + def path(from, to) + distances = Hash.new(vertices.size + 1) + distances[from.name] = 0 + predecessors = {} + each do |vertex| + vertex.successors.each do |successor| + if distances[successor.name] > distances[vertex.name] + 1 + distances[successor.name] = distances[vertex.name] + 1 + predecessors[successor] = vertex + end + end + end + + path = [to] + while before = predecessors[to] + path << before + to = before + break if to == from + end + + unless path.last.equal?(from) + raise ArgumentError, "There is no path from #{from.name} to #{to.name}" + end + + path.reverse + end end end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb index fccfc78cc7..5b5da3e4f9 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb @@ -14,11 +14,11 @@ module Bundler::Molinillo end # (see Action#up) - def up(_graph) + def up(graph) end # (see Action#down) - def down(_graph) + def down(graph) end # @!group Tag diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb b/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb index 89c7c324d5..4d64d21072 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb @@ -65,7 +65,7 @@ module Bundler::Molinillo # @param [SpecificationProvider] specification_provider see {#specification_provider} def initialize(conflicts, specification_provider) pairs = [] - Compatibility.flat_map(conflicts.values.flatten, &:requirements).each do |conflicting| + conflicts.values.flat_map(&:requirements).each do |conflicting| conflicting.each do |source, conflict_requirements| conflict_requirements.each do |c| pairs << [c, source] diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb index 73f8fbf2ac..e13a781a50 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb @@ -2,5 +2,5 @@ module Bundler::Molinillo # The version of Bundler::Molinillo. - VERSION = '0.6.6'.freeze + VERSION = '0.7.0'.freeze end diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb index acf7777414..26b8bc745c 100644 --- a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +++ b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb @@ -207,7 +207,7 @@ module Bundler::Molinillo def start_resolution @started_at = Time.now - handle_missing_or_push_dependency_state(initial_state) + push_initial_state debug { "Starting resolution (#{@started_at})\nUser-requested dependencies: #{original_requested}" } resolver_ui.before_resolution @@ -273,10 +273,10 @@ module Bundler::Molinillo states.last end - # Creates the initial state for the resolution, based upon the + # Creates and pushes the initial state for the resolution, based upon the # {#requested} dependencies - # @return [DependencyState] the initial state for the resolution - def initial_state + # @return [void] + def push_initial_state graph = DependencyGraph.new.tap do |dg| original_requested.each do |requested| vertex = dg.add_vertex(name_for(requested), nil, true) @@ -285,18 +285,7 @@ module Bundler::Molinillo dg.tag(:initial_state) end - requirements = sort_dependencies(original_requested, graph, {}) - initial_requirement = requirements.shift - DependencyState.new( - initial_requirement && name_for(initial_requirement), - requirements, - graph, - initial_requirement, - possibilities_for_requirement(initial_requirement, graph), - 0, - {}, - [] - ) + push_state_for_requirements(original_requested, true, graph) end # Unwinds the states stack because a conflict has been encountered @@ -361,7 +350,7 @@ module Bundler::Molinillo current_detail end - # @param [Array] array of requirements that combine to create a conflict + # @param [Array] binding_requirements array of requirements that combine to create a conflict # @return [Array] array of UnwindDetails that have a chance # of resolving the passed requirements def unwind_options_for_requirements(binding_requirements) @@ -429,7 +418,7 @@ module Bundler::Molinillo end # @param [DependencyState] state - # @param [Array] array of requirements + # @param [Array] binding_requirements array of requirements # @return [Boolean] whether or not the given state has any possibilities # that could satisfy the given requirements def conflict_fixing_possibilities?(state, binding_requirements) @@ -444,7 +433,8 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would not fix the # conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from + # @param [UnwindDetails] unwind_details details of the conflict just + # unwound from # @return [void] def filter_possibilities_after_unwind(unwind_details) return unless state && !state.possibilities.empty? @@ -458,7 +448,7 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would not satisfy # the requirements in the conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from + # @param [UnwindDetails] unwind_details details of the conflict just unwound from # @return [void] def filter_possibilities_for_primary_unwind(unwind_details) unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index } @@ -491,7 +481,7 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would (eventually) # create a requirement in the conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from + # @param [UnwindDetails] unwind_details details of the conflict just unwound from # @return [void] def filter_possibilities_for_parent_unwind(unwind_details) unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index } @@ -500,7 +490,7 @@ module Bundler::Molinillo primary_unwinds = unwinds_to_state.select(&:unwinding_to_primary_requirement?).uniq parent_unwinds = unwinds_to_state.uniq - primary_unwinds - allowed_possibility_sets = Compatibility.flat_map(primary_unwinds) do |unwind| + allowed_possibility_sets = primary_unwinds.flat_map do |unwind| states[unwind.state_index].possibilities.select do |possibility_set| possibility_set.possibilities.any? do |poss| possibility_satisfies_requirements?(poss, unwind.conflicting_requirements) @@ -508,7 +498,7 @@ module Bundler::Molinillo end end - requirements_to_avoid = Compatibility.flat_map(parent_unwinds, &:sub_dependencies_to_avoid) + requirements_to_avoid = parent_unwinds.flat_map(&:sub_dependencies_to_avoid) state.possibilities.reject! do |possibility_set| !allowed_possibility_sets.include?(possibility_set) && @@ -524,12 +514,12 @@ module Bundler::Molinillo possible_binding_requirements = conflict.requirements.values.flatten(1).uniq - # When there’s a `CircularDependency` error the conflicting requirement - # (the one causing the circular) won’t be `conflict.requirement` - # (which won’t be for the right state, because we won’t have created it, - # because it’s circular). - # We need to make sure we have that requirement in the conflict’s list, - # otherwise we won’t be able to unwind properly, so we just return all + # When there's a `CircularDependency` error the conflicting requirement + # (the one causing the circular) won't be `conflict.requirement` + # (which won't be for the right state, because we won't have created it, + # because it's circular). + # We need to make sure we have that requirement in the conflict's list, + # otherwise we won't be able to unwind properly, so we just return all # the requirements for the conflict. return possible_binding_requirements if conflict.underlying_error @@ -558,8 +548,8 @@ module Bundler::Molinillo end # @param [Object] requirement we wish to check - # @param [Array] array of requirements - # @param [Array] array of possibilities the requirements will be used to filter + # @param [Array] possible_binding_requirements array of requirements + # @param [Array] possibilities array of possibilities the requirements will be used to filter # @return [Boolean] whether or not the given requirement is required to filter # out all elements of the array of possibilities. def binding_requirement_in_set?(requirement, possible_binding_requirements, possibilities) @@ -568,6 +558,7 @@ module Bundler::Molinillo end end + # @param [Object] requirement # @return [Object] the requirement that led to `requirement` being added # to the list of requirements. def parent_of(requirement) @@ -577,6 +568,7 @@ module Bundler::Molinillo parent_state.requirement end + # @param [String] name # @return [Object] the requirement that led to a version of a possibility # with the given name being activated. def requirement_for_existing_name(name) @@ -585,6 +577,7 @@ module Bundler::Molinillo states.find { |s| s.name == name }.requirement end + # @param [Object] requirement # @return [ResolutionState] the state whose `requirement` is the given # `requirement`. def find_state_for(requirement) @@ -592,6 +585,7 @@ module Bundler::Molinillo states.find { |i| requirement == i.requirement } end + # @param [Object] underlying_error # @return [Conflict] a {Conflict} that reflects the failure to activate # the {#possibility} in conjunction with the current {#state} def create_conflict(underlying_error = nil) @@ -628,6 +622,7 @@ module Bundler::Molinillo vertex.requirements.map { |r| requirement_tree_for(r) } end + # @param [Object] requirement # @return [Array] the list of requirements that led to # `requirement` being required. def requirement_tree_for(requirement) @@ -673,9 +668,8 @@ module Bundler::Molinillo attempt_to_filter_existing_spec(existing_vertex) else latest = possibility.latest_version - # use reject!(!satisfied) for 1.8.7 compatibility - possibility.possibilities.reject! do |possibility| - !requirement_satisfied_by?(requirement, activated, possibility) + possibility.possibilities.select! do |possibility| + requirement_satisfied_by?(requirement, activated, possibility) end if possibility.latest_version.nil? # ensure there's a possibility for better error messages @@ -705,7 +699,7 @@ module Bundler::Molinillo # Generates a filtered version of the existing vertex's `PossibilitySet` using the # current state's `requirement` - # @param [Object] existing vertex + # @param [Object] vertex existing vertex # @return [PossibilitySet] filtered possibility set def filtered_possibility_set(vertex) PossibilitySet.new(vertex.payload.dependencies, vertex.payload.possibilities & possibility.possibilities) @@ -730,7 +724,7 @@ module Bundler::Molinillo end # Requires the dependencies that the recently activated spec has - # @param [Object] activated_possibility the PossibilitySet that has just been + # @param [Object] possibility_set the PossibilitySet that has just been # activated # @return [void] def require_nested_dependencies_for(possibility_set) @@ -749,6 +743,8 @@ module Bundler::Molinillo # Pushes a new {DependencyState} that encapsulates both existing and new # requirements # @param [Array] new_requirements + # @param [Boolean] requires_sort + # @param [Object] new_activated # @return [void] def push_state_for_requirements(new_requirements, requires_sort = true, new_activated = activated) new_requirements = sort_dependencies(new_requirements.uniq, new_activated, conflicts) if requires_sort @@ -767,7 +763,8 @@ module Bundler::Molinillo # Checks a proposed requirement with any existing locked requirement # before generating an array of possibilities for it. - # @param [Object] the proposed requirement + # @param [Object] requirement the proposed requirement + # @param [Object] activated # @return [Array] possibilities def possibilities_for_requirement(requirement, activated = self.activated) return [] unless requirement @@ -778,7 +775,8 @@ module Bundler::Molinillo group_possibilities(search_for(requirement)) end - # @param [Object] the proposed requirement + # @param [Object] requirement the proposed requirement + # @param [Object] activated # @return [Array] possibility set containing only the locked requirement, if any def locked_requirement_possibility_set(requirement, activated = self.activated) all_possibilities = search_for(requirement) @@ -797,8 +795,8 @@ module Bundler::Molinillo # Build an array of PossibilitySets, with each element representing a group of # dependency versions that all have the same sub-dependency version constraints # and are contiguous. - # @param [Array] an array of possibilities - # @return [Array] an array of possibility sets + # @param [Array] possibilities an array of possibilities + # @return [Array] an array of possibility sets def group_possibilities(possibilities) possibility_sets = [] current_possibility_set = nil diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb index 847479a0af..d0ab956faf 100644 --- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb @@ -3,6 +3,8 @@ require_relative '../../../../uri/lib/uri' require 'cgi' # for escaping require_relative '../../../../connection_pool/lib/connection_pool' +autoload :OpenSSL, 'openssl' + ## # Persistent connections for Net::HTTP # @@ -147,14 +149,9 @@ class Bundler::Persistent::Net::HTTP::Persistent EPOCH = Time.at 0 # :nodoc: ## - # Is OpenSSL available? + # Is OpenSSL available? This test works with autoload - HAVE_OPENSSL = begin # :nodoc: - require 'openssl' - true - rescue LoadError - false - end + HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc: ## # The default connection pool size is 1/4 the allowed open files diff --git a/lib/bundler/vendor/tmpdir/lib/tmpdir.rb b/lib/bundler/vendor/tmpdir/lib/tmpdir.rb new file mode 100644 index 0000000000..a00496687c --- /dev/null +++ b/lib/bundler/vendor/tmpdir/lib/tmpdir.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true +# +# tmpdir - retrieve temporary directory path +# +# $Id$ +# + +require_relative '../../fileutils/lib/fileutils' +begin + require 'etc.so' +rescue LoadError # rescue LoadError for miniruby +end + +class Bundler::Dir < Dir + + @systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp' + + ## + # Returns the operating system's temporary file path. + + def self.tmpdir + tmp = nil + ['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @systmpdir], ['/tmp']*2, ['.']*2].each do |name, dir = ENV[name]| + next if !dir + dir = File.expand_path(dir) + stat = File.stat(dir) rescue next + case + when !stat.directory? + warn "#{name} is not a directory: #{dir}" + when !stat.writable? + warn "#{name} is not writable: #{dir}" + when stat.world_writable? && !stat.sticky? + warn "#{name} is world-writable: #{dir}" + else + tmp = dir + break + end + end + raise ArgumentError, "could not find a temporary directory" unless tmp + tmp + end + + # Bundler::Dir.mktmpdir creates a temporary directory. + # + # The directory is created with 0700 permission. + # Application should not change the permission to make the temporary directory accessible from other users. + # + # The prefix and suffix of the name of the directory is specified by + # the optional first argument, prefix_suffix. + # - If it is not specified or nil, "d" is used as the prefix and no suffix is used. + # - If it is a string, it is used as the prefix and no suffix is used. + # - If it is an array, first element is used as the prefix and second element is used as a suffix. + # + # Bundler::Dir.mktmpdir {|dir| dir is ".../d..." } + # Bundler::Dir.mktmpdir("foo") {|dir| dir is ".../foo..." } + # Bundler::Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" } + # + # The directory is created under Bundler::Dir.tmpdir or + # the optional second argument tmpdir if non-nil value is given. + # + # Bundler::Dir.mktmpdir {|dir| dir is "#{Bundler::Dir.tmpdir}/d..." } + # Bundler::Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." } + # + # If a block is given, + # it is yielded with the path of the directory. + # The directory and its contents are removed + # using Bundler::FileUtils.remove_entry before Bundler::Dir.mktmpdir returns. + # The value of the block is returned. + # + # Bundler::Dir.mktmpdir {|dir| + # # use the directory... + # open("#{dir}/foo", "w") { ... } + # } + # + # If a block is not given, + # The path of the directory is returned. + # In this case, Bundler::Dir.mktmpdir doesn't remove the directory. + # + # dir = Bundler::Dir.mktmpdir + # begin + # # use the directory... + # open("#{dir}/foo", "w") { ... } + # ensure + # # remove the directory. + # Bundler::FileUtils.remove_entry dir + # end + # + def self.mktmpdir(prefix_suffix=nil, *rest, **options) + base = nil + path = Tmpname.create(prefix_suffix || "d", *rest, **options) {|p, _, _, d| + base = d + mkdir(p, 0700) + } + if block_given? + begin + yield path.dup + ensure + unless base + stat = File.stat(File.dirname(path)) + if stat.world_writable? and !stat.sticky? + raise ArgumentError, "parent directory is world writable but not sticky" + end + end + Bundler::FileUtils.remove_entry path + end + else + path + end + end + + module Tmpname # :nodoc: + module_function + + def tmpdir + Bundler::Dir.tmpdir + end + + UNUSABLE_CHARS = [File::SEPARATOR, File::ALT_SEPARATOR, File::PATH_SEPARATOR, ":"].uniq.join("").freeze + + class << (RANDOM = Random.new) + MAX = 36**6 # < 0x100000000 + def next + rand(MAX).to_s(36) + end + end + private_constant :RANDOM + + def create(basename, tmpdir=nil, max_try: nil, **opts) + origdir = tmpdir + tmpdir ||= tmpdir() + n = nil + prefix, suffix = basename + prefix = (String.try_convert(prefix) or + raise ArgumentError, "unexpected prefix: #{prefix.inspect}") + prefix = prefix.delete(UNUSABLE_CHARS) + suffix &&= (String.try_convert(suffix) or + raise ArgumentError, "unexpected suffix: #{suffix.inspect}") + suffix &&= suffix.delete(UNUSABLE_CHARS) + begin + t = Time.now.strftime("%Y%m%d") + path = "#{prefix}#{t}-#{$$}-#{RANDOM.next}"\ + "#{n ? %[-#{n}] : ''}#{suffix||''}" + path = File.join(tmpdir, path) + yield(path, n, opts, origdir) + rescue Errno::EEXIST + n ||= 0 + n += 1 + retry if !max_try or n < max_try + raise "cannot generate temporary name using `#{basename}' under `#{tmpdir}'" + end + path + end + end +end diff --git a/lib/bundler/vendored_tmpdir.rb b/lib/bundler/vendored_tmpdir.rb new file mode 100644 index 0000000000..43b4fa75fe --- /dev/null +++ b/lib/bundler/vendored_tmpdir.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +module Bundler; end +require_relative "vendor/tmpdir/lib/tmpdir" diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 4b2b0ec3c1..c865621acb 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.2.0.rc.2".freeze + VERSION = "2.2.0".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/man/bundle-add.1 b/man/bundle-add.1 index 486c249719..985d3be8b1 100644 --- a/man/bundle-add.1 +++ b/man/bundle-add.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-ADD" "1" "October 2020" "" "" +.TH "BUNDLE\-ADD" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install diff --git a/man/bundle-add.1.ronn b/man/bundle-add.1.ronn deleted file mode 100644 index 26cbe55647..0000000000 --- a/man/bundle-add.1.ronn +++ /dev/null @@ -1,46 +0,0 @@ -bundle-add(1) -- Add gem to the Gemfile and run bundle install -================================================================ - -## SYNOPSIS - -`bundle add` [--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`. - -Example: - -bundle add rails - -bundle add rails --version "< 3.0, > 1.1" - -bundle add rails --version "~> 5.0.0" --source "https://gems.example.com" --group "development" - -bundle add rails --skip-install - -bundle add rails --group "development, test" - -## OPTIONS -* `--version`, `-v`: - Specify version requirements(s) for the added gem. - -* `--group`, `-g`: - 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. - -* `--optimistic`: - Adds optimistic declaration of version - -* `--strict`: - Adds strict declaration of version diff --git a/man/bundle-binstubs.1 b/man/bundle-binstubs.1 index 782a464c16..75d6b98c96 100644 --- a/man/bundle-binstubs.1 +++ b/man/bundle-binstubs.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-BINSTUBS" "1" "October 2020" "" "" +.TH "BUNDLE\-BINSTUBS" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems diff --git a/man/bundle-binstubs.1.ronn b/man/bundle-binstubs.1.ronn deleted file mode 100644 index a96186929f..0000000000 --- a/man/bundle-binstubs.1.ronn +++ /dev/null @@ -1,41 +0,0 @@ -bundle-binstubs(1) -- Install the binstubs of the listed gems -============================================================= - -## SYNOPSIS - -`bundle binstubs` [--force] [--path PATH] [--standalone] - -## DESCRIPTION - -Binstubs are scripts that wrap around executables. Bundler creates a -small Ruby file (a binstub) that loads Bundler, runs the command, -and puts it into `bin/`. Binstubs are a shortcut-or alternative- -to always using `bundle exec`. This gives you a file that can be run -directly, and one that will always run the correct gem version -used by the application. - -For example, if you run `bundle binstubs rspec-core`, Bundler will create -the file `bin/rspec`. That file will contain enough code to load Bundler, -tell it to load the bundled gems, and then run rspec. - -This command generates binstubs for executables in `GEM_NAME`. -Binstubs are put into `bin`, or the `--path` directory if one has been set. -Calling binstubs with [GEM [GEM]] will create binstubs for all given gems. - -## OPTIONS - -* `--force`: - Overwrite existing binstubs if they exist. - -* `--path`: - The location to install the specified binstubs to. This defaults to `bin`. - -* `--standalone`: - Makes binstubs that can work without depending on Rubygems or Bundler at - runtime. - -* `--shebang`: - Specify a different shebang executable name than the default (default 'ruby') - -* `--all`: - Create binstubs for all gems in the bundle. diff --git a/man/bundle-cache.1 b/man/bundle-cache.1 index f840893f96..313359d78f 100644 --- a/man/bundle-cache.1 +++ b/man/bundle-cache.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CACHE" "1" "October 2020" "" "" +.TH "BUNDLE\-CACHE" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application diff --git a/man/bundle-cache.1.ronn b/man/bundle-cache.1.ronn deleted file mode 100644 index 383adb2ba3..0000000000 --- a/man/bundle-cache.1.ronn +++ /dev/null @@ -1,72 +0,0 @@ -bundle-cache(1) -- Package your needed `.gem` files into your application -=========================================================================== - -## SYNOPSIS - -`bundle cache` - -## DESCRIPTION - -Copy all of the `.gem` files needed to run the application into the -`vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install], -use the gems in the cache in preference to the ones on `rubygems.org`. - -## GIT AND PATH GEMS - -The `bundle cache` command can also package `:git` and `:path` dependencies -besides .gem files. This needs to be explicitly enabled via the `--all` option. -Once used, the `--all` option will be remembered. - -## SUPPORT FOR MULTIPLE PLATFORMS - -When using gems that have different packages for different platforms, Bundler -supports caching of gems for other platforms where the Gemfile has been resolved -(i.e. present in the lockfile) in `vendor/cache`. This needs to be enabled via -the `--all-platforms` option. This setting will be remembered in your local -bundler configuration. - -## REMOTE FETCHING - -By default, if you run `bundle install(1)`](bundle-install.1.html) after running -[bundle cache(1)](bundle-cache.1.html), bundler will still connect to `rubygems.org` -to check whether a platform-specific gem exists for any of the gems -in `vendor/cache`. - -For instance, consider this Gemfile(5): - - source "https://rubygems.org" - - gem "nokogiri" - -If you run `bundle cache` under C Ruby, bundler will retrieve -the version of `nokogiri` for the `"ruby"` platform. If you deploy -to JRuby and run `bundle install`, bundler is forced to check to -see whether a `"java"` platformed `nokogiri` exists. - -Even though the `nokogiri` gem for the Ruby platform is -_technically_ acceptable on JRuby, it has a C extension -that does not run on JRuby. As a result, bundler will, by default, -still connect to `rubygems.org` to check whether it has a version -of one of your gems more specific to your platform. - -This problem is also not limited to the `"java"` platform. -A similar (common) problem can happen when developing on Windows -and deploying to Linux, or even when developing on OSX and -deploying to Linux. - -If you know for sure that the gems packaged in `vendor/cache` -are appropriate for the platform you are on, you can run -`bundle install --local` to skip checking for more appropriate -gems, and use the ones in `vendor/cache`. - -One way to be sure that you have the right platformed versions -of all your gems is to run `bundle cache` on an identical -machine and check in the gems. For instance, you can run -`bundle cache` on an identical staging box during your -staging process, and check in the `vendor/cache` before -deploying to production. - -By default, [bundle cache(1)](bundle-cache.1.html) fetches and also -installs the gems to the default location. To package the -dependencies to `vendor/cache` without installing them to the -local install location, you can run `bundle cache --no-install`. diff --git a/man/bundle-check.1 b/man/bundle-check.1 index 4c7bc3f329..3f1a4bc329 100644 --- a/man/bundle-check.1 +++ b/man/bundle-check.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CHECK" "1" "October 2020" "" "" +.TH "BUNDLE\-CHECK" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems diff --git a/man/bundle-check.1.ronn b/man/bundle-check.1.ronn deleted file mode 100644 index f2846b8ff2..0000000000 --- a/man/bundle-check.1.ronn +++ /dev/null @@ -1,26 +0,0 @@ -bundle-check(1) -- Verifies if dependencies are satisfied by installed gems -=========================================================================== - -## SYNOPSIS - -`bundle check` [--dry-run] - [--gemfile=FILE] - [--path=PATH] - -## DESCRIPTION - -`check` searches the local machine for each of the gems requested in the -Gemfile. If all gems are found, Bundler prints a success message and exits with -a status of 0. - -If not, the first missing gem is listed and Bundler exits status 1. - -## OPTIONS - -* `--dry-run`: - Locks the [`Gemfile(5)`][Gemfile(5)] before running the command. -* `--gemfile`: - Use the specified gemfile instead of the [`Gemfile(5)`][Gemfile(5)]. -* `--path`: - Specify a different path than the system default (`$BUNDLE_PATH` or `$GEM_HOME`). - Bundler will remember this value for future installs on this machine. diff --git a/man/bundle-clean.1 b/man/bundle-clean.1 index dd1682a48b..1c111ae906 100644 --- a/man/bundle-clean.1 +++ b/man/bundle-clean.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CLEAN" "1" "October 2020" "" "" +.TH "BUNDLE\-CLEAN" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory diff --git a/man/bundle-clean.1.ronn b/man/bundle-clean.1.ronn deleted file mode 100644 index de23991782..0000000000 --- a/man/bundle-clean.1.ronn +++ /dev/null @@ -1,18 +0,0 @@ -bundle-clean(1) -- Cleans up unused gems in your bundler directory -================================================================== - -## SYNOPSIS - -`bundle clean` [--dry-run] [--force] - -## DESCRIPTION - -This command will remove all unused gems in your bundler directory. This is -useful when you have made many changes to your gem dependencies. - -## OPTIONS - -* `--dry-run`: - Print the changes, but do not clean the unused gems. -* `--force`: - Force a clean even if `--path` is not set. diff --git a/man/bundle-config.1 b/man/bundle-config.1 index d989aaeb86..39b32e7496 100644 --- a/man/bundle-config.1 +++ b/man/bundle-config.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CONFIG" "1" "October 2020" "" "" +.TH "BUNDLE\-CONFIG" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-config\fR \- Set bundler configuration options @@ -262,9 +262,6 @@ The following is a list of all configuration keys and their purpose\. You can le \fBsilence_root_warning\fR (\fBBUNDLE_SILENCE_ROOT_WARNING\fR): Silence the warning Bundler prints when installing gems as root\. . .IP "\(bu" 4 -\fBspecific_platform\fR (\fBBUNDLE_SPECIFIC_PLATFORM\fR): Allow bundler to resolve for the specific running platform and store it in the lockfile, instead of only using a generic platform\. A specific platform is the exact platform triple reported by \fBGem::Platform\.local\fR, such as \fBx86_64\-darwin\-16\fR or \fBuniversal\-java\-1\.8\fR\. On the other hand, generic platforms are those such as \fBruby\fR, \fBmswin\fR, or \fBjava\fR\. In this example, \fBx86_64\-darwin\-16\fR would map to \fBruby\fR and \fBuniversal\-java\-1\.8\fR to \fBjava\fR\. -. -.IP "\(bu" 4 \fBssl_ca_cert\fR (\fBBUNDLE_SSL_CA_CERT\fR): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format\. . .IP "\(bu" 4 @@ -441,7 +438,7 @@ For gems with a git source with HTTP(S) URL you can specify credentials like so: . .nf -bundle config set \-\-global https://github\.com/bundler/bundler\.git username:password +bundle config set \-\-global https://github\.com/rubygems/rubygems\.git username:password . .fi . diff --git a/man/bundle-config.1.ronn b/man/bundle-config.1.ronn deleted file mode 100644 index a0ff30cb15..0000000000 --- a/man/bundle-config.1.ronn +++ /dev/null @@ -1,396 +0,0 @@ -bundle-config(1) -- Set bundler configuration options -===================================================== - -## SYNOPSIS - -`bundle config` [list|get|set|unset] [ []] - -## DESCRIPTION - -This command allows you to interact with Bundler's configuration system. - -Bundler loads configuration settings in this order: - -1. Local config (`/.bundle/config` or `$BUNDLE_APP_CONFIG/config`) -2. Environmental variables (`ENV`) -3. Global config (`~/.bundle/config`) -4. Bundler default config - -Executing `bundle config list` with will print a list of all bundler -configuration for the current bundle, and where that configuration -was set. - -Executing `bundle config get ` will print the value of that configuration -setting, and where it was set. - -Executing `bundle config set ` will set that configuration to the -value specified for all bundles executed as the current user. The configuration -will be stored in `~/.bundle/config`. If already is set, will be -overridden and user will be warned. - -Executing `bundle config set --global ` works the same as above. - -Executing `bundle config set --local ` will set that configuration -in the directory for the local application. The configuration will be stored in -`/.bundle/config`. If `BUNDLE_APP_CONFIG` is set, the configuration -will be stored in `$BUNDLE_APP_CONFIG/config`. - -Executing `bundle config unset ` will delete the configuration in both -local and global sources. - -Executing `bundle config unset --global ` will delete the configuration -only from the user configuration. - -Executing `bundle config unset --local ` will delete the -configuration only from the local application. - -Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will -cause it to ignore all configuration. - -Executing `bundle config set --local disable_multisource true` upgrades the warning about -the Gemfile containing multiple primary sources to an error. Executing `bundle -config unset disable_multisource` downgrades this error to a warning. - -## REMEMBERING OPTIONS - -Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or -`--without production`, are remembered between commands and saved to your local -application's configuration (normally, `./.bundle/config`). - -However, this will be changed in bundler 3, so it's better not to rely on this -behavior. If these options must be remembered, it's better to set them using -`bundle config` (e.g., `bundle config set --local path foo`). - -The options that can be configured are: - -* `bin`: - Creates a directory (defaults to `~/bin`) and place any executables from the - gem there. These executables run in Bundler's context. If used, you might add - this directory to your environment's `PATH` variable. For instance, if the - `rails` gem comes with a `rails` executable, this flag will create a - `bin/rails` executable that ensures that all referred dependencies will be - resolved using the bundled gems. - -* `deployment`: - In deployment mode, Bundler will 'roll-out' the bundle for - `production` use. Please check carefully if you want to have this option - enabled in `development` or `test` environments. - -* `path`: - The location to install the specified gems to. This defaults to Rubygems' - setting. Bundler shares this location with Rubygems, `gem install ...` will - have gem installed there, too. Therefore, gems installed without a - `--path ...` setting will show up by calling `gem list`. Accordingly, gems - installed to other locations will not get listed. - -* `without`: - A space-separated list of groups referencing gems to skip during installation. - -* `with`: - A space-separated list of groups referencing gems to include during installation. - -## BUILD OPTIONS - -You can use `bundle config` to give Bundler the flags to pass to the gem -installer every time bundler tries to install a particular gem. - -A very common example, the `mysql` gem, requires Snow Leopard users to -pass configuration flags to `gem install` to specify where to find the -`mysql_config` executable. - - gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -Since the specific location of that executable can change from machine -to machine, you can specify these flags on a per-machine basis. - - bundle config set --global build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config - -After running this command, every time bundler needs to install the -`mysql` gem, it will pass along the flags you specified. - -## CONFIGURATION KEYS - -Configuration keys in bundler have two forms: the canonical form and the -environment variable form. - -For instance, passing the `--without` flag to [bundle install(1)](bundle-install.1.html) -prevents Bundler from installing certain groups specified in the Gemfile(5). Bundler -persists this value in `app/.bundle/config` so that calls to `Bundler.setup` -do not try to find gems from the `Gemfile` that you didn't install. Additionally, -subsequent calls to [bundle install(1)](bundle-install.1.html) remember this setting -and skip those groups. - -The canonical form of this configuration is `"without"`. To convert the canonical -form to the environment variable form, capitalize it, and prepend `BUNDLE_`. The -environment variable form of `"without"` is `BUNDLE_WITHOUT`. - -Any periods in the configuration keys must be replaced with two underscores when -setting it via environment variables. The configuration key `local.rack` becomes -the environment variable `BUNDLE_LOCAL__RACK`. - -## LIST OF AVAILABLE KEYS - -The following is a list of all configuration keys and their purpose. You can -learn more about their operation in [bundle install(1)](bundle-install.1.html). - -* `allow_bundler_dependency_conflicts` (`BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS`): - Allow resolving to specifications that have dependencies on `bundler` that - are incompatible with the running Bundler version. -* `allow_deployment_source_credential_changes` (`BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES`): - When in deployment mode, allow changing the credentials to a gem's source. - Ex: `https://some.host.com/gems/path/` -> `https://user_name:password@some.host.com/gems/path` -* `allow_offline_install` (`BUNDLE_ALLOW_OFFLINE_INSTALL`): - Allow Bundler to use cached data when installing without network access. -* `auto_clean_without_path` (`BUNDLE_AUTO_CLEAN_WITHOUT_PATH`): - Automatically run `bundle clean` after installing when an explicit `path` - has not been set and Bundler is not installing into the system gems. -* `auto_install` (`BUNDLE_AUTO_INSTALL`): - Automatically run `bundle install` when gems are missing. -* `bin` (`BUNDLE_BIN`): - Install executables from gems in the bundle to the specified directory. - Defaults to `false`. -* `cache_all` (`BUNDLE_CACHE_ALL`): - Cache all gems, including path and git gems. This needs to be explicitly - configured on bundler 1 and bundler 2, but will be the default on bundler 3. -* `cache_all_platforms` (`BUNDLE_CACHE_ALL_PLATFORMS`): - Cache gems for all platforms. -* `cache_path` (`BUNDLE_CACHE_PATH`): - The directory that bundler will place cached gems in when running - bundle package, and that bundler will look in when installing gems. - Defaults to `vendor/cache`. -* `clean` (`BUNDLE_CLEAN`): - Whether Bundler should run `bundle clean` automatically after - `bundle install`. -* `console` (`BUNDLE_CONSOLE`): - The console that `bundle console` starts. Defaults to `irb`. -* `default_install_uses_path` (`BUNDLE_DEFAULT_INSTALL_USES_PATH`): - Whether a `bundle install` without an explicit `--path` argument defaults - to installing gems in `.bundle`. -* `deployment` (`BUNDLE_DEPLOYMENT`): - Disallow changes to the `Gemfile`. When the `Gemfile` is changed and the - lockfile has not been updated, running Bundler commands will be blocked. -* `disable_checksum_validation` (`BUNDLE_DISABLE_CHECKSUM_VALIDATION`): - Allow installing gems even if they do not match the checksum provided by - RubyGems. -* `disable_exec_load` (`BUNDLE_DISABLE_EXEC_LOAD`): - Stop Bundler from using `load` to launch an executable in-process in - `bundle exec`. -* `disable_local_branch_check` (`BUNDLE_DISABLE_LOCAL_BRANCH_CHECK`): - Allow Bundler to use a local git override without a branch specified in the - Gemfile. -* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`): - When set, Gemfiles containing multiple sources will produce errors - instead of warnings. - Use `bundle config unset disable_multisource` to unset. -* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`): - Stop Bundler from accessing gems installed to RubyGems' normal location. -* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`): - Stop Bundler from checking if a newer Bundler version is available on - rubygems.org. -* `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. -* `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 `--deployment` is used. -* `gem.push_key` (`BUNDLE_GEM__PUSH_KEY`): - Sets the `--key` parameter for `gem push` when using the `rake release` - command with a private gemstash server. -* `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 `Gemfile`, among other things. By default, bundler - will search up from the current working directory until it finds a - `Gemfile`. -* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`): - Whether Bundler should cache all gems globally, rather than locally to the - installing Ruby installation. -* `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`. -* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`) - Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`. -* `jobs` (`BUNDLE_JOBS`): - The number of gems Bundler can install in parallel. Defaults to 1. -* `no_install` (`BUNDLE_NO_INSTALL`): - Whether `bundle package` should skip installing gems. -* `no_prune` (`BUNDLE_NO_PRUNE`): - Whether Bundler should leave outdated gems unpruned when caching. -* `only_update_to_newer_versions` (`BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS`): - During `bundle update`, only resolve to newer versions of the gems in the - lockfile. -* `path` (`BUNDLE_PATH`): - The location on disk where all gems in your bundle will be located regardless - of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location - will be installed by `bundle install`. Defaults to `Gem.dir`. When --deployment - is used, defaults to vendor/bundle. -* `path.system` (`BUNDLE_PATH__SYSTEM`): - Whether Bundler will install gems into the default system path (`Gem.dir`). -* `path_relative_to_cwd` (`BUNDLE_PATH_RELATIVE_TO_CWD`) - Makes `--path` relative to the CWD instead of the `Gemfile`. -* `plugins` (`BUNDLE_PLUGINS`): - Enable Bundler's experimental plugin system. -* `prefer_patch` (BUNDLE_PREFER_PATCH): - Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`. -* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`) - Print only version number from `bundler --version`. -* `redirect` (`BUNDLE_REDIRECT`): - The number of redirects allowed for network requests. Defaults to `5`. -* `retry` (`BUNDLE_RETRY`): - The number of times to retry failed network requests. Defaults to `3`. -* `setup_makes_kernel_gem_public` (`BUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC`): - Have `Bundler.setup` make the `Kernel#gem` method public, even though - RubyGems declares it as private. -* `shebang` (`BUNDLE_SHEBANG`): - The program name that should be invoked for generated binstubs. Defaults to - the ruby install name used to generate the binstub. -* `silence_deprecations` (`BUNDLE_SILENCE_DEPRECATIONS`): - Whether Bundler should silence deprecation warnings for behavior that will - be changed in the next major version. -* `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`): - Silence the warning Bundler prints when installing gems as root. -* `specific_platform` (`BUNDLE_SPECIFIC_PLATFORM`): - Allow bundler to resolve for the specific running platform and store it in - the lockfile, 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` to `java`. -* `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`): - Path to a designated CA certificate file or folder containing multiple - certificates for trusted CAs in PEM format. -* `ssl_client_cert` (`BUNDLE_SSL_CLIENT_CERT`): - Path to a designated file containing a X.509 client certificate - and key in PEM format. -* `ssl_verify_mode` (`BUNDLE_SSL_VERIFY_MODE`): - The SSL verification mode Bundler uses when making HTTPS requests. - Defaults to verify peer. -* `suppress_install_using_messages` (`BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES`): - Avoid printing `Using ...` messages during installation when the version of - a gem has not changed. -* `system_bindir` (`BUNDLE_SYSTEM_BINDIR`): - The location where RubyGems installs binstubs. Defaults to `Gem.bindir`. -* `timeout` (`BUNDLE_TIMEOUT`): - The seconds allowed before timing out for network requests. Defaults to `10`. -* `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`): - Whether running `bundle update --source NAME` unlocks a gem with the given - name. Defaults to `true`. -* `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`. -* `user_agent` (`BUNDLE_USER_AGENT`): - The custom user agent fragment Bundler includes in API requests. -* `with` (`BUNDLE_WITH`): - A `:`-separated list of groups whose gems bundler should install. -* `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 [bundle 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, environment variables -will take preference over global settings. - -## LOCAL GIT REPOS - -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: - - bundle config set --local local.GEM_NAME /path/to/local/git/repository - -For example, in order to use a local Rack repository, a developer could call: - - bundle config set --local local.rack ~/Work/git/rack - -Now instead of checking out the remote git repository, the local -override 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 ensure the local override was pushed, otherwise -you may point to a commit 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 to a different branch. - -Finally, Bundler also ensures that the current revision in the -`Gemfile.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 to -configure rubygems.org as the gem source in your Gemfile while still using your -mirror to fetch gems. - - bundle config set --global mirror.SOURCE_URL MIRROR_URL - -For example, to use a mirror of rubygems.org hosted at rubygems-mirror.org: - - bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org - -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. - - bundle config set --global mirror.SOURCE_URL.fallback_timeout TIMEOUT - -For example, to fall back to rubygems.org after 3 seconds: - - bundle config set --global mirror.https://rubygems.org.fallback_timeout 3 - -The default fallback timeout is 0.1 seconds, but the setting can currently -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 allows -you to avoid putting secrets into your Gemfile. - - bundle config set --global SOURCE_HOSTNAME USERNAME:PASSWORD - -For example, to save the credentials of user `claudette` for the gem source at -`gems.longerous.com`, you would run: - - bundle config set --global gems.longerous.com claudette:s00pers3krit - -Or you can set the credentials as an environment variable like this: - - export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit" - -For gems with a git source with HTTP(S) URL you can specify credentials like so: - - bundle config set --global https://github.com/bundler/bundler.git username:password - -Or you can set the credentials as an environment variable like so: - - export BUNDLE_GITHUB__COM=username:password - -This is especially useful for private repositories on hosts such as Github, -where you can use personal OAuth tokens: - - export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic - - -## 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 from by default. The following -outlines the available environment variables and their default values - - BUNDLE_USER_HOME : $HOME/.bundle - BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache - BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config - BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin diff --git a/man/bundle-doctor.1 b/man/bundle-doctor.1 index 82f0fc6fba..39841c8032 100644 --- a/man/bundle-doctor.1 +++ b/man/bundle-doctor.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-DOCTOR" "1" "October 2020" "" "" +.TH "BUNDLE\-DOCTOR" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-doctor\fR \- Checks the bundle for common problems diff --git a/man/bundle-doctor.1.ronn b/man/bundle-doctor.1.ronn deleted file mode 100644 index 271ee800ad..0000000000 --- a/man/bundle-doctor.1.ronn +++ /dev/null @@ -1,33 +0,0 @@ -bundle-doctor(1) -- Checks the bundle for common problems -========================================================= - -## SYNOPSIS - -`bundle doctor` [--quiet] - [--gemfile=GEMFILE] - -## DESCRIPTION - -Checks your Gemfile and gem environment for common problems. If issues -are detected, Bundler prints them and exits status 1. Otherwise, -Bundler prints a success message and exits status 0. - -Examples of common problems caught by bundle-doctor include: - -* Invalid Bundler settings -* Mismatched Ruby versions -* Mismatched platforms -* Uninstalled gems -* Missing dependencies - -## OPTIONS - -* `--quiet`: - Only output warnings and errors. - -* `--gemfile=`: - The location of the Gemfile(5) which Bundler should use. This defaults - to a Gemfile(5) in the current working directory. In general, Bundler - will assume that the location of the Gemfile(5) is also the project's - root and will try to find `Gemfile.lock` and `vendor/cache` relative - to this location. diff --git a/man/bundle-exec.1 b/man/bundle-exec.1 index 4dc42bed28..b8c1b308c3 100644 --- a/man/bundle-exec.1 +++ b/man/bundle-exec.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-EXEC" "1" "October 2020" "" "" +.TH "BUNDLE\-EXEC" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-exec\fR \- Execute a command in the context of the bundle diff --git a/man/bundle-exec.1.ronn b/man/bundle-exec.1.ronn deleted file mode 100644 index dec3c7cb82..0000000000 --- a/man/bundle-exec.1.ronn +++ /dev/null @@ -1,152 +0,0 @@ -bundle-exec(1) -- Execute a command in the context of the bundle -================================================================ - -## SYNOPSIS - -`bundle exec` [--keep-file-descriptors] - -## DESCRIPTION - -This command executes the command, making all gems specified in the -[`Gemfile(5)`][Gemfile(5)] available to `require` in Ruby programs. - -Essentially, if you would normally have run something like -`rspec spec/my_spec.rb`, and you want to use the gems specified -in the [`Gemfile(5)`][Gemfile(5)] and installed via [bundle install(1)](bundle-install.1.html), you -should run `bundle exec rspec spec/my_spec.rb`. - -Note that `bundle exec` does not require that an executable is -available on your shell's `$PATH`. - -## OPTIONS - -* `--keep-file-descriptors`: - Exec in Ruby 2.0 began discarding non-standard file descriptors. When this - flag is passed, exec will revert to the 1.9 behaviour of passing all file - descriptors to the new process. - -## BUNDLE INSTALL --BINSTUBS - -If you use the `--binstubs` flag in [bundle install(1)](bundle-install.1.html), Bundler will -automatically create a directory (which defaults to `app_root/bin`) -containing all of the executables available from gems in the bundle. - -After using `--binstubs`, `bin/rspec spec/my_spec.rb` is identical -to `bundle exec rspec spec/my_spec.rb`. - -## ENVIRONMENT MODIFICATIONS - -`bundle exec` makes a number of changes to the shell environment, -then executes the command you specify in full. - -* make sure that it's still possible to shell out to `bundle` - from inside a command invoked by `bundle exec` (using - `$BUNDLE_BIN_PATH`) -* put the directory containing executables (like `rails`, `rspec`, - `rackup`) for your bundle on `$PATH` -* make sure that if bundler is invoked in the subshell, it uses - the same `Gemfile` (by setting `BUNDLE_GEMFILE`) -* add `-rbundler/setup` to `$RUBYOPT`, which makes sure that - Ruby programs invoked in the subshell can see the gems in - the bundle - -It also modifies Rubygems: - -* disallow loading additional gems not in the bundle -* modify the `gem` method to be a no-op if a gem matching - the requirements is in the bundle, and to raise a - `Gem::LoadError` if it's not -* Define `Gem.refresh` to be a no-op, since the source - index is always frozen when using bundler, and to - prevent gems from the system leaking into the environment -* Override `Gem.bin_path` to use the gems in the bundle, - making system executables work -* Add all gems in the bundle into Gem.loaded_specs - -Finally, `bundle exec` also implicitly modifies `Gemfile.lock` if the lockfile -and the Gemfile do not match. Bundler needs the Gemfile to determine things -such as a gem's groups, `autorequire`, and platforms, etc., and that -information isn't stored in the lockfile. The Gemfile and lockfile must be -synced in order to `bundle exec` successfully, so `bundle exec` -updates the lockfile beforehand. - -### Loading - -By default, when attempting to `bundle exec` to a file with a ruby shebang, -Bundler will `Kernel.load` that file instead of using `Kernel.exec`. For the -vast majority of cases, this is a performance improvement. In a rare few cases, -this could cause some subtle side-effects (such as dependence on the exact -contents of `$0` or `__FILE__`) and the optimization can be disabled by enabling -the `disable_exec_load` setting. - -### Shelling out - -Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will -automatically use the current Bundler environment. If you need to shell out to -a Ruby command that is not part of your current bundle, use the -`with_clean_env` method with a block. Any subshells created inside the block -will be given the environment present before Bundler was activated. For -example, Homebrew commands run Ruby, but don't work inside a bundle: - - Bundler.with_clean_env do - `brew install wget` - end - -Using `with_clean_env` is also necessary if you are shelling out to a different -bundle. Any Bundler commands run in a subshell will inherit the current -Gemfile, so commands that need to run in the context of a different bundle also -need to use `with_clean_env`. - - Bundler.with_clean_env do - Dir.chdir "/other/bundler/project" do - `bundle exec ./script` - end - end - -Bundler provides convenience helpers that wrap `system` and `exec`, and they -can be used like this: - - Bundler.clean_system('brew install wget') - Bundler.clean_exec('brew install wget') - - -## RUBYGEMS PLUGINS - -At present, the Rubygems plugin system requires all files -named `rubygems_plugin.rb` on the load path of _any_ installed -gem when any Ruby code requires `rubygems.rb`. This includes -executables installed into the system, like `rails`, `rackup`, -and `rspec`. - -Since Rubygems plugins can contain arbitrary Ruby code, they -commonly end up activating themselves or their dependencies. - -For instance, the `gemcutter 0.5` gem depended on `json_pure`. -If you had that version of gemcutter installed (even if -you _also_ had a newer version without this problem), Rubygems -would activate `gemcutter 0.5` and `json_pure `. - -If your Gemfile(5) also contained `json_pure` (or a gem -with a dependency on `json_pure`), the latest version on -your system might conflict with the version in your -Gemfile(5), or the snapshot version in your `Gemfile.lock`. - -If this happens, bundler will say: - - You have already activated json_pure 1.4.6 but your Gemfile - requires json_pure 1.4.3. Consider using bundle exec. - -In this situation, you almost certainly want to remove the -underlying gem with the problematic gem plugin. In general, -the authors of these plugins (in this case, the `gemcutter` -gem) have released newer versions that are more careful in -their plugins. - -You can find a list of all the gems containing gem plugins -by running - - ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')" - -At the very least, you should remove all but the newest -version of each gem plugin, and also remove all gem plugins -that you aren't using (`gem uninstall gem_name`). diff --git a/man/bundle-gem.1 b/man/bundle-gem.1 index 124df739cc..65c35615c5 100644 --- a/man/bundle-gem.1 +++ b/man/bundle-gem.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-GEM" "1" "October 2020" "" "" +.TH "BUNDLE\-GEM" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem diff --git a/man/bundle-gem.1.ronn b/man/bundle-gem.1.ronn deleted file mode 100644 index a997cb907a..0000000000 --- a/man/bundle-gem.1.ronn +++ /dev/null @@ -1,101 +0,0 @@ -bundle-gem(1) -- Generate a project skeleton for creating a rubygem -==================================================================== - -## SYNOPSIS - -`bundle gem` [OPTIONS] - -## DESCRIPTION - -Generates a directory named `GEM_NAME` with a `Rakefile`, `GEM_NAME.gemspec`, -and other supporting files and directories that can be used to develop a -rubygem with that name. - -Run `rake -T` in the resulting project for a list of Rake tasks that can be used -to test and publish the gem to rubygems.org. - -The generated project skeleton can be customized with OPTIONS, as explained -below. Note that these options can also be specified via Bundler's global -configuration file using the following names: - -* `gem.coc` -* `gem.mit` -* `gem.test` - -## OPTIONS - -* `--exe` or `-b` or `--bin`: - Specify that Bundler should create a binary executable (as `exe/GEM_NAME`) - in the generated rubygem project. This binary will also be added to the - `GEM_NAME.gemspec` manifest. This behavior is disabled by default. - -* `--no-exe`: - Do not create a binary (overrides `--exe` specified in the global config). - -* `--coc`: - Add a `CODE_OF_CONDUCT.md` file to the root of the generated project. If - this option is unspecified, an interactive prompt will be displayed and the - answer will be saved in Bundler's global config for future `bundle gem` use. - -* `--no-coc`: - Do not create a `CODE_OF_CONDUCT.md` (overrides `--coc` specified in the - global config). - -* `--ext`: - Add boilerplate for C extension code to the generated project. This behavior - is disabled by default. - -* `--no-ext`: - Do not add C extension code (overrides `--ext` specified in the global - config). - -* `--mit`: - Add an MIT license to a `LICENSE.txt` file in the root of the generated - project. Your name from the global git config is used for the copyright - statement. If this option is unspecified, an interactive prompt will be - displayed and the answer will be saved in Bundler's global config for future - `bundle gem` use. - -* `--no-mit`: - Do not create a `LICENSE.txt` (overrides `--mit` specified in the global - config). - -* `-t`, `--test=minitest`, `--test=rspec`, `--test=test-unit`: - Specify the test framework that Bundler should use when generating the - project. Acceptable values are `minitest`, `rspec` and `test-unit`. The - `GEM_NAME.gemspec` will be configured and a skeleton test/spec directory will - be created based on this option. Given no option is specified: - - When Bundler is configured to generate tests, this defaults to Bundler's - global config setting `gem.test`. - - When Bundler is configured to not generate tests, an interactive prompt will - be displayed and the answer will be used for the current rubygem project. - - When Bundler is unconfigured, an interactive prompt will be displayed and - the answer will be saved in Bundler's global config for future `bundle gem` - use. - -* `--ci`, `--ci=github`, `--ci=travis`, `--ci=gitlab`, `--ci=circle`: - Specify the continuous integration service that Bundler should use when - generating the project. Acceptable values are `github`, `travis`, `gitlab` - and `circle`. A configuration file will be generated in the project directory. - Given no option is specified: - - When Bundler is configured to generate CI files, this defaults to Bundler's - global config setting `gem.ci`. - - When Bundler is configured to not generate CI files, an interactive prompt - will be displayed and the answer will be used for the current rubygem project. - - When Bundler is unconfigured, an interactive prompt will be displayed and - the answer will be saved in Bundler's global config for future `bundle gem` - use. - -* `-e`, `--edit[=EDITOR]`: - Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not - specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`. - -## SEE ALSO - -* [bundle config(1)](bundle-config.1.html) diff --git a/man/bundle-info.1 b/man/bundle-info.1 index 2d860d51ab..b20396d273 100644 --- a/man/bundle-info.1 +++ b/man/bundle-info.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INFO" "1" "October 2020" "" "" +.TH "BUNDLE\-INFO" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-info\fR \- Show information for the given gem in your bundle diff --git a/man/bundle-info.1.ronn b/man/bundle-info.1.ronn deleted file mode 100644 index 47e457aa3c..0000000000 --- a/man/bundle-info.1.ronn +++ /dev/null @@ -1,17 +0,0 @@ -bundle-info(1) -- Show information for the given gem in your bundle -========================================================================= - -## SYNOPSIS - -`bundle info` [GEM] - [--path] - -## DESCRIPTION - -Print the basic information about the provided GEM such as homepage, version, -path and summary. - -## OPTIONS - -* `--path`: -Print the path of the given gem diff --git a/man/bundle-init.1 b/man/bundle-init.1 index c21e269071..b6714730c4 100644 --- a/man/bundle-init.1 +++ b/man/bundle-init.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INIT" "1" "October 2020" "" "" +.TH "BUNDLE\-INIT" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-init\fR \- Generates a Gemfile into the current working directory diff --git a/man/bundle-init.1.ronn b/man/bundle-init.1.ronn deleted file mode 100644 index 9d3d97deea..0000000000 --- a/man/bundle-init.1.ronn +++ /dev/null @@ -1,29 +0,0 @@ -bundle-init(1) -- Generates a Gemfile into the current working directory -======================================================================== - -## SYNOPSIS - -`bundle init` [--gemspec=FILE] - -## DESCRIPTION - -Init generates a default [`Gemfile(5)`][Gemfile(5)] in the current working directory. When -adding a [`Gemfile(5)`][Gemfile(5)] to a gem with a gemspec, the `--gemspec` option will -automatically add each dependency listed in the gemspec file to the newly -created [`Gemfile(5)`][Gemfile(5)]. - -## OPTIONS - -* `--gemspec`: - Use the specified .gemspec to create the [`Gemfile(5)`][Gemfile(5)] - -## FILES - -Included in the default [`Gemfile(5)`][Gemfile(5)] -generated is the line `# frozen_string_literal: true`. This is a magic comment -supported for the first time in Ruby 2.3. The presence of this line -results in all string literals in the file being implicitly frozen. - -## SEE ALSO - -[Gemfile(5)](https://bundler.io/man/gemfile.5.html) diff --git a/man/bundle-inject.1 b/man/bundle-inject.1 index 20bcbba735..9704eba89b 100644 --- a/man/bundle-inject.1 +++ b/man/bundle-inject.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INJECT" "1" "October 2020" "" "" +.TH "BUNDLE\-INJECT" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile diff --git a/man/bundle-inject.1.ronn b/man/bundle-inject.1.ronn deleted file mode 100644 index f454341896..0000000000 --- a/man/bundle-inject.1.ronn +++ /dev/null @@ -1,22 +0,0 @@ -bundle-inject(1) -- Add named gem(s) with version requirements to Gemfile -========================================================================= - -## SYNOPSIS - -`bundle inject` [GEM] [VERSION] - -## DESCRIPTION - -Adds the named gem(s) with their version requirements to the resolved -[`Gemfile(5)`][Gemfile(5)]. - -This command will add the gem to both your [`Gemfile(5)`][Gemfile(5)] and Gemfile.lock if it -isn't listed yet. - -Example: - - bundle install - bundle inject 'rack' '> 0' - -This will inject the 'rack' gem with a version greater than 0 in your -[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock diff --git a/man/bundle-install.1 b/man/bundle-install.1 index 0abd1a31e2..7c34f37cdd 100644 --- a/man/bundle-install.1 +++ b/man/bundle-install.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INSTALL" "1" "October 2020" "" "" +.TH "BUNDLE\-INSTALL" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile @@ -67,7 +67,7 @@ The maximum number of parallel download and install jobs\. The default is \fB1\f . .TP \fB\-\-local\fR -Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\. +Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if an appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\. . .TP \fB\-\-no\-cache\fR diff --git a/man/bundle-install.1.ronn b/man/bundle-install.1.ronn deleted file mode 100644 index 07aeb1da90..0000000000 --- a/man/bundle-install.1.ronn +++ /dev/null @@ -1,405 +0,0 @@ -bundle-install(1) -- Install the dependencies specified in your Gemfile -======================================================================= - -## SYNOPSIS - -`bundle install` [--binstubs[=DIRECTORY]] - [--clean] - [--deployment] - [--frozen] - [--full-index] - [--gemfile=GEMFILE] - [--jobs=NUMBER] - [--local] - [--no-cache] - [--no-prune] - [--path PATH] - [--quiet] - [--redownload] - [--retry=NUMBER] - [--shebang] - [--standalone[=GROUP[ GROUP...]]] - [--system] - [--trust-policy=POLICY] - [--with=GROUP[ GROUP...]] - [--without=GROUP[ GROUP...]] - -## DESCRIPTION - -Install the gems specified in your Gemfile(5). If this is the first -time you run bundle install (and a `Gemfile.lock` does not exist), -Bundler will fetch all remote sources, resolve dependencies and -install all needed gems. - -If a `Gemfile.lock` does exist, and you have not updated your Gemfile(5), -Bundler will fetch all remote sources, but use the dependencies -specified in the `Gemfile.lock` instead of resolving dependencies. - -If a `Gemfile.lock` does exist, and you have updated your Gemfile(5), -Bundler will use the dependencies in the `Gemfile.lock` for all gems -that you did not update, but will re-resolve the dependencies of -gems that you did update. You can find more information about this -update process below under [CONSERVATIVE UPDATING][]. - -## OPTIONS - -The `--clean`, `--deployment`, `--frozen`, `--no-prune`, `--path`, `--shebang`, -`--system`, `--without` and `--with` options are deprecated because they only -make sense if they are applied to every subsequent `bundle install` run -automatically and that requires `bundler` to silently remember them. Since -`bundler` will no longer remember CLI flags in future versions, `bundle config` -(see bundle-config(1)) should be used to apply them permanently. - -* `--binstubs[=]`: - Binstubs are scripts that wrap around executables. Bundler creates a small Ruby - file (a binstub) that loads Bundler, runs the command, and puts it in `bin/`. - This lets you link the binstub inside of an application to the exact gem - version the application needs. - - Creates a directory (defaults to `~/bin`) and places any executables from the - gem there. These executables run in Bundler's context. If used, you might add - this directory to your environment's `PATH` variable. For instance, if the - `rails` gem comes with a `rails` executable, this flag will create a - `bin/rails` executable that ensures that all referred dependencies will be - resolved using the bundled gems. - -* `--clean`: - On finishing the installation Bundler is going to remove any gems not present - in the current Gemfile(5). Don't worry, gems currently in use will not be - removed. - - This option is deprecated in favor of the `clean` setting. - -* `--deployment`: - In [deployment mode][DEPLOYMENT MODE], Bundler will 'roll-out' the bundle for - production or CI use. Please check carefully if you want to have this option - enabled in your development environment. - - This option is deprecated in favor of the `deployment` setting. - -* `--redownload`: - Force download every gem, even if the required versions are already available - locally. - -* `--frozen`: - Do not allow the Gemfile.lock to be updated after this install. Exits - non-zero if there are going to be changes to the Gemfile.lock. - - This option is deprecated in favor of the `frozen` setting. - -* `--full-index`: - Bundler will not call Rubygems' API endpoint (default) but download and cache - a (currently big) index file of all gems. Performance can be improved for - large bundles that seldom change by enabling this option. - -* `--gemfile=`: - The location of the Gemfile(5) which Bundler should use. This defaults - to a Gemfile(5) in the current working directory. In general, Bundler - will assume that the location of the Gemfile(5) is also the project's - root and will try to find `Gemfile.lock` and `vendor/cache` relative - to this location. - -* `--jobs=[]`, `-j[]`: - The maximum number of parallel download and install jobs. The default - is `1`. - -* `--local`: - Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the - gems already present in Rubygems' cache or in `vendor/cache`. Note that if a - appropriate platform-specific gem exists on `rubygems.org` it will not be - found. - -* `--no-cache`: - Do not update the cache in `vendor/cache` with the newly bundled gems. This - does not remove any gems in the cache but keeps the newly bundled gems from - being cached during the install. - -* `--no-prune`: - Don't remove stale gems from the cache when the installation finishes. - - This option is deprecated in favor of the `no_prune` setting. - -* `--path=`: - The location to install the specified gems to. This defaults to Rubygems' - setting. Bundler shares this location with Rubygems, `gem install ...` will - have gem installed there, too. Therefore, gems installed without a - `--path ...` setting will show up by calling `gem list`. Accordingly, gems - installed to other locations will not get listed. - - This option is deprecated in favor of the `path` setting. - -* `--quiet`: - Do not print progress information to the standard output. Instead, Bundler - will exit using a status code (`$?`). - -* `--retry=[]`: - Retry failed network or git requests for times. - -* `--shebang=`: - Uses the specified ruby executable (usually `ruby`) to execute the scripts - created with `--binstubs`. In addition, if you use `--binstubs` together with - `--shebang jruby` these executables will be changed to execute `jruby` - instead. - - This option is deprecated in favor of the `shebang` setting. - -* `--standalone[=]`: - Makes a bundle that can work without depending on Rubygems or Bundler at - runtime. A space separated list of groups to install has to be specified. - Bundler creates a directory named `bundle` and installs the bundle there. It - also generates a `bundle/bundler/setup.rb` file to replace Bundler's own setup - in the manner required. Using this option implicitly sets `path`, which is a - [remembered option][REMEMBERED OPTIONS]. - -* `--system`: - Installs the gems specified in the bundle to the system's Rubygems location. - This overrides any previous configuration of `--path`. - - This option is deprecated in favor of the `system` setting. - -* `--trust-policy=[]`: - Apply the Rubygems security policy , where policy is one of - `HighSecurity`, `MediumSecurity`, `LowSecurity`, `AlmostNoSecurity`, or - `NoSecurity`. For more details, please see the Rubygems signing documentation - linked below in [SEE ALSO][]. - -* `--with=`: - A space-separated list of groups referencing gems to install. If an - optional group is given it is installed. If a group is given that is - in the remembered list of groups given to --without, it is removed - from that list. - - This option is deprecated in favor of the `with` setting. - -* `--without=`: - A space-separated list of groups referencing gems to skip during installation. - If a group is given that is in the remembered list of groups given - to --with, it is removed from that list. - - This option is deprecated in favor of the `without` setting. - -## DEPLOYMENT MODE - -Bundler's defaults are optimized for development. To switch to -defaults optimized for deployment and for CI, use the `--deployment` -flag. Do not activate deployment mode on development machines, as it -will cause an error when the Gemfile(5) is modified. - -1. A `Gemfile.lock` is required. - - To ensure that the same versions of the gems you developed with - and tested with are also used in deployments, a `Gemfile.lock` - is required. - - This is mainly to ensure that you remember to check your - `Gemfile.lock` into version control. - -2. The `Gemfile.lock` must be up to date - - In development, you can modify your Gemfile(5) and re-run - `bundle install` to [conservatively update][CONSERVATIVE UPDATING] - your `Gemfile.lock` snapshot. - - In deployment, your `Gemfile.lock` should be up-to-date with - changes made in your Gemfile(5). - -3. Gems are installed to `vendor/bundle` not your default system location - - In development, it's convenient to share the gems used in your - application with other applications and other scripts that run on - the system. - - In deployment, isolation is a more important default. In addition, - the user deploying the application may not have permission to install - gems to the system, or the web server may not have permission to - read them. - - As a result, `bundle install --deployment` installs gems to - the `vendor/bundle` directory in the application. This may be - overridden using the `--path` option. - -## SUDO USAGE - -By default, Bundler installs gems to the same location as `gem install`. - -In some cases, that location may not be writable by your Unix user. In -that case, Bundler will stage everything in a temporary directory, -then ask you for your `sudo` password in order to copy the gems into -their system location. - -From your perspective, this is identical to installing the gems -directly into the system. - -You should never use `sudo bundle install`. This is because several -other steps in `bundle install` must be performed as the current user: - -* Updating your `Gemfile.lock` -* Updating your `vendor/cache`, if necessary -* Checking out private git repositories using your user's SSH keys - -Of these three, the first two could theoretically be performed by -`chown`ing the resulting files to `$SUDO_USER`. The third, however, -can only be performed by invoking the `git` command as -the current user. Therefore, git gems are downloaded and installed -into `~/.bundle` rather than $GEM_HOME or $BUNDLE_PATH. - -As a result, you should run `bundle install` as the current user, -and Bundler will ask for your password if it is needed to put the -gems into their final location. - -## INSTALLING GROUPS - -By default, `bundle install` will install all gems in all groups -in your Gemfile(5), except those declared for a different platform. - -However, you can explicitly tell Bundler to skip installing -certain groups with the `--without` option. This option takes -a space-separated list of groups. - -While the `--without` option will skip _installing_ the gems in the -specified groups, it will still _download_ those gems and use them to -resolve the dependencies of every gem in your Gemfile(5). - -This is so that installing a different set of groups on another - machine (such as a production server) will not change the -gems and versions that you have already developed and tested against. - -`Bundler offers a rock-solid guarantee that the third-party -code you are running in development and testing is also the -third-party code you are running in production. You can choose -to exclude some of that code in different environments, but you -will never be caught flat-footed by different versions of -third-party code being used in different environments.` - -For a simple illustration, consider the following Gemfile(5): - - source 'https://rubygems.org' - - gem 'sinatra' - - group :production do - gem 'rack-perftools-profiler' - end - -In this case, `sinatra` depends on any version of Rack (`>= 1.0`), while -`rack-perftools-profiler` depends on 1.x (`~> 1.0`). - -When you run `bundle install --without production` in development, we -look at the dependencies of `rack-perftools-profiler` as well. That way, -you do not spend all your time developing against Rack 2.0, using new -APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2 -when the `production` group _is_ used. - -This should not cause any problems in practice, because we do not -attempt to `install` the gems in the excluded groups, and only evaluate -as part of the dependency resolution process. - -This also means that you cannot include different versions of the same -gem in different groups, because doing so would result in different -sets of dependencies used in development and production. Because of -the vagaries of the dependency resolution process, this usually -affects more than the gems you list in your Gemfile(5), and can -(surprisingly) radically change the gems you are using. - -## THE GEMFILE.LOCK - -When you run `bundle install`, Bundler will persist the full names -and versions of all gems that you used (including dependencies of -the gems specified in the Gemfile(5)) into a file called `Gemfile.lock`. - -Bundler uses this file in all subsequent calls to `bundle install`, -which guarantees that you always use the same exact code, even -as your application moves across machines. - -Because of the way dependency resolution works, even a -seemingly small change (for instance, an update to a point-release -of a dependency of a gem in your Gemfile(5)) can result in radically -different gems being needed to satisfy all dependencies. - -As a result, you `SHOULD` check your `Gemfile.lock` into version -control, in both applications and gems. If you do not, every machine that -checks out your repository (including your production server) will resolve all -dependencies again, which will result in different versions of -third-party code being used if `any` of the gems in the Gemfile(5) -or any of their dependencies have been updated. - -When Bundler first shipped, the `Gemfile.lock` was included in the `.gitignore` -file included with generated gems. Over time, however, it became clear that -this practice forces the pain of broken dependencies onto new contributors, -while leaving existing contributors potentially unaware of the problem. Since -`bundle install` is usually the first step towards a contribution, the pain of -broken dependencies would discourage new contributors from contributing. As a -result, we have revised our guidance for gem authors to now recommend checking -in the lock for gems. - -## CONSERVATIVE UPDATING - -When you make a change to the Gemfile(5) and then run `bundle install`, -Bundler will update only the gems that you modified. - -In other words, if a gem that you `did not modify` worked before -you called `bundle install`, it will continue to use the exact -same versions of all dependencies as it used before the update. - -Let's take a look at an example. Here's your original Gemfile(5): - - source 'https://rubygems.org' - - gem 'actionpack', '2.3.8' - gem 'activemerchant' - -In this case, both `actionpack` and `activemerchant` depend on -`activesupport`. The `actionpack` gem depends on `activesupport 2.3.8` -and `rack ~> 1.1.0`, while the `activemerchant` gem depends on -`activesupport >= 2.3.2`, `braintree >= 2.0.0`, and `builder >= 2.0.0`. - -When the dependencies are first resolved, Bundler will select -`activesupport 2.3.8`, which satisfies the requirements of both -gems in your Gemfile(5). - -Next, you modify your Gemfile(5) to: - - source 'https://rubygems.org' - - gem 'actionpack', '3.0.0.rc' - gem 'activemerchant' - -The `actionpack 3.0.0.rc` gem has a number of new dependencies, -and updates the `activesupport` dependency to `= 3.0.0.rc` and -the `rack` dependency to `~> 1.2.1`. - -When you run `bundle install`, Bundler notices that you changed -the `actionpack` gem, but not the `activemerchant` gem. It -evaluates the gems currently being used to satisfy its requirements: - - * `activesupport 2.3.8`: - also used to satisfy a dependency in `activemerchant`, - which is not being updated - * `rack ~> 1.1.0`: - not currently being used to satisfy another dependency - -Because you did not explicitly ask to update `activemerchant`, -you would not expect it to suddenly stop working after updating -`actionpack`. However, satisfying the new `activesupport 3.0.0.rc` -dependency of actionpack requires updating one of its dependencies. - -Even though `activemerchant` declares a very loose dependency -that theoretically matches `activesupport 3.0.0.rc`, Bundler treats -gems in your Gemfile(5) that have not changed as an atomic unit -together with their dependencies. In this case, the `activemerchant` -dependency is treated as `activemerchant 1.7.1 + activesupport 2.3.8`, -so `bundle install` will report that it cannot update `actionpack`. - -To explicitly update `actionpack`, including its dependencies -which other gems in the Gemfile(5) still depend on, run -`bundle update actionpack` (see `bundle update(1)`). - -`Summary`: In general, after making a change to the Gemfile(5) , you -should first try to run `bundle install`, which will guarantee that no -other gem in the Gemfile(5) is impacted by the change. If that -does not work, run [bundle update(1)](bundle-update.1.html). - -## SEE ALSO - -* [Gem install docs](http://guides.rubygems.org/rubygems-basics/#installing-gems) -* [Rubygems signing docs](http://guides.rubygems.org/security/) diff --git a/man/bundle-list.1 b/man/bundle-list.1 index ebedb62b38..d758e61a49 100644 --- a/man/bundle-list.1 +++ b/man/bundle-list.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LIST" "1" "October 2020" "" "" +.TH "BUNDLE\-LIST" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-list\fR \- List all the gems in the bundle diff --git a/man/bundle-list.1.ronn b/man/bundle-list.1.ronn deleted file mode 100644 index dc058ecd5f..0000000000 --- a/man/bundle-list.1.ronn +++ /dev/null @@ -1,33 +0,0 @@ -bundle-list(1) -- List all the gems in the bundle -========================================================================= - -## SYNOPSIS - -`bundle list` [--name-only] [--paths] [--without-group=GROUP[ GROUP...]] [--only-group=GROUP[ GROUP...]] - -## DESCRIPTION - -Prints a list of all the gems in the bundle including their version. - -Example: - -bundle list --name-only - -bundle list --paths - -bundle list --without-group test - -bundle list --only-group dev - -bundle list --only-group dev test --paths - -## OPTIONS - -* `--name-only`: - Print only the name of each gem. -* `--paths`: - Print the path to each gem in the bundle. -* `--without-group=`: - A space-separated list of groups of gems to skip during printing. -* `--only-group=`: - A space-separated list of groups of gems to print. diff --git a/man/bundle-lock.1 b/man/bundle-lock.1 index 350f1b3daa..a70043df00 100644 --- a/man/bundle-lock.1 +++ b/man/bundle-lock.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LOCK" "1" "October 2020" "" "" +.TH "BUNDLE\-LOCK" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing diff --git a/man/bundle-lock.1.ronn b/man/bundle-lock.1.ronn deleted file mode 100644 index 3aa5920f5a..0000000000 --- a/man/bundle-lock.1.ronn +++ /dev/null @@ -1,94 +0,0 @@ -bundle-lock(1) -- Creates / Updates a lockfile without installing -================================================================= - -## SYNOPSIS - -`bundle lock` [--update] - [--local] - [--print] - [--lockfile=PATH] - [--full-index] - [--add-platform] - [--remove-platform] - [--patch] - [--minor] - [--major] - [--strict] - [--conservative] - -## DESCRIPTION - -Lock the gems specified in Gemfile. - -## OPTIONS - -* `--update=<*gems>`: - Ignores the existing lockfile. Resolve then updates lockfile. Taking a list - of gems or updating all gems if no list is given. - -* `--local`: - Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the - gems already present in Rubygems' cache or in `vendor/cache`. Note that if a - appropriate platform-specific gem exists on `rubygems.org` it will not be - found. - -* `--print`: - Prints the lockfile to STDOUT instead of writing to the file system. - -* `--lockfile=`: - The path where the lockfile should be written to. - -* `--full-index`: - Fall back to using the single-file index of all gems. - -* `--add-platform`: - Add a new platform to the lockfile, re-resolving for the addition of that - platform. - -* `--remove-platform`: - Remove a platform from the lockfile. - -* `--patch`: - If updating, prefer updating only to next patch version. - -* `--minor`: - If updating, prefer updating only to next minor version. - -* `--major`: - If updating, prefer updating to next major version (default). - -* `--strict`: - If updating, do not allow any gem to be updated past latest --patch | --minor | --major. - -* `--conservative`: - If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated. - -## UPDATING ALL GEMS - -If you run `bundle lock` with `--update` option without list of gems, bundler will -ignore any previously installed gems and resolve all dependencies again based -on the latest versions of all gems available in the sources. - -## UPDATING A LIST OF GEMS - -Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of -the gems that you specified locked to the versions in the `Gemfile.lock`. - -For instance, you only want to update `nokogiri`, run `bundle lock --update nokogiri`. - -Bundler will update `nokogiri` and any of its dependencies, but leave the rest of the -gems that you specified locked to the versions in the `Gemfile.lock`. - -## SUPPORTING OTHER PLATFORMS - -If you want your bundle to support platforms other than the one you're running -locally, you can run `bundle lock --add-platform PLATFORM` to add PLATFORM to -the lockfile, force bundler to re-resolve and consider the new platform when -picking gems, all without needing to have a machine that matches PLATFORM handy -to install those platform-specific gems on. - -For a full explanation of gem platforms, see `gem help platform`. - -## PATCH LEVEL OPTIONS - -See [bundle update(1)](bundle-update.1.html) for details. diff --git a/man/bundle-open.1 b/man/bundle-open.1 index 9986d5004c..631280c969 100644 --- a/man/bundle-open.1 +++ b/man/bundle-open.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OPEN" "1" "October 2020" "" "" +.TH "BUNDLE\-OPEN" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle diff --git a/man/bundle-open.1.ronn b/man/bundle-open.1.ronn deleted file mode 100644 index 497beac93f..0000000000 --- a/man/bundle-open.1.ronn +++ /dev/null @@ -1,19 +0,0 @@ -bundle-open(1) -- Opens the source directory for a gem in your bundle -===================================================================== - -## SYNOPSIS - -`bundle open` [GEM] - -## DESCRIPTION - -Opens the source directory of the provided GEM in your editor. - -For this to work the `EDITOR` or `BUNDLER_EDITOR` environment variable has to -be set. - -Example: - - bundle open 'rack' - -Will open the source directory for the 'rack' gem in your bundle. diff --git a/man/bundle-outdated.1 b/man/bundle-outdated.1 index 3fc3cdc601..66cfe1a5f7 100644 --- a/man/bundle-outdated.1 +++ b/man/bundle-outdated.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OUTDATED" "1" "October 2020" "" "" +.TH "BUNDLE\-OUTDATED" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-outdated\fR \- List installed gems with newer versions available diff --git a/man/bundle-outdated.1.ronn b/man/bundle-outdated.1.ronn deleted file mode 100644 index a991d23789..0000000000 --- a/man/bundle-outdated.1.ronn +++ /dev/null @@ -1,111 +0,0 @@ -bundle-outdated(1) -- List installed gems with newer versions available -======================================================================= - -## SYNOPSIS - -`bundle outdated` [GEM] [--local] - [--pre] - [--source] - [--strict] - [--parseable | --porcelain] - [--group=GROUP] - [--groups] - [--update-strict] - [--patch|--minor|--major] - [--filter-major] - [--filter-minor] - [--filter-patch] - [--only-explicit] - -## DESCRIPTION - -Outdated lists the names and versions of gems that have a newer version available -in the given source. Calling outdated with [GEM [GEM]] will only check for newer -versions of the given gems. Prerelease gems are ignored by default. If your gems -are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1. - -## OPTIONS - -* `--local`: - Do not attempt to fetch gems remotely and use the gem cache instead. - -* `--pre`: - Check for newer pre-release gems. - -* `--source`: - Check against a specific source. - -* `--strict`: - Only list newer versions allowed by your Gemfile requirements. - -* `--parseable`, `--porcelain`: - Use minimal formatting for more parseable output. - -* `--group`: - List gems from a specific group. - -* `--groups`: - List gems organized by groups. - -* `--update-strict`: - Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor| --major. - -* `--minor`: - Prefer updating only to next minor version. - -* `--major`: - Prefer updating to next major version (default). - -* `--patch`: - Prefer updating only to next patch version. - -* `--filter-major`: - Only list major newer versions. - -* `--filter-minor`: - Only list minor newer versions. - -* `--filter-patch`: - Only list patch newer versions. - -* `--only-explicit`: - Only list gems specified in your Gemfile, not their dependencies. - -## PATCH LEVEL OPTIONS - -See [bundle update(1)](bundle-update.1.html) for details. - -One difference between the patch level options in `bundle update` and here is the `--strict` option. -`--strict` was already an option on outdated before the patch level options were added. `--strict` -wasn't altered, and the `--update-strict` option on `outdated` reflects what `--strict` does on -`bundle update`. - -## FILTERING OUTPUT - -The 3 filtering options do not affect the resolution of versions, merely what versions are shown -in the output. - -If the regular output shows the following: - - * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" - * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default" - * headless (newest 2.3.1, installed 2.2.3) in groups "test" - -`--filter-major` would only show: - - * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default" - -`--filter-minor` would only show: - - * headless (newest 2.3.1, installed 2.2.3) in groups "test" - -`--filter-patch` would only show: - - * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" - -Filter options can be combined. `--filter-minor` and `--filter-patch` would show: - - * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test" - * headless (newest 2.3.1, installed 2.2.3) in groups "test" - -Combining all three `filter` options would be the same result as providing none of them. diff --git a/man/bundle-platform.1 b/man/bundle-platform.1 index b4c521e0c1..9fda7cb92c 100644 --- a/man/bundle-platform.1 +++ b/man/bundle-platform.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PLATFORM" "1" "October 2020" "" "" +.TH "BUNDLE\-PLATFORM" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-platform\fR \- Displays platform compatibility information diff --git a/man/bundle-platform.1.ronn b/man/bundle-platform.1.ronn deleted file mode 100644 index b5d3283fb6..0000000000 --- a/man/bundle-platform.1.ronn +++ /dev/null @@ -1,42 +0,0 @@ -bundle-platform(1) -- Displays platform compatibility information -================================================================= - -## SYNOPSIS - -`bundle platform` [--ruby] - -## DESCRIPTION - -`platform` will display information from your Gemfile, Gemfile.lock, and Ruby -VM about your platform. - -For instance, using this Gemfile(5): - - source "https://rubygems.org" - - ruby "1.9.3" - - gem "rack" - -If you run `bundle platform` on Ruby 1.9.3, it will display the following output: - - Your platform is: x86_64-linux - - Your app has gems that work on these platforms: - * ruby - - Your Gemfile specifies a Ruby version requirement: - * ruby 1.9.3 - - Your current platform satisfies the Ruby version requirement. - -`platform` will list all the platforms in your `Gemfile.lock` as well as the -`ruby` directive if applicable from your Gemfile(5). It will also let you know -if the `ruby` directive requirement has been met. If `ruby` directive doesn't -match the running Ruby VM, it will tell you what part does not. - -## OPTIONS - -* `--ruby`: - It will display the ruby directive information, so you don't have to - parse it from the Gemfile(5). diff --git a/man/bundle-pristine.1 b/man/bundle-pristine.1 index 0a1790655e..4561081746 100644 --- a/man/bundle-pristine.1 +++ b/man/bundle-pristine.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PRISTINE" "1" "October 2020" "" "" +.TH "BUNDLE\-PRISTINE" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition diff --git a/man/bundle-pristine.1.ronn b/man/bundle-pristine.1.ronn deleted file mode 100644 index e2d6b6a348..0000000000 --- a/man/bundle-pristine.1.ronn +++ /dev/null @@ -1,34 +0,0 @@ -bundle-pristine(1) -- Restores installed gems to their pristine condition -=========================================================================== - -## SYNOPSIS - -`bundle pristine` - -## DESCRIPTION - -`pristine` restores the installed gems in the bundle to their pristine condition -using the local gem cache from RubyGems. For git gems, a forced checkout will be performed. - -For further explanation, `bundle pristine` ignores unpacked files on disk. In other -words, this command utilizes the local `.gem` cache or the gem's git repository -as if one were installing from scratch. - -Note: the Bundler gem cannot be restored to its original state with `pristine`. -One also cannot use `bundle pristine` on gems with a 'path' option in the Gemfile, -because bundler has no original copy it can restore from. - -When is it practical to use `bundle pristine`? - -It comes in handy when a developer is debugging a gem. `bundle pristine` is a -great way to get rid of experimental changes to a gem that one may not want. - -Why use `bundle pristine` over `gem pristine --all`? - -Both commands are very similar. -For context: `bundle pristine`, without arguments, cleans all gems from the lockfile. -Meanwhile, `gem pristine --all` cleans all installed gems for that Ruby version. - -If a developer forgets which gems in their project they might -have been debugging, the Rubygems `gem pristine [GEMNAME]` command may be inconvenient. -One can avoid waiting for `gem pristine --all`, and instead run `bundle pristine`. diff --git a/man/bundle-remove.1 b/man/bundle-remove.1 index ee24f676a6..b649f62673 100644 --- a/man/bundle-remove.1 +++ b/man/bundle-remove.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-REMOVE" "1" "October 2020" "" "" +.TH "BUNDLE\-REMOVE" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile diff --git a/man/bundle-remove.1.ronn b/man/bundle-remove.1.ronn deleted file mode 100644 index 40a239b4a2..0000000000 --- a/man/bundle-remove.1.ronn +++ /dev/null @@ -1,23 +0,0 @@ -bundle-remove(1) -- Removes gems from the Gemfile -=========================================================================== - -## SYNOPSIS - -`bundle remove [GEM [GEM ...]] [--install]` - -## DESCRIPTION - -Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised. - -## OPTIONS - -* `--install`: - Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s). - -Example: - -bundle remove rails - -bundle remove rails rack - -bundle remove rails rack --install diff --git a/man/bundle-show.1 b/man/bundle-show.1 index f83c810ffe..1b0608f75a 100644 --- a/man/bundle-show.1 +++ b/man/bundle-show.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-SHOW" "1" "October 2020" "" "" +.TH "BUNDLE\-SHOW" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem diff --git a/man/bundle-show.1.ronn b/man/bundle-show.1.ronn deleted file mode 100644 index a6a59a1445..0000000000 --- a/man/bundle-show.1.ronn +++ /dev/null @@ -1,21 +0,0 @@ -bundle-show(1) -- Shows all the gems in your bundle, or the path to a gem -========================================================================= - -## SYNOPSIS - -`bundle show` [GEM] - [--paths] - -## DESCRIPTION - -Without the [GEM] option, `show` will print a list of the names and versions of -all gems that are required by your [`Gemfile(5)`][Gemfile(5)], sorted by name. - -Calling show with [GEM] will list the exact location of that gem on your -machine. - -## OPTIONS - -* `--paths`: - List the paths of all gems that are required by your [`Gemfile(5)`][Gemfile(5)], - sorted by gem name. diff --git a/man/bundle-update.1 b/man/bundle-update.1 index 002f2e69b9..f9922f6618 100644 --- a/man/bundle-update.1 +++ b/man/bundle-update.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-UPDATE" "1" "October 2020" "" "" +.TH "BUNDLE\-UPDATE" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-update\fR \- Update your gems to the latest available versions diff --git a/man/bundle-update.1.ronn b/man/bundle-update.1.ronn deleted file mode 100644 index 397fecadcb..0000000000 --- a/man/bundle-update.1.ronn +++ /dev/null @@ -1,350 +0,0 @@ -bundle-update(1) -- Update your gems to the latest available versions -===================================================================== - -## SYNOPSIS - -`bundle update` <*gems> [--all] - [--group=NAME] - [--source=NAME] - [--local] - [--ruby] - [--bundler[=VERSION]] - [--full-index] - [--jobs=JOBS] - [--quiet] - [--patch|--minor|--major] - [--redownload] - [--strict] - [--conservative] - -## DESCRIPTION - -Update the gems specified (all gems, if `--all` flag is used), ignoring -the previously installed gems specified in the `Gemfile.lock`. In -general, you should use [bundle install(1)](bundle-install.1.html) to install the same exact -gems and versions across machines. - -You would use `bundle update` to explicitly update the version of a -gem. - -## OPTIONS - -* `--all`: - Update all gems specified in Gemfile. - -* `--group=`, `-g=[]`: - Only update the gems in the specified group. For instance, you can update all gems - in the development group with `bundle update --group development`. You can also - call `bundle update rails --group test` to update the rails gem and all gems in - the test group, for example. - -* `--source=`: - The name of a `:git` or `:path` source used in the Gemfile(5). For - instance, with a `:git` source of `http://github.com/rails/rails.git`, - you would call `bundle update --source rails` - -* `--local`: - Do not attempt to fetch gems remotely and use the gem cache instead. - -* `--ruby`: - Update the locked version of Ruby to the current version of Ruby. - -* `--bundler`: - Update the locked version of bundler to the invoked bundler version. - -* `--full-index`: - Fall back to using the single-file index of all gems. - -* `--jobs=[]`, `-j[]`: - Specify the number of jobs to run in parallel. The default is `1`. - -* `--retry=[]`: - Retry failed network or git requests for times. - -* `--quiet`: - Only output warnings and errors. - -* `--redownload`: - Force downloading every gem. - -* `--patch`: - Prefer updating only to next patch version. - -* `--minor`: - Prefer updating only to next minor version. - -* `--major`: - Prefer updating to next major version (default). - -* `--strict`: - Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`. - -* `--conservative`: - Use bundle install conservative update behavior and do not allow shared dependencies to be updated. - -## UPDATING ALL GEMS - -If you run `bundle update --all`, bundler will ignore -any previously installed gems and resolve all dependencies again -based on the latest versions of all gems available in the sources. - -Consider the following Gemfile(5): - - source "https://rubygems.org" - - gem "rails", "3.0.0.rc" - gem "nokogiri" - -When you run [bundle install(1)](bundle-install.1.html) the first time, bundler will resolve -all of the dependencies, all the way down, and install what you need: - - Fetching gem metadata from https://rubygems.org/......... - Resolving dependencies... - Installing builder 2.1.2 - Installing abstract 1.0.0 - Installing rack 1.2.8 - Using bundler 1.7.6 - Installing rake 10.4.0 - Installing polyglot 0.3.5 - Installing mime-types 1.25.1 - Installing i18n 0.4.2 - Installing mini_portile 0.6.1 - Installing tzinfo 0.3.42 - Installing rack-mount 0.6.14 - Installing rack-test 0.5.7 - Installing treetop 1.4.15 - Installing thor 0.14.6 - Installing activesupport 3.0.0.rc - Installing erubis 2.6.6 - Installing activemodel 3.0.0.rc - Installing arel 0.4.0 - Installing mail 2.2.20 - Installing activeresource 3.0.0.rc - Installing actionpack 3.0.0.rc - Installing activerecord 3.0.0.rc - Installing actionmailer 3.0.0.rc - Installing railties 3.0.0.rc - Installing rails 3.0.0.rc - Installing nokogiri 1.6.5 - - Bundle complete! 2 Gemfile dependencies, 26 gems total. - Use `bundle show [gemname]` to see where a bundled gem is installed. - -As you can see, even though you have two gems in the Gemfile(5), your application -needs 26 different gems in order to run. Bundler remembers the exact versions -it installed in `Gemfile.lock`. The next time you run [bundle install(1)](bundle-install.1.html), bundler skips -the dependency resolution and installs the same gems as it installed last time. - -After checking in the `Gemfile.lock` into version control and cloning it on another -machine, running [bundle install(1)](bundle-install.1.html) will _still_ install the gems that you installed -last time. You don't need to worry that a new release of `erubis` or `mail` changes -the gems you use. - -However, from time to time, you might want to update the gems you are using to the -newest versions that still match the gems in your Gemfile(5). - -To do this, run `bundle update --all`, which will ignore the `Gemfile.lock`, and resolve -all the dependencies again. Keep in mind that this process can result in a significantly -different set of the 25 gems, based on the requirements of new gems that the gem -authors released since the last time you ran `bundle update --all`. - -## UPDATING A LIST OF GEMS - -Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the -gems that you specified locked to the versions in the `Gemfile.lock`. - -For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and -you want to update it _without_ updating Rails and all of its dependencies. To do this, -run `bundle update nokogiri`. - -Bundler will update `nokogiri` and any of its dependencies, but leave alone Rails and -its dependencies. - -## OVERLAPPING DEPENDENCIES - -Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same -second-level dependency. For instance, consider the case of `thin` and -`rack-perftools-profiler`. - - source "https://rubygems.org" - - gem "thin" - gem "rack-perftools-profiler" - -The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends -on `rack ~> 1.0`. If you run bundle install, you get: - - Fetching source index for https://rubygems.org/ - Installing daemons (1.1.0) - Installing eventmachine (0.12.10) with native extensions - Installing open4 (1.0.1) - Installing perftools.rb (0.4.7) with native extensions - Installing rack (1.2.1) - Installing rack-perftools_profiler (0.0.2) - Installing thin (1.2.7) with native extensions - Using bundler (1.0.0.rc.3) - -In this case, the two gems have their own set of dependencies, but they share -`rack` in common. If you run `bundle update thin`, bundler will update `daemons`, -`eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or -`perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that -`bundle update thin` will update `rack` even though it's _also_ a dependency of -`rack-perftools_profiler`. - -In short, by default, when you update a gem using `bundle update`, bundler will -update all dependencies of that gem, including those that are also dependencies -of another gem. - -To prevent updating shared dependencies, prior to version 1.14 the only option -was the `CONSERVATIVE UPDATING` behavior in [bundle install(1)](bundle-install.1.html): - -In this scenario, updating the `thin` version manually in the Gemfile(5), -and then running [bundle install(1)](bundle-install.1.html) will only update `daemons` and `eventmachine`, -but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section -of [bundle install(1)](bundle-install.1.html). - -Starting with 1.14, specifying the `--conservative` option will also prevent shared -dependencies from being updated. - -## PATCH LEVEL OPTIONS - -Version 1.14 introduced 4 patch-level options that will influence how gem -versions are resolved. One of the following options can be used: `--patch`, -`--minor` or `--major`. `--strict` can be added to further influence resolution. - -* `--patch`: - Prefer updating only to next patch version. - -* `--minor`: - Prefer updating only to next minor version. - -* `--major`: - Prefer updating to next major version (default). - -* `--strict`: - Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`. - -When Bundler is resolving what versions to use to satisfy declared -requirements in the Gemfile or in parent gems, it looks up all -available versions, filters out any versions that don't satisfy -the requirement, and then, by default, sorts them from newest to -oldest, considering them in that order. - -Providing one of the patch level options (e.g. `--patch`) changes the -sort order of the satisfying versions, causing Bundler to consider the -latest `--patch` or `--minor` version available before other versions. -Note that versions outside the stated patch level could still be -resolved to if necessary to find a suitable dependency graph. - -For example, if gem 'foo' is locked at 1.0.2, with no gem requirement -defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0 -all exist, the default order of preference by default (`--major`) will -be "2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2". - -If the `--patch` option is used, the order of preference will change to -"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0". - -If the `--minor` option is used, the order of preference will change to -"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0". - -Combining the `--strict` option with any of the patch level options -will remove any versions beyond the scope of the patch level option, -to ensure that no gem is updated that far. - -To continue the previous example, if both `--patch` and `--strict` -options are used, the available versions for resolution would be -"1.0.4, 1.0.3, 1.0.2". If `--minor` and `--strict` are used, it would -be "1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2". - -Gem requirements as defined in the Gemfile will still be the first -determining factor for what versions are available. If the gem -requirement for `foo` in the Gemfile is '~> 1.0', that will accomplish -the same thing as providing the `--minor` and `--strict` options. - -## PATCH LEVEL EXAMPLES - -Given the following gem specifications: - - foo 1.4.3, requires: ~> bar 2.0 - foo 1.4.4, requires: ~> bar 2.0 - foo 1.4.5, requires: ~> bar 2.1 - foo 1.5.0, requires: ~> bar 2.1 - foo 1.5.1, requires: ~> bar 3.0 - bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0 - -Gemfile: - - gem 'foo' - -Gemfile.lock: - - foo (1.4.3) - bar (~> 2.0) - bar (2.0.3) - -Cases: - - # Command Line Result - ------------------------------------------------------------ - 1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1' - 2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1' - 3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0' - 4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1' - 5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4' - -In case 1, bar is upgraded to 2.1.1, a minor version increase, because -the dependency from foo 1.4.5 required it. - -In case 2, only foo is requested to be unlocked, but bar is also -allowed to move because it's not a declared dependency in the Gemfile. - -In case 3, bar goes up a whole major release, because a minor increase -is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0 -of bar. - -In case 4, foo is preferred up to a minor version, but 1.5.1 won't work -because the --strict flag removes bar 3.0.0 from consideration since -it's a major increment. - -In case 5, both foo and bar have any minor or major increments removed -from consideration because of the --strict flag, so the most they can -move is up to 1.4.4 and 2.0.4. - -## RECOMMENDED WORKFLOW - -In general, when working with an application managed with bundler, you should -use the following workflow: - -* After you create your Gemfile(5) for the first time, run - - $ bundle install - -* Check the resulting `Gemfile.lock` into version control - - $ git add Gemfile.lock - -* When checking out this repository on another development machine, run - - $ bundle install - -* When checking out this repository on a deployment machine, run - - $ bundle install --deployment - -* After changing the Gemfile(5) to reflect a new or update dependency, run - - $ bundle install - -* Make sure to check the updated `Gemfile.lock` into version control - - $ git add Gemfile.lock - -* If [bundle install(1)](bundle-install.1.html) reports a conflict, manually update the specific - gems that you changed in the Gemfile(5) - - $ bundle update rails thin - -* If you want to update all the gems to the latest possible versions that - still match the gems listed in the Gemfile(5), run - - $ bundle update --all diff --git a/man/bundle-viz.1 b/man/bundle-viz.1 index cb2fcde537..2f68f644bf 100644 --- a/man/bundle-viz.1 +++ b/man/bundle-viz.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-VIZ" "1" "October 2020" "" "" +.TH "BUNDLE\-VIZ" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile diff --git a/man/bundle-viz.1.ronn b/man/bundle-viz.1.ronn deleted file mode 100644 index 701df5415e..0000000000 --- a/man/bundle-viz.1.ronn +++ /dev/null @@ -1,30 +0,0 @@ -bundle-viz(1) -- Generates a visual dependency graph for your Gemfile -===================================================================== - -## SYNOPSIS - -`bundle viz` [--file=FILE] - [--format=FORMAT] - [--requirements] - [--version] - [--without=GROUP GROUP] - -## DESCRIPTION - -`viz` generates a PNG file of the current `Gemfile(5)` as a dependency graph. -`viz` requires the ruby-graphviz gem (and its dependencies). - -The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html). - -## OPTIONS - -* `--file`, `-f`: - The name to use for the generated file. See `--format` option -* `--format`, `-F`: - This is output format option. Supported format is png, jpg, svg, dot ... -* `--requirements`, `-R`: - Set to show the version of each required dependency. -* `--version`, `-v`: - Set to show each gem version. -* `--without`, `-W`: - Exclude gems that are part of the specified named group. diff --git a/man/bundle.1 b/man/bundle.1 index 86d0aec497..232752e914 100644 --- a/man/bundle.1 +++ b/man/bundle.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE" "1" "October 2020" "" "" +.TH "BUNDLE" "1" "November 2020" "" "" . .SH "NAME" \fBbundle\fR \- Ruby Dependency Management diff --git a/man/bundle.1.ronn b/man/bundle.1.ronn deleted file mode 100644 index 5b1712394a..0000000000 --- a/man/bundle.1.ronn +++ /dev/null @@ -1,111 +0,0 @@ -bundle(1) -- Ruby Dependency Management -======================================= - -## SYNOPSIS - -`bundle` COMMAND [--no-color] [--verbose] [ARGS] - -## DESCRIPTION - -Bundler manages an `application's dependencies` through its entire life -across many machines systematically and repeatably. - -See [the bundler website](https://bundler.io) for information on getting -started, and Gemfile(5) for more information on the `Gemfile` format. - -## OPTIONS - -* `--no-color`: - Print all output without color - -* `--retry`, `-r`: - Specify the number of times you wish to attempt network commands - -* `--verbose`, `-V`: - Print out additional logging information - -## BUNDLE COMMANDS - -We divide `bundle` subcommands into primary commands and utilities: - -## PRIMARY COMMANDS - -* [`bundle install(1)`](bundle-install.1.html): - Install the gems specified by the `Gemfile` or `Gemfile.lock` - -* [`bundle update(1)`](bundle-update.1.html): - Update dependencies to their latest versions - -* [`bundle package(1)`](bundle-package.1.html): - Package the .gem files required by your application into the - `vendor/cache` directory - -* [`bundle exec(1)`](bundle-exec.1.html): - Execute a script in the current bundle - -* [`bundle config(1)`](bundle-config.1.html): - Specify and read configuration options for Bundler - -* `bundle help(1)`: - Display detailed help for each subcommand - -## UTILITIES - -* [`bundle add(1)`](bundle-add.1.html): - Add the named gem to the Gemfile and run `bundle install` - -* [`bundle binstubs(1)`](bundle-binstubs.1.html): - Generate binstubs for executables in a gem - -* [`bundle check(1)`](bundle-check.1.html): - Determine whether the requirements for your application are installed - and available to Bundler - -* [`bundle show(1)`](bundle-show.1.html): - Show the source location of a particular gem in the bundle - -* [`bundle outdated(1)`](bundle-outdated.1.html): - Show all of the outdated gems in the current bundle - -* `bundle console(1)`: - Start an IRB session in the current bundle - -* [`bundle open(1)`](bundle-open.1.html): - Open an installed gem in the editor - -* [`bundle lock(1)`](bundle-lock.1.html): - Generate a lockfile for your dependencies - -* [`bundle viz(1)`](bundle-viz.1.html): - Generate a visual representation of your dependencies - -* [`bundle init(1)`](bundle-init.1.html): - Generate a simple `Gemfile`, placed in the current directory - -* [`bundle gem(1)`](bundle-gem.1.html): - Create a simple gem, suitable for development with Bundler - -* [`bundle platform(1)`](bundle-platform.1.html): - Display platform compatibility information - -* [`bundle clean(1)`](bundle-clean.1.html): - Clean up unused gems in your Bundler directory - -* [`bundle doctor(1)`](bundle-doctor.1.html): - Display warnings about common problems - -* [`bundle remove(1)`](bundle-remove.1.html): - Removes gems from the Gemfile - -## PLUGINS - -When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, -Bundler will try to find an executable on your path named `bundler-` -and execute it, passing down any extra arguments to it. - -## OBSOLETE - -These commands are obsolete and should no longer be used: - -* `bundle cache(1)` -* `bundle show(1)` diff --git a/man/gemfile.5 b/man/gemfile.5 index 401487c688..f501db2b66 100644 --- a/man/gemfile.5 +++ b/man/gemfile.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GEMFILE" "5" "October 2020" "" "" +.TH "GEMFILE" "5" "November 2020" "" "" . .SH "NAME" \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn deleted file mode 100644 index 994f0d66bd..0000000000 --- a/man/gemfile.5.ronn +++ /dev/null @@ -1,517 +0,0 @@ -Gemfile(5) -- A format for describing gem dependencies for Ruby programs -======================================================================== - -## SYNOPSIS - -A `Gemfile` describes the gem dependencies required to execute associated -Ruby code. - -Place the `Gemfile` in the root of the directory containing the associated -code. For instance, in a Rails application, place the `Gemfile` in the same -directory as the `Rakefile`. - -## SYNTAX - -A `Gemfile` is evaluated as Ruby code, in a context which makes available -a number of methods used to describe the gem requirements. - -## GLOBAL SOURCES - -At the top of the `Gemfile`, add a line for the `Rubygems` source that contains -the gems listed in the `Gemfile`. - - source "https://rubygems.org" - -It is possible, but not recommended as of Bundler 1.7, to add multiple global -`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository. - -Sources are checked for gems following the heuristics described in -[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler -will print a warning after installing the gem indicating which source was used, -and listing the other sources where the gem is available. A specific source can -be selected for gems that need to use a non-standard repository, suppressing -this warning, by using the [`:source` option](#SOURCE) or a -[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS). - -### CREDENTIALS - -Some gem sources require a username and password. Use [bundle config(1)](bundle-config.1.html) to set -the username and password for any of the sources that need it. The command must -be run once on each computer that will install the Gemfile, but this keeps the -credentials from being stored in plain text in version control. - - bundle config gems.example.com user:password - -For some sources, like a company Gemfury account, it may be easier to -include the credentials in the Gemfile as part of the source URL. - - source "https://user:password@gems.example.com" - -Credentials in the source URL will take precedence over credentials set using -`config`. - -## RUBY - -If your application requires a specific Ruby version or engine, specify your -requirements using the `ruby` method, with the following arguments. -All parameters are `OPTIONAL` unless otherwise specified. - -### VERSION (required) - -The version of Ruby that your application requires. If your application -requires an alternate Ruby engine, such as JRuby, Rubinius or TruffleRuby, this -should be the Ruby version that the engine is compatible with. - - ruby "1.9.3" - -### ENGINE - -Each application _may_ specify a Ruby engine. If an engine is specified, an -engine version _must_ also be specified. - -What exactly is an Engine? - - A Ruby engine is an implementation of the Ruby language. - - - For background: the reference or original implementation of the Ruby - programming language is called - [Matz's Ruby Interpreter](https://en.wikipedia.org/wiki/Ruby_MRI), or MRI - for short. This is named after Ruby creator Yukihiro Matsumoto, - also known as Matz. MRI is also known as CRuby, because it is written in C. - MRI is the most widely used Ruby engine. - - - [Other implementations](https://www.ruby-lang.org/en/about/) of Ruby exist. - Some of the more well-known implementations include - [Rubinius](https://rubinius.com/), and [JRuby](http://jruby.org/). - Rubinius is an alternative implementation of Ruby written in Ruby. - JRuby is an implementation of Ruby on the JVM, short for Java Virtual Machine. - -### ENGINE VERSION - -Each application _may_ specify a Ruby engine version. If an engine version is -specified, an engine _must_ also be specified. If the engine is "ruby" the -engine version specified _must_ match the Ruby version. - - ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7" - -### PATCHLEVEL - -Each application _may_ specify a Ruby patchlevel. - - ruby "2.0.0", :patchlevel => "247" - -## GEMS - -Specify gem requirements using the `gem` method, with the following arguments. -All parameters are `OPTIONAL` unless otherwise specified. - -### NAME (required) - -For each gem requirement, list a single _gem_ line. - - gem "nokogiri" - -### VERSION - -Each _gem_ `MAY` have one or more version specifiers. - - gem "nokogiri", ">= 1.4.2" - gem "RedCloth", ">= 4.1.0", "< 4.2.0" - -### REQUIRE AS - -Each _gem_ `MAY` specify files that should be used when autorequiring via -`Bundler.require`. You may pass an array with multiple files or `true` if the file -you want `required` has the same name as _gem_ or `false` to -prevent any file from being autorequired. - - gem "redis", :require => ["redis/connection/hiredis", "redis"] - gem "webmock", :require => false - gem "byebug", :require => true - -The argument defaults to the name of the gem. For example, these are identical: - - gem "nokogiri" - gem "nokogiri", :require => "nokogiri" - gem "nokogiri", :require => true - -### GROUPS - -Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does -not specify membership in any group is placed in the `default` group. - - gem "rspec", :group => :test - gem "wirble", :groups => [:development, :test] - -The Bundler runtime allows its two main methods, `Bundler.setup` and -`Bundler.require`, to limit their impact to particular groups. - - # setup adds gems to Ruby's load path - Bundler.setup # defaults to all groups - require "bundler/setup" # same as Bundler.setup - Bundler.setup(:default) # only set up the _default_ group - Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) - Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others - - # require requires all of the gems in the specified groups - Bundler.require # defaults to the _default_ group - Bundler.require(:default) # identical - Bundler.require(:default, :test) # requires the _default_ and _test_ groups - Bundler.require(:test) # requires the _test_ group - -The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should -not install with the `without` configuration. - -To specify multiple groups to ignore, specify a list of groups separated by spaces. - - bundle config set --local without test - bundle config set --local without development test - -Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"` -will setup all groups except for the ones you excluded via `--without` (since they -are not available). - -Note that on `bundle install`, bundler downloads and evaluates all gems, in order to -create a single canonical list of all of the required gems and their dependencies. -This means that you cannot list different versions of the same gems in different -groups. For more details, see [Understanding Bundler](https://bundler.io/rationale.html). - -### PLATFORMS - -If a gem should only be used in a particular platform or set of platforms, you can -specify them. Platforms are essentially identical to groups, except that you do not -need to use the `--without` install-time flag to exclude groups of gems for other -platforms. - -There are a number of `Gemfile` platforms: - - * `ruby`: - C Ruby (MRI), Rubinius or TruffleRuby, but `NOT` Windows - * `mri`: - Same as _ruby_, but only C Ruby (MRI) - * `mingw`: - Windows 32 bit 'mingw32' platform (aka RubyInstaller) - * `x64_mingw`: - Windows 64 bit 'mingw32' platform (aka RubyInstaller x64) - * `rbx`: - Rubinius - * `jruby`: - JRuby - * `truffleruby`: - TruffleRuby - * `mswin`: - Windows - -You can restrict further by platform and version for all platforms *except* for -`rbx`, `jruby`, `truffleruby` and `mswin`. - -To specify a version in addition to a platform, append the version number without -the delimiter to the platform. For example, to specify that a gem should only be -used on platforms with Ruby 2.3, use: - - ruby_23 - -The full list of platforms and supported versions includes: - - * `ruby`: - 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 - * `mri`: - 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 - * `mingw`: - 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 - * `x64_mingw`: - 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 - -As with groups, you can specify one or more platforms: - - gem "weakling", :platforms => :jruby - gem "ruby-debug", :platforms => :mri_18 - gem "nokogiri", :platforms => [:mri_18, :jruby] - -All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`, -`Bundler.require`) behave exactly the same as if any groups not -matching the current platform were explicitly excluded. - -### SOURCE - -You can select an alternate Rubygems repository for a gem using the ':source' -option. - - gem "some_internal_gem", :source => "https://gems.example.com" - -This forces the gem to be loaded from this source and ignores any global sources -declared at the top level of the file. If the gem does not exist in this source, -it will not be installed. - -Bundler will search for child dependencies of this gem by first looking in the -source selected for the parent, but if they are not found there, it will fall -back on global sources using the ordering described in [SOURCE PRIORITY][]. - -Selecting a specific source repository this way also suppresses the ambiguous -gem warning described above in -[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES). - -Using the `:source` option for an individual gem will also make that source -available as a possible global source for any other gems which do not specify -explicit sources. Thus, when adding gems with explicit sources, it is -recommended that you also ensure all other gems in the Gemfile are using -explicit sources. - -### GIT - -If necessary, you can specify that a gem is located at a particular -git repository using the `:git` parameter. The repository can be accessed via -several protocols: - - * `HTTP(S)`: - gem "rails", :git => "https://github.com/rails/rails.git" - * `SSH`: - gem "rails", :git => "git@github.com:rails/rails.git" - * `git`: - gem "rails", :git => "git://github.com/rails/rails.git" - -If using SSH, the user that you use to run `bundle install` `MUST` have the -appropriate keys available in their `$HOME/.ssh`. - -`NOTE`: `http://` and `git://` URLs should be avoided if at all possible. These -protocols are unauthenticated, so a man-in-the-middle attacker can deliver -malicious code and compromise your system. HTTPS and SSH are strongly -preferred. - -The `group`, `platforms`, and `require` options are available and behave -exactly the same as they would for a normal gem. - -A git repository `SHOULD` have at least one file, at the root of the -directory containing the gem, with the extension `.gemspec`. This file -`MUST` contain a valid gem specification, as expected by the `gem build` -command. - -If a git repository does not have a `.gemspec`, bundler will attempt to -create one, but it will not contain any dependencies, executables, or -C extension compilation instructions. As a result, it may fail to properly -integrate into your application. - -If a git repository does have a `.gemspec` for the gem you attached it -to, a version specifier, if provided, means that the git repository is -only valid if the `.gemspec` specifies a version matching the version -specifier. If not, bundler will print a warning. - - gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git" - # bundle install will fail, because the .gemspec in the rails - # repository's master branch specifies version 3.0.0 - -If a git repository does `not` have a `.gemspec` for the gem you attached -it to, a version specifier `MUST` be provided. Bundler will use this -version in the simple `.gemspec` it creates. - -Git repositories support a number of additional options. - - * `branch`, `tag`, and `ref`: - You `MUST` only specify at most one of these options. The default - is `:branch => "master"`. For example: - - gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-0-stable" - - gem "rails", :git => "https://github.com/rails/rails.git", :tag => "v5.0.0" - - gem "rails", :git => "https://github.com/rails/rails.git", :ref => "4aded" - - * `submodules`: - For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) - lets you have another git repository within a subfolder of your repository. - Specify `:submodules => true` to cause bundler to expand any - submodules included in the git repository - -If a git repository contains multiple `.gemspecs`, each `.gemspec` -represents a gem located at the same place in the file system as -the `.gemspec`. - - |~rails [git root] - | |-rails.gemspec [rails gem located here] - |~actionpack - | |-actionpack.gemspec [actionpack gem located here] - |~activesupport - | |-activesupport.gemspec [activesupport gem located here] - |... - -To install a gem located in a git repository, bundler changes to -the directory containing the gemspec, runs `gem build name.gemspec` -and then installs the resulting gem. The `gem build` command, -which comes standard with Rubygems, evaluates the `.gemspec` in -the context of the directory in which it is located. - -### GIT SOURCE - -A custom git source can be defined via the `git_source` method. Provide the source's name -as an argument, and a block which receives a single argument and interpolates it into a -string to return the full repo address: - - git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" } - gem 'rails', :stash => 'forks/rails' - -In addition, if you wish to choose a specific branch: - - gem "rails", :stash => "forks/rails", :branch => "branch_name" - -### GITHUB - -`NOTE`: This shorthand should be avoided until Bundler 2.0, since it -currently expands to an insecure `git://` URL. This allows a -man-in-the-middle attacker to compromise your system. - -If the git repository you want to use is hosted on GitHub and is public, you can use the -:github shorthand to specify the github username and repository name (without the -trailing ".git"), separated by a slash. If both the username and repository name are the -same, you can omit one. - - gem "rails", :github => "rails/rails" - gem "rails", :github => "rails" - -Are both equivalent to - - gem "rails", :git => "git://github.com/rails/rails.git" - -Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument. - -### GIST - -If the git repository you want to use is hosted as a Github Gist and is public, you can use -the :gist shorthand to specify the gist identifier (without the trailing ".git"). - - gem "the_hatch", :gist => "4815162342" - -Is equivalent to: - - gem "the_hatch", :git => "https://gist.github.com/4815162342.git" - -Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument. - -### BITBUCKET - -If the git repository you want to use is hosted on Bitbucket and is public, you can use the -:bitbucket shorthand to specify the bitbucket username and repository name (without the -trailing ".git"), separated by a slash. If both the username and repository name are the -same, you can omit one. - - gem "rails", :bitbucket => "rails/rails" - gem "rails", :bitbucket => "rails" - -Are both equivalent to - - gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git" - -Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument. - -### PATH - -You can specify that a gem is located in a particular location -on the file system. Relative paths are resolved relative to the -directory containing the `Gemfile`. - -Similar to the semantics of the `:git` option, the `:path` -option requires that the directory in question either contains -a `.gemspec` for the gem, or that you specify an explicit -version that bundler should use. - -Unlike `:git`, bundler does not compile C extensions for -gems specified as paths. - - gem "rails", :path => "vendor/rails" - -If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories. - - path 'components' do - gem 'admin_ui' - gem 'public_ui' - end - -## BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS - -The `:source`, `:git`, `:path`, `:group`, and `:platforms` options may be -applied to a group of gems by using block form. - - source "https://gems.example.com" do - gem "some_internal_gem" - gem "another_internal_gem" - end - - git "https://github.com/rails/rails.git" do - gem "activesupport" - gem "actionpack" - end - - platforms :ruby do - gem "ruby-debug" - gem "sqlite3" - end - - group :development, :optional => true do - gem "wirble" - gem "faker" - end - -In the case of the group block form the :optional option can be given -to prevent a group from being installed unless listed in the `--with` -option given to the `bundle install` command. - -In the case of the `git` block form, the `:ref`, `:branch`, `:tag`, -and `:submodules` options may be passed to the `git` method, and -all gems in the block will inherit those options. - -The presence of a `source` block in a Gemfile also makes that source -available as a possible global source for any other gems which do not specify -explicit sources. Thus, when defining source blocks, it is -recommended that you also ensure all other gems in the Gemfile are using -explicit sources, either via source blocks or `:source` directives on -individual gems. - -## INSTALL_IF - -The `install_if` method allows gems to be installed based on a proc or lambda. -This is especially useful for optional gems that can only be used if certain -software is installed or some other conditions are met. - - install_if -> { RUBY_PLATFORM =~ /darwin/ } do - gem "pasteboard" - end - -## GEMSPEC - -The [`.gemspec`](http://guides.rubygems.org/specification-reference/) file is where - you provide metadata about your gem to Rubygems. Some required Gemspec - attributes include the name, description, and homepage of your gem. This is - also where you specify the dependencies your gem needs to run. - -If you wish to use Bundler to help install dependencies for a gem while it is -being developed, use the `gemspec` method to pull in the dependencies listed in -the `.gemspec` file. - -The `gemspec` method adds any runtime dependencies as gem requirements in the -default group. It also adds development dependencies as gem requirements in the -`development` group. Finally, it adds a gem requirement on your project (`:path -=> '.'`). In conjunction with `Bundler.setup`, this allows you to require project -files in your test code as you would if the project were installed as a gem; you -need not manipulate the load path manually or require project files via relative -paths. - -The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group` -options, which control where bundler looks for the `.gemspec`, the glob it uses to look -for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses -(if more than one is present), and which group development dependencies are included in. - -When a `gemspec` dependency encounters version conflicts during resolution, the -local version under development will always be selected -- even if there are -remote versions that better match other requirements for the `gemspec` gem. - -## SOURCE PRIORITY - -When attempting to locate a gem to satisfy a gem requirement, -bundler uses the following priority order: - - 1. The source explicitly attached to the gem (using `:source`, `:path`, or - `:git`) - 2. For implicit gems (dependencies of explicit gems), any source, git, or path - repository declared on the parent. This results in bundler prioritizing the - ActiveSupport gem from the Rails git repository over ones from - `rubygems.org` - 3. The sources specified via global `source` lines, searching each source in - your `Gemfile` from last added to first added. diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index 50e2a698eb..8e4f9e6d36 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -32,49 +32,49 @@ RSpec.describe "bundle executable" do it "aliases e to exec" do bundle "e --help" - expect(out).to include("BUNDLE-EXEC") + expect(out).to include("bundle-exec") end it "aliases ex to exec" do bundle "ex --help" - expect(out).to include("BUNDLE-EXEC") + expect(out).to include("bundle-exec") end it "aliases exe to exec" do bundle "exe --help" - expect(out).to include("BUNDLE-EXEC") + expect(out).to include("bundle-exec") end it "aliases c to check" do bundle "c --help" - expect(out).to include("BUNDLE-CHECK") + expect(out).to include("bundle-check") end it "aliases i to install" do bundle "i --help" - expect(out).to include("BUNDLE-INSTALL") + expect(out).to include("bundle-install") end it "aliases ls to list" do bundle "ls --help" - expect(out).to include("BUNDLE-LIST") + expect(out).to include("bundle-list") end it "aliases package to cache" do bundle "package --help" - expect(out).to include("BUNDLE-CACHE") + expect(out).to include("bundle-cache") end it "aliases pack to cache" do bundle "pack --help" - expect(out).to include("BUNDLE-CACHE") + expect(out).to include("bundle-cache") end end diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb index 26159dccd8..acb312edb3 100644 --- a/spec/bundler/bundler/compact_index_client/updater_spec.rb +++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb @@ -3,28 +3,25 @@ require "net/http" require "bundler/compact_index_client" require "bundler/compact_index_client/updater" +require "tmpdir" RSpec.describe Bundler::CompactIndexClient::Updater do let(:fetcher) { double(:fetcher) } - let(:local_path) { Pathname("/tmp/localpath") } + let(:local_path) { Pathname.new Dir.mktmpdir("localpath") } let(:remote_path) { double(:remote_path) } let!(:updater) { described_class.new(fetcher) } context "when the ETag header is missing" do # Regression test for https://github.com/rubygems/bundler/issues/5463 + let(:response) { double(:response, :body => "abc123") } - let(:response) { double(:response, :body => "") } - - it "MisMatchedChecksumError is raised" do - # Twice: #update retries on failure - expect(response).to receive(:[]).with("Content-Encoding").twice { "" } - expect(response).to receive(:[]).with("ETag").twice { nil } - expect(fetcher).to receive(:call).twice { response } + it "treats the response as an update" do + expect(response).to receive(:[]).with("Content-Encoding") { "" } + expect(response).to receive(:[]).with("ETag") { nil } + expect(fetcher).to receive(:call) { response } - expect do - updater.update(local_path, remote_path) - end.to raise_error(Bundler::CompactIndexClient::Updater::MisMatchedChecksumError) + updater.update(local_path, remote_path) end end @@ -43,7 +40,8 @@ RSpec.describe Bundler::CompactIndexClient::Updater do context "when bundler doesn't have permissions on Dir.tmpdir" do it "Errno::EACCES is raised" do - allow(Dir).to receive(:mktmpdir) { raise Errno::EACCES } + local_path # create local path before stubbing mktmpdir + allow(Bundler::Dir).to receive(:mktmpdir) { raise Errno::EACCES } expect do updater.update(local_path, remote_path) diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb index e900963350..ac65c34b0d 100644 --- a/spec/bundler/bundler/env_spec.rb +++ b/spec/bundler/bundler/env_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "openssl" require "bundler/settings" RSpec.describe Bundler::Env do diff --git a/spec/bundler/bundler/fetcher/index_spec.rb b/spec/bundler/bundler/fetcher/index_spec.rb index 5ecd7d9e05..b8ce46321e 100644 --- a/spec/bundler/bundler/fetcher/index_spec.rb +++ b/spec/bundler/bundler/fetcher/index_spec.rb @@ -17,100 +17,81 @@ RSpec.describe Bundler::Fetcher::Index do end context "error handling" do - shared_examples_for "the error is properly handled" do - let(:remote_uri) { Bundler::URI("http://remote-uri.org") } - before do - allow(subject).to receive(:remote_uri).and_return(remote_uri) - end + let(:remote_uri) { Bundler::URI("http://remote-uri.org") } + before do + allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, display_uri) } + allow(subject).to receive(:remote_uri).and_return(remote_uri) + end - context "when certificate verify failed" do - let(:error_message) { "certificate verify failed" } + context "when certificate verify failed" do + let(:error_message) { "certificate verify failed" } - it "should raise a Bundler::Fetcher::CertificateFailureError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::CertificateFailureError, - %r{Could not verify the SSL certificate for http://sample_uri.com}) - end + it "should raise a Bundler::Fetcher::CertificateFailureError" do + expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::CertificateFailureError, + %r{Could not verify the SSL certificate for http://sample_uri.com}) end + end - context "when a 401 response occurs" do - let(:error_message) { "401" } - - before do - allow(remote_uri).to receive(:userinfo).and_return(userinfo) - end - - context "and there was userinfo" do - let(:userinfo) { double(:userinfo) } + context "when a 401 response occurs" do + let(:error_message) { "401" } - 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 + before do + allow(remote_uri).to receive(:userinfo).and_return(userinfo) + end - context "and there was no userinfo" do - let(:userinfo) { nil } + context "and there was userinfo" do + let(:userinfo) { double(:userinfo) } - 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 + 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 "when a 403 response occurs" do - let(:error_message) { "403" } + context "and there was no userinfo" do + let(:userinfo) { nil } - before do - allow(remote_uri).to receive(:userinfo).and_return(userinfo) + 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 - context "and there was userinfo" do - let(:userinfo) { double(:userinfo) } + context "when a 403 response occurs" do + let(:error_message) { "403" } - 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 + before do + allow(remote_uri).to receive(:userinfo).and_return(userinfo) + end - context "and there was no userinfo" do - let(:userinfo) { nil } + context "and there was userinfo" do + let(:userinfo) { double(:userinfo) } - 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 + 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 "any other message is returned" do - let(:error_message) { "You get an error, you get an error!" } - - before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) } + context "and there was no userinfo" do + let(:userinfo) { nil } - it "should raise a Bundler::HTTPError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com") + 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 - context "when a Gem::RemoteFetcher::FetchError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, nil) } } + context "any other message is returned" do + let(:error_message) { "You get an error, you get an error!" } - it_behaves_like "the error is properly handled" - end + before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) } - context "when a OpenSSL::SSL::SSLError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise OpenSSL::SSL::SSLError.new(error_message) } } - - it_behaves_like "the error is properly handled" - end - - context "when a Net::HTTPFatalError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Net::HTTPFatalError.new(error_message, 404) } } - - it_behaves_like "the error is properly handled" + it "should raise a Bundler::HTTPError" do + expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com due to underlying error ") + end end end end diff --git a/spec/bundler/bundler/plugin/api/source_spec.rb b/spec/bundler/bundler/plugin/api/source_spec.rb index 2c50ff56a4..428ceb220a 100644 --- a/spec/bundler/bundler/plugin/api/source_spec.rb +++ b/spec/bundler/bundler/plugin/api/source_spec.rb @@ -79,4 +79,10 @@ RSpec.describe Bundler::Plugin::API::Source do end end end + + describe "to_s" do + it "returns the string with type and uri" do + expect(source.to_s).to eq("plugin source for spec_type with uri uri://to/test") + end + end end diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb index 169d7234b4..4744e0cd4c 100644 --- a/spec/bundler/bundler/source/git/git_proxy_spec.rb +++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do let(:path) { Pathname("path") } - let(:uri) { "https://github.com/bundler/bundler.git" } + let(:uri) { "https://github.com/rubygems/rubygems.git" } let(:ref) { "HEAD" } let(:revision) { nil } let(:git_source) { nil } @@ -11,20 +11,20 @@ RSpec.describe Bundler::Source::Git::GitProxy do context "with configured credentials" do it "adds username and password to URI" do Bundler.settings.temporary(uri => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git")) + expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git")) subject.checkout end end it "adds username and password to URI for host" do Bundler.settings.temporary("github.com" => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git")) + expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git")) subject.checkout end end it "does not add username and password to mismatched URI" do - Bundler.settings.temporary("https://u:p@github.com/bundler/bundler-mismatch.git" => "u:p") do + Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do expect(subject).to receive(:git_retry).with(match(uri)) subject.checkout end @@ -32,7 +32,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do it "keeps original userinfo" do Bundler.settings.temporary("github.com" => "u:p") do - original = "https://orig:info@github.com/bundler/bundler.git" + original = "https://orig:info@github.com/rubygems/rubygems.git" subject = described_class.new(Pathname("path"), original, "HEAD") expect(subject).to receive(:git_retry).with(match(original)) subject.checkout diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb index 2b5ba733f0..161ec64218 100644 --- a/spec/bundler/cache/gems_spec.rb +++ b/spec/bundler/cache/gems_spec.rb @@ -197,7 +197,12 @@ RSpec.describe "bundle cache" do end it "adds and removes when gems are updated" do - update_repo2 + update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + end + bundle "update", :all => true expect(cached_gem("rack-1.2")).to exist expect(cached_gem("rack-1.0.0")).not_to exist diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 632c521caa..3b177b32ea 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -51,6 +51,18 @@ RSpec.describe "bundle binstubs " do expect(bundled_app("bin/rake")).to exist end + it "allows installing binstubs for all platforms" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + + bundle "binstubs rack --all-platforms" + + expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/rackup.cmd")).to exist + end + it "displays an error when used without any gem" do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -96,6 +108,10 @@ RSpec.describe "bundle binstubs " do before do pristine_system_gems "bundler-#{system_bundler_version}" build_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "prints_loaded_gems", "1.0" do |s| s.executables = "print_loaded_gems" s.bindir = "exe" @@ -262,7 +278,7 @@ RSpec.describe "bundle binstubs " do end it "sets correct permissions for binstubs" do - skip "https://github.com/rubygems/bundler/issues/6895" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3352" if Gem.win_platform? with_umask(0o002) do install_gemfile <<-G @@ -352,6 +368,14 @@ RSpec.describe "bundle binstubs " do expect(bundled_app("foo/rackup")).to exist end end + + context "when specified --all-platforms option" do + it "generates standalone binstubs for all platforms" do + bundle "binstubs rack --standalone --all-platforms" + expect(bundled_app("bin/rackup")).to exist + expect(bundled_app("bin/rackup.cmd")).to exist + end + end end context "when the bin already exists" do @@ -417,8 +441,14 @@ RSpec.describe "bundle binstubs " do end it "works if the gem has development dependencies" do + build_repo2 do + build_gem "with_development_dependency" do |s| + s.add_development_dependency "activesupport", "= 2.3.5" + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "with_development_dependency" G diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index dd69172677..5a746591b3 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -71,13 +71,19 @@ RSpec.describe "bundle check" do end it "prints a generic message if you changed your lockfile" do + build_repo2 do + build_gem "rails_pinned_to_old_activesupport" do |s| + s.add_dependency "activesupport", "= 1.2.3" + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem 'rails' G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rails" gem "rails_pinned_to_old_activesupport" G diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index bd8e7f16c7..7c43aaabc4 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -603,8 +603,7 @@ RSpec.describe "bundle clean" do it "when using --force on system gems, it doesn't remove binaries" do bundle "config set path.system true" - build_repo2 - update_repo2 do + build_repo2 do build_gem "bindir" do |s| s.bindir = "exe" s.executables = "foo" @@ -640,7 +639,7 @@ RSpec.describe "bundle clean" do end end - realworld_system_gems "fiddle" + realworld_system_gems "fiddle --version 1.0.0" install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb index 3092184f45..6f1e96261e 100644 --- a/spec/bundler/commands/console_spec.rb +++ b/spec/bundler/commands/console_spec.rb @@ -2,8 +2,43 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do before :each do + build_repo2 do + # A minimal fake pry console + build_gem "pry" do |s| + s.write "lib/pry.rb", <<-RUBY + class Pry + class << self + def toplevel_binding + unless defined?(@toplevel_binding) && @toplevel_binding + TOPLEVEL_BINDING.eval %{ + def self.__pry__; binding; end + Pry.instance_variable_set(:@toplevel_binding, __pry__) + class << self; undef __pry__; end + } + end + @toplevel_binding.eval('private') + @toplevel_binding + end + + def __pry__ + while line = gets + begin + puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1') + rescue Exception => e + puts "\#{e.class}: \#{e.message}" + puts e.backtrace.first + end + end + end + alias start __pry__ + end + end + RUBY + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development @@ -28,7 +63,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "starts another REPL if configured as such" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "pry" G bundle "config set console pry" @@ -87,7 +122,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index fbce4b7bc1..4c34964053 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -68,7 +68,7 @@ RSpec.describe "bundle exec" do end it "respects custom process title when loading through ruby" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility = <<~'RUBY' Process.setproctitle("1-2-3-4-5-6-7") @@ -93,7 +93,7 @@ RSpec.describe "bundle exec" do end it "handles --keep-file-descriptors" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? require "tempfile" @@ -126,7 +126,7 @@ RSpec.describe "bundle exec" do end it "can run a command named --verbose" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile 'gem "rack"' File.open(bundled_app("--verbose"), "w") do |f| @@ -286,7 +286,7 @@ RSpec.describe "bundle exec" do end it "does not duplicate already exec'ed RUBYOPT" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -304,7 +304,7 @@ RSpec.describe "bundle exec" do end it "does not duplicate already exec'ed RUBYLIB" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -357,7 +357,7 @@ RSpec.describe "bundle exec" do bundle "config set clean false" # want to keep the rackup binstub install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" - gem "with_license" + gem "foo" G [true, false].each do |l| bundle "config set disable_exec_load #{l}" @@ -373,7 +373,7 @@ RSpec.describe "bundle exec" do each_prefix.call("exec") do |exec| describe "when #{exec} is used" do before(:each) do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -588,7 +588,7 @@ RSpec.describe "bundle exec" do describe "with gems bundled for deployment" do it "works when calling bundler from another script" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? gemfile <<-G module Monkey @@ -644,7 +644,7 @@ RSpec.describe "bundle exec" do shared_examples_for "it runs" do it "like a normally executed executable" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? subject expect(exitstatus).to eq(exit_code) @@ -698,15 +698,23 @@ RSpec.describe "bundle exec" do let(:exit_code) { 1 } let(:expected_err) do "bundler: failed to load command: #{path} (#{path})" \ - "\nRuntimeError: ERROR\n #{path}:10:in `'" + "\n#{path}:10:in `': ERROR (RuntimeError)" + end + + it "runs like a normally executed executable" do + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? + + subject + expect(exitstatus).to eq(exit_code) + expect(err).to start_with(expected_err) + expect(out).to eq(expected) end - it_behaves_like "it runs" end context "the executable raises an error without a backtrace" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } - let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } + let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\n#{system_gem_path("bin/bundle")}: Err (Err)" } let(:expected) { super() } it_behaves_like "it runs" @@ -747,7 +755,7 @@ RSpec.describe "bundle exec" do let(:expected) { "" } let(:expected_err) { <<-EOS.strip } \e[31mCould not find gem 'rack (= 2)' in locally installed gems. -The source contains 'rack' at: 1.0.0\e[0m +The source contains the following versions of 'rack': 1.0.0\e[0m \e[33mRun `bundle install` to install missing gems.\e[0m EOS @@ -825,7 +833,7 @@ __FILE__: #{path.to_s.inspect} RUBY it "receives the signal" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? bundle("exec #{path}") do |_, o, thr| o.gets # Consumes 'Started' and ensures that thread has started @@ -848,7 +856,7 @@ __FILE__: #{path.to_s.inspect} RUBY it "makes sure no unexpected signals are restored to DEFAULT" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? test_signals.each do |n| Signal.trap(n, "IGNORE") @@ -865,6 +873,8 @@ __FILE__: #{path.to_s.inspect} context "nested bundle exec" do context "when bundle in a local path" do before do + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? + gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -874,8 +884,6 @@ __FILE__: #{path.to_s.inspect} end it "correctly shells out" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? - file = bundled_app("file_that_bundle_execs.rb") create_file(file, <<-RUBY) #!#{Gem.ruby} @@ -887,12 +895,55 @@ __FILE__: #{path.to_s.inspect} end end + context "when Kernel.require uses extra monkeypatches" do + before do + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? + + install_gemfile "" + end + + it "does not undo the monkeypatches" do + karafka = bundled_app("bin/karafka") + create_file(karafka, <<~RUBY) + #!#{Gem.ruby} + + module Kernel + module_function + + alias_method :require_before_extra_monkeypatches, :require + + def require(path) + puts "requiring \#{path} used the monkeypatch" + + require_before_extra_monkeypatches(path) + end + end + + Bundler.setup(:default) + + require "foo" + RUBY + karafka.chmod(0o777) + + foreman = bundled_app("bin/foreman") + create_file(foreman, <<~RUBY) + #!#{Gem.ruby} + + puts `bundle exec bin/karafka` + RUBY + foreman.chmod(0o777) + + bundle "exec #{foreman}" + expect(out).to eq("requiring foo used the monkeypatch") + end + end + context "with a system gem that shadows a default gem" do let(:openssl_version) { "99.9.9" } let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil, :raise_on_error => false } it "only leaves the default gem in the stdlib available" do - skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? + skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? skip "openssl isn't a default gem" if expected.empty? install_gemfile "" # must happen before installing the broken system gem diff --git a/spec/bundler/commands/fund_spec.rb b/spec/bundler/commands/fund_spec.rb index ee3aff3a29..5a0c5411da 100644 --- a/spec/bundler/commands/fund_spec.rb +++ b/spec/bundler/commands/fund_spec.rb @@ -1,24 +1,51 @@ # frozen_string_literal: true RSpec.describe "bundle fund" do + before do + build_repo2 do + build_gem "has_funding_and_other_metadata" do |s| + s.metadata = { + "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", + "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", + "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", + "homepage_uri" => "https://bestgemever.example.io", + "mailing_list_uri" => "https://groups.example.com/bestgemever", + "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding", + "source_code_uri" => "https://example.com/user/bestgemever", + "wiki_uri" => "https://example.com/user/bestgemever/wiki", + } + end + + build_gem "has_funding", "1.2.3" do |s| + s.metadata = { + "funding_uri" => "https://example.com/has_funding/funding", + } + end + + build_gem "gem_with_dependent_funding", "1.0" do |s| + s.add_dependency "has_funding" + end + end + end + it "prints fund information for all gems in the bundle" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' + source "#{file_uri_for(gem_repo2)}" + gem 'has_funding_and_other_metadata' gem 'has_funding' gem 'rack-obama' G bundle "fund" - expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding") + expect(out).to include("* has_funding_and_other_metadata (1.0)\n Funding: https://example.com/has_funding_and_other_metadata/funding") expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") expect(out).to_not include("rack-obama") end it "does not consider fund information for gem dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem 'gem_with_dependent_funding' G @@ -30,7 +57,7 @@ RSpec.describe "bundle fund" do it "prints message if none of the gems have fund information" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem 'rack-obama' G @@ -42,13 +69,13 @@ RSpec.describe "bundle fund" do describe "with --group option" do it "prints fund message for only specified group gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata', :group => :development + source "#{file_uri_for(gem_repo2)}" + gem 'has_funding_and_other_metadata', :group => :development gem 'has_funding' G bundle "fund --group development" - expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding") + expect(out).to include("* has_funding_and_other_metadata (1.0)\n Funding: https://example.com/has_funding_and_other_metadata/funding") expect(out).to_not include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") end end diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb index eec9c773bc..6bc07ea399 100644 --- a/spec/bundler/commands/info_spec.rb +++ b/spec/bundler/commands/info_spec.rb @@ -3,8 +3,22 @@ RSpec.describe "bundle info" do context "with a standard Gemfile" do before do + build_repo2 do + build_gem "has_metadata" do |s| + s.metadata = { + "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", + "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", + "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", + "homepage_uri" => "https://bestgemever.example.io", + "mailing_list_uri" => "https://groups.example.com/bestgemever", + "source_code_uri" => "https://example.com/user/bestgemever", + "wiki_uri" => "https://example.com/user/bestgemever/wiki", + } + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rails" gem "has_metadata" G @@ -66,7 +80,6 @@ RSpec.describe "bundle info" do \tHomepage: http://example.com \tDocumentation: https://www.example.info/gems/bestgemever/0.0.1 \tSource Code: https://example.com/user/bestgemever -\tFunding: https://example.com/has_metadata/funding \tWiki: https://example.com/user/bestgemever/wiki \tChangelog: https://example.com/user/bestgemever/CHANGELOG.md \tBug Tracker: https://example.com/user/bestgemever/issues diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index d1b8585114..a8b174a547 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -141,8 +141,14 @@ RSpec.describe "bundle install with gem sources" do end it "does not install the development dependency" do + build_repo2 do + build_gem "with_development_dependency" do |s| + s.add_development_dependency "activesupport", "= 2.3.5" + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "with_development_dependency" G @@ -216,6 +222,18 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" end + it "loads env plugins" do + plugin_msg = "hello from an env plugin!" + create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'" + rubylib = ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR).unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR) + install_gemfile <<-G, :env => { "RUBYLIB" => rubylib } + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + + expect(last_command.stdboth).to include(plugin_msg) + end + describe "with a gem that installs multiple platforms" do it "installs gems for the local platform as first choice" do skip "version is 1.0, not 1.0.0" if Gem.win_platform? @@ -294,8 +312,11 @@ RSpec.describe "bundle install with gem sources" do end it "finds gems in multiple sources", :bundler => "< 3" do - build_repo2 - update_repo2 + build_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + end install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" diff --git a/spec/bundler/commands/licenses_spec.rb b/spec/bundler/commands/licenses_spec.rb index d4fa02d0a7..a203984890 100644 --- a/spec/bundler/commands/licenses_spec.rb +++ b/spec/bundler/commands/licenses_spec.rb @@ -2,8 +2,14 @@ RSpec.describe "bundle licenses" do before :each do + build_repo2 do + build_gem "with_license" do |s| + s.license = "MIT" + end + end + install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rails" gem "with_license" G @@ -18,7 +24,7 @@ RSpec.describe "bundle licenses" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rails" gem "with_license" gem "foo" diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index ed3edad163..66930ded75 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -117,6 +117,10 @@ RSpec.describe "bundle list" do context "with paths option" do before do build_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "bar" end diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index c97358c62d..cc56c34952 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -15,7 +15,7 @@ RSpec.describe "bundle lock" do gemfile <<-G source "#{file_uri_for(repo)}" gem "rails" - gem "with_license" + gem "weakling" gem "foo" G @@ -40,7 +40,7 @@ RSpec.describe "bundle lock" do activeresource (= 2.3.2) rake (= 13.0.1) rake (13.0.1) - with_license (1.0) + weakling (0.0.3) PLATFORMS #{lockfile_platforms} @@ -48,7 +48,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES foo rails - with_license + weakling BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index beee2b0fdc..421ffa80c6 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -14,6 +14,7 @@ RSpec.describe "bundle gem" do prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) rubocop_version = RUBY_VERSION > "2.4" ? "0.90.0" : "0.80.1" gems = ["minitest", "rake", "rake-compiler", "rspec", "rubocop -v #{rubocop_version}", "test-unit"] + gems.unshift "parallel -v 1.19.2" if RUBY_VERSION < "2.5" gems += ["rubocop-ast -v 0.4.0"] if rubocop_version == "0.90.0" path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app(gem_name)) : system_gem_path realworld_system_gems gems, :path => path @@ -423,7 +424,7 @@ RSpec.describe "bundle gem" do it "requires the version file" do bundle "gem #{gem_name}" - expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require "#{require_path}/version"}) + expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require_relative "#{require_relative_path}/version"}) end it "creates a base error class" do @@ -910,6 +911,8 @@ RSpec.describe "bundle gem" do let(:require_path) { "test_gem" } + let(:require_relative_path) { "test_gem" } + let(:flags) { nil } it "does not nest constants" do @@ -963,6 +966,8 @@ RSpec.describe "bundle gem" do let(:require_path) { "test/gem" } + let(:require_relative_path) { "gem" } + it "nests constants so they work" do bundle "gem #{gem_name}" expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module Test\n module Gem/) diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index bee4490a8d..46c42fea10 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -83,7 +83,7 @@ RSpec.describe "bundle remove" do end end - describe "remove mutiple gems from gemfile" do + describe "remove multiple gems from gemfile" do context "when all gems are present in gemfile" do it "shows success fir all removed gems" do gemfile <<-G @@ -210,7 +210,7 @@ RSpec.describe "bundle remove" do end end - context "when the gem belongs to mutiple groups" do + context "when the gem belongs to multiple groups" do it "removes the groups" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -616,4 +616,84 @@ RSpec.describe "bundle remove" do expect(out).to include("foo could not be removed.") end end + + describe "with comments that mention gems" do + context "when comment is a separate line comment" do + it "does not remove the line comment" do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + + # gem "rack" might be used in the future + gem "rack" + G + + bundle "remove rack" + + expect(out).to include("rack was removed.") + gemfile_should_be <<-G + source "#{file_uri_for(gem_repo1)}" + + # gem "rack" might be used in the future + G + end + end + + context "when gem specified for removal has an inline comment" do + it "removes the inline comment" do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + + gem "rack" # this can be removed + G + + bundle "remove rack" + + expect(out).to include("rack was removed.") + gemfile_should_be <<-G + source "#{file_uri_for(gem_repo1)}" + G + end + end + + context "when gem specified for removal is mentioned in other gem's comment" do + it "does not remove other gem" do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "puma" # implements interface provided by gem "rack" + + gem "rack" + G + + bundle "remove rack" + + expect(out).to_not include("puma was removed.") + expect(out).to include("rack was removed.") + gemfile_should_be <<-G + source "#{file_uri_for(gem_repo1)}" + gem "puma" # implements interface provided by gem "rack" + G + end + end + + context "when gem specified for removal has a comment that mentions other gem" do + it "does not remove other gem" do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "puma" # implements interface provided by gem "rack" + + gem "rack" + G + + bundle "remove puma" + + expect(out).to include("puma was removed.") + expect(out).to_not include("rack was removed.") + gemfile_should_be <<-G + source "#{file_uri_for(gem_repo1)}" + + gem "rack" + G + end + end + end end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 5ab932e5d7..b8de6507f6 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -15,6 +15,10 @@ RSpec.describe "bundle update" do describe "with no arguments", :bundler => "< 3" do it "updates the entire bundle" do update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end @@ -38,6 +42,10 @@ RSpec.describe "bundle update" do describe "with --all", :bundler => "3" do it "updates the entire bundle" do update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end @@ -103,6 +111,10 @@ RSpec.describe "bundle update" do describe "with a top level dependency" do it "unlocks all child dependencies that are unrelated to other locked dependencies" do update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end @@ -124,7 +136,12 @@ RSpec.describe "bundle update" do describe "with a child dependency" do it "should update the child dependency" do - update_repo2 + update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + end + bundle "update rack" expect(the_bundle).to include_gems "rack 1.2" end @@ -217,6 +234,10 @@ RSpec.describe "bundle update" do gem "rack" G update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end bundle "update --group development" @@ -269,6 +290,10 @@ RSpec.describe "bundle update" do gem "rack" G update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end bundle "update --group development" @@ -446,6 +471,10 @@ RSpec.describe "bundle update in more complicated situations" do G update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "thin", "2.0" do |s| s.add_dependency "rack" end diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb index e5352ab6a2..af1ff7225a 100644 --- a/spec/bundler/install/bundler_spec.rb +++ b/spec/bundler/install/bundler_spec.rb @@ -54,6 +54,12 @@ RSpec.describe "bundle install" do end it "works for gems with multiple versions in its dependencies" do + build_repo2 do + build_gem "multiple_versioned_deps" do |s| + s.add_dependency "weakling", ">= 0.0.1", "< 0.1" + end + end + install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" @@ -93,6 +99,12 @@ RSpec.describe "bundle install" do it "causes a conflict if child dependencies conflict" do bundle "config set force_ruby_platform true" + update_repo2 do + build_gem "rails_pinned_to_old_activesupport" do |s| + s.add_dependency "activesupport", "= 1.2.3" + end + end + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "activemerchant" @@ -114,6 +126,12 @@ RSpec.describe "bundle install" do it "causes a conflict if a child dependency conflicts with the Gemfile" do bundle "config set force_ruby_platform true" + update_repo2 do + build_gem "rails_pinned_to_old_activesupport" do |s| + s.add_dependency "activesupport", "= 1.2.3" + end + end + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rails_pinned_to_old_activesupport" @@ -132,6 +150,12 @@ RSpec.describe "bundle install" do end it "does not cause a conflict if new dependencies in the Gemfile require older dependencies than the lockfile" do + update_repo2 do + build_gem "rails_pinned_to_old_activesupport" do |s| + s.add_dependency "activesupport", "= 1.2.3" + end + end + install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem 'rails', "2.3.2" diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 441daabe72..357f4512f1 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -361,10 +361,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config --local deployment true" bundle :install, :raise_on_error => false expect(err).to include("deployment mode") - # The drive letter of the Windows environment is fragile value in GitHub Actions - unless Gem.win_platform? - expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") - end + expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") expect(err).not_to include("You have added to the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end @@ -388,10 +385,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config --local deployment true" bundle :install, :raise_on_error => false expect(err).to include("deployment mode") - # The drive letter of the Windows environment is fragile value in GitHub Actions - unless Gem.win_platform? - expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") - end + expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") expect(err).not_to include("You have added to the Gemfile") expect(err).not_to include("You have deleted from the Gemfile") end diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index 8e13ac05a9..7a95a8abde 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -422,8 +422,6 @@ RSpec.describe "bundle install from an existing gemspec" do end end - bundle "config specific_platform false" - %w[ruby jruby].each do |platform| simulate_platform(platform) do install_gemfile <<-G diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index a70fb18c45..7850fad8d0 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -30,11 +30,15 @@ RSpec.describe "bundle install with git sources" do expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 end - it "caches the git repo globally" do + it "caches the git repo globally and properly uses the cached repo on the next invocation" do simulate_new_machine bundle "config set global_gem_cache true" bundle :install expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1 + + bundle "install --verbose" + expect(err).to be_empty + expect(out).to include("Using foo 1.0 from #{lib_path("foo")}") end it "caches the evaluated gemspec" do @@ -83,7 +87,7 @@ RSpec.describe "bundle install with git sources" do gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}" G - expect(err).to include("The source contains 'foo' at: 1.0") + expect(err).to include("The source contains the following versions of 'foo': 1.0") end it "complains with version and platform if pinned specs don't exist in the git repo" do @@ -99,7 +103,7 @@ RSpec.describe "bundle install with git sources" do end G - expect(err).to include("The source contains 'only_java' at: 1.0 java") + expect(err).to include("The source contains the following versions of 'only_java': 1.0 java") end it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do @@ -120,7 +124,7 @@ RSpec.describe "bundle install with git sources" do end G - expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java") + expect(err).to include("The source contains the following versions of 'only_java': 1.0 java, 1.1 java") end it "still works after moving the application directory" do @@ -933,8 +937,6 @@ RSpec.describe "bundle install with git sources" do end it "prints a friendly error if a file blocks the git repo" do - skip "drive letter is not detected correctly in error message" if Gem.win_platform? - build_git "foo" FileUtils.mkdir_p(default_bundle_path) diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index 07722d09dd..f19fe39721 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -718,11 +718,11 @@ RSpec.describe "bundle install with explicit source paths" do expect(bar_file).not_to be_file build_lib "foo" do |s| - s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{foo_file}')") + s.write("lib/rubygems_plugin.rb", "require 'fileutils'; FileUtils.touch('#{foo_file}')") end build_git "bar" do |s| - s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{bar_file}')") + s.write("lib/rubygems_plugin.rb", "require 'fileutils'; FileUtils.touch('#{bar_file}')") end install_gemfile <<-G diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index 41b95481cb..46fc393fe9 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -255,32 +255,6 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end - it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do - simulate_platform x64_mac - - update_repo2 do - build_gem "facter", "2.4.6" - build_gem "facter", "2.4.6" do |s| - s.platform = "universal-darwin" - s.add_runtime_dependency "CFPropertyList" - end - build_gem "CFPropertyList" - end - - install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - - gem "facter" - G - - expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \ - "because it has different dependencies from the ruby version. " \ - "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again." - - expect(the_bundle).to include_gem "facter 2.4.6" - expect(the_bundle).not_to include_gem "CFPropertyList" - end - it "works with gems with platform-specific dependency having different requirements order" do simulate_platform x64_mac @@ -430,7 +404,7 @@ RSpec.describe "bundle install with platform conditionals" do expect(out).not_to match(/Could not find gem 'some_gem/) end - it "resolves all platforms by default and without warning messages" do + it "does not print a warning when a dependency is unused on a platform different from the current one" do simulate_platform "ruby" gemfile <<-G @@ -447,14 +421,9 @@ RSpec.describe "bundle install with platform conditionals" do GEM remote: #{file_uri_for(gem_repo1)}/ specs: - rack (1.0.0) PLATFORMS - java ruby - x64-mingw32 - x86-mingw32 - x86-mswin32 DEPENDENCIES rack @@ -469,13 +438,21 @@ RSpec.describe "when a gem has no architecture" do it "still installs correctly" do simulate_platform mswin + build_repo2 do + # The rcov gem is platform mswin32, but has no arch + build_gem "rcov" do |s| + s.platform = Gem::Platform.new([nil, "mswin32", nil]) + s.write "lib/rcov.rb", "RCOV = '1.0.0'" + end + end + gemfile <<-G # Try to install gem with nil arch source "http://localgemserver.test/" gem "rcov" G - bundle :install, :artifice => "windows" + bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(the_bundle).to include_gems "rcov 1.0.0" end end diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index be41857043..655f91dd69 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -597,6 +597,10 @@ RSpec.describe "bundle install with gems on multiple sources" do G build_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "bar" end diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index 959ffbf615..82492e78cb 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -1,53 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle install with specific_platform enabled" do - before do - bundle "config set specific_platform true" - - build_repo2 do - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "universal-darwin" } - - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") - - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "universal-darwin" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") - - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "universal-darwin" } - - build_gem("google-protobuf", "3.0.0.alpha.4.0") - build_gem("google-protobuf", "3.0.0.alpha.3.1.pre") - build_gem("google-protobuf", "3.0.0.alpha.3") - build_gem("google-protobuf", "3.0.0.alpha.2.0") - build_gem("google-protobuf", "3.0.0.alpha.1.1") - build_gem("google-protobuf", "3.0.0.alpha.1.0") - - build_gem("facter", "2.4.6") - build_gem("facter", "2.4.6") do |s| - s.platform = "universal-darwin" - s.add_runtime_dependency "CFPropertyList" - end - build_gem("CFPropertyList") - end - end - +RSpec.describe "bundle install with specific platforms" do let(:google_protobuf) { <<-G } source "#{file_uri_for(gem_repo2)}" gem "google-protobuf" @@ -57,6 +10,7 @@ RSpec.describe "bundle install with specific_platform enabled" do before { simulate_platform "x86_64-darwin-15" } it "locks to both the specific darwin platform and ruby" do + setup_multiplatform_gem install_gemfile(google_protobuf) allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")]) @@ -67,14 +21,66 @@ RSpec.describe "bundle install with specific_platform enabled" do ]) end - it "caches both the universal-darwin and ruby gems when --all-platforms is passed" do + it "caches both the universal-darwin and ruby gems when --all-platforms is passed and properly picks them up on further bundler invocations" do + setup_multiplatform_gem + gemfile(google_protobuf) + bundle "cache --all-platforms" + expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]). + to all(exist) + + bundle "install --verbose" + expect(err).to be_empty + end + + it "caches both the universal-darwin and ruby gems when cache_all_platforms is configured and properly picks them up on further bundler invocations" do + setup_multiplatform_gem gemfile(google_protobuf) - bundle "package --all-platforms" + bundle "config set --local cache_all_platforms true" + bundle "cache" expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]). to all(exist) + + bundle "install --verbose" + expect(err).to be_empty + end + + it "caches multiplatform git gems with a single gemspec when --all-platforms is passed" do + git = build_git "pg_array_parser", "1.0" + + gemfile <<-G + gem "pg_array_parser", :git => "#{lib_path("pg_array_parser-1.0")}" + G + + lockfile <<-L + GIT + remote: #{lib_path("pg_array_parser-1.0")} + revision: #{git.ref_for("master")} + specs: + pg_array_parser (1.0-java) + pg_array_parser (1.0) + + GEM + specs: + + PLATFORMS + java + #{lockfile_platforms} + + DEPENDENCIES + pg_array_parser! + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "config set --local cache_all true" + bundle "cache --all-platforms" + + expect(err).to be_empty end it "uses the platform-specific gem with extra dependencies" do + setup_multiplatform_gem_with_different_dependencies_per_platform install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem "facter" @@ -94,6 +100,7 @@ RSpec.describe "bundle install with specific_platform enabled" do end it "adds the foreign platform" do + setup_multiplatform_gem install_gemfile(google_protobuf) bundle "lock --add-platform=#{x64_mingw}" @@ -106,6 +113,7 @@ RSpec.describe "bundle install with specific_platform enabled" do end it "falls back on plain ruby when that version doesnt have a platform-specific gem" do + setup_multiplatform_gem install_gemfile(google_protobuf) bundle "lock --add-platform=#{java}" @@ -117,4 +125,55 @@ RSpec.describe "bundle install with specific_platform enabled" do end end end + + private + + def setup_multiplatform_gem + build_repo2 do + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86_64-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x64-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "universal-darwin" } + + build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86_64-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x64-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.5") + + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "universal-darwin" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86_64-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x64-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.4") + + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86_64-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-linux" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x64-mingw32" } + build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "universal-darwin" } + + build_gem("google-protobuf", "3.0.0.alpha.4.0") + build_gem("google-protobuf", "3.0.0.alpha.3.1.pre") + build_gem("google-protobuf", "3.0.0.alpha.3") + build_gem("google-protobuf", "3.0.0.alpha.2.0") + build_gem("google-protobuf", "3.0.0.alpha.1.1") + build_gem("google-protobuf", "3.0.0.alpha.1.0") + end + end + + def setup_multiplatform_gem_with_different_dependencies_per_platform + build_repo2 do + build_gem("facter", "2.4.6") + build_gem("facter", "2.4.6") do |s| + s.platform = "universal-darwin" + s.add_runtime_dependency "CFPropertyList" + end + build_gem("CFPropertyList") + end + end end diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 5ef3f38fe7..b5fca9c6ad 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -138,19 +138,6 @@ RSpec.describe "compact index api" do expect(the_bundle).to include_gems("foo 1.0") end - it "falls back when the API errors out" do - simulate_platform mswin - - gemfile <<-G - source "#{source_uri}" - gem "rcov" - G - - bundle :install, :artifice => "windows" - expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rcov 1.0.0" - end - it "falls back when the API URL returns 403 Forbidden" do gemfile <<-G source "#{source_uri}" @@ -258,14 +245,37 @@ The checksum of /versions does not match the checksum provided by the server! So end it "does not double check for gems that are only installed locally" do - system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0] + build_repo2 do + build_gem "net_a" do |s| + s.add_dependency "net_b" + s.add_dependency "net_build_extensions" + end + + build_gem "net_b" + + build_gem "net_build_extensions" do |s| + s.add_dependency "rake" + s.extensions << "Rakefile" + s.write "Rakefile", <<-RUBY + task :default do + path = File.expand_path("../lib", __FILE__) + FileUtils.mkdir_p(path) + File.open("\#{path}/net_build_extensions.rb", "w") do |f| + f.puts "NET_BUILD_EXTENSIONS = 'YES'" + end + end + RUBY + end + end + + system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0], :gem_repo => gem_repo2 bundle "config set --local path.system true" ENV["BUNDLER_SPEC_ALL_REQUESTS"] = strip_whitespace(<<-EOS).strip #{source_uri}/versions #{source_uri}/info/rack EOS - install_gemfile <<-G, :artifice => "compact_index", :verbose => true + install_gemfile <<-G, :artifice => "compact_index", :verbose => true, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } source "#{source_uri}" gem "rack" G @@ -499,13 +509,19 @@ The checksum of /versions does not match the checksum provided by the server! So end it "does not refetch if the only unmet dependency is bundler" do + build_repo2 do + build_gem "bundler_dep" do |s| + s.add_dependency "bundler" + end + end + gemfile <<-G source "#{source_uri}" gem "bundler_dep" G - bundle :install, :artifice => "compact_index" + bundle :install, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching gem metadata from #{source_uri}") end @@ -598,27 +614,6 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rack 1.0.0" end - it "strips http basic authentication creds for modern index" do - gemfile <<-G - source "#{basic_auth_source_uri}" - gem "rack" - G - - bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" - expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" - end - - it "strips http basic auth creds when it can't reach the server" do - gemfile <<-G - source "#{basic_auth_source_uri}" - gem "rack" - G - - bundle :install, :artifice => "endpoint_500", :raise_on_error => false - expect(out).not_to include("#{user}:#{password}") - end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index e92669e97c..5e0be89995 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -121,12 +121,20 @@ RSpec.describe "gemcutter's dependency API" do it "falls back when the API errors out" do simulate_platform mswin + build_repo2 do + # The rcov gem is platform mswin32, but has no arch + build_gem "rcov" do |s| + s.platform = Gem::Platform.new([nil, "mswin32", nil]) + s.write "lib/rcov.rb", "RCOV = '1.0.0'" + end + end + gemfile <<-G source "#{source_uri}" gem "rcov" G - bundle :install, :artifice => "windows" + bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rcov 1.0.0" end @@ -473,13 +481,19 @@ RSpec.describe "gemcutter's dependency API" do end it "does not refetch if the only unmet dependency is bundler" do + build_repo2 do + build_gem "bundler_dep" do |s| + s.add_dependency "bundler" + end + end + gemfile <<-G source "#{source_uri}" gem "bundler_dep" G - bundle :install, :artifice => "endpoint" + bundle :install, :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching gem metadata from #{source_uri}") end @@ -578,7 +592,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" + bundle :install, :artifice => "endpoint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb index 858c40c07c..7ab0ded26d 100644 --- a/spec/bundler/install/gems/flex_spec.rb +++ b/spec/bundler/install/gems/flex_spec.rb @@ -166,8 +166,7 @@ RSpec.describe "bundle flex_install" do expect(the_bundle).to include_gems "rack_middleware 1.0", "rack 0.9.1" - build_repo2 - update_repo2 do + build_repo2 do build_gem "rack-obama", "2.0" do |s| s.add_dependency "rack", "=1.2" end diff --git a/spec/bundler/install/gems/fund_spec.rb b/spec/bundler/install/gems/fund_spec.rb index 57e7c3aed3..f521b0296f 100644 --- a/spec/bundler/install/gems/fund_spec.rb +++ b/spec/bundler/install/gems/fund_spec.rb @@ -2,11 +2,38 @@ RSpec.describe "bundle install" do context "with gem sources" do + before do + build_repo2 do + build_gem "has_funding_and_other_metadata" do |s| + s.metadata = { + "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", + "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", + "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", + "homepage_uri" => "https://bestgemever.example.io", + "mailing_list_uri" => "https://groups.example.com/bestgemever", + "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding", + "source_code_uri" => "https://example.com/user/bestgemever", + "wiki_uri" => "https://example.com/user/bestgemever/wiki", + } + end + + build_gem "has_funding", "1.2.3" do |s| + s.metadata = { + "funding_uri" => "https://example.com/has_funding/funding", + } + end + + build_gem "gem_with_dependent_funding", "1.0" do |s| + s.add_dependency "has_funding" + end + end + end + context "when gems include a fund URI" do it "displays the plural fund message after installing" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' + source "#{file_uri_for(gem_repo2)}" + gem 'has_funding_and_other_metadata' gem 'has_funding' gem 'rack-obama' G @@ -16,7 +43,7 @@ RSpec.describe "bundle install" do it "displays the singular fund message after installing" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem 'has_funding' gem 'rack-obama' G @@ -28,7 +55,7 @@ RSpec.describe "bundle install" do context "when gems do not include fund messages" do it "does not display any fund messages" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "activesupport" G @@ -39,7 +66,7 @@ RSpec.describe "bundle install" do context "when a dependency includes a fund message" do it "does not display the fund message" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem 'gem_with_dependent_funding' G diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb index f621b01366..1c01ce588b 100644 --- a/spec/bundler/install/gems/resolving_spec.rb +++ b/spec/bundler/install/gems/resolving_spec.rb @@ -1,9 +1,46 @@ # frozen_string_literal: true RSpec.describe "bundle install with install-time dependencies" do + before do + build_repo2 do + # Test complicated gem dependencies for install + build_gem "net_a" do |s| + s.add_dependency "net_b" + s.add_dependency "net_build_extensions" + end + + build_gem "net_b" + + build_gem "net_build_extensions" do |s| + s.add_dependency "rake" + s.extensions << "Rakefile" + s.write "Rakefile", <<-RUBY + task :default do + path = File.expand_path("../lib", __FILE__) + FileUtils.mkdir_p(path) + File.open("\#{path}/net_build_extensions.rb", "w") do |f| + f.puts "NET_BUILD_EXTENSIONS = 'YES'" + end + end + RUBY + end + + build_gem "net_c" do |s| + s.add_dependency "net_a" + s.add_dependency "net_d" + end + + build_gem "net_d" + + build_gem "net_e" do |s| + s.add_dependency "net_d" + end + end + end + it "installs gems with implicit rake dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "with_implicit_rake_dep" gem "another_implicit_rake_dep" gem "rake" @@ -43,7 +80,7 @@ RSpec.describe "bundle install with install-time dependencies" do describe "with crazy rubygem plugin stuff" do it "installs plugins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_b" G @@ -52,7 +89,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs plugins depended on by other plugins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_a" G @@ -61,7 +98,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs multiple levels of dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_c" gem "net_e" G @@ -72,7 +109,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_c" gem "net_e" G @@ -86,7 +123,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_c" gem "net_e" G @@ -100,7 +137,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER_TREE'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "net_c" gem "net_e" G @@ -126,6 +163,10 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs the older version" do build_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "rack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end @@ -198,13 +239,7 @@ RSpec.describe "bundle install with install-time dependencies" do let(:ruby_requirement) { %("#{RUBY_VERSION}") } let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" } - let(:error_message_platform) do - if Bundler.feature_flag.specific_platform? - " #{Bundler.local_platform}" - else - "" - end - end + let(:error_message_platform) { " #{Bundler.local_platform}" } shared_examples_for "ruby version conflicts" do it "raises an error during resolution" do diff --git a/spec/bundler/install/prereleases_spec.rb b/spec/bundler/install/prereleases_spec.rb index fb01220ed7..c3f968ad70 100644 --- a/spec/bundler/install/prereleases_spec.rb +++ b/spec/bundler/install/prereleases_spec.rb @@ -1,10 +1,19 @@ # frozen_string_literal: true RSpec.describe "bundle install" do + before do + build_repo2 do + build_gem "not_released", "1.0.pre" + + build_gem "has_prerelease", "1.0" + build_gem "has_prerelease", "1.1.pre" + end + end + describe "when prerelease gems are available" do it "finds prereleases" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "not_released" G expect(the_bundle).to include_gems "not_released 1.0.pre" @@ -12,7 +21,7 @@ RSpec.describe "bundle install" do it "uses regular releases if available" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "has_prerelease" G expect(the_bundle).to include_gems "has_prerelease 1.0" @@ -20,7 +29,7 @@ RSpec.describe "bundle install" do it "uses prereleases if requested" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "has_prerelease", "1.1.pre" G expect(the_bundle).to include_gems "has_prerelease 1.1.pre" diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index d26dc789cc..941cbd13e0 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -3,16 +3,28 @@ RSpec.describe "the lockfile format" do include Bundler::GemHelpers + before do + build_repo2 do + # Capistrano did this (at least until version 2.5.10) + # RubyGems 2.2 doesn't allow the specifying of a dependency twice + # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f + build_gem "double_deps", "1.0", :skip_validation => true do |s| + s.add_dependency "net-ssh", ">= 1.0.0" + s.add_dependency "net-ssh" + end + end + end + it "generates a simple lockfile for a single source, gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -37,7 +49,7 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -53,14 +65,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -80,7 +92,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -95,14 +107,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -120,7 +132,7 @@ RSpec.describe "the lockfile format" do it "updates the lockfile's bundler version if not present" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -132,14 +144,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack", "> 0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -160,7 +172,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -175,7 +187,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack" G @@ -189,7 +201,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -212,7 +224,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -227,7 +239,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" G @@ -239,7 +251,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -256,14 +268,14 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack-obama" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -282,14 +294,14 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with a version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack-obama", ">= 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -380,13 +392,13 @@ RSpec.describe "the lockfile format" do it "generates lockfiles with multiple requirements" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "net-sftp" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: net-sftp (1.1.1) net-ssh (>= 1.0.0, < 1.99.0) @@ -405,34 +417,6 @@ RSpec.describe "the lockfile format" do expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0" end - it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do - git = build_git "foo" - - install_gemfile <<-G - gem "foo", :git => "#{lib_path("foo-1.0")}" - G - - lockfile_should_be <<-G - GIT - remote: #{lib_path("foo-1.0")} - revision: #{git.ref_for("master")} - specs: - foo (1.0) - - GEM - specs: - - PLATFORMS - #{lockfile_platforms} - - DEPENDENCIES - foo! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - it "generates a simple lockfile for a single pinned source, gem with a version requirement" do git = build_git "foo" @@ -465,7 +449,7 @@ RSpec.describe "the lockfile format" do build_lib "omg", :path => lib_path("omg") gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" platforms :#{not_local_tag} do gem "omg", :path => "#{lib_path("omg")}" @@ -481,7 +465,7 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo1)}// + remote: #{file_uri_for(gem_repo2)}// specs: rack (1.0.0) @@ -653,7 +637,7 @@ RSpec.describe "the lockfile format" do bar = build_git "bar" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" gem "foo", :path => "#{lib_path("foo-1.0")}" @@ -673,7 +657,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -692,7 +676,7 @@ RSpec.describe "the lockfile format" do it "lists gems alphabetically" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "thin" gem "actionpack" @@ -701,7 +685,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: actionpack (2.3.2) activesupport (= 2.3.2) @@ -727,14 +711,14 @@ RSpec.describe "the lockfile format" do it "orders dependencies' dependencies in alphabetical order" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rails" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -766,13 +750,13 @@ RSpec.describe "the lockfile format" do it "orders dependencies by version" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem 'double_deps' G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: double_deps (1.0) net-ssh @@ -792,14 +776,14 @@ RSpec.describe "the lockfile format" do it "does not add the :require option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack-obama", ">= 1.0", :require => "rack/obama" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -818,14 +802,14 @@ RSpec.describe "the lockfile format" do it "does not add the :group option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack-obama", ">= 1.0", :group => :test G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -956,51 +940,10 @@ RSpec.describe "the lockfile format" do G end - it "keeps existing platforms in the lockfile", :bundler => "< 3" do + it "keeps existing platforms in the lockfile" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - rack (1.0.0) - - PLATFORMS - java - - DEPENDENCIES - rack - - BUNDLED WITH - #{Bundler::VERSION} - G - - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" - - gem "rack" - G - - lockfile_should_be <<-G - GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - rack (1.0.0) - - PLATFORMS - java - #{generic_local_platform} - - DEPENDENCIES - rack - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "keeps existing platforms in the lockfile", :bundler => "3" do - lockfile <<-G - GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -1015,21 +958,20 @@ RSpec.describe "the lockfile format" do G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) PLATFORMS java - #{generic_local_platform} - #{specific_local_platform} + #{lockfile_platforms} DEPENDENCIES rack @@ -1039,38 +981,7 @@ RSpec.describe "the lockfile format" do G end - it "persists the spec's platform to the lockfile", :bundler => "< 3" do - build_repo2 do - build_gem "platform_specific", "1.0" do |s| - s.platform = Gem::Platform.new("universal-java-16") - end - end - - simulate_platform "universal-java-16" - - install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "platform_specific" - G - - lockfile_should_be <<-G - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - platform_specific (1.0-java) - - PLATFORMS - java - - DEPENDENCIES - platform_specific - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "persists the spec's platform and specific platform to the lockfile", :bundler => "3" do + it "persists the spec's platform and specific platform to the lockfile" do build_repo2 do build_gem "platform_specific", "1.0" do |s| s.platform = Gem::Platform.new("universal-java-16") @@ -1105,19 +1016,19 @@ RSpec.describe "the lockfile format" do it "does not add duplicate gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" gem "activesupport" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: activesupport (2.3.5) rack (1.0.0) @@ -1136,14 +1047,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -1160,14 +1071,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies with versions" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack", "1.0" gem "rack", "1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -1184,14 +1095,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies in different groups" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack", "1.0", :group => :one gem "rack", "1.0", :group => :two G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (1.0.0) @@ -1208,7 +1119,7 @@ RSpec.describe "the lockfile format" do it "raises if two different versions are used" do install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack", "1.0" gem "rack", "1.1" G @@ -1219,7 +1130,7 @@ RSpec.describe "the lockfile format" do it "raises if two different sources are used" do install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" gem "rack", :git => "git://hubz.com" G @@ -1230,13 +1141,13 @@ RSpec.describe "the lockfile format" do it "works correctly with multiple version dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack", "> 0.9", "< 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (0.9.1) @@ -1253,14 +1164,14 @@ RSpec.describe "the lockfile format" do it "captures the Ruby version in the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" ruby '#{RUBY_VERSION}' gem "rack", "> 0.9", "< 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack (0.9.1) @@ -1289,7 +1200,7 @@ RSpec.describe "the lockfile format" do revision = revision_for(lib_path("omg")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "omg", :git => "#{lib_path("omg")}", :branch => 'master' G @@ -1314,7 +1225,7 @@ RSpec.describe "the lockfile format" do omg (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: PLATFORMS @@ -1341,7 +1252,7 @@ RSpec.describe "the lockfile format" do omg (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: PLATFORMS @@ -1358,7 +1269,7 @@ RSpec.describe "the lockfile format" do it "raises a helpful error message when the lockfile is missing deps" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ specs: rack_middleware (1.0) @@ -1370,7 +1281,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" gem "rack_middleware" G @@ -1400,7 +1311,11 @@ RSpec.describe "the lockfile format" do context "during updates" do it "preserves Gemfile.lock \\n line endings" do - update_repo2 + update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + end expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).not_to match("\r\n") @@ -1410,7 +1325,12 @@ RSpec.describe "the lockfile format" do it "preserves Gemfile.lock \\n\\r line endings" do skip "needs to be adapted" if Gem.win_platform? - update_repo2 + update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + end + win_lock = File.read(bundled_app_lock).gsub(/\n/, "\r\n") File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value @@ -1449,7 +1369,7 @@ RSpec.describe "the lockfile format" do it "refuses to install if Gemfile.lock contains conflict markers" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}// + remote: #{file_uri_for(gem_repo2)}// specs: <<<<<<< rack (1.0.0) @@ -1468,7 +1388,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" + source "#{file_uri_for(gem_repo2)}/" gem "rack" G diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb index a8fd4d51fb..eb3539b412 100644 --- a/spec/bundler/other/platform_spec.rb +++ b/spec/bundler/other/platform_spec.rb @@ -496,6 +496,10 @@ G #{ruby_version_correct} G update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end @@ -512,6 +516,10 @@ G #{ruby_version_correct_engineless} G update_repo2 do + build_gem "rack", "1.2" do |s| + s.executables = "rackup" + end + build_gem "activesupport", "3.0" end diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index a91175c616..370973ad1a 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -208,6 +208,19 @@ RSpec.describe "bundler plugin install" do plugin_should_be_installed("ga-plugin") end + it "accepts path sources" do + build_lib "ga-plugin" do |s| + s.write "plugins.rb" + end + + install_gemfile <<-G + plugin 'ga-plugin', :path => "#{lib_path("ga-plugin-1.0")}" + G + + expect(out).to include("Installed plugin ga-plugin") + plugin_should_be_installed("ga-plugin") + end + context "in deployment mode" do it "installs plugins" do install_gemfile <<-G diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb index 60ed051ec3..03a377ac93 100644 --- a/spec/bundler/plugins/source/example_spec.rb +++ b/spec/bundler/plugins/source/example_spec.rb @@ -33,6 +33,7 @@ RSpec.describe "real source plugins" do def install(spec, opts) mkdir_p(install_path.parent) + require 'fileutils' FileUtils.cp_r(path, install_path) spec_path = install_path.join("\#{spec.full_name}.gemspec") @@ -66,32 +67,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("a-path-gem 1.0") end - it "writes to lock file", :bundler => "< 3" do - bundle "install" - - lockfile_should_be <<-G - PLUGIN SOURCE - remote: #{lib_path("a-path-gem-1.0")} - type: mpath - specs: - a-path-gem (1.0) - - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - - PLATFORMS - #{generic_local_platform} - - DEPENDENCIES - a-path-gem! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "writes to lock file", :bundler => "3" do + it "writes to lock file" do bundle "install" lockfile_should_be <<-G @@ -362,34 +338,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("ma-gitp-gem 1.0") end - it "writes to lock file", :bundler => "< 3" do - revision = revision_for(lib_path("ma-gitp-gem-1.0")) - bundle "install" - - lockfile_should_be <<-G - PLUGIN SOURCE - remote: #{file_uri_for(lib_path("ma-gitp-gem-1.0"))} - type: gitp - revision: #{revision} - specs: - ma-gitp-gem (1.0) - - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - - PLATFORMS - #{generic_local_platform} - - DEPENDENCIES - ma-gitp-gem! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "writes to lock file", :bundler => "3" do + it "writes to lock file" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index b0647b7663..808f0502a4 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -190,7 +190,7 @@ RSpec.describe "The library itself" do line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } end end - documented_settings = File.read("man/bundle-config.1.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten + documented_settings = File.read("lib/bundler/man/bundle-config.1.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten documented_settings.each do |s| all_settings.delete(s) @@ -249,7 +249,7 @@ RSpec.describe "The library itself" do end it "does not use require internally, but require_relative" do - exempt = %r{templates/|vendor/} + exempt = %r{templates/|man/|vendor/} all_bad_requires = [] lib_tracked_files.each do |filename| next if filename =~ exempt diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb index 626092c7eb..a2b5c89150 100644 --- a/spec/bundler/realworld/mirror_probe_spec.rb +++ b/spec/bundler/realworld/mirror_probe_spec.rb @@ -74,10 +74,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") + expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error ") end it "prints each error and warning on a new line" do @@ -90,10 +90,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = expect(out).to include "Fetching source index from #{mirror}/" expect(err).to include <<-EOS.strip -Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Could not fetch specs from #{mirror}/ +Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error +Could not fetch specs from #{mirror}/ due to underlying error EOS end end @@ -112,10 +112,10 @@ Could not fetch specs from #{mirror}/ bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") + expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ due to underlying error ") + expect(err).to include("Could not fetch specs from #{mirror}/ due to underlying error ") end end @@ -138,7 +138,7 @@ Could not fetch specs from #{mirror}/ end def setup_mirror - mirror_port = find_unused_port - @mirror_uri = "http://#{host}:#{mirror_port}" + @mirror_port = find_unused_port + @mirror_uri = "http://#{host}:#{@mirror_port}" end end diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb index 1ba50c0e97..fadf3eb989 100644 --- a/spec/bundler/runtime/inline_spec.rb +++ b/spec/bundler/runtime/inline_spec.rb @@ -369,4 +369,34 @@ RSpec.describe "bundler/inline#gemfile" do expect(out).to eq("WIN") expect(err).to be_empty end + + it "when requiring fileutils after does not show redefinition warnings" do + dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", :raise_on_error => false + skip "does not work if rubygems/dependency_installer loads fileutils, which happens until rubygems 3.2.0" unless dependency_installer_loads_fileutils.empty? + + skip "does not work on ruby 3.0 because it changes the path to look for default gems, tsort is a default gem there, and we can't install it either like we do with fiddle because it doesn't yet exist" unless RUBY_VERSION < "3.0.0" + + Dir.mkdir tmp("path_without_gemfile") + + default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", :raise_on_error => false + skip "fileutils isn't a default gem" if default_fileutils_version.empty? + + realworld_system_gems "fileutils --version 1.4.1" + + realworld_system_gems "fiddle" # not sure why, but this is needed on Windows to boot rubygems succesfully + + realworld_system_gems "timeout uri" # this spec uses net/http which requires these default gems + + script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + require "bundler/inline" + + gemfile(true) do + source "#{file_uri_for(gem_repo2)}" + end + + require "fileutils" + RUBY + + expect(err).to eq("The Gemfile specifies no dependencies") + end end diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 8424e02de1..6b47878944 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1233,6 +1233,9 @@ end end << "bundler" exempts << "fiddle" if Gem.win_platform? && Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") exempts << "uri" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7") + exempts << "pathname" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0") + exempts << "set" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0") + exempts << "tsort" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0") exempts end @@ -1313,7 +1316,7 @@ end expect(out).to eq("The Gemfile's dependencies are satisfied") end - # bundler respects paths specified directly in RUBYLIB or RUBYOPT, and + # bundler respects paths specified direclty in RUBYLIB or RUBYOPT, and # that happens when running ruby from the ruby-core setup. To # workaround, we manually remove those for these tests when they would # override the default gem. diff --git a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb b/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb deleted file mode 100644 index c341c3993f..0000000000 --- a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require_relative "endpoint_marshal_fail" - -Artifice.deactivate - -class EndpointMarshalFailBasicAuthentication < EndpointMarshalFail - before do - unless env["HTTP_AUTHORIZATION"] - halt 401, "Authentication info not supplied" - end - end -end - -Artifice.activate_with(EndpointMarshalFailBasicAuthentication) diff --git a/spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb b/spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb new file mode 100644 index 0000000000..c341c3993f --- /dev/null +++ b/spec/bundler/support/artifice/endpoint_marshal_fail_basic_authentication.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require_relative "endpoint_marshal_fail" + +Artifice.deactivate + +class EndpointMarshalFailBasicAuthentication < EndpointMarshalFail + before do + unless env["HTTP_AUTHORIZATION"] + halt 401, "Authentication info not supplied" + end + end +end + +Artifice.activate_with(EndpointMarshalFailBasicAuthentication) diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb index a1770759a9..02a2c0f659 100644 --- a/spec/bundler/support/builders.rb +++ b/spec/bundler/support/builders.rb @@ -76,14 +76,6 @@ module Spec s.add_dependency "activesupport", ">= 2.0.0" end - build_gem "rails_pinned_to_old_activesupport" do |s| - s.add_dependency "activesupport", "= 1.2.3" - end - - build_gem "missing_dep" do |s| - s.add_dependency "not_here" - end - build_gem "rspec", "1.2.7", :no_default => true do |s| s.write "lib/spec.rb", "SPEC = '1.2.7'" end @@ -158,23 +150,6 @@ module Spec build_gem "duradura", "7.0" - build_gem "multiple_versioned_deps" do |s| - s.add_dependency "weakling", ">= 0.0.1", "< 0.1" - end - - build_gem "not_released", "1.0.pre" - - build_gem "has_prerelease", "1.0" - build_gem "has_prerelease", "1.1.pre" - - build_gem "with_development_dependency" do |s| - s.add_development_dependency "activesupport", "= 2.3.5" - end - - build_gem "with_license" do |s| - s.license = "MIT" - end - build_gem "with_implicit_rake_dep" do |s| s.extensions << "Rakefile" s.write "Rakefile", <<-RUBY @@ -215,10 +190,6 @@ module Spec s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'" end - build_gem "bundler_dep" do |s| - s.add_dependency "bundler" - end - # The yard gem iterates over Gem.source_index looking for plugins build_gem "yard" do |s| s.write "lib/yard.rb", <<-Y @@ -228,115 +199,12 @@ module Spec Y end - # The rcov gem is platform mswin32, but has no arch - build_gem "rcov" do |s| - s.platform = Gem::Platform.new([nil, "mswin32", nil]) - s.write "lib/rcov.rb", "RCOV = '1.0.0'" - end - build_gem "net-ssh" build_gem "net-sftp", "1.1.1" do |s| s.add_dependency "net-ssh", ">= 1.0.0", "< 1.99.0" end - # Test complicated gem dependencies for install - build_gem "net_a" do |s| - s.add_dependency "net_b" - s.add_dependency "net_build_extensions" - end - - build_gem "net_b" - - build_gem "net_build_extensions" do |s| - s.add_dependency "rake" - s.extensions << "Rakefile" - s.write "Rakefile", <<-RUBY - task :default do - path = File.expand_path("../lib", __FILE__) - FileUtils.mkdir_p(path) - File.open("\#{path}/net_build_extensions.rb", "w") do |f| - f.puts "NET_BUILD_EXTENSIONS = 'YES'" - end - end - RUBY - end - - build_gem "net_c" do |s| - s.add_dependency "net_a" - s.add_dependency "net_d" - end - - build_gem "net_d" - - build_gem "net_e" do |s| - s.add_dependency "net_d" - end - - # Capistrano did this (at least until version 2.5.10) - # RubyGems 2.2 doesn't allow the specifying of a dependency twice - # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f - build_gem "double_deps", "1.0", :skip_validation => true do |s| - s.add_dependency "net-ssh", ">= 1.0.0" - s.add_dependency "net-ssh" - end - build_gem "foo" - - # A minimal fake pry console - build_gem "pry" do |s| - s.write "lib/pry.rb", <<-RUBY - class Pry - class << self - def toplevel_binding - unless defined?(@toplevel_binding) && @toplevel_binding - TOPLEVEL_BINDING.eval %{ - def self.__pry__; binding; end - Pry.instance_variable_set(:@toplevel_binding, __pry__) - class << self; undef __pry__; end - } - end - @toplevel_binding.eval('private') - @toplevel_binding - end - - def __pry__ - while line = gets - begin - puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1') - rescue Exception => e - puts "\#{e.class}: \#{e.message}" - puts e.backtrace.first - end - end - end - alias start __pry__ - end - end - RUBY - end - - build_gem "has_metadata" do |s| - s.metadata = { - "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", - "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", - "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", - "homepage_uri" => "https://bestgemever.example.io", - "mailing_list_uri" => "https://groups.example.com/bestgemever", - "funding_uri" => "https://example.com/has_metadata/funding", - "source_code_uri" => "https://example.com/user/bestgemever", - "wiki_uri" => "https://example.com/user/bestgemever/wiki", - } - end - - build_gem "has_funding", "1.2.3" do |s| - s.metadata = { - "funding_uri" => "https://example.com/has_funding/funding", - } - end - - build_gem "gem_with_dependent_funding", "1.0" do |s| - s.add_dependency "has_funding" - end end end @@ -366,9 +234,6 @@ module Spec def update_repo2 update_repo gem_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" - end yield if block_given? end end @@ -658,6 +523,7 @@ module Spec file = Pathname.new(path).join(file) FileUtils.mkdir_p(file.dirname) File.open(file, "w") {|f| f.puts source } + File.chmod("+x", file) if @spec.executables.map {|exe| "#{@spec.bindir}/#{exe}" }.include?(file) end path end diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb index a6ebd7510f..ab203919e7 100644 --- a/spec/bundler/support/platforms.rb +++ b/spec/bundler/support/platforms.rb @@ -94,11 +94,7 @@ module Spec end def local_platforms - if Bundler.feature_flag.specific_platform? - [local, specific_local_platform] - else - [local] - end + [local, specific_local_platform].uniq end end end diff --git a/spec/bundler/update/gems/fund_spec.rb b/spec/bundler/update/gems/fund_spec.rb index 6d7075b424..0dfe63d36d 100644 --- a/spec/bundler/update/gems/fund_spec.rb +++ b/spec/bundler/update/gems/fund_spec.rb @@ -2,9 +2,30 @@ RSpec.describe "bundle update" do before do + build_repo2 do + build_gem "has_funding_and_other_metadata" do |s| + s.metadata = { + "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", + "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", + "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", + "homepage_uri" => "https://bestgemever.example.io", + "mailing_list_uri" => "https://groups.example.com/bestgemever", + "funding_uri" => "https://example.com/has_funding_and_other_metadata/funding", + "source_code_uri" => "https://example.com/user/bestgemever", + "wiki_uri" => "https://example.com/user/bestgemever/wiki", + } + end + + build_gem "has_funding", "1.2.3" do |s| + s.metadata = { + "funding_uri" => "https://example.com/has_funding/funding", + } + end + end + gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' + source "#{file_uri_for(gem_repo2)}" + gem 'has_funding_and_other_metadata' gem 'has_funding', '< 2.0' G @@ -14,8 +35,8 @@ RSpec.describe "bundle update" do context "when listed gems are updated" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' + source "#{file_uri_for(gem_repo2)}" + gem 'has_funding_and_other_metadata' gem 'has_funding' G -- cgit v1.2.3