Weird problem "uninitialized constant Capistrano"


#1

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, “removed_email_address@domain.invalid: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!


#2

On Apr 15, 11:24am, LuisRuby removed_email_address@domain.invalid 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


#3

WOW! It worked!
It was exactly what you said!
This was a newbie question!

Thank you very, very much!

Em domingo, 15 de abril de 2012 10h24min34s UTC-3, LuisRuby escreveu: