Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

If you're pinning a gem to a source (such as a git repo) and there ar…

…e only prereleases in the source (that satisfy the dependency) it should work.
  • Loading branch information...
commit 71ae06293440fb3658bec838e6368414afbb4d2b 1 parent 9b834f6
Carlhuda authored
Showing with 24 additions and 7 deletions.
  1. +13 −7 lib/bundler/resolver.rb
  2. +11 −0 spec/bundler/directory_spec.rb
View
20 lib/bundler/resolver.rb
@@ -222,13 +222,19 @@ def resolve_requirement(spec, requirement, reqs, activated)
def search(dependency)
@cache[dependency.hash] ||= begin
- collection = @by_gem[dependency.name].gems if @by_gem[dependency.name]
- collection ||= @specs
- collection[dependency.name].select do |spec|
- match = dependency =~ spec
- match &= dependency.version_requirements.prerelease? if spec.version.prerelease?
- match
- end.sort_by {|s| [s.version, s.platform == 'ruby' ? "\0" : s.platform] }
+ pinned = @by_gem[dependency.name].gems if @by_gem[dependency.name]
+ specs = (pinned || @specs)[dependency.name]
+
+ wants_prerelease = dependency.version_requirements.prerelease?
+ only_prerelease = specs.all? {|spec| spec.version.prerelease? }
+
+ found = specs.select { |spec| dependency =~ spec }
+
+ unless wants_prerelease || (pinned && only_prerelease)
+ found.reject! { |spec| spec.version.prerelease? }
+ end
+
+ found.sort_by {|s| [s.version, s.platform == 'ruby' ? "\0" : s.platform] }
end
end
end
View
11 spec/bundler/directory_spec.rb
@@ -91,6 +91,17 @@
tmp_gem_path.should include_installed_gem("rack-0.9.1")
end
+ it "works with prerelease gems" do
+ build_lib "very-simple", "1.0.pre", :gemspec => true
+ install_manifest <<-Gemfile
+ clear_sources
+ gem "very-simple", :path => "#{tmp_path}/libs/very-simple-1.0.pre"
+ Gemfile
+
+ out = run_in_context "Bundler.require_env ; puts VERYSIMPLE"
+ out.should == "1.0.pre"
+ end
+
it "recursively finds all gemspec files in a directory" do
build_lib("first", "1.0", :gemspec => true)
build_lib("second", "1.0", :gemspec => true) do |s|
Please sign in to comment.
Something went wrong with that request. Please try again.