Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Make updating sources a noop in bundle install if all of the gems are…
Browse files Browse the repository at this point in the history
… already available
  • Loading branch information
Carlhuda committed Jul 13, 2010
1 parent c5f25d6 commit 70c9699
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/cli.rb
Expand Up @@ -139,7 +139,7 @@ def update(*gems)
Bundler.definition(:gems => gems, :sources => sources)
end

Installer.install Bundler.root, Bundler.definition
Installer.install Bundler.root, Bundler.definition, "update" => true
cache if Bundler.root.join("vendor/cache").exist?
Bundler.ui.confirm "Your bundle is updated! " +
"Use `bundle show [gemname]` to see where a bundled gem is installed."
Expand Down
16 changes: 13 additions & 3 deletions lib/bundler/installer.rb
Expand Up @@ -15,11 +15,21 @@ def run(options)
return
end

if Bundler.root.join("Gemfile.lock").exist? && !options["update"]
begin
missing_specs = Definition.build(Bundler.default_gemfile, Bundler.root.join("Gemfile.lock"), nil).missing_specs
local = true unless missing_specs.any?
rescue BundlerError
end
end

# Since we are installing, we can resolve the definition
# using remote specs
options["local"] ?
@definition.resolve_with_cache! :
@definition.resolve_remotely!
unless local
options["local"] ?
@definition.resolve_with_cache! :
@definition.resolve_remotely!
end

# Ensure that BUNDLE_PATH exists
Bundler.mkdir_p(Bundler.bundle_path)
Expand Down
3 changes: 2 additions & 1 deletion lib/bundler/source.rb
Expand Up @@ -544,7 +544,8 @@ def install(spec)
end

def load_spec_files
super if cache_path.exist?
return super if cache_path.exist?
raise PathError
rescue PathError
raise PathError, "#{to_s} is not checked out. Please run `bundle install`"
end
Expand Down

0 comments on commit 70c9699

Please sign in to comment.