rake system command causes bundle error - ruby-on-rails-3

I'm trying to run this rake task but it keeps on returning the following error:
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
When I try and run bundle install bundler says everything is up to date.
I am running the task using this command:
bundle exec rake deploy:staging
Here's what my rake task looks like:
task :staging do
app = "heroku-app-name"
puts "Turn maintenance on"
system "heroku maintenance:on --app #{app}"
end

I was able to shell out to heroku commands from a rake task by wrapping the command in a Bundler.with_clean_env block like as follows:
Bundler.with_clean_env do
system "heroku maintenance:on --app #{app}"
end

Related

QUEUE=* not found error on Foreman

I'm trying to use foreman to run my app locally, using the same Procfile I use when deploying my app on Heroku, where it works perfectly. However, when running foreman start on my terminal, foreman gives an error saying:
line 41: exec: QUEUE=*: not found
What I gather from this is that foreman doesn't recognize QUEUE=* as a command. So why does it work on Heroku? And what can I do to run the command exactly as it is run in production mode?
I ran into the same issue. You want to put the queue param at the end.
eg:
worker: bundle exec rake jobs:work QUEUE=hi

Capistrano with a nested rails directory

My Ruby on Rails application is not the root file of my git repository. Is there a variable that I can set so that Capistrano knows what directory to run rake when I ask it to run migrations?
I would do it by overriding the deploy:migrate recipe like this:
namespace :deploy do
task :migrate do
run "cd /path/to/rails/root; rake RAILS_ENV=#{rails_env} #{migrate_env} db:migrate"
end
end

Rake aborted: Don't know how to build task 'jobs:work'

When I run bundle exec rake jobs:work I receive this error:
rake aborted!
Don't know how to build task 'jobs:work'
Anything wrong with the syntax?
Note: I installed delayed_jobs like this:
rails plugin install git://github.com/collectiveidea/delayed_job.git
rails generate migration create_delayed_jobs
[ Fill the migration from https://github.com/collectiveidea/delayed_job ]
bundle exec rake db:migrate
The solution was to install delayed_jobs as described here:
https://github.com/collectiveidea/delayed_job
After this, bundle exec rake jobs:work runs fine.

undefined method `args=' for [[]]:Sass::Tree::FunctionNode deploying to heroku with rails 3.1

I have an app that I am trying to deploy to Heroku Cedar stack with rails 3.1.0.rc5.
Some blogs that I followed implementing the migration to cedar and asset pipeline:
http://metaskills.net/2011/07/29/use-compass-sass-framework-files-with-the-rails-3.1.0.rc5-asset-pipeline/
http://devcenter.heroku.com/articles/rails31_heroku_cedar
http://railsapps.github.com/rails-heroku-tutorial.html
After a git push to heroku, I ran the assets:precompile task:
heroku run rake -t assets:precompile --app myapp
The js files are compiled fine, however Sass bombs compiling application.css.scss with error:
rake aborted!
undefined method `args=' for [[]]:Sass::Tree::FunctionNode
(in /app/app/assets/stylesheets/application.css.scss)
Full output and stacktrace here: https://gist.github.com/1122683
running bundle exec rake assets:precompile locally executes fine without errors.
It seems to be some kind of incompatibility between Sass 3.1.6 and blueprint; I added
gem 'sass', '3.1.5'
to my gemfile and that seems to have cleared it up

Is it possible to combine rake task and bundle install into one command?

I have several rake tasks combined into one rake command. Just wondering is it possible to have one command run the "bundle install" within a rake task ?
Or other way around ?
So when I deploy my rails app to a new server all I need to do is just run one command and it will grab all the dependencies and migrate databases settings.yaml files etc
you can chained your command with &&
For example :
rake my_task && bundle install
It's poor response but it's work ;-)
Obviously you can make your script
vi ./scripts/deploy.sh
#!/bin/sh
rake my_task && bundle install
I've seen this been done bundle install && bundle exec rake db:migrate