capistrano-unicorn-methods 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.3-p0
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
- ## Usage
2
-
3
- 1If you don't have one, copy the config/unicorn.rb file into your app in the app/condig/unicorn.rb path. This is the location where the gem will look for the configuration file.
1
+ # Capistrano Unicorn Methods [![Build Status](https://secure.travis-ci.org/ekampp/capistrano-unicorn-methods.png)](http://travis-ci.org/ekampp/capistrano-unicorn-methods)
4
2
 
5
- After copying the file you should make sure that all the paths are changed to reflect your system setup.
3
+ Contains a namespace with methods for administrating the unicorn server through capistrano recipes.
6
4
 
7
- If you already have a config file you should make sure that the pid file is written to shared/pids/unicorn.pid.
5
+ ## Usage
8
6
 
9
7
  The gem gives you access to the followig methods within the `unicorn.<method>` namespace.
10
8
 
@@ -12,3 +10,21 @@ The gem gives you access to the followig methods within the `unicorn.<method>` n
12
10
  * `unicorn.stop` will stop the unicorn server.
13
11
  * `unicorn.restart` restarts the unicorn server by moving the old one to <somename>.pid.oldbin and running a `unicorn.cleanup` command.
14
12
  * `unicorn.cleanup` will remove the master and worker processes associated with the <something>.pid.oldbin file.
13
+
14
+ If you'r having trouble targeting the correct namespace you can alternatively run the commands prepended with a `top.` so it becomes e.g. `top.unicorn.start`.
15
+
16
+ ## Requirements
17
+
18
+ * `unicorn`
19
+
20
+ It also relies on the `current_release` variable beeing present. This is part of capistrano's standard deploy schema, so there should be no problems.
21
+
22
+ ## Customization
23
+
24
+ You can customize the gems behavior by setting any (or all) of the following options within capistrano's configuration:
25
+
26
+ * `unicorn_pid` indicates the path for the pid file. Defaults to shared/pids/unicorn.pid.
27
+ * `unicorn_old_pid` contains the pid for the old server. Defaults to shared/pids/unicorn.pid.oldbin.
28
+ * `unicorn_config` the path to the unicorn config file. Defaults to /path/to/your/app/config/unicorn.rb.
29
+ * `unicorn_port` defines the port that unicorn should listen on. Defaults to 3000.
30
+ * `use_bundler` defines if unicorn should be started through bundler. Defaults to true
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "Runs all the specs"
4
+ task :default do
5
+ puts "Running default rake task.."
6
+ end
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
22
+ s.add_development_dependency "rake"
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "rspec-rails"
25
+ s.add_runtime_dependency "unicorn"
24
26
  end
data/config/unicorn.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  worker_processes 5
2
- working_directory "/dana/data/imageupload/current"
2
+ working_directory "/path/to/your/project/current"
3
3
 
4
4
  # This loads the application in the master process before forking
5
5
  # worker processes
@@ -11,13 +11,13 @@ timeout 30
11
11
 
12
12
  # This is where we specify the socket.
13
13
  # We will point the upstream Nginx module to this socket later on
14
- listen "/dana/data/imageupload/shared/sockets/unicorn.sock", :backlog => 64
14
+ listen "/path/to/your/project/shared/sockets/unicorn.sock", :backlog => 64
15
15
 
16
- pid "/dana/data/imageupload/shared/pids/unicorn.pid"
16
+ pid "/path/to/your/project/current/shared/pids/unicorn.pid"
17
17
 
18
18
  # Set the path of the log files inside the log folder of the testapp
19
- stderr_path "/dana/data/imageupload/shared/log/unicorn.stderr.log"
20
- stdout_path "/dana/data/imageupload/shared/log/unicorn.stdout.log"
19
+ stderr_path "/path/to/your/project/current/log/unicorn.stderr.log"
20
+ stdout_path "/path/to/your/project/current/log/unicorn.stdout.log"
21
21
 
22
22
  before_fork do |server, worker|
23
23
  # This option works in together with preload_app true setting
@@ -32,4 +32,4 @@ after_fork do |server, worker|
32
32
  # processes
33
33
  defined?(ActiveRecord::Base) and
34
34
  ActiveRecord::Base.establish_connection
35
- end
35
+ end
data/lib/.DS_Store ADDED
Binary file
@@ -1,31 +1,37 @@
1
1
  require "capistrano-unicorn-methods/version"
2
2
  Capistrano::Configuration.instance.load do
3
+ _cset :unicorn_pid, "#{current_release}/tmp/pids/unicorn.pid"
4
+ _cset :unicorn_old_pid, "#{current_release}/tmp/pids/unicorn.pid.oldbin"
5
+ _cset :unicorn_config, "#{current_release}/config/unicorn.rb"
6
+ _cset :unicorn_port, 3000
7
+ _cset :use_bundler, true
8
+
3
9
  namespace :unicorn do
4
10
  desc "Zero-downtime restart of Unicorn"
5
- task :restart, :except => { :no_release => true } do
11
+ task :restart do
6
12
  unicorn.cleanup
7
- run "touch #{current_release}/tmp/pids/unicorn.pid"
8
- pid = capture("cat #{current_release}/tmp/pids/unicorn.pid").to_i
13
+ run "touch #{unicorn_pid}"
14
+ pid = capture("cat #{unicorn_pid}").to_i
9
15
  run "kill -s USR2 #{pid}" if pid > 0
10
16
  end
11
17
 
12
18
  desc "Starts unicorn"
13
- task :start, :except => { :no_release => true } do
19
+ task :start do
14
20
  unicorn.cleanup
15
- run "cd #{current_release} ; bundle exec unicorn_rails -c #{current_release}/config/unicorn.rb -D -p 3000"
21
+ run "cd #{current_release} ; #{'bundle exec' if use_bundler} unicorn_rails -c #{unicorn_config} -D -p #{unicorn_port}"
16
22
  end
17
23
 
18
24
  desc "Stop unicorn"
19
- task :stop, :except => { :no_release => true } do
20
- run "touch #{current_release}/tmp/pids/unicorn.pid"
21
- pid = capture("cat #{current_release}/tmp/pids/unicorn.pid").to_i
25
+ task :stop do
26
+ run "touch #{unicorn_pid}"
27
+ pid = capture("cat #{unicorn_pid}").to_i
22
28
  run "kill -s QUIT #{pid}" if pid > 0
23
29
  end
24
30
 
25
31
  desc "Cleans up the old unicorn processes"
26
32
  task :cleanup do
27
- run "touch #{current_release}/tmp/pids/unicorn.pid.oldbin"
28
- pid = capture("cat #{current_release}/tmp/pids/unicorn.pid.oldbin").to_i
33
+ run "touch #{unicorn_old_pid}"
34
+ pid = capture("cat #{unicorn_old_pid}").to_i
29
35
  run "kill -s QUIT #{pid}" if pid > 0
30
36
  end
31
37
  end
@@ -1,7 +1,7 @@
1
1
  module Capistrano
2
2
  module Unicorn
3
3
  module Methods
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-unicorn-methods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,52 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-23 00:00:00.000000000Z
13
- dependencies: []
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70232672589820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70232672589820
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70232672587440 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70232672587440
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec-rails
38
+ requirement: &70232672586760 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70232672586760
47
+ - !ruby/object:Gem::Dependency
48
+ name: unicorn
49
+ requirement: &70232672586020 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70232672586020
14
58
  description: Contains a unicorn namespace with methods for starting stopping and maintaining
15
59
  the unicorn server to serve the rails app.
16
60
  email:
@@ -20,6 +64,8 @@ extensions: []
20
64
  extra_rdoc_files: []
21
65
  files:
22
66
  - .gitignore
67
+ - .rvmrc
68
+ - .travis.yml
23
69
  - CHANGELOG.md
24
70
  - Gemfile
25
71
  - README.md
@@ -27,6 +73,7 @@ files:
27
73
  - capistrano-unicorn-methods.gemspec
28
74
  - config/.DS_Store
29
75
  - config/unicorn.rb
76
+ - lib/.DS_Store
30
77
  - lib/capistrano-unicorn-methods.rb
31
78
  - lib/capistrano-unicorn-methods/version.rb
32
79
  homepage: http://emil.kampp.me
@@ -49,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
96
  version: '0'
50
97
  requirements: []
51
98
  rubyforge_project: capistrano-unicorn-methods
52
- rubygems_version: 1.8.15
99
+ rubygems_version: 1.8.10
53
100
  signing_key:
54
101
  specification_version: 3
55
102
  summary: Contains standadized methods for managing unicorn servers through capistrano.