summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-02-02 11:43:13 -0800
committerCarl Lerche <carllerche@mac.com>2010-02-02 11:43:13 -0800
commit32c39baa7ee3ba955204a4b5b0b21eb6436a95ed (patch)
tree5d527968714e0003e3f4c85b0ebdf1462dbc01a2
parenta17714ac64780f00bc6a00f86639273117c679be (diff)
downloadbundler-32c39baa7ee3ba955204a4b5b0b21eb6436a95ed.tar.gz
Add bundle unlock
-rw-r--r--lib/bundler/cli.rb6
-rw-r--r--lib/bundler/environment.rb13
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index d8c20e46c3..959735ff84 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -62,6 +62,12 @@ module Bundler
environment.lock
end
+ desc "unlock", "Unlock the bundle. This allows gem versions to be changed"
+ def unlock
+ environment = Bundler.load
+ environment.unlock
+ end
+
desc "show", "Shows all gems that are part of the bundle."
def show
environment = Bundler.load
diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb
index b396136cc6..004b978fa6 100644
--- a/lib/bundler/environment.rb
+++ b/lib/bundler/environment.rb
@@ -28,7 +28,18 @@ module Bundler
FileUtils.mkdir_p("#{root}/vendor")
write_yml_lock
write_rb_lock
- Bundler.ui.info("The bundle is locked. Use `bundle show` to list the gems in the environment.")
+ Bundler.ui.info("The bundle is now locked. Use `bundle show` to list the gems in the environment.")
+ end
+
+ def unlock
+ unless locked?
+ Bundler.ui.info("The bundle is not currently locked.")
+ return
+ end
+
+ File.delete("#{root}/vendor/environment.rb")
+ File.delete("#{root}/Gemfile.lock")
+ Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
end
def locked?