rvmrc specifies 1.9.3 but bundle install --deployment uses 1.9.1? why so? - deployment

My rails app (myapp) has a .rvmrc containing
# cat .rvmrc
rvm --create use ruby-1.9.3-p0#myapp
When I deploy my app using capistrano in production (which works fine)...
#cat deploy.rb
require 'bundler/capistrano'
require 'rvm/capistrano'
...
#cap deploy
I noticed bundle install --deployment installs the gems in the shared/bundle directory which is fine.
* executing "cd /usr/local/mycompany/myapp/releases/20130523003402 &&
bundle install --gemfile /usr/local/mycompany/myapp/releases/20130523003402/Gemfile
--path /usr/local/mycompany/myapp/shared/bundle
--deployment
--quiet
--without development test"
Im just curious why the ruby version that bundle uses is 1.9.1. Shouldn't it pick up 1.9.3 as specified in my .rvmrc?
/usr/local/mycompany/myapp/shared/bundle/ruby/1.9.1

1.9.1 is ruby compatibility level, all 1.9..* rubies are supposed to be compatible so theoretically it should be safe to use gems from ruby 1.9.2 in ruby 1.9.3, in practice there is more factors then just ruby version - but being careful you could share gems between ruby versions.

Related

How to setup rake to compile mruby gems?

I am trying to build the example gem from here following the mruby documentation for building gems.
I'm on a Mac OS Catalina, and I have installed RVM to manage my installation mruby. Right now which ruby returns /Users/mdorier/.rvm/rubies/mruby-2.0.1/bin/ruby so I can see that mruby is used.
The example gem above has an mrbgem.rake file, so even though the documentation doesn't explain how to build the gem, I suppose rake should be invoked in that directory. I didn't have rake installed, so I tried to install it with gem install rake, but it seems that Mac OS's native gem executable in /usr/bin got invoked, apparently installing the normal ruby's rake gem. When I call that rake, it doesn't find a Rakefile in the directory. If I specify rake -f mrbgem.rake, it tells me NameError: uninitialized constant MRuby.
I see that mruby doesn't have a gem command but seems to have a mgem that can be installed with gem. I installed it. I see that there is a mruby-rake mgem available, which I activated using mgem add mruby-rake, but it doesn't change what the rake command points to.
Can someone explain how I can install and use the proper rake command to build this mruby gem?

Installing redmine_contacts plugin for bitnami_redmine

I am trying to install redmine_contacts plugin for my redmine 2.2.3.0 (which is installed using BITNami installer), as in readme.rdoc:
Copy redmine_contacts plugin to {RAILS_APP}/plugins on your redmine path
Run bundle install --without development test RAILS_ENV=production
Run rake redmine:plugins NAME=redmine_contacts RAILS_ENV=production
The first two steps was successful, but last executing last command, following error would occur:
(in /home/.../redmine-2.2.3-0/apps/redmine/htdocs)
Could not find sprockets-2.2.1 in any of the sources
Run bundle install to install missing gems.
To see if the sprockets library is installed by executing command: #bundle show sprockets, it shows a newer version of this library is installed:
/var/lib/gems/1.8/gems/sprockets-2.2.2
I think somehow the BitNami version of gem which is installed is not compatible with the sprockets-2.2.2 on the system and it requires 2.2.1. Maybe you should change to that version.
Try something like:
gem install sprockets -v 2.2.1

Trouble upgrading to rails 2.3.15 with rack 1.1.3

I'm getting the following error when trying to fire up script/console for my rails 2.3.15 app, after upgrading from rails 2.3.5. Does this mean the issue is with bundler 1.2.1 is not compatible with rack 1.1.3? Any help would be appreciated immensely.
usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/rubygems_integration.rb:157:in gem': can't activate rack (~> 1.0.1), already activated rack-1.1.3. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
from /home/developer/bigpink/vendor/rails/actionpack/lib/action_controller.rb:34
from /home/developer/bigpink/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:inrequire'
from /home/developer/bigpink/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in require'
from /home/developer/bigpink/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:innew_constants_in'
from /home/developer/bigpink/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in require'
from /home/developer/bigpink/vendor/rails/railties/lib/commands/server.rb:2
from script/server:3:inrequire'
from script/server:3
In my case, problem solved by the following steps:
Deleted the directory $PROJECT_ROOT/vendor/rails
Modified RAILS_GEM_VERSION in config/environment.rb
we used this process to upgrade Rails to 3.2.11 on our Heroku apps (as reported here)
stop – your Ruby on Rails (RoR) server
edit – appropriate line in gem file to read [one of]:
gem ‘rails’, ’3.2.11′
gem ‘rails’, ’3.1.10′
gem ‘rails’, ’3.0.19′
gem ‘rails’, ’2.3.15′
run – gem update
run – bundle update
run - bundle install
test – rspec # or test-driven dev’t framework of choice
launch – rails s
test – # interact with Rails server & explore if all is well
run – git add .
run – git commit -a -m “upgrade Rails server to ver. [x.y.z]“
run - git push # to github or rcs of choice
run - git push heroku # or to deployment server of choice

heroku deployment error : bundler version

I have ruby 1.9.2 and rails 3.0.0 with bundler 1.0.22
when I push to heroku, I get
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle -
-binstubs bin/
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.rc.7)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
why does it use bundler version 1.1.rc.7 to install the dependencies and
why does it think the current bundler version is 1.1.rc.7?
No references in the .Gemfile or the Gemfile.lock to any version.
Any input appreciated.
-Thanks
If you have the following lines in your Gemfile.lock:
PLATFORMS
x86-mingw32
be sure to delete them. And don't forget to use:
git add Gemfile Gemfile.lock

Rails 3.1 - Pushing to Heroku - Errors installing postgres adapter?

I just upgraded to Rails 3.1 and the first app i've tried to deploy to Heroku has encountered a problem relating to Postgres adapter. I'm able to push the app to heroku but then when i try to migrate the database i get the following error:
heroku rake db:migrate
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
(pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
when I try their suggested install i get:
ERROR: Could not find a valid gem 'activerecord-postgresql-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-postgis-adapter, activerecord-jdbcpostgresql-adapter, activerecord-postgresql-cursors, activerecord-jdbcmysql-adapter, activerecord-jdbcmssql-adapter
which already seems weird... so what exact gem should I install to get this thing working if not what they say I should install??
When I try installing gem pg i get:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/jerometufte/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
...
I'm using SQLite3 currently. Any help greatly appreciated, this is baffling me.
Option 1:
Add pg to your Gemfile but skip trying to install it locally.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Skip attempting to install the pg gem
$ bundle install --without production
Option 2 (Debian/Ubuntu):
Add pg to your Gemfile but first install the prerequisites.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Install the pg gem's dependencies first
$ sudo apt-get install libpq-dev
# Then install the pg gem along with all the other gems
$ bundle install
You definitely need pg in the Gemfile for Heroku.
About the error you're getting locally: make sure you have postgres installed, run gem install pq -- --with-pg-config=[path to wherever your pg-config binary is], then bundle install.
Alternatively, if your local database is working fine (either because you're using sqlite or postgres-pr), you could put the gem 'pg' line in your Gemfile in a group called production, then bundle install --without production locally.
More up-to-date info: It had something to do with a different version of pg gem locally.
I already had pg in a production group (I run sqllite locally), but Heroku was still puking.
The problem went away for my new Rails 3.1 app when I:
rm Gemfile.lock
touch Gemfile
bundle install
git add .
git commit -am "wiped Gemfile.lock re-ran bundle install"
git push heroku master
worked like a charm when I then ran heroku run rake db:migrate