Sha256: b92588fc49dd4d5d35b236cb270d40df06aef9ff6be9f1f780d518eb96f7c59f
Contents?: true
Size: 1.27 KB
Versions: 13
Compression:
Stored size: 1.27 KB
Contents
require 'capistrano/magic_recipes/base_helpers' include Capistrano::MagicRecipes::BaseHelpers namespace :load do task :defaults do set :thin_path, -> { '/etc/thin' } set :thin_roles, -> { :web } end end namespace :thin do desc "rewrite thin-configurations" task :reconf => ['nginx:load_vars'] do on release_roles fetch(:thin_roles) do within current_path do magic_template("thin_app_yml", '/tmp/thin_app.yml') execute :sudo, :mv, '/tmp/thin_app.yml', "config/thin_app_#{fetch(:stage)}.yml" execute :sudo, :rm, ' -f', "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}*" execute :sudo, :ln, ' -sf', "#{current_path}/config/thin_app_#{fetch(:stage)}.yml", "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}.yml" end end end %w[start stop restart].each do |command| desc "#{command} thin" task command => ['nginx:load_vars'] do on release_roles fetch(:thin_roles) do within current_path do execute :bundle, :exec, :thin, "#{command} -C config/thin_app_#{fetch(:stage)}.yml" end end end end end after 'deploy:published', nil do on release_roles fetch(:thin_roles) do invoke "thin:reconf" invoke "thin:restart" end end
Version data entries
13 entries across 13 versions & 1 rubygems