summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel E. Giddins <segiddins@segiddins.me>2015-06-25 08:14:54 -0700
committerSamuel E. Giddins <segiddins@segiddins.me>2015-06-25 08:14:54 -0700
commita96f7ccfe6ba070447b0f3a6a6d14593eb1f8121 (patch)
treed0199d15abffd1b1e00e2f58b5cea526a46ebe0b
parentf11efb087d648faa92eb79ccb07a592f13c028f0 (diff)
parentb5db5535355e37a9bc23b87acc602e0398b3ec3c (diff)
downloadbundler-a96f7ccfe6ba070447b0f3a6a6d14593eb1f8121.tar.gz
Merge tag 'v1.10.5'
Version 1.10.5 # Conflicts: # README.md
-rw-r--r--CHANGELOG.md10
-rw-r--r--README.md8
-rw-r--r--lib/bundler/definition.rb19
-rw-r--r--lib/bundler/source/rubygems.rb6
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--man/gemfile.5.ronn10
-rw-r--r--spec/install/force_spec.rb18
-rw-r--r--spec/lock/lockfile_spec.rb44
8 files changed, 99 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cb80bee5a..1bad906041 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,14 @@
-## 1.10.5 (Unreleased)
+## 1.10.5 (2015-06-24)
+
+Workarounds:
+
+ - don't add or update BUNDLED WITH during `install` with no changes (@segiddins)
Bugfixes:
- - fix sorting of mixed DependencyLists with RubyGems >= 2.23 (@tony-spataro-rs)
+ - fix sorting of mixed DependencyLists with RubyGems >= 2.23 (#3762, @tony-spataro-rs)
+ - speed up resolver for path and git gems (@segiddins)
+ - fix `install --force` to not reinstall Bundler (#3743, @karlo57)
## 1.10.4 (2015-06-16)
diff --git a/README.md b/README.md
index 55eb6e80e7..c467673067 100644
--- a/README.md
+++ b/README.md
@@ -14,9 +14,9 @@ It does this by managing the gems that the application depends on. Given a list
```
gem install bundler
bundle init
-echo "gem 'rails'" >> Gemfile
+echo 'gem "rspec"' >> Gemfile
bundle install
-bundle exec rails new myapp
+bundle exec rspec
```
See [bundler.io](http://bundler.io) for the full documentation.
@@ -34,3 +34,7 @@ Feel free to chat with the Bundler core team (and many other users) on IRC in th
### Contributing
If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md).
+
+### Code of Conduct
+
+Everyone interacting in the Bundler project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/bundler/bundler/blob/master/CODE_OF_CONDUCT.md).
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 352ed55c08..997258c309 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -248,23 +248,24 @@ module Bundler
# i.e., Windows with `git config core.autocrlf=true`
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
- return if lockfiles_equal?(@lockfile_contents, contents, preserve_bundled_with)
-
- if Bundler.settings[:frozen]
- Bundler.ui.error "Cannot write a changed lockfile while frozen."
- return
- end
-
if @locked_bundler_version
locked_major = @locked_bundler_version.segments.first
current_major = Gem::Version.create(Bundler::VERSION).segments.first
- if locked_major < current_major
- Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{Bundler::VERSION.split('.').first}, " \
+ if updating_major = locked_major < current_major
+ Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
"after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}."
end
end
+ preserve_bundled_with ||= !updating_major && (Bundler.settings[:frozen] || !@unlocking)
+ return if lockfiles_equal?(@lockfile_contents, contents, preserve_bundled_with)
+
+ if Bundler.settings[:frozen]
+ Bundler.ui.error "Cannot write a changed lockfile while frozen."
+ return
+ end
+
File.open(file, 'wb'){|f| f.puts(contents) }
rescue Errno::EACCES
raise PermissionError.new(file)
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 7b40860db9..a7a826d3f9 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -98,7 +98,7 @@ module Bundler
end
end
- if installed_specs[spec].any? && !force
+ if installed?(spec) && (!force || spec.name.eql?("bundler"))
Bundler.ui.info "Using #{version_message(spec)}"
return nil # no post-install message
end
@@ -413,6 +413,10 @@ module Bundler
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
end
+ def installed?(spec)
+ installed_specs[spec].any?
+ end
+
end
end
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index e4646d5b79..9873d538f3 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -2,5 +2,5 @@ module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
- VERSION = "1.10.4" unless defined?(::Bundler::VERSION)
+ VERSION = "1.10.5" unless defined?(::Bundler::VERSION)
end
diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn
index 89911695fc..94458d2464 100644
--- a/man/gemfile.5.ronn
+++ b/man/gemfile.5.ronn
@@ -443,6 +443,16 @@ In the case of the `git` block form, the `:ref`, `:branch`, `:tag`,
and `:submodules` options may be passed to the `git` method, and
all gems in the block will inherit those options.
+## INSTALL_IF (#install_if)
+
+The `install_if` method allows gems to be installed based on a proc or lambda.
+This is especially useful for optional gems that can only be used if certain
+software is installed or some other conditions are met.
+
+ install_if -> { RUBY_PLATFORM =~ /darwin/ } do
+ gem "pasteboard"
+ end
+
## GEMSPEC (#gemspec)
If you wish to use Bundler to help install dependencies for a gem while it is
diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb
index 269390994a..737c11d923 100644
--- a/spec/install/force_spec.rb
+++ b/spec/install/force_spec.rb
@@ -7,14 +7,30 @@ describe "bundle install" do
source "file://#{gem_repo1}"
gem "rack"
G
+ end
+
+ it "re-installs installed gems" do
+ rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
bundle "install"
+ rack_lib.open('w'){|f| f.write("blah blah blah") }
+ bundle "install --force"
+
+ expect(exitstatus).to eq(0) if exitstatus
+ expect(out).to include "Using bundler"
+ expect(out).to include "Installing rack 1.0.0"
+ expect(rack_lib.open{|f| f.read }).to eq("RACK = '1.0.0'\n")
+ should_be_installed "rack 1.0.0"
end
- it "re-installs installed gems" do
+ it "works on first bundle install" do
bundle "install --force"
+
+ expect(exitstatus).to eq(0) if exitstatus
+ expect(out).to include "Using bundler"
expect(out).to include "Installing rack 1.0.0"
should_be_installed "rack 1.0.0"
end
+
end
end
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 052c08f414..792ebf07b8 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -74,8 +74,7 @@ describe "the lockfile format" do
G
end
- it "updates the lockfile's bundler version if not present" do
-
+ it "does not update the lockfile's bundler version if nothing changed during bundle install" do
lockfile <<-L
GEM
remote: file:#{gem_repo1}/
@@ -87,6 +86,9 @@ describe "the lockfile format" do
DEPENDENCIES
rack
+
+ BUNDLED WITH
+ 1.10.0
L
install_gemfile <<-G
@@ -108,6 +110,44 @@ describe "the lockfile format" do
rack
BUNDLED WITH
+ 1.10.0
+ G
+ end
+
+ it "updates the lockfile's bundler version if not present" do
+
+ lockfile <<-L
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{generic(Gem::Platform.local)}
+
+ DEPENDENCIES
+ rack
+ L
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack", "> 0"
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{generic(Gem::Platform.local)}
+
+ DEPENDENCIES
+ rack (> 0)
+
+ BUNDLED WITH
#{Bundler::VERSION}
G
end