summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli.rb5
-rw-r--r--spec/cache/gems_spec.rb11
-rw-r--r--spec/support/builders.rb8
3 files changed, 22 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index decab015e7..0fff9000d4 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -72,6 +72,7 @@ module Bundler
method_option "relock", :type => :boolean, :banner => "Unlock, install the gems, and relock."
method_option "disable-shared-gems", :type => :boolean, :banner => "Do not use any shared gems, such as the system gem repository."
method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
def install(path = nil)
opts = options.dup
opts[:without] ||= []
@@ -91,11 +92,11 @@ module Bundler
raise GemfileChanged, "You changed your Gemfile after locking. " +
"Please run `bundle install --relock`."
end
- Bundler.ui.confirm "Your bundle is complete! " +
- "Use `bundle show [gemname]` to see where a bundled gem is installed."
lock if options[:relock]
cache if Bundler.root.join("vendor/cache").exist?
+ Bundler.ui.confirm "Your bundle is complete! " +
+ "Use `bundle show [gemname]` to see where a bundled gem is installed."
rescue GemNotFound => e
if Bundler.definition.sources.empty?
Bundler.ui.warn "Your Gemfile doesn't have any sources. You can add one with a line like 'source :gemcutter'"
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb
index 8b1a006e9b..cf9cf354c6 100644
--- a/spec/cache/gems_spec.rb
+++ b/spec/cache/gems_spec.rb
@@ -115,6 +115,17 @@ describe "bundle cache" do
cached_gem("actionpack-2.3.2").should_not exist
cached_gem("activesupport-2.3.2").should_not exist
end
+
+ it "doesn't remove gems with mismatched :rubygems_version or :date" do
+ cached_gem("rack-1.0.0").rmtree
+ build_gem "rack", "1.0.0",
+ :path => bundled_app('vendor/cache'),
+ :rubygems_version => "1.3.2"
+ simulate_new_machine
+
+ bundle :install
+ cached_gem("rack-1.0.0").should exist
+ end
end
end \ No newline at end of file
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index bff998e992..8b6454fe0d 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -369,6 +369,13 @@ module Spec
def _build(options)
path = options[:path] || _default_path
+
+ if options[:rubygems_version]
+ @spec.rubygems_version = options[:rubygems_version]
+ def @spec.mark_version; end
+ def @spec.validate; end
+ end
+
case options[:gemspec]
when false
# do nothing
@@ -381,6 +388,7 @@ module Spec
unless options[:no_default]
@files = _default_files.merge(@files)
end
+
@files.each do |file, source|
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)