Bundler dependency ~> doesn't recognize beta versions from github properly - ruby-on-rails

Here's a part of my Gemfile:
gem 'rails', "3.1.0"
gem "sprockets", :git => 'git://github.com/sstephenson/sprockets.git', :tag => "v2.0.0.beta.13"
When try to do bundle install, it says that rails 3.1.0 depend on sprockets ~> 2.0.0
Apparantely, this beta version that is downloaded from github is not recognized as a newer version. However, if I put gem "rails", "3.1.0.rc5" in my Gemfile it works fine.
How do I tell bundler to ignore this sprocket dependency or otherwise resolve this issue? And whose issue is that: bundler's or sprockets'?

Have you tried using:
gem 'rails', '~> 3.1'
gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git', :tag => 'v2.0.0.beta.13'
It's possible that your pinning rails to 3.1.0 actually forces the use of the 2.0.0 Sprockets gem. That said, I'm not sure that using a soft pin to rails 3.1 is going to ease out the dependency from rails to sprockets and let you use the beta version instead of the "release" one...

Related

prevent beta gems from being installed with gemfile constraint

in a gemfile, with the following gem constraint:
gem 'testgem', '>= 1.2.0'
is it possible to prevent a gem '1.2.6-beta' from being installed without changing the constrant?
try gem 'testgem', '~>1.2.0' or gem 'testgem', '1.2.0'
using ~>1.2.0 will only use the latest version from the 1.2.x series and not 2.0
for more info https://guides.rubygems.org/patterns/#pessimistic_version_constraint
Bundler doesn't include pre-release versions in the version check so you don't have to worry about this.

The bundle currently has rails locked at 3.2.12. whats to do?

I've changed in my gemfile the rails version from 3.2.12 to 4.2.0
then I got this error:
The bundle currently has rails locked at 3.2.12
so I tried bundle update / and bundle update rails ... but I got this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
prototype-rails (>= 0) ruby depends on
rails (~> 3.2) ruby
rails (4.2.0)
What do I have to do?
Update Gemfile:
source 'http://rubygems.org'
#gem 'rails', '3.2.12'
gem 'rails', '4.2.0'
gem "airbrake"
#gem "mysql"
gem 'mysql2', '~>0.3.7'
gem 'fastercsv'
gem 'newrelic_rpm', :group => [:production, :staging]
gem "xml-simple", :require => "xmlsimple"
gem "will_paginate", "~> 3.0.0"
gem "json", '1.7.7'
gem "default_value_for"
gem "whenever"
gem 'charlock_holmes'
gem 'prototype-rails'
gem 'rails_autolink'
group :development do
gem 'capistrano'
gem 'capistrano-ext'
end
Just run
bundle update
without telling to update just a specific gem (like rails). This allows bundler to find the lastest possible combination for all gems in the Gemfile.
The prototype-rails gem is not actively supported anymore. You should try to replace it as soon as possible (even if the latest version still works for you).
Furthermore: Multiple configuration settings have changed between Rails 3.2 and 4.2, you will have to change some of your config and core files. You also might want to read the Rails Guide: Upgrading Rails.
I suggest to upgrade your app in smaller steps (3.2 -> 4.0, 4.0 -> 4.1, 4.1 -> 4.2). Make sure that the app works in each step before you continue to the next. Also, watch out for deprecation warnings in the console or the logs.
remove your gemfile.lock
rm Gemfile.lock
then add
rails 4.2.0 in your Gemfile
then
bundle install
I think, the problem is in prototype-rails
https://github.com/rails/prototype-rails
Below Comment of prototype-rails gem
Unfortunately, due to limited manpower and resources, the Rails core team has not been able to confirm if this gem currently works with Rails 4.1 and above. If you have found any problems while upgrading your application, please report them at the issue tracker, or better yet, submit patches by sending a pull request.
Tried to remove first remove prototype-rails then run
bundle update

alternative for github : <repo-name> in gem file

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

Installing cancan 2.0 gem in Rails 3.1

I'm having trouble installing the cancan 2.0 gem in Windows XP. I am using Rails 3.1 and in my gemfile y have
gem "cancan", :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
but it keeps saying
No such file or directory - git clone
"git://github.com/ryanb/cancan.git"
My teammates are not having this problem, but the are working in Unix systems.
It sounds like your git is not working properly. Are you using any other git references in your Gemfile?
I copied and pasted the exact same thing in my gemfile and it worked just fine.
gem 'cancan', github: 'ryanb/cancan', branch: '2.0'

'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile

I am trying to use this forked version of the searchlogic gem. In my gemfile, I have
gem "searchlogic", :git => "http://github.com/railsdog/searchlogic.git"
when I do bundle install, I get this error:
Could not find gem 'searchlogic (>= 0, runtime)' in http://github.com/railsdog/searchlogic.git (at master).
Source does not contain any versions of 'searchlogic (>= 0, runtime)'
What is causing this error? Thanks for reading.
It's because your fork not define searchlogic gem by rd_searchlogic gem. So use in your Gemfile :
gem "rd_searchlogic",
:git => "rd_searchlogic.gemspec",
:require => "searchlogic"
Use:
gem 'rd_searchlogic', :git => 'https://github.com/railsdog/searchlogic.git', :require => 'searchlogic'
The .gemspec of your fork might contain a different name to that of the gem on RubyGems, for example when I forked active_merchant on GitHub their .gemspec file had:
s.name = 'activemerchant'
but the gem is defined as active_merchant on RubyGems so I changed my Gemfile from:
gem "active_merchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
to:
gem "activemerchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
note the lack of _.
All worked perfectly after that. This may be an obscure case, but hope it helps someone!
It doesn't look like that gem has been upgraded for Rails3. From the issues listed in Github, it seems that searchlogic is heavily dependent on ActiveRecord2 and may not be easily upgraded for Rails 3. It may be worth looking into an alternative.
Will searchlogic work with Rails 3?
http://github.com/binarylogic/searchlogic/issues/issue/65

Resources