This commit is contained in:
Hiroshi SHIBATA 2020-01-08 16:11:52 +09:00 коммит произвёл SHIBATA Hiroshi
Родитель f518b608d6
Коммит 13f4f07f21
69 изменённых файлов: 242 добавлений и 184 удалений

Просмотреть файл

@ -38,7 +38,8 @@ module Bundler
if Bundler.feature_flag.deployment_means_frozen?
Bundler.settings.set_command_option :deployment, true
else
Bundler.settings.set_command_option :frozen, true
Bundler.settings.set_command_option :deployment, true if options[:deployment]
Bundler.settings.set_command_option :frozen, true if options[:frozen]
end
end
@ -169,7 +170,7 @@ module Bundler
def normalize_settings
Bundler.settings.set_command_option :path, nil if options[:system]
Bundler.settings.temporary(:path_relative_to_cwd => false) do
Bundler.settings.set_command_option :path, "vendor/bundle" if options[:deployment]
Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
end
Bundler.settings.set_command_option_if_given :path, options[:path]
Bundler.settings.temporary(:path_relative_to_cwd => false) do

Просмотреть файл

@ -73,7 +73,7 @@ module Bundler
def build_gem
file_name = nil
sh("#{gem_command} build -V #{spec_path}".shellsplit) do
sh("#{gem_command} build -V #{spec_path.shellescape}".shellsplit) do
file_name = File.basename(built_gem_path)
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
FileUtils.mv(built_gem_path, "pkg")
@ -130,9 +130,8 @@ module Bundler
def perform_git_push(options = "")
cmd = "git push #{options}"
out, status = sh_with_status(cmd)
out, status = sh_with_status(cmd.shellsplit)
return if status.success?
cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
end

Просмотреть файл

@ -78,7 +78,7 @@ def gemfile(install = false, options = {}, &gemfile)
if old_gemfile
ENV["BUNDLE_GEMFILE"] = old_gemfile
else
ENV.delete("BUNDLE_GEMFILE")
ENV["BUNDLE_GEMFILE"] = ""
end
end
end

Просмотреть файл

@ -3,11 +3,6 @@ require_relative '../../../../uri/lib/uri'
require 'cgi' # for escaping
require_relative '../../../../connection_pool/lib/connection_pool'
begin
require 'net/http/pipeline'
rescue LoadError
end
autoload :OpenSSL, 'openssl'
##
@ -773,23 +768,6 @@ class Bundler::Persistent::Net::HTTP::Persistent
(uri =~ /^https?:/) ? uri : "http://#{uri}"
end
##
# Pipelines +requests+ to the HTTP server at +uri+ yielding responses if a
# block is given. Returns all responses received.
#
# See
# Net::HTTP::Pipeline[http://docs.seattlerb.org/net-http-pipeline/Net/HTTP/Pipeline.html]
# for further details.
#
# Only if <tt>net-http-pipeline</tt> was required before
# <tt>net-http-persistent</tt> #pipeline will be present.
def pipeline uri, requests, &block # :yields: responses
connection_for uri do |connection|
connection.http.pipeline requests, &block
end
end
##
# Sets this client's SSL private key

Просмотреть файл

@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
VERSION = "2.1.2".freeze
VERSION = "2.1.4".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-ADD" "1" "December 2019" "" ""
.TH "BUNDLE\-ADD" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install

Просмотреть файл

@ -55,4 +55,4 @@ OPTIONS
December 2019 BUNDLE-ADD(1)
January 2020 BUNDLE-ADD(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-BINSTUBS" "1" "December 2019" "" ""
.TH "BUNDLE\-BINSTUBS" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems

Просмотреть файл

@ -45,4 +45,4 @@ BUNDLE INSTALL --BINSTUBS
December 2019 BUNDLE-BINSTUBS(1)
January 2020 BUNDLE-BINSTUBS(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CACHE" "1" "December 2019" "" ""
.TH "BUNDLE\-CACHE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application

Просмотреть файл

@ -75,4 +75,4 @@ REMOTE FETCHING
December 2019 BUNDLE-CACHE(1)
January 2020 BUNDLE-CACHE(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CHECK" "1" "December 2019" "" ""
.TH "BUNDLE\-CHECK" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems

Просмотреть файл

@ -30,4 +30,4 @@ OPTIONS
December 2019 BUNDLE-CHECK(1)
January 2020 BUNDLE-CHECK(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CLEAN" "1" "December 2019" "" ""
.TH "BUNDLE\-CLEAN" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory

Просмотреть файл

@ -23,4 +23,4 @@ OPTIONS
December 2019 BUNDLE-CLEAN(1)
January 2020 BUNDLE-CLEAN(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CONFIG" "1" "December 2019" "" ""
.TH "BUNDLE\-CONFIG" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options

Просмотреть файл

@ -525,4 +525,4 @@ CONFIGURE BUNDLER DIRECTORIES
December 2019 BUNDLE-CONFIG(1)
January 2020 BUNDLE-CONFIG(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-DOCTOR" "1" "December 2019" "" ""
.TH "BUNDLE\-DOCTOR" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems

Просмотреть файл

@ -41,4 +41,4 @@ OPTIONS
December 2019 BUNDLE-DOCTOR(1)
January 2020 BUNDLE-DOCTOR(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-EXEC" "1" "December 2019" "" ""
.TH "BUNDLE\-EXEC" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle

Просмотреть файл

@ -175,4 +175,4 @@ RUBYGEMS PLUGINS
December 2019 BUNDLE-EXEC(1)
January 2020 BUNDLE-EXEC(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-GEM" "1" "December 2019" "" ""
.TH "BUNDLE\-GEM" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem

Просмотреть файл

@ -88,4 +88,4 @@ SEE ALSO
December 2019 BUNDLE-GEM(1)
January 2020 BUNDLE-GEM(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INFO" "1" "December 2019" "" ""
.TH "BUNDLE\-INFO" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle

Просмотреть файл

@ -18,4 +18,4 @@ OPTIONS
December 2019 BUNDLE-INFO(1)
January 2020 BUNDLE-INFO(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INIT" "1" "December 2019" "" ""
.TH "BUNDLE\-INIT" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory

Просмотреть файл

@ -31,4 +31,4 @@ SEE ALSO
December 2019 BUNDLE-INIT(1)
January 2020 BUNDLE-INIT(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INJECT" "1" "December 2019" "" ""
.TH "BUNDLE\-INJECT" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile

Просмотреть файл

@ -29,4 +29,4 @@ DESCRIPTION
December 2019 BUNDLE-INJECT(1)
January 2020 BUNDLE-INJECT(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-INSTALL" "1" "December 2019" "" ""
.TH "BUNDLE\-INSTALL" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile

Просмотреть файл

@ -398,4 +398,4 @@ SEE ALSO
December 2019 BUNDLE-INSTALL(1)
January 2020 BUNDLE-INSTALL(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-LIST" "1" "December 2019" "" ""
.TH "BUNDLE\-LIST" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle

Просмотреть файл

@ -40,4 +40,4 @@ OPTIONS
December 2019 BUNDLE-LIST(1)
January 2020 BUNDLE-LIST(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-LOCK" "1" "December 2019" "" ""
.TH "BUNDLE\-LOCK" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing

Просмотреть файл

@ -90,4 +90,4 @@ PATCH LEVEL OPTIONS
December 2019 BUNDLE-LOCK(1)
January 2020 BUNDLE-LOCK(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-OPEN" "1" "December 2019" "" ""
.TH "BUNDLE\-OPEN" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle

Просмотреть файл

@ -26,4 +26,4 @@ DESCRIPTION
December 2019 BUNDLE-OPEN(1)
January 2020 BUNDLE-OPEN(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-OUTDATED" "1" "December 2019" "" ""
.TH "BUNDLE\-OUTDATED" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available

Просмотреть файл

@ -128,4 +128,4 @@ FILTERING OUTPUT
December 2019 BUNDLE-OUTDATED(1)
January 2020 BUNDLE-OUTDATED(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-PLATFORM" "1" "December 2019" "" ""
.TH "BUNDLE\-PLATFORM" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information

Просмотреть файл

@ -54,4 +54,4 @@ OPTIONS
December 2019 BUNDLE-PLATFORM(1)
January 2020 BUNDLE-PLATFORM(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-PRISTINE" "1" "December 2019" "" ""
.TH "BUNDLE\-PRISTINE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition

Просмотреть файл

@ -41,4 +41,4 @@ DESCRIPTION
December 2019 BUNDLE-PRISTINE(1)
January 2020 BUNDLE-PRISTINE(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-REMOVE" "1" "December 2019" "" ""
.TH "BUNDLE\-REMOVE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile

Просмотреть файл

@ -31,4 +31,4 @@ OPTIONS
December 2019 BUNDLE-REMOVE(1)
January 2020 BUNDLE-REMOVE(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-SHOW" "1" "December 2019" "" ""
.TH "BUNDLE\-SHOW" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem

Просмотреть файл

@ -24,4 +24,4 @@ OPTIONS
December 2019 BUNDLE-SHOW(1)
January 2020 BUNDLE-SHOW(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-UPDATE" "1" "December 2019" "" ""
.TH "BUNDLE\-UPDATE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions

Просмотреть файл

@ -387,4 +387,4 @@ RECOMMENDED WORKFLOW
December 2019 BUNDLE-UPDATE(1)
January 2020 BUNDLE-UPDATE(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-VIZ" "1" "December 2019" "" ""
.TH "BUNDLE\-VIZ" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile

Просмотреть файл

@ -36,4 +36,4 @@ OPTIONS
December 2019 BUNDLE-VIZ(1)
January 2020 BUNDLE-VIZ(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE" "1" "December 2019" "" ""
.TH "BUNDLE" "1" "January 2020" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management

Просмотреть файл

@ -113,4 +113,4 @@ OBSOLETE
December 2019 BUNDLE(1)
January 2020 BUNDLE(1)

Просмотреть файл

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GEMFILE" "5" "December 2019" "" ""
.TH "GEMFILE" "5" "January 2020" "" ""
.
.SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs

Просмотреть файл

@ -646,4 +646,4 @@ SOURCE PRIORITY
December 2019 GEMFILE(5)
January 2020 GEMFILE(5)

Просмотреть файл

@ -423,7 +423,7 @@ RSpec.describe "bundle outdated" do
expect(err).to include("You are trying to check outdated gems in deployment mode.")
expect(err).to include("Run `bundle outdated` elsewhere.")
expect(err).to include("If this is a development machine, remove the ")
expect(err).to include("Gemfile freeze\nby running `bundle install --no-deployment`.")
expect(err).to include("Gemfile freeze\nby running `bundle config unset deployment`.")
end
end

Просмотреть файл

@ -99,7 +99,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
it "reinstall gemspec dependency" do
spec = Bundler.definition.specs["baz-dev"].first
changed_file = Pathname.new(spec.full_gem_path).join("lib/baz-dev.rb")
changed_file = Pathname.new(spec.full_gem_path).join("lib/baz/dev.rb")
diff = "#Pristine spec changes"
File.open(changed_file, "a") {|f| f.puts "#Pristine spec changes" }

Просмотреть файл

@ -286,7 +286,7 @@ RSpec.describe "bundle update" do
expect(last_command).to be_failure
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
expect(err).to match(/freeze \nby running `bundle install --no-deployment`./m)
expect(err).to match(/freeze \nby running `bundle config unset deployment`./m)
end
it "should suggest different command when frozen is set globally", :bundler => "< 3" do

Просмотреть файл

@ -34,7 +34,7 @@ RSpec.describe "install with --deployment or --frozen" do
expect(exitstatus).to eq(15) if exitstatus
end
it "works after you try to deploy without a lock" do
it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do
bundle "install --deployment"
bundle! :install
expect(the_bundle).to include_gems "rack 1.0"
@ -42,7 +42,7 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "still works if you are not in the app directory and specify --gemfile" do
bundle "install"
bundle! "install"
Dir.chdir tmp do
simulate_new_machine
bundle! :install,
@ -60,12 +60,12 @@ RSpec.describe "install with --deployment or --frozen" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
end
G
bundle :install
bundle! :install
bundle! :install, forgotten_command_line_options(:deployment => true, :without => "test")
end
it "works when you bundle exec bundle" do
bundle :install
bundle! :install
bundle "install --deployment"
bundle! "exec bundle check"
end
@ -104,9 +104,90 @@ RSpec.describe "install with --deployment or --frozen" do
expect(the_bundle).to include_gems "rack 1.0"
end
context "when replacing a host with the same host with credentials" do
before do
bundle! "install", forgotten_command_line_options(:path => "vendor/bundle")
gemfile <<-G
source "http://user_name:password@localgemserver.test/"
gem "rack"
G
lockfile <<-G
GEM
remote: http://localgemserver.test/
specs:
rack (1.0.0)
PLATFORMS
#{local}
DEPENDENCIES
rack
G
bundle! "config set --local deployment true"
end
it "prevents the replace by default" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
context "when allow_deployment_source_credential_changes is true" do
before { bundle! "config set allow_deployment_source_credential_changes true" }
it "allows the replace" do
bundle! :install
expect(out).to match(/Bundle complete!/)
end
end
context "when allow_deployment_source_credential_changes is false" do
before { bundle! "config set allow_deployment_source_credential_changes false" }
it "prevents the replace" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
end
context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is true" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
it "allows the replace" do
bundle :install
expect(out).to match(/Bundle complete!/)
end
end
context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is false" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
it "prevents the replace" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
end
end
describe "with an existing lockfile" do
before do
bundle "install"
bundle! "install"
end
it "installs gems by default to vendor/bundle", :bundler => "< 3" do
bundle! "install --deployment"
expect(out).to include("vendor/bundle")
end
it "installs gems to custom path if specified", :bundler => "< 3" do
bundle! "install --path vendor/bundle2 --deployment"
expect(out).to include("vendor/bundle2")
end
it "works with the --deployment flag if you didn't change anything", :bundler => "< 3" do
@ -197,6 +278,19 @@ RSpec.describe "install with --deployment or --frozen" do
expect(err).not_to include("You have changed in the Gemfile")
end
it "installs gems by default to vendor/bundle when `--deployment` is set via an environment variable", :bundler => "< 3" do
ENV["BUNDLE_DEPLOYMENT"] = "true"
bundle "install"
expect(out).to include("vendor/bundle")
end
it "installs gems to custom path when deployment mode is set via an environment variable ", :bundler => "< 3" do
ENV["BUNDLE_DEPLOYMENT"] = "true"
ENV["BUNDLE_PATH"] = "vendor/bundle2"
bundle "install"
expect(out).to include("vendor/bundle2")
end
it "can have --frozen set to false via an environment variable" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@ -280,80 +374,6 @@ RSpec.describe "install with --deployment or --frozen" do
expect(err).not_to include("You have deleted from the Gemfile")
end
context "when replacing a host with the same host with credentials" do
let(:success_message) do
"Bundle complete!"
end
before do
install_gemfile <<-G
source "http://user_name:password@localgemserver.test/"
gem "rack"
G
lockfile <<-G
GEM
remote: http://localgemserver.test/
specs:
rack (1.0.0)
PLATFORMS
#{local}
DEPENDENCIES
rack
G
bundle! "config set --local deployment true"
end
it "prevents the replace by default" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
context "when allow_deployment_source_credential_changes is true" do
before { bundle! "config set allow_deployment_source_credential_changes true" }
it "allows the replace" do
bundle :install
expect(out).to match(/#{success_message}/)
end
end
context "when allow_deployment_source_credential_changes is false" do
before { bundle! "config set allow_deployment_source_credential_changes false" }
it "prevents the replace" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
end
context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is true" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
it "allows the replace" do
bundle :install
expect(out).to match(/#{success_message}/)
end
end
context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is false" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
it "prevents the replace" do
bundle :install
expect(err).to match(/The list of sources changed/)
end
end
end
it "remembers that the bundle is frozen at runtime" do
bundle! :lock

Просмотреть файл

@ -210,7 +210,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => bundled_app)
gemspec = bundled_app("foo.gemspec").read
bundled_app("foo.gemspec").open("w") do |f|
f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack-obama' }"
f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }"
end
install_gemfile! <<-G

Просмотреть файл

@ -125,14 +125,14 @@ RSpec.describe "real source plugins" do
end
it "installs the gem executables" do
build_lib "gem-with-bin" do |s|
build_lib "gem_with_bin" do |s|
s.executables = ["foo"]
end
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}" # plugin source
source "#{lib_path("gem-with-bin-1.0")}", :type => :mpath do
gem "gem-with-bin"
source "#{lib_path("gem_with_bin-1.0")}", :type => :mpath do
gem "gem_with_bin"
end
G
@ -451,7 +451,7 @@ RSpec.describe "real source plugins" do
bundle "install"
run <<-RUBY
require 'ma-gitp-gem'
require 'ma/gitp/gem'
puts "WIN" unless defined?(MAGITPGEM_PREV_REF)
RUBY
expect(out).to eq("WIN")
@ -462,7 +462,7 @@ RSpec.describe "real source plugins" do
bundle "update ma-gitp-gem"
run <<-RUBY
require 'ma-gitp-gem'
require 'ma/gitp/gem'
puts "WIN" if defined?(MAGITPGEM_PREV_REF)
RUBY
expect(out).to eq("WIN")

Просмотреть файл

@ -57,6 +57,20 @@ RSpec.describe "require 'bundler/gem_tasks'" do
expect(err).to be_empty
end
context "rake build when path has spaces" do
before do
spaced_bundled_app = tmp.join("bundled app")
FileUtils.mv bundled_app, spaced_bundled_app
Dir.chdir(spaced_bundled_app)
end
it "still runs successfully" do
bundle! "exec rake build"
expect(err).to be_empty
end
end
it "adds 'pkg' to rake/clean's CLOBBER" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect')

Просмотреть файл

@ -333,4 +333,21 @@ RSpec.describe "bundler/inline#gemfile" do
expect(last_command).to be_success
expect(out).to include("BUNDLE_GEMFILE is empty")
end
it "resets BUNDLE_GEMFILE to the empty string if it wasn't set previously" do
ENV["BUNDLE_GEMFILE"] = nil
script <<-RUBY
gemfile do
source "#{file_uri_for(gem_repo1)}"
gem "rack"
end
puts "BUNDLE_GEMFILE is empty" if ENV["BUNDLE_GEMFILE"].empty?
system("#{Gem.ruby} -w -e '42'") # this should see original value of BUNDLE_GEMFILE
exit $?.exitstatus
RUBY
expect(last_command).to be_success
expect(out).to include("BUNDLE_GEMFILE is empty")
end
end

Просмотреть файл

@ -168,7 +168,6 @@ RSpec.describe "Bundler.require" do
build_lib "jquery-rails", "1.0.0" do |s|
s.write "lib/jquery/rails.rb", "puts 'jquery/rails'"
end
lib_path("jquery-rails-1.0.0/lib/jquery-rails.rb").rmtree
end
it "requires gem names that are namespaced" do
@ -241,7 +240,6 @@ RSpec.describe "Bundler.require" do
build_lib "load-fuuu", "1.0.0" do |s|
s.write "lib/load/fuuu.rb", "raise LoadError.new(\"cannot load such file -- load-bar\")"
end
lib_path("load-fuuu-1.0.0/lib/load-fuuu.rb").rmtree
gemfile <<-G
path "#{lib_path}" do

Просмотреть файл

@ -899,17 +899,17 @@ end
describe "with git gems that don't have gemspecs" do
before :each do
build_git "no-gemspec", :gemspec => false
build_git "no_gemspec", :gemspec => false
install_gemfile <<-G
gem "no-gemspec", "1.0", :git => "#{lib_path("no-gemspec-1.0")}"
gem "no_gemspec", "1.0", :git => "#{lib_path("no_gemspec-1.0")}"
G
end
it "loads the library via a virtual spec" do
run <<-R
require 'no-gemspec'
puts NOGEMSPEC
require 'no_gemspec'
puts NO_GEMSPEC
R
expect(out).to eq("1.0")
@ -1263,6 +1263,27 @@ end
expect(out).to eq("{}")
end
it "does not load net-http-pipeline too early" do
build_repo4 do
build_gem "net-http-pipeline", "1.0.1"
end
system_gems "net-http-pipeline-1.0.1", :gem_repo => gem_repo4 do
gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "net-http-pipeline", "1.0.1"
G
bundle "config set --local path vendor/bundle"
bundle! :install
bundle! :check
expect(out).to eq("The Gemfile's dependencies are satisfied")
end
end
Gem::Specification.select(&:default_gem?).map(&:name).each do |g|
it "activates newer versions of #{g}" do
skip if exemptions.include?(g)

Просмотреть файл

@ -611,7 +611,7 @@ module Spec
unless options[:no_default]
gem_source = options[:source] || "path@#{path}"
@files = _default_files.
merge("lib/#{name}/source.rb" => "#{Builders.constantize(name)}_SOURCE = #{gem_source.to_s.dump}").
merge("lib/#{entrypoint}/source.rb" => "#{Builders.constantize(name)}_SOURCE = #{gem_source.to_s.dump}").
merge(@files)
end
@ -627,15 +627,20 @@ module Spec
end
def _default_files
@_default_files ||= begin
platform_string = " #{@spec.platform}" unless @spec.platform == Gem::Platform::RUBY
{ "lib/#{name}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'" }
end
@_default_files ||= { "lib/#{entrypoint}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'" }
end
def entrypoint
name.tr("-", "/")
end
def _default_path
@context.tmp("libs", @spec.full_name)
end
def platform_string
" #{@spec.platform}" unless @spec.platform == Gem::Platform::RUBY
end
end
class GitBuilder < LibBuilder
@ -755,7 +760,10 @@ module Spec
class PluginBuilder < GemBuilder
def _default_files
@_default_files ||= super.merge("plugins.rb" => "")
@_default_files ||= {
"lib/#{name}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'",
"plugins.rb" => "",
}
end
end

Просмотреть файл

@ -210,8 +210,10 @@ module Spec
yield stdin, stdout, wait_thr if block_given?
stdin.close
command_execution.stdout = Thread.new { stdout.read }.value.strip
command_execution.stderr = Thread.new { stderr.read }.value.strip
stdout_read_thread = Thread.new { stdout.read }
stderr_read_thread = Thread.new { stderr.read }
command_execution.stdout = stdout_read_thread.value.strip
command_execution.stderr = stderr_read_thread.value.strip
command_execution.exitstatus = wait_thr && wait_thr.value.exitstatus
end

Просмотреть файл

@ -45,7 +45,7 @@ module Spec
def should_conflict_on(names)
got = resolve
flunk "The resolve succeeded with: #{got.map(&:full_name).sort.inspect}"
raise "The resolve succeeded with: #{got.map(&:full_name).sort.inspect}"
rescue Bundler::VersionConflict => e
expect(Array(names).sort).to eq(e.conflicts.sort)
end

Просмотреть файл

@ -128,7 +128,7 @@ module Spec
groups << opts
@errors = names.map do |name|
name, version, platform = name.split(/\s+/)
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
begin
run! "require '#{require_path}.rb'; puts #{version_const}", *groups
@ -145,7 +145,7 @@ module Spec
next unless source
begin
source_const = "#{Spec::Builders.constantize(name)}_SOURCE"
run! "require '#{name}/source'; puts #{source_const}", *groups
run! "require '#{require_path}/source'; puts #{source_const}", *groups
rescue StandardError
next "#{name} does not have a source defined:\n#{indent(e)}"
end