So, many people like to fork gems and add features to them etc.. that is fine. but it makes trying their gem a bit of work if you have to clone teh gem yourself, download it, install, etc.
I'd like to be able to have bundler compile the gem for me if there is no pkg/gem_name.gem file
This is what I'm doing currently:
gem "yard-rest-plugin", :git => "git://github.com/ql/yard-rest-plugin.git"
And then the bundle update error:
Could not find gem 'yard-rest-plugin (>= 0) ruby' in git://github.com/ql/yard-rest-plugin.git (at master).
Source does not contain any versions of 'yard-rest-plugin (>= 0) ruby'
Hence why it would be nice if it auto-compiled.
Looks like the name of the gem is gem 'yard-rest' so this should work:
gem "yard-rest", :git => "git://github.com/ql/yard-rest-plugin.git"
https://github.com/ql/yard-rest-plugin
Related
In my Gemfile
source 'https://rubygems.org'
ruby '2.1.0'
gem 'rails', '4.0.1'
gem "faraday"
gem "faraday_middleware"
gem "twitter", github: 'sferik/twitter'
if I run
$ bundle install
I get
Bundler could not find compatible versions for gem "faraday": In
Gemfile:
twitter (>= 0) ruby depends on
faraday (~> 0.9.0) ruby
faraday (0.8.9)
TL;DR: Try running bundle update.
Bundler tries to find gems that match in such a way that all their dependencies also match. So consider this:
gem A v1 depends on B v1
gem A v2 depends on B v2
gem C v1 depends on B v1
there is no version of C that knows how to handle B v2.
In this case, Bundler will choose (or even downgrade) A to v1, so that you can A and C running next to each other.
However there are a couple of things that might prevent this from happening, and that will cause the error you are seeing:
There is no A v1, so no match can be made at all. You're stuck in this case, those gems will not work together at all.
You've already installed A v2 and you are adding C later. This means Bundler needs to downgrade A, but it doesn't do downgrades/upgrades when only running bundle install. You'd have to specifically say that it needs to recalculate the dependencies by running bundle update A or for all the gems in your gemfile: bundle update.
One of the gems is from a git repository. Git repositories don't really have versions like gems hosted on rubygems.org do. This means that Bundler will only fetch the latest version and cannot downgrade that gem. You need to specify a branch or revision manually in this case.
My guess is that you are looking at scenario 2. You've already installed (and locked down on) version 0.8.9 of faraday. By adding twitter, your previous lock needs to be updated.
Be careful of running bundle update without arguments however. It will try to get the latest versions of every gem in your gemfile, which might not be what you want.
When developing rails 4.1 engine module_infox, there include gem authentify which is developed in rails 3.2 in module_infox's gemfile:
gem 'authentify', :path => '../authentify'
Gem authentify sits locally and its gemfile.lock was deleted to remove the version lock.
When bundle install under module_infox, there is an error:
$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "rails":
In Gemfile:
authentify (>= 0) x86-mingw32 depends on
rails (= 3.2.12) x86-mingw32
module_infox (>= 0) x86-mingw32 depends on
rails (4.1.0.beta1)
Based on our reading, old version gem can be used in newer version gem. Both gemfile.lock in authentify and module_infox were deleted before bundle install. But there is the same error. What's right way to do so?
I think the specific dependency on Rails 3.2.12 on authentify gem is the reason of conflict.
Solution 1: Direct fix
The most intuitive solution would be changing this hard dependency. Say, revise the gemspec as rails, '> 3.2'.
However, your authentify gem itself may not be ready for Rails 4 yet. So using this would be a bit aggressive.
Solution 2: Use git brach
The better alternative is to add a branch in authentify gem say "rails-4", then change the gemspec as above.
Then you need to specify this git branch in Gemfile.
If you use Github to host this gem
gem 'authentify', git: 'git://github.com/username/authentify', branch: 'rails-4'
If you are not going to opensource this gem, you can still use local path. But you need to setup Bundle to recognize it.
$ bundle config local.authentify ~/Work/git/authentify
Then set it in Gemfile
# gem 'authentify', :github => 'authentify/authentify', :branch => 'master'
I commented out the last line of code because I just copied it from Bundle doc but not verified that before. You can check the doc and experiment by yourself. http://bundler.io/v1.2/git.html
I've been searching for a solution to this problem but been unable to find it.
I'm trying to add spree-stock-manager to my vanilla spree test store (1.2.0).
When I run 'bundle install' i get
Could not find gem 'spree-stock-manager (>= 0) ruby' in git://github.com/olivierbuffon/spree-stock-manager.git (at master). Source does not contain any versions of 'spree-stock-manager (>= 0) ruby'
I tried downloading and installing it as a local gem into vendor/gems and also added a specific version to my Gemfile (suggestion from Stackoverflow). Same result only said (= 1.1.0) instead of (>= 0).
I looked into the .gemspec for spree_stock_manager and it said
s.add_dependency 'spree_core', '~> 1.1.0'
so that should include spree_core 1.2.0, right?
Other info:
Mac OSX, rvm, rails 3.2.9
Anyone knows why this happens?
Thanks in advance!
s.add_dependency 'spree_core', '~> 1.1.0'
This indicates that it requires any version of spree_core from 1.1.0 up to, but NOT including 1.2.0.
I would be weary of using this gem for a couple reasons. First, there are no tests associated with it, which tells me the author doesn't care enough about the code to take the time to document the expected behavior. It also won't be easy for others to contribute bug fixes or enhancements without tests. Second, the gem isn't registered at rubygems.org. While not required, this is the standard gem repo and tells me that the author had no intention of actually releasing it publicly.
I am trying to build the docrails in my system. When I clone the repo and do bundle install as the guides say.
I get the following error
You passed :github as an option for gem 'rails/active_record_deprecated_finders'
, but it is invalid.
Entry in gemfile looks like this:
gem 'rails/active_record_deprecated_finders', github: 'rails/active_record_deprecated_finders'
To avoid that what I am doing is commenting the rest of the line like this:
gem 'rails/active_record_deprecated_finders'#, github: 'rails/active_record_deprecated_finders'
Then it foregoes that and the next problem arrives with the error message saying:
Could not find gem 'active_record_deprecated_finders (>= 0) x86-mingw32' in any
of the gem sources listed in your Gemfile.
Environment specs:
Bundler version 1.0.21
Rails 3.2.3
Win7 64bit
Question
I dont know why its looking for x86 when my System is 64bit.Is there any work around for this? or its a bug?
If gem file couldn't accept github: as parameter why is it there in the first place?
Please let me know if there are any workarounds to this problem
The :github option is just shorthand for a longer :git option:
gem :foo, :github => 'rails/foo'
Is just short for
gem :foo, :git => 'git://github.com/rails/foo.git'
This is new in bundler 1.1 which is why it doesn't work on your setup. You could rewrite the gemfile but it would probably be easier to update bundler. In addition bundler 1.1 is a lot faster than 1.0
Following these easy steps:
gem unpack spree_easy_contact -v 1.0.2 --target vendor/gems
Unpacked gem: '../vendor/gems/spree_easy_contact-1.0.2'
And then in my Gemfile I add this line :
gem "spree_easy_contact", :path => "vendor/gems/spree_easy_contact-1.0.2"
But it fails when I run bundle install.
Could not find gem 'spree_easy_contact (>= 0, runtime)' in source at vendor/gems/spree_easy_contact-1.0.2.
Source does not contain any versions of 'spree_easy_contact (>= 0, runtime)'
I believe this is because there is no gemspec file located in the gem. Is there a way to build one for it ?
Anyone know a way to get around this ?
I forgot to leave the version out on my Gem! Super important :
gem "spree_easy_contact", '1.0.2', :path => "#{File.expand_path(__FILE__)}/../vendor/gems/spree_easy_contact-1.0.2"
Also it was strange..this Gem also require honeypot-captcha, so I had to include that in my Gemfile. All is well.
You can try this solution:
http://makandra.com/notes/538-freeze-vendor-unpack-a-single-ruby-gem-with-and-without-bundler