Using Mailer with Assets precompiled in production - ruby-on-rails

I'm having problems using Mailer from the command prompt in my production environment. Using this command
Mailer.function.deliver
Gives this error
Errno::ENOTDIR: Not a directory - /assets/
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `initialize'
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/rails/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:70:in `request_and_unzip'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:45:in `load_css_at_path'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/css_helper.rb:15:in `css_for_doc'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/premailer.rb:14:in `initialize'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/hook.rb:18:in `new'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/premailer-rails3-1.2.0/lib/premailer-rails3/hook.rb:18:in `delivering_email'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:230:in `block in inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:229:in `each'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/mail.rb:229:in `inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/message.rb:218:in `inform_interceptors'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/mail-2.3.3/lib/mail/message.rb:228:in `deliver'
from (irb):1
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /home/rails/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3-p194 :002 >
I can correct the problem if I delete the 'public/assets' folder, however this causes the rest of the production website to fail at loading images/css, etc.
I precompile my assets using this command rake assets:precompile

Figured it out. Seems in production for rails 3.1 pre-compiled assets pipeline, premailer requires you have at least a blank email.css under app/assets/stylesheets before you pre-compile your assets.

Related

When upgrading from Rails 3.2 to Rails 4, why does rake give 'uninitialized constant ActiveModel::ForbiddenAttributesProtection'?

I am currently attempting to upgrade a Rails 3.2 app to Rails 4. I updated my Gemfile by referencing the correct version of Rails:
gem 'rails', '~>4.0.0'
as well as removing the assets header, per here.
Next, I attempted to run rake rails:update. It gave me this error:
rake aborted!
NameError: uninitialized constant ActiveModel::ForbiddenAttributesProtection
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/attribute_assignment.rb:6:in `<module:AttributeAssignment>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/attribute_assignment.rb:3:in `<module:ActiveRecord>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/attribute_assignment.rb:2:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/base.rb:300:in `<class:Base>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/base.rb:281:in `<module:ActiveRecord>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/base.rb:22:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.13/lib/active_record/railtie.rb:38:in `block in <class:Railtie>'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/railtie.rb:201:in `instance_exec'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/railtie.rb:201:in `block in run_tasks_blocks'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/railtie.rb:201:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/railtie.rb:201:in `run_tasks_blocks'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/application.rb:253:in `block in run_tasks_blocks'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/engine/railties.rb:17:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/engine/railties.rb:17:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/application.rb:253:in `run_tasks_blocks'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/engine.rb:446:in `load_tasks'
/home/vagrant/.rvm/gems/ruby-2.2.0/gems/railties-4.0.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/vagrant/Rakefile:7:in `<top (required)>'
(See full trace by running task with --trace)
What is causing this error?
The only place I could find this error online was this GitHub issue.
I searched for ActiveModel::ForbiddenAttributesProtection on that page, and found it here.
As I was reading that comment and following, I found this one, which said:
Rails 3.2 apps can just add strong_parameter gem AFAIK and it would work out of the box.
Looking at my Gemfile again I realized what the problem was. It contained this line:
gem 'strong_parameters'
The problem is that the strong_parameters gem duplicates the Rails 4 way of doing things, allowing newer, better code to be used in Rails 3.2. Thus, it conflicts with the built-in functionality in Rails 4.
I removed that line from my Gemfile, and after running bundle, the rake command worked.
Edit: After restarting unicorn, I was getting a similar error in the log. I deleted config/initializers/strong_parameters.rb, but that didn't seem to help. However, after rebooting my VM, it was working properly.

rails - running production mode locally = No such file to load - config/environment

I am trying to run locally in production mode with:
$ RAILS_ENV=production rails s
But I get:
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
I can create a brand new rails 3.1.8 app and do RAILS_ENV=production rails server and I don't get this problem.
I can also do rails s and that runs the server fine in development mode without error.
I can also do RAILS_ENV=development rails s and that runs the server fine in development mode without error.
fwiw, my app was originally a rails 2.3 app so perhaps I am missing something that's been added or changed in rails ?
I do have the config directory with an environment.rb file. Perhaps the way it's being referenced is wrong somehow?
I added config.assets.enabled = true to config/application.rb but it didn't help (didn't expect it to as that is asset compilation, but it was a difference I found!).
Full Trace:
durrantm#Castle2012:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Changed a few things. One of the main ones were to enable static assets locally in config/environments/production.rb when trying to run it locally (only) and revert that before pushing to a production web server. I didn't know that.
seems like your old assets directory lived in other place (maybe in public) and now it is in app/assets, but it doesn't know about it and some files try to load environment.rb. just double check assets dir.

Error: uninitialized constant Sprockets::Helpers when pushing to Heroku

I just installed carrierwave and have set my rails 4 app up to store images on Amazon s3 through fog. The app was working and deploying to Heroku with Carrierwave (but images were getting purged with dyno). After some initial issues I got it working on my localhost (as far as I could tell).
Now I am having trouble pushing the new version to Heroku. I have reset the DATABASE. Precompiled the assets and now trying to migrate the database. Below is the error I'm getting.
Running `rake db:migrate` attached to terminal... up, run.6517
rake aborted!
uninitialized constant Sprockets::Helpers
/app/app/uploaders/image_uploader.rb:12:in `<class:ImageUploader>'
/app/app/uploaders/image_uploader.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
I have tried to include and not include Sprockets in the Uploader file and get the same error either way. I understand that Sprockets is no longer included in the master for Rails 4. I have now installed the sprockets-rails and sprockets-helper gems. I have also tried to require them at the top of the file (I don't understand this completely, but following this suggestion https://github.com/petebrowne/sprockets-helpers). Nothing has worked. Any suggestions about how I can go about resolving this. How do I initialize Sprockets::Helpers. Thanks.
I was making a pretty silly mistake. I had corrected files in my app and as committing the changes to the master, but I kept running the heroku run rake db:migrate command and getting the same error, so I didn't think I have resolved it yet. I had forgotten to push the new version to heroku! Hence the reason for still getting the same error.
Also, in case anyone else has a similar issue. Make sure you have fixed this:
https://github.com/carrierwaveuploader/carrierwave/issues/1020

Trying to deploy a Rails 4 app to WebFaction, using their documentation and getting an error locally

I am trying to deploy a Rails 4 app via github to Webfaction via Capistrano 2.15.5. Initially I installed Capistrano 3 and was getting errors, so I ended up installing Capistrano 2.15.5 and following webfaction's documentation here:
I spoke with webfaction, and they suggested I try the older Cap 2 version since that's what they're familiar with and wouldn't be updating their documentation for Capistrano 3 for awhile.
I get through all the appropriate steps in their tutorial, and I get a bunch of errors when trying to run "cap deploy:setup" or "cap deploy:check" etc.
Errors in a pastebin, here: (and shown below)
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
from Capfile:6:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
galactica% cap deploy:check
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
from Capfile:6:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
I've tried looking into the files, but I'm unsure really of what the issue is, and I dont know enough ruby to troubleshoot. I was hoping you of you could help me.
Any help would be IMMENSELY appreciated and gittipp'ed!! :)
Thank you in advance!
~Josh
I'm guessing you set up your project's configuration with Capistrano 3, and I think the setup for Capistrano 2 is different.
I'm not too familiar with the differences, but the error you're getting is cannot load such file -- capistrano/setup and this post about capistrano 3 references require 'capistrano/setup' as being in the Capfile that capistrano 3 generates.
So I'm guessing that file doesn't exist for capistrano 2. I don't know if capistrano 2 has generators that you could run and let them overwrite the files you have, but if it does, try that?
Or try taking out that line and see if you get a different error? Or revert the commit(s) where you started setting up capistrano 3 and start the configuration process completely over with capistrano 2?
Have you installed Capistrano 2 using "gem install" under your ruby v2.0?
rvm 2.0.0
gem install capistrano "your version"
Try this first....
I got the same error while deploying my rails 4 application using cap 2.15.5. I did research and found out that the problem was syntax as i switched from cap 3 to cap 2. So if you are using cap v2 only load command work in capfile and Require commands are used only in deploy.rb . So if you are switching from 3 to 2, do keep in mind the syntax as there are lots of changes between cap v2 and cap v3.
Note: For deploying rails 4 application 2.15.5 is the stable capistrano version you can use. Here is the guide link that worked for me : https://gist.github.com/brobertsaz/8660415

Unable to run console on Heroku

I'm trying to deploy my app on a Heroku server, but for some reason I can neither start my app nor run console. When I try to execute heroku run console, I get the following:
MacBook:threexortwo lander$ heroku run console
Running `console` attached to terminal... up, run.1
Rubber[ERROR]: Unable to read rubber configuration from /app/config/rubber/rubber.yml
(erb):301:in `<main>': undefined local variable or method `rubber_env' for main:Object (NameError)
from /usr/local/lib/ruby/1.9.1/erb.rb:753:in `eval'
from /usr/local/lib/ruby/1.9.1/erb.rb:753:in `result'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:39:in `read_config'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `block in initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/environment.rb:30:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:37:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:37:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:14:in `new'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:14:in `get_configuration'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/configuration.rb:22:in `rubber_env'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber.rb:53:in `config'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber.rb:31:in `initialize'
from /app/vendor/bundle/ruby/1.9.1/gems/rubber-2.1.2/lib/rubber/railtie.rb:9:in `block in <class:Railtie>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `call'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:67:in `inherited'
from /app/config/application.rb:13:in `<module:Threexortwo>'
from /app/config/application.rb:12:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Previously, I was playing with an Amazon EC2 server, and was using rubber. Before doing anything with rubber, I created a backup (pretty much just zipped the project), then afterwards deleted the vulcanized version, restored the old one, and uninstalled `rubber. When I run my server app locally, I don't encounter this issue, and I only get it when messing with Heroku.
It looks like rubber is still in your gemfile. Heroku reads in your gemfile and installs all of the gems listed.
Try removing it.

Resources