Skip to content

Commit 0610302

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Don't validate local gemspec twice
Calling `remote!` or `cached!` on the source was expiring local specs for now reason. It's unnecessary to override these methods for path sources since they only deal with local specifications. rubygems/rubygems@aa93b196a2
1 parent 758e01d commit 0610302

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

lib/bundler/source/git.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ def initialize(options)
3232
@local = false
3333
end
3434

35+
def remote!
36+
@local_specs = nil
37+
@allow_remote = true
38+
end
39+
40+
def cached!
41+
@local_specs = nil
42+
@allow_cached = true
43+
end
44+
3545
def self.from_lock(options)
3646
new(options.merge("uri" => options.delete("remote")))
3747
end

lib/bundler/source/path.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ def initialize(options)
1818
@options = options.dup
1919
@glob = options["glob"] || DEFAULT_GLOB
2020

21-
@allow_cached = false
22-
@allow_remote = false
23-
2421
@root_path = options["root_path"] || root
2522

2623
if options["path"]
@@ -41,16 +38,6 @@ def initialize(options)
4138
@original_path = @path
4239
end
4340

44-
def remote!
45-
@local_specs = nil
46-
@allow_remote = true
47-
end
48-
49-
def cached!
50-
@local_specs = nil
51-
@allow_cached = true
52-
end
53-
5441
def self.from_lock(options)
5542
new(options.merge("path" => options.delete("remote")))
5643
end

spec/bundler/install/gemspecs_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,25 @@ module Persistent💎
157157
expect(err).to include("but your Gemfile specified")
158158
expect(exitstatus).to eq(18)
159159
end
160+
161+
it "validates gemspecs just once when everything installed and lockfile up to date" do
162+
build_lib "foo"
163+
164+
install_gemfile <<-G
165+
source "#{file_uri_for(gem_repo1)}"
166+
gemspec path: "#{lib_path("foo-1.0")}"
167+
168+
module Monkey
169+
def validate(spec)
170+
puts "Validate called on \#{spec.full_name}"
171+
end
172+
end
173+
Bundler.rubygems.extend(Monkey)
174+
G
175+
176+
bundle "install"
177+
178+
expect(out).to include("Validate called on foo-1.0").once
179+
end
160180
end
161181
end

0 commit comments

Comments
 (0)