diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-01 23:29:38 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-01 23:29:38 +0000 |
commit | be7b5929126cb3e696ef222339237faba9b8fe5a (patch) | |
tree | 51eae376f93c09bc82dde5a657a91df2c89062e4 /spec/bundler/plugins/source/example_spec.rb | |
parent | ae49dbd392083f69026f2a0fff4a1d5f42d172a7 (diff) | |
download | ruby-be7b5929126cb3e696ef222339237faba9b8fe5a.tar.gz |
Update bundled bundler to 1.16.0.
* lib/bundler, spec/bundler: Merge bundler-1.16.0.
* common.mk: rspec examples of bundler-1.16.0 needs require option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/plugins/source/example_spec.rb')
-rw-r--r-- | spec/bundler/plugins/source/example_spec.rb | 85 |
1 files changed, 72 insertions, 13 deletions
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb index 2ae34caf73..0dbd9a2a0f 100644 --- a/spec/bundler/plugins/source/example_spec.rb +++ b/spec/bundler/plugins/source/example_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require "spec_helper" RSpec.describe "real source plugins" do context "with a minimal source plugin" do @@ -7,7 +6,7 @@ RSpec.describe "real source plugins" do build_repo2 do build_plugin "bundler-source-mpath" do |s| s.write "plugins.rb", <<-RUBY - require "fileutils" + require "bundler/vendored_fileutils" require "bundler-source-mpath" class MPath < Bundler::Plugin::API @@ -37,6 +36,10 @@ RSpec.describe "real source plugins" do mkdir_p(install_path.parent) FileUtils.cp_r(path, install_path) + spec_path = install_path.join("\#{spec.full_name}.gemspec") + spec_path.open("wb") {|f| f.write spec.to_ruby } + spec.loaded_from = spec_path.to_s + post_install(spec) nil @@ -64,7 +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" do + it "writes to lock file", :bundler => "< 2" do bundle "install" lockfile_should_be <<-G @@ -89,12 +92,37 @@ RSpec.describe "real source plugins" do G end + it "writes to lock file", :bundler => "2" do + bundle "install" + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo2}/ + specs: + + PLUGIN SOURCE + remote: #{lib_path("a-path-gem-1.0")} + type: mpath + specs: + a-path-gem (1.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + a-path-gem! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + it "provides correct #full_gem_path" do bundle "install" run <<-RUBY puts Bundler.rubygems.find_name('a-path-gem').first.full_gem_path RUBY - expect(out).to eq(bundle("show a-path-gem")) + expect(out).to eq(bundle("info a-path-gem --path")) end it "installs the gem executables" do @@ -114,10 +142,10 @@ RSpec.describe "real source plugins" do end describe "bundle cache/package" do - let(:uri_hash) { Digest::SHA1.hexdigest(lib_path("a-path-gem-1.0").to_s) } + let(:uri_hash) { Digest(:SHA1).hexdigest(lib_path("a-path-gem-1.0").to_s) } it "copies repository to vendor cache and uses it" do bundle "install" - bundle "cache --all" + bundle :cache, forgotten_command_line_options([:all, :cache_all] => true) expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}/.git")).not_to exist @@ -128,8 +156,8 @@ RSpec.describe "real source plugins" do end it "copies repository to vendor cache and uses it even when installed with bundle --path" do - bundle "install --path vendor/bundle" - bundle "cache --all" + bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") + bundle! :cache, forgotten_command_line_options([:all, :cache_all] => true) expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist @@ -138,8 +166,8 @@ RSpec.describe "real source plugins" do end it "bundler package copies repository to vendor cache" do - bundle "install --path vendor/bundle" - bundle "package --all" + bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") + bundle! :package, forgotten_command_line_options([:all, :cache_all] => true) expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist @@ -173,7 +201,7 @@ RSpec.describe "real source plugins" do end it "installs" do - bundle "install" + bundle! "install" expect(the_bundle).to include_gems("a-path-gem 1.0") end @@ -228,6 +256,10 @@ RSpec.describe "real source plugins" do `git reset --hard \#{revision}` end + spec_path = install_path.join("\#{spec.full_name}.gemspec") + spec_path.open("wb") {|f| f.write spec.to_ruby } + spec.loaded_from = spec_path.to_s + post_install(spec) nil @@ -327,7 +359,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("ma-gitp-gem 1.0") end - it "writes to lock file" do + it "writes to lock file", :bundler => "< 2" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" @@ -354,6 +386,33 @@ RSpec.describe "real source plugins" do G end + it "writes to lock file", :bundler => "2" do + revision = revision_for(lib_path("ma-gitp-gem-1.0")) + bundle "install" + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo2}/ + specs: + + PLUGIN SOURCE + remote: file://#{lib_path("ma-gitp-gem-1.0")} + type: gitp + revision: #{revision} + specs: + ma-gitp-gem (1.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ma-gitp-gem! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + context "with lockfile" do before do revision = revision_for(lib_path("ma-gitp-gem-1.0")) @@ -433,7 +492,7 @@ RSpec.describe "real source plugins" do end G - bundle "cache --all" + bundle :cache, forgotten_command_line_options([:all, :cache_all] => true) expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file |