Skip to content

Commit

Permalink
added capistrano deploy tasks mirror rake tasks install_script and in…
Browse files Browse the repository at this point in the history
…stall_assets
  • Loading branch information
neodude committed Mar 18, 2009
1 parent 9599680 commit 139a1d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -7,7 +7,7 @@ The `sprockets-rails` plugin sets up your Rails application for use with [Sprock

To source Sprockets' JavaScript concatenation from your HTML templates, use the provided `sprockets_include_tag` helper.

`sprockets-rails` also includes a set of Rake tasks for generating the concatenation (`rake sprockets:install_script`) and installing provided assets (`rake sprockets:install_assets`). Run `sprockets:install_assets` any time you add or update a Sprockets plugin in your application. Add `sprockets:install_script` as a [Capistrano](http://www.capify.org/) post-deploy hook to generate the Sprockets concatenation on your servers automatically at deploy time.
`sprockets-rails` also includes a set of Rake tasks for generating the concatenation (`rake sprockets:install_script`) and installing provided assets (`rake sprockets:install_assets`). Run `sprockets:install_assets` any time you add or update a Sprockets plugin in your application. Add `after "deploy:update_code", "sprockets:install_script"` as a [Capistrano](http://www.capify.org/) post-deploy hook to generate the Sprockets concatenation on your servers automatically at deploy time.

Here's a walkthrough of the installation process:

Expand Down
17 changes: 17 additions & 0 deletions recipes/sprockets_tasks.rb
@@ -0,0 +1,17 @@
def run_sprockets_rake_task(task)
rake = fetch(:rake, 'rake')
rails_env = fetch(:rails_env, 'production')
`cd #{current_release}; #{rake} RAILS_ENV=#{rails_env} sprockets:#{task}`
end

namespace :sprockets do
desc "Generate and install the Sprockets concatenated JavaScript file"
task :install_script, :roles => :app do
run_sprockets_rake_task 'install_script'
end

desc "Install any assets provided by Sprockets scripts"
task :install_assets, :roles => :app do
run_sprockets_rake_task 'install_assets'
end
end

0 comments on commit 139a1d8

Please sign in to comment.