Sha256: 65982055b8bc28c5bbe8d9dc3142b93921e681268fa4309cbc6a9e02c3d04b5c

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8
module MagicRecipes
  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 #{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

9 entries across 9 versions & 1 rubygems

Version Path
magic_recipes-0.0.13 lib/magic_recipes/thin.rb
magic_recipes-0.0.12 lib/magic_recipes/thin.rb
magic_recipes-0.0.11 lib/magic_recipes/thin.rb
magic_recipes-0.0.10 lib/magic_recipes/thin.rb
magic_recipes-0.0.9 lib/magic_recipes/thin.rb
magic_recipes-0.0.8 lib/magic_recipes/thin.rb
magic_recipes-0.0.7 lib/magic_recipes/thin.rb
magic_recipes-0.0.6 lib/magic_recipes/thin.rb
magic_recipes-0.0.5 lib/magic_recipes/thin.rb