Skip to content

Instantly share code, notes, and snippets.

@zmajstor
Created February 14, 2017 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmajstor/4e6d2327e9a27da1898b14305a5a00ad to your computer and use it in GitHub Desktop.
Save zmajstor/4e6d2327e9a27da1898b14305a5a00ad to your computer and use it in GitHub Desktop.
Herokuised Capistrano Tasks
namespace :info do
desc 'Show deployed revisions (releases)'
task :releases do
on roles(:app) do
within deploy_path do
with rails_env: "#{fetch(:stage)}" do
deployed_releases = capture(:tac, revision_log)
puts "=== #{fetch(:application)} releases:"
puts deployed_releases
end
end
end
end
desc 'Show current ruby version in the current_path'
namespace :ruby do
on roles(:app) do
within current_path do
with rails_env: "#{fetch(:stage)}" do
output = capture(:ruby, '--version')
puts "Current Ruby version in #{current_path}"
puts output
end
end
end
end
desc 'Show Config Vars (ENV)'
task :env do
on roles(:all) do
within current_path do
with rails_env: "#{fetch(:stage)}" do
remote_env = capture(:env)
puts "=== #{fetch(:application)} Config Vars"
puts remote_env
end
end
end
end
desc 'Show latest deployed revision (release)'
task :rev do
on roles(:app) do
within current_path do
with rails_env: "#{fetch(:stage)}" do
revision = capture(:cat, "#{current_path}/REVISION")
puts "=== #{fetch(:application)}'s latest deployed revision (release) is #{revision}"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment