Created
October 15, 2012 15:33
-
-
Save bachue/3893119 to your computer and use it in GitHub Desktop.
GemBundler Bug Report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. bundle gem json1 # create a gem | |
2. cd json1 | |
3. modify json1.gemspec to this: | |
# -*- encoding: utf-8 -*- | |
lib = File.expand_path('../lib', __FILE__) | |
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
require 'json1/version' | |
Gem::Specification.new do |gem| | |
gem.name = "json1" | |
gem.version = Json1::VERSION | |
gem.authors = ["Bachue Zhou"] | |
gem.email = ["[email protected]"] | |
gem.description = %q{description} | |
gem.summary = %q{summary} | |
gem.homepage = "" | |
gem.files = `git ls-files`.split($/) | |
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } | |
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) | |
gem.require_paths = ["lib"] | |
gem.add_dependency 'json', '>= 1.7.3' # important | |
end | |
4. gem build json1.gemspec # build it, get json1-0.0.1.gem | |
5. cd .. | |
6. bundle gem json2 # create another gem | |
7. cd json2 | |
8. modify json2.gemspec to this: | |
# -*- encoding: utf-8 -*- | |
lib = File.expand_path('../lib', __FILE__) | |
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
require 'json2/version' | |
Gem::Specification.new do |gem| | |
gem.name = "json2" | |
gem.version = Json2::VERSION | |
gem.authors = ["Bachue Zhou"] | |
gem.email = ["[email protected]"] | |
gem.description = %q{description} | |
gem.summary = %q{summary} | |
gem.homepage = "" | |
gem.files = `git ls-files`.split($/) | |
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } | |
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) | |
gem.require_paths = ["lib"] | |
gem.add_dependency 'json', '<= 1.7.4' # important | |
end | |
9. gem build json2.gemspec # build it, get json2-0.0.1.gem | |
10. cd .. | |
11. mkdir test-project # create a project for test (not a rails project) | |
12. cd test-project | |
13. gem unpack ../json1/json1-0.0.1.gem | |
14. gem unpack ../json2/json2-0.0.1.gem # unpack these two gems to local | |
15. create a Gemfile, the content is: | |
source :rubygems | |
gem 'json1', '0.0.1', :path => 'json1-0.0.1/' | |
gem 'json2', '0.0.1', :path => 'json2-0.0.1/' | |
16. run "bundle install" # install gems from Gemfile | |
------------------ | |
expected: | |
Fetching gem metadata from http://rubygems.org/.. | |
Installing json (1.7.4) with native extensions | |
Using json1 (0.0.1) from source at json1-0.0.1/ | |
Using json2 (0.0.1) from source at json2-0.0.1/ | |
Using bundler (1.2.1) | |
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. | |
------------------ | |
actual: | |
Fetching gem metadata from http://rubygems.org/.. | |
Bundler could not find compatible versions for gem "json": | |
In Gemfile: | |
json2 (= 0.0.1) ruby depends on | |
json (<= 1.7.4) ruby | |
json1 (= 0.0.1) ruby depends on | |
json (1.7.5) | |
------------------ | |
# My explanation: | |
# Here I wrote 2 gems: | |
# json1, which depends on json >= 1.7.3 | |
# json2, which depends on json <= 1.7.4 | |
# And I created a project, use these 2 gems | |
# When I run "bundle install", bundler should install json plugin, whose version is >= 1.7.3 and <= 1.7.4 | |
# So I think bundler should install json 1.7.4, but actually it failed. | |
------------------ | |
Bundler version 1.2.1 | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2] | |
gem version: 1.8.24 | |
rvm 1.14.7 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] | |
rubygems-bundler (1.1.0, 1.0.3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment