Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Merge branch '2-0-stable'
Browse files Browse the repository at this point in the history
* 2-0-stable: (43 commits)
  remove path that i copied from my personal computer
  Auto merge of #6586 - bundler:segiddins/softer-major-deprecations, r=indirect
  Merge #6941
  Merge #6834
  Version 2.0.1 with changelog
  update tested rubygems in travis
  Lower required RubyGems to 2.5 or greater
  Bundler 2.0 with changelog
  update CHANGELOG with new changes and release
  Merge #6856
  add RubyGems v3.0.1 to rg clone task
  Version 2.0.0.pre.3 wih changelog
  update tested versions of RubyGems in travis
  update gemspec to require RubyGems 3.0.0
  Merge #6849
  Merge #6853
  Revert "Version 2.0.0 with changelog"
  Version 2.0.0 with changelog
  fix breaking edge case spec
  Merge #6818
  ...

(cherry picked from commit 77f4c15)
  • Loading branch information
colby-swandale authored and deivid-rodriguez committed Feb 28, 2019
1 parent 981fa2b commit ee02a03
Show file tree
Hide file tree
Showing 69 changed files with 263 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ inherit_from:
- .rubocop_todo.yml

AllCops:
TargetRubyVersion: 1.9
TargetRubyVersion: 2.3
Exclude:
- tmp/**/*
- lib/bundler/vendor/**/*
Expand Down
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Layout/IndentArray:
EnforcedStyle: consistent

# Offense count: 40
# Offense count: 48
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
Expand Down Expand Up @@ -102,11 +102,10 @@ Lint/UselessAccessModifier:
Exclude:
- 'lib/bundler/fetcher.rb'

# Offense count: 6
# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'lib/bundler/index.rb'
- 'lib/bundler/installer.rb'

# Offense count: 2564
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
Expand Down Expand Up @@ -204,7 +203,7 @@ Style/CaseEquality:
- 'lib/bundler/match_platform.rb'
- 'lib/bundler/rubygems_ext.rb'

# Offense count: 27
# Offense count: 28
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Expand Down Expand Up @@ -334,6 +333,7 @@ Style/MultilineIfModifier:
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/bundler/cli/common.rb'
- 'lib/bundler/gem_helper.rb'
- 'lib/bundler/mirror.rb'
- 'lib/bundler/source/path.rb'
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ jobs:
- rvm: ruby-head
env: RGV=master
stage: test
# 1.x mode (we want to keep stuff passing in 1.x mode for now)
# 3.x mode
- rvm: 2.6.1
env: RGV=v3.0.2 BUNDLER_SPEC_SUB_VERSION=1.98
env: RGV=v3.0.2 BUNDLER_SPEC_SUB_VERSION=3.0.0
stage: test

allow_failures:
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
## 2.0.1 (2019-01-04)

Changes:

- Relaxed RubyGems requirement to `>= 2.5.0` ([#6867](https://github.com/bundler/bundler/pull/6867))

## 2.0.0 (2019-01-03)

No new changes

## 2.0.0.pre.3 (2018-12-30)

Breaking Changes:

- Bundler 2 now requires RubyGems 3.0.0 at minimum

Changes:

- Ruby 2.6 compatibility fixes (@segiddins)
- Import changes from Bundler 1.17.3 release

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`

## 2.0.0.pre.2 (2018-11-27)

Breaking Changes:

- `:github` source in the Gemfile now defaults to using HTTPS

Changes

- Add compatibility for Bundler merge into ruby-src

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`

## 2.0.0.pre.1 (2018-11-09)

Breaking Changes:

- Dropped support for versions of Ruby < 2.3
- Dropped support for version of RubyGems < 2.5
- Moved error messages from STDOUT to STDERR

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`

## 1.17.3 (2018-12-27)

Bugfixes:
Expand Down
1 change: 0 additions & 1 deletion bundler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Gem::Specification.new do |s|

base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1")
s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }

# we don't check in man pages, but we need to ship them because
# we use them to generate the long-form help for each command.
s.files += Dir.glob("man/**/*")
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def load
end

def environment
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
SharedHelpers.major_deprecation 3, "Bundler.environment has been removed in favor of Bundler.load"
load
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/capistrano.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation 2,
Bundler::SharedHelpers.major_deprecation 3,
"The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"

# Capistrano task for Bundler.
Expand Down
10 changes: 5 additions & 5 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def remove(*gems)
"Include gems that are part of the specified named group."
map "i" => "install"
def install
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run
Expand Down Expand Up @@ -275,7 +275,7 @@ def install
method_option "all", :type => :boolean, :banner =>
"Update everything."
def update(*gems)
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/update"
Update.new(options, gems).run
end
Expand Down Expand Up @@ -303,7 +303,7 @@ def show(gem_name = nil)
old_argv = ARGV.join(" ")
new_argv = [new_command, *new_arguments.compact].join(" ")

Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
Bundler::SharedHelpers.major_deprecation(3, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
end
require "bundler/cli/show"
Show.new(options, gem_name).run
Expand Down Expand Up @@ -535,7 +535,7 @@ def licenses
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
def viz
SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
SharedHelpers.major_deprecation 3, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
require "bundler/cli/viz"
Viz.new(options.dup).run
end
Expand Down Expand Up @@ -606,7 +606,7 @@ def platform
method_option "group", :type => :string, :banner =>
"Install gem into a bundler group"
def inject(name, version)
SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
SharedHelpers.major_deprecation 3, "The `inject` command has been replaced by the `add` command"
require "bundler/cli/inject"
Inject.new(options.dup, name, version).run
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(options, group)
end

def run
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`"

group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run
Bundler::Fetcher.disable_endpoint = options["full-index"]

if options["binstubs"]
Bundler::SharedHelpers.major_deprecation 2,
Bundler::SharedHelpers.major_deprecation 3,
"The --binstubs option will be removed in favor of `bundle binstubs`"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def run
if Bundler.feature_flag.update_requires_all_flag?
raise InvalidOption, "To update everything, pass the `--all` flag."
end
SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything"
elsif !full_update && options[:all]
raise InvalidOption, "Cannot specify --all along with specific options."
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def lock(file, preserve_unknown_sections = false)
# i.e., Windows with `git config core.autocrlf=true`
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")

if @locked_bundler_version
if @locked_bundler_version && Bundler.feature_flag.lockfile_upgrade_warning?
locked_major = @locked_bundler_version.segments.first
current_major = Gem::Version.create(Bundler::VERSION).segments.first

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/deployment.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
Bundler::SharedHelpers.major_deprecation 3, "Bundler no longer integrates with " \
"Capistrano, but Capistrano provides its own integration with " \
"Bundler via the capistrano-bundler gem. Use it instead."

Expand Down
12 changes: 6 additions & 6 deletions lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def path(path, options = {}, &blk)
" end\n\n"

raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
SharedHelpers.major_deprecation(2, msg.strip)
SharedHelpers.major_deprecation(3, msg.strip)
end

source_options = normalize_hash(options).merge(
Expand Down Expand Up @@ -454,7 +454,7 @@ def validate_keys(command, opts, valid_keys)
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
Bundler::SharedHelpers.major_deprecation 3, "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org"
Expand All @@ -472,13 +472,13 @@ def check_primary_source_safety(source_list)
msg = "This Gemfile contains multiple primary sources. " \
"Each source after the first must include a block to indicate which gems " \
"should come from that source"
unless Bundler.feature_flag.bundler_2_mode?
unless Bundler.feature_flag.bundler_3_mode?
msg += ". To downgrade this error to a warning, run " \
"`bundle config unset disable_multisource`"
end
raise GemfileEvalError, msg
else
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
Bundler::SharedHelpers.major_deprecation 3, "Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source. " \
Expand All @@ -496,8 +496,8 @@ def warn_deprecated_git_source(name, replacement, additional_message = nil)
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
end

Bundler::SharedHelpers.major_deprecation 2, <<-EOS
The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
Bundler::SharedHelpers.major_deprecation 3, <<-EOS
The :#{name} git source is deprecated, and will be removed in Bundler 3.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement}
Expand Down
61 changes: 32 additions & 29 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,41 @@ def self.settings_method(name, key, &default)

(1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }

settings_flag(:allow_bundler_dependency_conflicts) { bundler_2_mode? }
settings_flag(:allow_offline_install) { bundler_2_mode? }
settings_flag(:auto_clean_without_path) { bundler_2_mode? }
settings_flag(:auto_config_jobs) { bundler_2_mode? }
settings_flag(:cache_all) { bundler_2_mode? }
settings_flag(:cache_command_is_package) { bundler_2_mode? }
settings_flag(:console_command) { !bundler_2_mode? }
settings_flag(:default_install_uses_path) { bundler_2_mode? }
settings_flag(:deployment_means_frozen) { bundler_2_mode? }
settings_flag(:disable_multisource) { bundler_2_mode? }
settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
settings_flag(:allow_offline_install) { bundler_3_mode? }
settings_flag(:auto_clean_without_path) { bundler_3_mode? }
settings_flag(:auto_config_jobs) { bundler_3_mode? }
settings_flag(:cache_all) { bundler_3_mode? }
settings_flag(:cache_command_is_package) { bundler_3_mode? }
settings_flag(:console_command) { !bundler_3_mode? }
settings_flag(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? }
settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_2_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_2_mode? }
settings_flag(:list_command) { bundler_2_mode? }
settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_2_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_2_mode? }
settings_flag(:path_relative_to_cwd) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_3_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? }
settings_flag(:global_gem_cache) { bundler_3_mode? }
settings_flag(:init_gems_rb) { bundler_3_mode? }
settings_flag(:list_command) { bundler_3_mode? }
settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_3_mode? }
settings_flag(:lockfile_upgrade_warning) { bundler_3_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
settings_flag(:prefer_gems_rb) { bundler_2_mode? }
settings_flag(:print_only_version_number) { bundler_2_mode? }
settings_flag(:setup_makes_kernel_gem_public) { !bundler_2_mode? }
settings_flag(:skip_default_git_sources) { bundler_2_mode? }
settings_flag(:specific_platform) { bundler_2_mode? }
settings_flag(:suppress_install_using_messages) { bundler_2_mode? }
settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
settings_flag(:update_requires_all_flag) { bundler_2_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? }
settings_flag(:viz_command) { !bundler_2_mode? }
settings_flag(:prefer_gems_rb) { bundler_3_mode? }
settings_flag(:print_only_version_number) { bundler_3_mode? }
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
settings_flag(:skip_default_git_sources) { bundler_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_3_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
settings_flag(:viz_command) { !bundler_3_mode? }

settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }

settings_method(:github_https?, "github.https") { bundler_2_mode? }

settings_method(:github_https?, "github.https") { bundler_2_mode? }

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/rubygems_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def replace_bin_path(specs, specs_by_name)
raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable

unless spec.name == gem_name
Bundler::SharedHelpers.major_deprecation 2,
Bundler::SharedHelpers.major_deprecation 3,
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
"You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict."
Expand Down
3 changes: 2 additions & 1 deletion lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Settings
ignore_messages
init_gems_rb
list_command
lockfile_upgrade_warning
lockfile_uses_separate_rubygems_sources
no_install
no_prune
Expand Down Expand Up @@ -115,7 +116,7 @@ def set_command_option(key, value)
"bundle config set #{key} #{Array(value).join(":")}"
end

Bundler::SharedHelpers.major_deprecation 2,\
Bundler::SharedHelpers.major_deprecation 3,\
"flags passed to commands " \
"will no longer be automatically remembered. Instead please set flags " \
"you want remembered between commands using `bundle config set " \
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/shared_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def print_major_deprecations!
next if gemfiles.empty?
break false if gemfiles.size == 1
end
return unless multiple_gemfiles && Bundler.bundler_major_version == 1
return unless multiple_gemfiles && Bundler.bundler_major_version == 2
Bundler::SharedHelpers.major_deprecation 2, \
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
end
Expand Down
2 changes: 0 additions & 2 deletions lib/bundler/templates/newgem/Gemfile.tt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec
2 changes: 1 addition & 1 deletion lib/bundler/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
VERSION = "2.0.0.dev" unless defined?(::Bundler::VERSION)
VERSION = "2.1.0.dev" unless defined?(::Bundler::VERSION)

def self.overwrite_loaded_gem_version
begin
Expand Down

0 comments on commit ee02a03

Please sign in to comment.