Gem is not available after bundle install - ruby-on-rails

I have a Gemfile where I add a new gem
gem 'activerecord-oracle_enhanced-adapter', git: "https://github.com/rsim/oracle-enhanced.git", branch: "rails4"
When I run bundle install I get
> bundle install
Updating https://github.com/rsim/oracle-enhanced.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
...
Using activerecord (4.0.0)
Using activerecord-oracle_enhanced-adapter (1.4.2) from https://github.com/rsim/oracle-enhanced.git (at rails4)
Using bundler (1.3.5)
...
But when I call gem list, the gem is missing. If I try to load this gem in the irb, I get
irb
require 'rubygems'
=> false
gem 'activerecord'
=> true
gem 'activerecord-oracle_enhanced-adapter'
Gem::LoadError: Could not find 'activerecord-oracle_enhanced-adapter' (>= 0) among 49 total gem(s)
I do not understand this behavior. I have several gems added to my Gemfile this way and all of them are working.
My system for the test:
RVM
ruby 2.0.0p195
new gemset
new rails 4 project without any modification except this gem in the Gemfile
I tried it with two different users
Ubuntu 12.04
If I call gem install activerecord-oracle_enhanced-adapter, this gem is installed, but not from the 'rails4' branch and I would like to use the Gemfile

Try calling bundle exec irb so you will load irb in specific Gemset scope instead of system one.

Related

'bundle install' keeps installing gem sqlite3 version 1.4.2 even if not in Gemfile

I need sqlite3 v1.3.9 gem installed for my app, so I add this line to the Gemfile:
gem 'sqlite3', '= 1.3.9'
However, when I run 'bundle install', it installs v1.4.2 of that gem.
I modified the above line to
gem 'sqlite3', '= 1.3.9', '< 1.4'
No joy -- sqlite v1.4.2 is installed (even if I remove any reference to 'sqlite3' from the Gemfile completely).
My Gemfile was created when I used rails new appname, so it is not fancy at all... I only added gem devise to it.
Gemfile.lock doesn't contain any reference to sqlite3. I removed it anyway and it didn't help.
As another option, I installed v1.3.9 via gem install sqlite3 -v 1.3.9 and I removed v1.4.2 with
# bundle exec gem uninstal sqlite3
Select gem to uninstall:
1. sqlite3-1.3.9
2. sqlite3-1.4.2
3. All versions
> 2
Successfully uninstalled sqlite3-1.4.2
...but as soon as I tried to add v1.3.9, I got:
# bundle add sqlite3 -v 1.3.9
[!] There was an error parsing `injected gems`: You cannot specify the same gem twice with different version requirements.
You specified: sqlite3 (~> 1.4) and sqlite3 (= 1.3.9). Bundler cannot continue.
# from injected gems:1
# -------------------------------------------
> gem "sqlite3", "= 1.3.9"
# -------------------------------------------
I'd grateful for any hints on why v1.4.2 keeps being installed and, most importantly, how do get the bundler forget about v1.4.2 and accept v1.3.9?
Thanks a lot!
There might be some gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.
There should be a gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.

Heroku, bundler fails on missing dependencies

I have had trouble recently trying to deploy my rails app on Heroku. In the past, I had deployed apps on Heroku with no problem, but Heroku does not support ruby 2.0.0 anymore. They suggest adding ruby "2.2.4" to the Gemfile, which is what I did. The beginning of my Gemfile is as follows:
source 'https://rubygems.org'
ruby "2.2.4"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use pg as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
...
So, I have run bundle install with version 1.7.8 on my computer with no problem. I can even run my app in production mode. However, when I try to deploy the app on Heroku, I get this:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.4
-----> Installing dependencies using bundler 1.11.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.4.3
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'mini_portile2'
Bundler Output: Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.4.3
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'mini_portile2'
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
Any help is greatly appreciated.
I'd suggest deleting your Gemfile.lock, running bundle install again locally, committing the new Gemfile.lock to your git repository and then try your git push heroku master again.
I had the same problem and what I did was I updated Ruby 2.2.4 in my system and restarted terminal, then followed these steps:
bundle install
bundle update
git push heroku
( it’s a good idea to update the gems with bundle update to make sure the versions match)
The problem is that you only changed the Ruby version number in the Gemfile, but did not recreate a valid Gemfile.lock. This leads to a Gemfile.lock that contains Gems in versions that are not compatible with Ruby 2.2.4.
If you change something in the Gemfile then you have to update or recreate the Gemfile.lock with the same Ruby version before pushing to Heroku.
I suggest to use a Ruby version manager (like rbenv or RVM) to be able to run multiple versions of Ruby on your development machine. Then update the Ruby version in your application by changing the Ruby version in Gemfile (for Heroku) and .ruby-version (for your local environment). Both version must match.
Once that is done, run bundle install to update the Gemfile.lock or (when there were major updates or you just want to ensure that you use the latest versions) run bundle update to recreate the Gemfile.lock.

Why can't I bundle update the latest "released" rails 3.2.16 gem?

Its important to update rails after all of the security fixes, but when I try it says the gem does not exist even though the rails blog says it has been released.
The blog says to upgrade: http://weblog.rubyonrails.org/2013/1/28/Rails-3-0-20-and-2-3-16-have-been-released/
But when I add the following to the Gemfile:
gem 'rails', '3.2.16'
And when I update I get:
➜ bundle update rails (ruby-1.9.3-p374#usertesting-orders)
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Could not find gem 'rails (= 3.2.16) ruby' in the gems available on this machine.
Any tips?
UPDATE: there is no such gem. Its supposed to be 3.2.11 NOT 3.2.16. The .16 is for the 2.3 Rails and not the 3.2.
Try gem 'rails', '3.2.11' ,according to the stable branch in GitHub.

Why does bundle install not use the version of bundler in Gemfile though its available?

When I do a
bundle install --path vendor/bundle
on my app, I get the following error.
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (= 1.0.18) java
Current Bundler version:
bundler (1.1.5)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
My gem list shows that I have the mentioned gem
*** LOCAL GEMS ***
bundler (1.1.5, 1.0.22, 1.0.18)
My gem file looks like this
gem "rake", "0.9.2"
gem "activerecord-jdbc-adapter", "1.2.0"
gem "activerecord-jdbcmysql-adapter", "1.2.0"
gem "acts_as_tree", "0.1.1"
gem "bundler", "1.0.18", :require => "bundler"
gem "database_cleaner", "0.6.7"
gem "jdbc-mysql", "5.1.13"
gem "jruby-jars", "1.6.2"
gem "jruby-rack", "1.1.3"
gem "jruby-openssl", "0.7.4"
gem "net-scp", "1.0.4"
gem "net-ssh", "2.2.1"
gem 'uuidtools', "2.1.1"
gem 'nokogiri', "1.5.0"
How do I fix this? I use jruby-1.6.3 and rails 3.0.10.
Have you tried to
- either remove bundler from the gemfile
- set it to the bundler version to use to bundle it
- or vice versa: use the bundler version to bundle that you require in the gem file
but as Anthony said, do you have a reason for including it in the Gemfile ?

Trouble launching active_record

I'm having a hard time launching active_record from my ruby script. I get :
Unable to activate activemodel-3.0.9, because i18n-0.6.0 conflicts with i18n (~> 0.5.0) (Gem::LoadError)
I'm using RVM on ruby-1.9.2-p180
remove all versions of i18n. gem uninstall i18n
now write gem 'rails', '3.0.9' in your gemfile.
Delete gemfile.lock
run bundle install

Resources