Weird problem "uninitialized constant Capistrano"

335 views
Skip to first unread message

LuisRuby

unread,
Apr 14, 2012, 11:24:44 PM4/14/12
to rubyonra...@googlegroups.com
Hi friends!

After hours of hard work searching for a solution, I appeal to the community to help me.
I'm using Rails 3.2.3, Postgresql, RVM, and running Ubuntu Server 11.10 in my own server machine.
The command "cap deploy:check" returns:

You appear to have all necessary dependencies installed

------------------------------------------------------------------------------------------------------------
Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'pg'
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
gem 'kaminari'
gem 'factory_girl_rails'
gem 'paperclip', '~> 3.0'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'

group :development do
  gem 'rspec-rails'
  gem 'capistrano'
end

gem 'rvm-capistrano'

-------------------------------------------------------------------------------
Capfile:
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'

-------------------------------------------------------------------------------
deploy.rb:
require "bundler/capistrano"
require "rvm/capistrano" 
set :rvm_ruby_string, '1.9.3'
set :application, "digifoto"
set :repository,  "g...@github.com:xxxxxxxx/digifoto.git"
set :branch, "production"

set :scm, :git
set :user, "digifoto.com"
set :deploy_to, "/home/digifoto.com/apps/#{application}"
set :deploy_via, :remote_cache

set :use_sudo, false
set :keep_releases, 3

role :web, "xxx.xx.xx.xx"                          # Your HTTP server, Apache/etc
role :app, "xxx.xx.xx.xx"                          # This may be the same as your `Web` server
role :db,  "xxx.xx.xx.xx", :primary => true # This is where Rails migrations will run

set :port, 22

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
  run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

------------------------------------------------------------------------------------------

The command "cap deploy:setup" works fine but "cap deploy:migrations" end up with this error:

rake aborted!
*** [err :: xxx.xx.xx.xx] uninitialized constant Capistrano
*** [err :: xxx.xx.xx.xx]
*** [err :: xxx.xx.xx.xx] (See full trace by running task with --trace)
    command finished in 4130ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3' -c 'cd /home/digifoto.com/apps/digifoto/releases/20120415025916 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on xxx.xx.xx.xx

I tried many things, like run the command: "bundle exec rake assets:clean" and deleting the line "//= require_tree" from app/assets/javascripts/application.js but nothing works!
Any help will be much appreciated!




Frederick Cheung

unread,
Apr 15, 2012, 5:33:31 AM4/15/12
to Ruby on Rails: Talk
On Apr 15, 11:24 am, LuisRuby <alfamemo...@gmail.com> wrote:

> I tried many things, like run the command: "bundle exec rake assets:clean"
> and deleting the line "//= require_tree" from
> app/assets/javascripts/application.js but nothing works!
> Any help will be much appreciated!


You have the rvm-capistrano gem in the main bit of your gemfile, so
when your app boots bundler will try and load it. In turn, this refers
to capistrano, which isn't installed on your production servers
because it's only in your development group.

Move the rvm-capistrano gem to the development group, alongside
capistrano and you should be fine.

Fred

LuisRuby

unread,
Apr 15, 2012, 9:24:34 AM4/15/12
to rubyonra...@googlegroups.com

LuisRuby

unread,
Apr 15, 2012, 9:31:53 AM4/15/12
to rubyonra...@googlegroups.com
WOW! It worked!
It was exactly what you said!
This was a newbie question!

Thank you very, very much!
Reply all
Reply to author
Forward
0 new messages