Skip to content

Commit

Permalink
Merge pull request #3968 from rubygems/no_unnecessary_remote_requests
Browse files Browse the repository at this point in the history
Don't hit the network when installing dependencyless local gemspec
  • Loading branch information
deivid-rodriguez committed Sep 29, 2020
2 parents 5521428 + 5608aeb commit 4b3e48c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/install-rubygems.yml
Expand Up @@ -42,4 +42,13 @@ jobs:
run: bundle --version
- name: Check bundler man pages were installed and are properly picked up
run: bundle install --help | grep -q BUNDLE-INSTALL
- name: Build bundler
run: gem build bundler.gemspec
working-directory: ./bundler
- name: Install built bundler
run: gem install bundler-*.gem --verbose > output.txt
working-directory: ./bundler
- name: Check bundler install didn't hit the network
run: if grep -q 'GET http' output.txt; then false; else true; fi
working-directory: ./bundler
timeout-minutes: 10
3 changes: 2 additions & 1 deletion lib/rubygems/dependency_installer.rb
Expand Up @@ -283,7 +283,6 @@ def resolve_dependencies(dep_or_name, version) # :nodoc:
request_set.development_shallow = @dev_shallow
request_set.soft_missing = @force
request_set.prerelease = @prerelease
request_set.remote = false unless consider_remote?

installer_set = Gem::Resolver::InstallerSet.new @domain
installer_set.ignore_installed = @only_install_dir
Expand All @@ -307,6 +306,7 @@ def resolve_dependencies(dep_or_name, version) # :nodoc:

dependency =
if spec = installer_set.local?(dep_or_name)
installer_set.remote = nil if spec.dependencies.none?
Gem::Dependency.new spec.name, version
elsif String === dep_or_name
Gem::Dependency.new dep_or_name, version
Expand All @@ -321,6 +321,7 @@ def resolve_dependencies(dep_or_name, version) # :nodoc:
installer_set.add_always_install dependency

request_set.always_install = installer_set.always_install
request_set.remote = installer_set.consider_remote?

if @ignore_dependencies
installer_set.ignore_dependencies = true
Expand Down
1 change: 0 additions & 1 deletion lib/rubygems/resolver/installer_set.rb
Expand Up @@ -32,7 +32,6 @@ def initialize(domain)
super()

@domain = domain
@remote = consider_remote?

@f = Gem::SpecFetcher.fetcher

Expand Down

0 comments on commit 4b3e48c

Please sign in to comment.