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

Commit

Permalink
Add a --relock option to bundle install
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlhuda committed Feb 11, 2010
1 parent fb1e725 commit 28d5130
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ def check
end

desc "install", "Install the current environment to the system"
method_option :without, :type => :array, :banner => "Exclude gems that are part of the specified named group"
method_option :without, :type => :array, :banner => "Exclude gems that are part of the specified named group"
method_option :relock, :type => :boolean, :banner => "Unlock, install the gems, and relock"
def install(path = nil)
remove_lockfiles if options[:relock]

opts = options.dup
opts[:without] ||= []
opts[:without].map! { |g| g.to_sym }

Bundler.settings[:path] = path if path

Installer.install(Bundler.root, Bundler.definition, opts)

lock if options[:relock]
end

desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
Expand Down
13 changes: 11 additions & 2 deletions spec/install/gems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,27 @@
end

describe "when locked" do
it "works" do
system_gems "rack-1.0.0" do
before(:each) do
system_gems "rack-0.9.1" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G

bundle :lock
end
end

it "works" do
system_gems [] do
bundle :install
should_be_installed "rack 0.9.1"
end
end

it "allows --relock to update the dependencies" do
system_gems "rack-0.9.1" do
bundle "install --relock"
should_be_installed "rack 1.0.0"
end
end
Expand Down

0 comments on commit 28d5130

Please sign in to comment.