summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 12:08:19 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 12:08:19 +0000
commitfc9509bdd246a1817119af5cfa4dc36de992b35a (patch)
treefa094229e46b0f4588bdfec215265b09999178d4 /lib
parent86cb3d319f8a9b39deaad9acc6863e6c5c854eac (diff)
Merge bundler-2.0.0.pre.2 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/build_metadata.rb15
-rw-r--r--lib/bundler/dsl.rb4
-rw-r--r--lib/bundler/feature_flag.rb2
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt2
-rw-r--r--lib/bundler/version.rb2
5 files changed, 16 insertions, 9 deletions
diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb
index a0428f0319..33f91e9162 100644
--- a/lib/bundler/build_metadata.rb
+++ b/lib/bundler/build_metadata.rb
@@ -28,12 +28,19 @@ module Bundler
# If Bundler has been installed without its .git directory and without a
# commit instance variable then we can't determine its commits SHA.
git_dir = File.join(File.expand_path("../../..", __FILE__), ".git")
- return "unknown" unless File.directory?(git_dir)
+ if File.directory?(git_dir)
+ return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
+ end
- # Otherwise shell out to git.
- @git_commit_sha = Dir.chdir(File.expand_path("..", __FILE__)) do
- `git rev-parse --short HEAD`.strip.freeze
+ # If Bundler is a submodule in RubyGems, get the submodule commit
+ git_sub_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
+ if File.directory?(git_sub_dir)
+ return @git_commit_sha = Dir.chdir(git_sub_dir) do
+ `git ls-tree --abbrev=8 HEAD bundler`.split(/\s/).fetch(2, "").strip.freeze
+ end
end
+
+ @git_commit_sha ||= "unknown"
end
# Whether this is an official release build of Bundler.
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 2cdfe338ea..90ac073c36 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -474,7 +474,7 @@ repo_name ||= user_name
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 --delete disable_multisource`"
end
@@ -499,7 +499,7 @@ repo_name ||= user_name
end
Bundler::SharedHelpers.major_deprecation 3, <<-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:
+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}
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index e3266da8ab..e5b4e84063 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -61,6 +61,8 @@ module Bundler
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
+ settings_method(:github_https?, "github.https") { bundler_2_mode? }
+
def initialize(bundler_version)
@bundler_version = Gem::Version.create(bundler_version)
end
diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt
index c114bd6665..4cd2e40f4f 100644
--- a/lib/bundler/templates/newgem/Gemfile.tt
+++ b/lib/bundler/templates/newgem/Gemfile.tt
@@ -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
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 25a72b272e..bf6c477c92 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -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.pre.1" unless defined?(::Bundler::VERSION)
+ VERSION = "2.0.0.pre.2" unless defined?(::Bundler::VERSION)
def self.overwrite_loaded_gem_version
begin