Sha256: e95120198e5cefea628a39630f76d8d88b8b99344a04dd203fb1a6a3a4f844ce

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 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
              # => run <<-CMD
              # =>   source '/usr/local/rvm/scripts/rvm' && 
              # =>   rvm use 1.9.3 && cd #{current_path} && 
              # =>   bundle exec thin #{command} -C config/thin_app.yml
              # => CMD
              run "bundle exec thin #{command} -C config/thin_app.yml"
            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

2 entries across 2 versions & 1 rubygems

Version Path
magic_recipes-0.0.2 lib/magic_recipes/thin.rb
magic_recipes-0.0.1 lib/magic_recipes/thin.rb