Sha256: 4c24099bcc31c7b5a5c0afb95fe300835a03d66c562335b5d101b7dd3b1c946e

Contents?: true

Size: 1.81 KB

Versions: 27

Compression:

Stored size: 1.81 KB

Contents

# encoding: utf-8
module MagicRecipes
  # = Thin - Deploy-Recipes
  # 
  # Simple recipe to work with thin, and app configurstion / registration.
  # 
  # [Tasks:]
  #   :reconf       # => Create or Update the thin yml configuration files
  # 
  #   :start        # => Start the private_pup server
  # 
  #   :stop         # => Start the private_pup server
  # 
  #   :restart      # => Restart the private_pup server
  # 
  # [Callbacks:]
  #   before "nginx:start", "thin:start"
  # 
  #   before "nginx:stop", "thin:stop"
  # 
  module Thin
    def self.load_into(configuration)
      configuration.load do
        
        set_default :thin_path,        '/etc/thin'
        
        namespace :thin do
          
          desc "rewrite thin-configurations"
          task :reconf, roles: :app do
            template "thin_app_yml.erb", "#{current_path}/config/thin_app.yml"
            run "#{sudo} rm -f #{thin_path}/thin_#{app_name}*"
            run "#{sudo} ln -sf #{current_path}/config/thin_app.yml #{thin_path}/thin_#{app_name}.yml"
          end
          
          # Start / Stop / Restart Thin
          %w[start stop restart].each do |command|
            desc "#{command} thin"
            task command, roles: :app do
              reconf
              if use_rvm
                run <<-CMD
                  #{rvm_cmd} && 
                  cd #{current_path} && 
                  bundle exec thin #{command} -C config/thin_app.yml
                CMD
              else
                run "bundle exec thin #{command} -C config/thin_app.yml"
              end
            end
            # before "nginx:#{command}", "thin:#{command}"
          end
          
          before "nginx:start", "thin:start"
          before "nginx:stop", "thin:stop"
          
        end
        
        # eof
        
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
magic_recipes-0.0.26 lib/magic_recipes/thin.rb
magic_recipes-0.0.25 lib/magic_recipes/thin.rb
magic_recipes-0.0.24 lib/magic_recipes/thin.rb
magic_recipes-0.0.23 lib/magic_recipes/thin.rb
magic_recipes-0.0.22 lib/magic_recipes/thin.rb
magic_recipes-0.0.21 lib/magic_recipes/thin.rb
magic_recipes-0.0.20 lib/magic_recipes/thin.rb