Non-Rails Capistrano Deploy Recipe

If you’re deploying non-Rails apps/websites, this snippet may be useful to you as it was to me.

I can’t remember when was the last time I actually used FTP to deploy websites.
Then again, I don’t do much non-Rails apps nowadays…

set :application, ""
set :repository,  ""

set :deploy_to, "/path/to/name"
set :user, 'deployer'
set :use_sudo, false

set :rvm_type, :system

set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

role :web, ""                          # Your HTTP server, Apache/etc
role :app, ""                          # This may be the same as your `Web` server
role :db,  "", :primary => true # This is where Rails migrations will run

# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
#
namespace :deploy do
  task :migrate do
    puts "    not doing migrate because not a Rails application."
  end
  task :finalize_update do
    puts "    not doing finalize_update because not a Rails application."
  end
  task :start do
    puts "    not doing start because not a Rails application."
  end
  task :stop do 
    puts "    not doing stop because not a Rails application."
  end
  task :restart do
    puts "    not doing restart because not a Rails application."
  end

# namespace :assets do
#   task :precompile, :roles => :web, :except => { :no_release => true } do
#     from = source.next_revision(current_revision)
#     if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
#       run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
#     else
#       logger.info "Skipping asset pre-compilation because there were no asset changes"
#     end
#   end
# end
end
</pre>

Grab the Gist here.