2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "bundle install" do
|
|
|
|
context "git sources" do
|
2019-01-04 08:10:58 -05:00
|
|
|
it "displays the revision hash of the gem repository", :bundler => "< 3" do
|
2018-11-02 19:07:56 -04:00
|
|
|
build_git "foo", "1.0", :path => lib_path("foo")
|
|
|
|
|
2020-05-08 01:19:04 -04:00
|
|
|
install_gemfile! <<-G
|
|
|
|
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
2020-05-08 01:19:04 -04:00
|
|
|
expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master@#{revision_for(lib_path("foo"))[0..6]})")
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
|
|
|
|
end
|
|
|
|
|
2019-01-04 08:10:58 -05:00
|
|
|
it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do
|
2020-05-08 01:19:04 -04:00
|
|
|
skip "maybe branch~num notation doesn't work on Windows' git" if Gem.win_platform?
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
build_git "foo", "1.0", :path => lib_path("foo")
|
|
|
|
rev = revision_for(lib_path("foo"))[0..6]
|
|
|
|
update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true
|
|
|
|
rev2 = revision_for(lib_path("foo"))[0..6]
|
|
|
|
update_git "foo", "3.0", :path => lib_path("foo"), :gemspec => true
|
|
|
|
|
|
|
|
install_gemfile! <<-G
|
2020-05-08 01:19:04 -04:00
|
|
|
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "master~2"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
2020-05-08 01:19:04 -04:00
|
|
|
expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev})")
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
|
|
|
|
|
|
|
|
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
bundle! :update, :all => true
|
2020-05-08 01:19:04 -04:00
|
|
|
expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev2})")
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should allows git repos that are missing but not being installed" do
|
|
|
|
revision = build_git("foo").ref_for("HEAD")
|
|
|
|
|
|
|
|
gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :group => :development
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
|
|
|
lockfile <<-L
|
|
|
|
GIT
|
2019-05-06 12:06:21 -04:00
|
|
|
remote: #{file_uri_for(lib_path("foo-1.0"))}
|
2018-11-02 19:07:56 -04:00
|
|
|
revision: #{revision}
|
|
|
|
specs:
|
|
|
|
foo (1.0)
|
|
|
|
|
|
|
|
PLATFORMS
|
|
|
|
ruby
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
foo!
|
|
|
|
L
|
|
|
|
|
|
|
|
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle", :without => "development")
|
|
|
|
|
|
|
|
expect(out).to include("Bundle complete!")
|
|
|
|
end
|
2019-12-14 05:49:16 -05:00
|
|
|
|
|
|
|
it "allows multiple gems from the same git source" do
|
|
|
|
build_repo2 do
|
|
|
|
build_lib "foo", "1.0", :path => lib_path("gems/foo")
|
|
|
|
build_lib "zebra", "2.0", :path => lib_path("gems/zebra")
|
|
|
|
build_git "gems", :path => lib_path("gems"), :gemspec => false
|
|
|
|
end
|
|
|
|
|
2020-05-08 01:19:04 -04:00
|
|
|
install_gemfile! <<-G
|
2019-12-14 05:49:16 -05:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2020-05-08 01:19:04 -04:00
|
|
|
gem "foo", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "foo/*.gemspec"
|
|
|
|
gem "zebra", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "zebra/*.gemspec"
|
2019-12-14 05:49:16 -05:00
|
|
|
G
|
|
|
|
|
|
|
|
bundle "info foo"
|
|
|
|
expect(out).to include("* foo (1.0 #{revision_for(lib_path("gems"))[0..6]})")
|
|
|
|
|
|
|
|
bundle "info zebra"
|
|
|
|
expect(out).to include("* zebra (2.0 #{revision_for(lib_path("gems"))[0..6]})")
|
|
|
|
end
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|