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

Commit

Permalink
Perform unlock before bundle is loaded to avoid fingerprint check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Feb 7, 2010
1 parent 2941baf commit b6bee12
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
21 changes: 17 additions & 4 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def install(path = nil)

desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
def lock
if File.exist?("#{Bundler.root}/Gemfile.lock")
if locked?
Bundler.ui.info("The bundle is already locked, relocking.")
`rm #{Bundler.root}/Gemfile.lock #{Bundler.root}/.bundle/environment.rb`
remove_lockfiles
end

environment = Bundler.load
Expand All @@ -72,8 +72,12 @@ def lock

desc "unlock", "Unlock the bundle. This allows gem versions to be changed"
def unlock
environment = Bundler.load
environment.unlock
if locked?
remove_lockfiles
Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
else
Bundler.ui.info("The bundle is not currently locked.")
end
end

desc "show", "Shows all gems that are part of the bundle."
Expand Down Expand Up @@ -113,5 +117,14 @@ def exec(*)
Kernel.exec *ARGV
end

private
def locked?
File.exist?("#{Bundler.root}/Gemfile.lock") || File.exist?("#{Bundler.root}/.bundle/environment.rb")
end

def remove_lockfiles
FileUtils.rm_f "#{Bundler.root}/Gemfile.lock"
FileUtils.rm_f "#{Bundler.root}/.bundle/environment.rb"
end
end
end
11 changes: 0 additions & 11 deletions lib/bundler/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ def dependencies
@definition.actual_dependencies
end

def unlock
unless locked?
Bundler.ui.info("The bundle is not currently locked.")
return
end

FileUtils.rm_f("#{root}/.bundle/environment.rb")
FileUtils.rm_f("#{root}/Gemfile.lock")
Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
end

def lock
Bundler.ui.info("The bundle is already locked, relocking.") if locked?
sources.each { |s| s.lock if s.respond_to?(:lock) }
Expand Down

0 comments on commit b6bee12

Please sign in to comment.