cap_unicorn 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/cap_unicorn/recipes.rb +45 -0
 - metadata +67 -0
 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Capistrano::Configuration.instance(:must_exist).load do
         
     | 
| 
      
 2 
     | 
    
         
            +
              namespace :unicorn do
         
     | 
| 
      
 3 
     | 
    
         
            +
                def self.master_pid
         
     | 
| 
      
 4 
     | 
    
         
            +
                  pid = capture "pid=$(ps aux | grep unicorn_rails | grep master | grep -v grep); echo $pid"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  unless pid.empty?
         
     | 
| 
      
 7 
     | 
    
         
            +
                    pid.split(" ")[1]
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                desc "Start unicorn"
         
     | 
| 
      
 12 
     | 
    
         
            +
                task :start do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  run "unicorn_rails -D -E #{rails_env} -c #{current_path}/config/unicorn/#{rails_env}.rb"
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                task :restart do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  if pid = master_pid
         
     | 
| 
      
 18 
     | 
    
         
            +
                    run "kill -s USR2 #{pid}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                task :stop do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  if pid = master_pid
         
     | 
| 
      
 24 
     | 
    
         
            +
                    run "kill -s TERM #{pid}"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              namespace :deploy do
         
     | 
| 
      
 30 
     | 
    
         
            +
                desc "Start the unicorn workers"
         
     | 
| 
      
 31 
     | 
    
         
            +
                task :start do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  unicorn.start
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                desc "Stop the unicorn workers"
         
     | 
| 
      
 36 
     | 
    
         
            +
                task :stop do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  unicorn.stop
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                desc "Restart the unicorn workers"
         
     | 
| 
      
 41 
     | 
    
         
            +
                task :restart do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  unicorn.restart
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,67 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: cap_unicorn
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 29
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 6 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 11 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Scott Taylor
         
     | 
| 
      
 14 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 16 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-06-29 00:00:00 -04:00
         
     | 
| 
      
 19 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            description: capistrano tasks to support unicorn
         
     | 
| 
      
 23 
     | 
    
         
            +
            email: scott@railsnewbie.com
         
     | 
| 
      
 24 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 31 
     | 
    
         
            +
            - lib/cap_unicorn/recipes.rb
         
     | 
| 
      
 32 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 33 
     | 
    
         
            +
            homepage: http://github.com/smtlaissezfaire/cap_unicorn
         
     | 
| 
      
 34 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 37 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 40 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 41 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 42 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 44 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 45 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 46 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 47 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 48 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 49 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 50 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 51 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 52 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 53 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 54 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 55 
     | 
    
         
            +
                  hash: 3
         
     | 
| 
      
 56 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 57 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 58 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 59 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 62 
     | 
    
         
            +
            rubygems_version: 1.3.7
         
     | 
| 
      
 63 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 64 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 65 
     | 
    
         
            +
            summary: unicorn capistrano tasks
         
     | 
| 
      
 66 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     |