Search code examples
ruby-on-rails-3.2capistranobundlervm-capistrano

Rails app fails to load as soon as i installed capistrano


i am trying to deploy my rails application for the first time on vexxhost. i am using github as my Source code management and capistrano.

here is my deploy file

require 'bundler/capistrano'
require 'capistrano'
require 'bundler'
require 'capistrano-vexxhost'

# Account Settings

ssh_options[:forward_agent] = true
set :scm_command, "/home/user/opt/bin/git"
set :local_scm_command,"git"
set :user, "xxxxxxxx"
set :password, "xxxxxxxxx"
set :domain, "domain.com"
set :mount_path,"/home/xxxxxxxx/xxxxxxx"
set :application,"app name"
set :scm, :git
set :deploy_via, :copy
set :repository, "[email protected]:xxxxx/xxxxxxx.git"
default_run_options[:pty] = true

As soon as i installed gem 'capistrano' gem 'capistrano-vexxhost' i got the following error when trying to load my application locally on my laptop (it was working before installing capistrano).

 C:/Ruby193/lib/ruby/gems/1.9.1/gems/capistrano-2.14.1/lib/capistrano/configuration/loading.rb:18:in `instance': Please require this file from within a Capistrano recipe (LoadError) 
  from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/capistrano.rb:7:in `<top (required)>'
    from C:/Users/mummy/LagoAds/config/application.rb:6:in `require'
    from C:/Users/mummy/LagoAds/config/application.rb:6:in `<top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

NOTE But as i soon as i comment the Bundler.require line from the following code in the application.rb file, it successfully runs but doesn't recognize the gems

 if defined?(Bundler)
 # If you precompile assets before deploying to production, use this line
 Bundler.require(*Rails.groups(:assets => %w(development test)))
 # If you want your assets lazily compiled in production, use this line
 # Bundler.require(:default, :assets, Rails.env)
 end

UPDATE

when i enter the following code " rake --trace " it also gives me the following error

 rake aborted!
 please require the file from withen a capistrano recipe

PLEASE I NEED HELP WITH THIS PROBLEM


Solution

  • if you put capistrano* gems into the Gemfile you need to disable automatic requiring:

    gem 'capistrano-vexxhost', :require => false