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

Move on to bundler 3 #6957

Merged
6 commits merged into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ rvm:
- 2.6.2
- 2.5.5
- 2.4.5
- 2.3.8

stages:
- linting
Expand All @@ -44,15 +43,24 @@ stages:
# see Rakefile:125 for the list of possible RGV values
env:
# We need to know if changes to rubygems will break bundler on release
- RGV=master BUNDLER_SPEC_SUB_VERSION=3.0.0
- RGV=master
# Test the latest rubygems release with all of our supported rubies
- RGV=v3.0.3 BUNDLER_SPEC_SUB_VERSION=3.0.0
- RGV=v3.0.3

jobs:
include:
- rvm: 2.6.2
script: rake rubocop
stage: linting
# Ruby 2.3 also tested in 2.x mode
- rvm: 2.3.8
env: RGV=master
stage: test
- rvm: 2.3.8
env: RGV=v3.0.3
stage: test
# Ruby 2.5, Rubygems 2.7
- rvm: 2.5.5
env: RGV=v2.7.9
Expand All @@ -69,10 +77,6 @@ jobs:
- rvm: ruby-head
env: RGV=master
stage: test
# 1.x mode (we want to keep stuff passing in 1.x mode for now)
- rvm: 2.6.2
env: RGV=v3.0.3 BUNDLER_SPEC_SUB_VERSION=1.98
stage: test

allow_failures:
- rvm: ruby-head
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
2 changes: 1 addition & 1 deletion lib/bundler/cli/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setup_cache_all
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
"to package them as well, please pass the --all flag. This will be the default " \
"on Bundler 2.0."
"on Bundler 3.0."
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setup_cache_all
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
"to package them as well, please pass the --all flag. This will be the default " \
"on Bundler 2.0."
"on Bundler 3.0."
end
end
end
Expand Down
42 changes: 21 additions & 21 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,34 @@ 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(:default_install_uses_path) { bundler_2_mode? }
settings_flag(:deployment_means_frozen) { 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(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? }
settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_3_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_2_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_2_mode? }
settings_flag(:path_relative_to_cwd) { bundler_2_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(: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(: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_4_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(: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_2_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { 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? }

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
6 changes: 3 additions & 3 deletions spec/bundler/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
end

context "with no arguments" do
it "prints a concise help message", :bundler => "2" do
it "prints a concise help message", :bundler => "3" do
bundle! ""
expect(last_command.stderr).to be_empty
expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}").
Expand Down Expand Up @@ -161,12 +161,12 @@
end

RSpec.describe "bundler executable" do
it "shows the bundler version just as the `bundle` executable does", :bundler => "< 2" do
it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do
bundler "--version"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
end

it "shows the bundler version just as the `bundle` executable does", :bundler => "2" do
it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do
bundler "--version"
expect(out).to eq(Bundler::VERSION)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/bundler/definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
end

describe "detects changes" do
it "for a path gem with changes", :bundler => "< 2" do
it "for a path gem with changes", :bundler => "< 3" do
build_lib "foo", "1.0", :path => lib_path("foo")

install_gemfile <<-G
Expand Down Expand Up @@ -72,7 +72,7 @@
G
end

it "for a path gem with changes", :bundler => "2" do
it "for a path gem with changes", :bundler => "3" do
build_lib "foo", "1.0", :path => lib_path("foo")

install_gemfile <<-G
Expand Down
18 changes: 12 additions & 6 deletions spec/bundler/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,26 @@
it_behaves_like "the github DSL", "https"
end

context "when github.https config is false" do
context "when github.https config is false", :bundler => "2" do
before { bundle "config set github.https false" }

it_behaves_like "the github DSL", "git"
end

context "by default", :bundler => "< 2" do
it_behaves_like "the github DSL", "git"
context "when github.https config is false", :bundler => "3" do
before { bundle "config set github.https false" }

pending "should show a proper message about the removed setting"
end

context "by default", :bundler => "2" do
it_behaves_like "the github DSL", "https"
end

context "by default", :bundler => "3" do
it_behaves_like "the github DSL", "https"
end

it "converts numeric :gist to :git" do
subject.gem("not-really-a-gem", :gist => 2_859_988)
github_uri = "https://gist.github.com/2859988.git"
Expand Down Expand Up @@ -266,20 +272,20 @@
# gem 'spree_api'
# gem 'spree_backend'
# end
describe "#github", :bundler => "< 2" do
describe "#github", :bundler => "< 3" do
it "from github" do
spree_gems = %w[spree_core spree_api spree_backend]
subject.github "spree" do
spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
end

subject.dependencies.each do |d|
expect(d.source.uri).to eq("git://github.com/spree/spree.git")
expect(d.source.uri).to eq("https://github.com/spree/spree.git")
end
end
end

describe "#github", :bundler => "2" do
describe "#github", :bundler => "3" do
it "from github" do
spree_gems = %w[spree_core spree_api spree_backend]
subject.github "spree" do
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/source_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
end
end

describe "#add_rubygems_remote", :bundler => "< 2" do
describe "#add_rubygems_remote", :bundler => "< 3" do
let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") }

it "returns the aggregate rubygems source" do
Expand Down
12 changes: 2 additions & 10 deletions spec/bundler/ui/shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@

describe "#warn" do
before { subject.level = "warn" }
it "prints to stdout", :bundler => "< 2" do
expect { subject.warn("warning") }.to output("warning\n").to_stdout
end

it "prints to stderr", :bundler => "2" do
it "prints to stderr" do
expect { subject.warn("warning") }.to output("warning\n").to_stderr
end

Expand All @@ -46,11 +42,7 @@
describe "#error" do
before { subject.level = "error" }

it "prints to stdout", :bundler => "< 2" do
expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout
end

it "prints to stderr", :bundler => "2" do
it "prints to stderr" do
expect { subject.error("error!!!") }.to output("error!!!\n").to_stderr
end

Expand Down
6 changes: 3 additions & 3 deletions spec/cache/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
expect(the_bundle).to include_gems "has_submodule 1.0"
end

it "displays warning message when detecting git repo in Gemfile", :bundler => "< 2" do
it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do
build_git "foo"

install_gemfile <<-G
Expand All @@ -177,7 +177,7 @@

bundle "#{cmd}"

expect(out).to include("Your Gemfile contains path and git dependencies.")
expect(err).to include("Your Gemfile contains path and git dependencies.")
end

it "does not display warning message if cache_all is set in bundle config" do
Expand All @@ -190,7 +190,7 @@
bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
bundle cmd

expect(out).not_to include("Your Gemfile contains path and git dependencies.")
expect(err).not_to include("Your Gemfile contains path and git dependencies.")
end

it "caches pre-evaluated gemspecs" do
Expand Down
4 changes: 2 additions & 2 deletions spec/cache/path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@
expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
end

it "raises a warning without --all", :bundler => "< 2" do
it "raises a warning without --all", :bundler => "< 3" do
build_lib "foo"

install_gemfile <<-G
gem "foo", :path => '#{lib_path("foo-1.0")}'
G

bundle cmd
expect(out).to match(/please pass the \-\-all flag/)
expect(err).to match(/please pass the \-\-all flag/)
expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
end

Expand Down
2 changes: 1 addition & 1 deletion spec/commands/binstubs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
expect(bundled_app("exec/rackup")).to exist
end

it "setting is saved for bundle install", :bundler => "< 2" do
it "setting is saved for bundle install", :bundler => "< 3" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
Expand Down
6 changes: 3 additions & 3 deletions spec/commands/check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.")
end

it "remembers --without option from install", :bundler => "< 2" do
it "remembers --without option from install", :bundler => "< 3" do
gemfile <<-G
source "file://#{gem_repo1}"
group :foo do
Expand Down Expand Up @@ -238,7 +238,7 @@
expect(last_command).to be_failure
end

context "--path", :bundler => "< 2" do
context "--path", :bundler => "< 3" do
before do
gemfile <<-G
source "file://#{gem_repo1}"
Expand All @@ -254,7 +254,7 @@
expect(out).to include("The Gemfile's dependencies are satisfied")
end

it "should write to .bundle/config", :bundler => "< 2" do
it "should write to .bundle/config", :bundler => "< 3" do
bundle "check --path vendor/bundle"
bundle! "check"
end
Expand Down