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.1.17 lib/magic_recipes/thin.rb
magic_recipes-0.1.16 lib/magic_recipes/thin.rb
magic_recipes-0.1.15 lib/magic_recipes/thin.rb
magic_recipes-0.1.14 lib/magic_recipes/thin.rb
magic_recipes-0.1.13 lib/magic_recipes/thin.rb
magic_recipes-0.1.11 lib/magic_recipes/thin.rb
magic_recipes-0.1.10 lib/magic_recipes/thin.rb
magic_recipes-0.1.9 lib/magic_recipes/thin.rb
magic_recipes-0.1.8 lib/magic_recipes/thin.rb
magic_recipes-0.1.7 lib/magic_recipes/thin.rb
magic_recipes-0.1.6 lib/magic_recipes/thin.rb
magic_recipes-0.1.5 lib/magic_recipes/thin.rb
magic_recipes-0.1.4 lib/magic_recipes/thin.rb
magic_recipes-0.1.3 lib/magic_recipes/thin.rb
magic_recipes-0.1.2 lib/magic_recipes/thin.rb
magic_recipes-0.1.1 lib/magic_recipes/thin.rb
magic_recipes-0.1.0 lib/magic_recipes/thin.rb
magic_recipes-0.0.29 lib/magic_recipes/thin.rb
magic_recipes-0.0.28 lib/magic_recipes/thin.rb
magic_recipes-0.0.27 lib/magic_recipes/thin.rb