vlad-unicorn 2.2.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA512:
3
+ data.tar.gz: 367c63d4fe4d88eecf4e5bef1e805bd0ba5aaa37b472bc0068c10dfcff8e6d55636debad5e58f30d16e72dfb847be3d874d8f096006cfa5cf4f9ba02239f92a2
4
+ metadata.gz: 03a7a527d6b060454be27e5d629a5735f379a12a908aec45c56058e346e8583dfad0057525b59f084224816a63d7e8cdd0cefcbb4b9417e9710c50d004dd8a49
5
+ SHA1:
6
+ data.tar.gz: 163cd11fb51aa38a671dddf33662cd56a02e8eb9
7
+ metadata.gz: d3ca64d3f88249e6bcdafe4a9a326712893eecca
File without changes
data/.hgtags CHANGED
@@ -3,3 +3,5 @@ bdc7c2851152cf080888a2c6d5d5bf22fc04f5b2 v2.1.0
3
3
  bdc7c2851152cf080888a2c6d5d5bf22fc04f5b2 semver
4
4
  90fa0693a4a0b49241357d1b7b03df6b064a14e9 v2.1.1
5
5
  0fa4ab85e99e8676d791db49fae89f81f164674f v2.2.0
6
+ 4595d1cc44fec363ac3f18434a0e5b3e9679b71d v2.2.1
7
+ cff28cee81113b40daaa41ff2bf29a8b0a7bc873 v2.3.0
@@ -1,3 +1,24 @@
1
+ === 2.3.1 / 2013-04-18
2
+
3
+ * 1 bug fix
4
+
5
+ * Generate the command to start Unicorn correctly.
6
+
7
+ === 2.3.0 / 2013-04-17
8
+
9
+ * 3 minor enhancements
10
+
11
+ * Pass an environment to Unicorn, default to rails_env (if present) or
12
+ 'production'. (Mathieu Lemoine) (BC)
13
+ * Create shared/log and shared/pids directories on vlad:setup_app, even for
14
+ non-Rails apps.
15
+ * Add an option to trivially enable using `bundle exec`.
16
+
17
+ * 2 bug fixes
18
+
19
+ * Fix broken shell-quoting of sudo commands
20
+ * Quote config file path when passing it to unicorn
21
+
1
22
  === 2.2.1 / 2013-03-08
2
23
 
3
24
  * 1 bug fix
data/README.txt CHANGED
@@ -59,6 +59,18 @@ unicorn_rackup:: The location of the rackup file unicorn should load.
59
59
  unicorn_use_sudo:: Whether to use sudo to run the 'unicorn' command on
60
60
  the remote host. Probably necessary if you specify a
61
61
  user and group in unicorn.rb.
62
+ unicorn_env:: Environment to be given to unicorn (value for +-E+).
63
+ Default value is based on +vlad/rails+'s +rails_env+.
64
+ If +rails_env+ is not defined, +production+ is used as
65
+ default value. To disable passing an environment, set to
66
+ +nil+.
67
+ unicorn_use_bundler:: Whether to use <tt>bundle exec</tt> to run the 'unicorn'
68
+ command on the remote host. Defaults to false.
69
+ unicorn_bundle_cmd:: How to invoke <tt>bundle exec</tt>. Defaults to
70
+ <tt>cd #{current_path} && bundle exec</tt>. If you have
71
+ defined +bundle_cmd+ for Bundler's built-in deployment
72
+ tasks, vlad-unicorn will use that in place of +bundle+
73
+ in the above default.
62
74
 
63
75
  For more on specific issues when deploying Rails applications, see
64
76
  rails-configuration.txt[link:docs/rails-configuration_txt.html].
@@ -1,33 +1,26 @@
1
1
  = Configuring Unicorn for Rails
2
2
 
3
- == Setting environment and prefix
3
+ == Setting the environment
4
4
 
5
- The astute observer will notice the lack of variables in vlad-unicorn to set
6
- the Rails environment or a path prefix for the app (the +unicorn_rails+
7
- command allows this with with the +--env+ and +--path+ options, respectively).
8
- Both of these can just as easily be done by setting the appropriate
9
- environment variables in the unicorn.rb config file, like so:
5
+ As of 2.3.0, vlad-unicorn allows you to pass the Rails or Rack environment to
6
+ the +unicorn+ command (the +--env+ option):
7
+
8
+ set :unicorn_env, 'production'
9
+
10
+ This can also be done by setting the appropriate environment variable in the
11
+ unicorn.rb config file, like so:
10
12
 
11
13
  ENV['RAILS_ENV'] = 'production'
12
14
  ENV['RAILS_RELATIVE_URL_ROOT'] = '/prefix'
13
15
 
14
- To use +RAILS_RELATIVE_URL_ROOT+ with Rails 3.x, you can use your project's rackup
15
- file (config.ru) to map the application to a prefix:
16
-
17
- # This file is used by Rack-based servers to start the application.
18
-
19
- require ::File.expand_path('../config/environment', __FILE__)
20
- -run MyApp::Application
21
- +app = MyApp::Application
22
- +app = Rack::URLMap.new(ENV['RAILS_RELATIVE_URL_ROOT'] => app) if
23
- + ENV['RAILS_RELATIVE_URL_ROOT']
24
- +run app
16
+ == Using with Bundler
25
17
 
26
- == Using with Rails 2.3 and Bundler
18
+ When deploying with Bundler, it's often more robust to <code>bundle exec</code>
19
+ everything. This can be done by setting +unicorn_use_bundler+ to true in your
20
+ deploy.rb. By default, this will change into the current release directory and
21
+ run +bundle exec+ there.
27
22
 
28
- When using Rails 2.3 with Bundler, you have to <code>bundle exec</code>
29
- everything. This can be done by setting +unicorn_command+ in your deploy.rb.
30
- Since Vlad doesn't change into the +RAILS_ROOT+ directory before attempting to
31
- run remote commands, though, you have to explicitly tell it to do so:
23
+ This can be changed by setting +unicorn_bundle_cmd+. One alternate approach is
24
+ to pass the full Gemfile path using the BUNDLE_GEMFILE environment variable:
32
25
 
33
- set :unicorn_command, "cd #{current_path} && bundle exec unicorn_rails"
26
+ set :unicorn_bundle_cmd, "BUNDLE_GEMFILE=#{current_path}/Gemfile bundle exec"
@@ -2,30 +2,41 @@ require 'vlad'
2
2
 
3
3
  module Vlad
4
4
  module Unicorn
5
- VERSION = '2.2.1' #:nodoc:
5
+ VERSION = '2.3.1' #:nodoc:
6
6
 
7
7
  # Runs +cmd+ using sudo if the +:unicorn_use_sudo+ variable is set.
8
8
  def self.maybe_sudo(cmd)
9
9
  if unicorn_use_sudo
10
- sudo %(sh -c '#{cmd.gsub(/'/, "'\''")}')
10
+ sudo %(sh -c '#{cmd.gsub(/'/, "'\\''")}')
11
11
  else
12
12
  run cmd
13
13
  end
14
14
  end
15
15
 
16
+ def self.start_unicorn(opts = '')
17
+ cmd = %(#{unicorn_command} -D --config-file "#{unicorn_config}")
18
+ cmd << %( -E "#{unicorn_env}") if unicorn_env
19
+ cmd << %( #{opts}) if opts and !opts.empty?
20
+ if unicorn_use_bundler
21
+ [unicorn_bundle_cmd, cmd].join(' ')
22
+ else
23
+ cmd
24
+ end
25
+ end
26
+
16
27
  def self.signal(sig = '0')
17
28
  %(test -s "#{unicorn_pid}" && kill -#{sig} `cat "#{unicorn_pid}"`)
18
29
  end
19
30
 
20
31
  def self.start(opts = '')
21
32
  cmd = signal('HUP')
22
- cmd << %( || (#{unicorn_command} -D --config-file #{unicorn_config} #{opts}))
33
+ cmd << %( || (#{start_unicorn(opts)}))
23
34
  maybe_sudo cmd
24
35
  end
25
36
 
26
37
  def self.reload(opts = '')
27
38
  cmd = signal('USR2')
28
- cmd << %( || (#{unicorn_command} -D --config-file #{unicorn_config} #{opts}))
39
+ cmd << %( || (#{start_unicorn(opts)}))
29
40
  maybe_sudo cmd
30
41
  end
31
42
 
@@ -42,6 +53,13 @@ namespace :vlad do
42
53
  set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
43
54
  set :unicorn_use_sudo, false
44
55
  set(:unicorn_pid) { "#{shared_path}/pids/unicorn.pid" }
56
+ set(:unicorn_env) { Rake::RemoteTask.fetch(:rails_env, 'production') }
57
+ set(:unicorn_bundle_cmd) {
58
+ "cd #{current_path} && #{Rake::RemoteTask.fetch(:bundle_cmd, 'bundle')} exec"
59
+ }
60
+ set :unicorn_use_bundler, false
61
+ shared_paths['log'] ||= 'log'
62
+ shared_paths['pids'] ||= 'tmp/pids'
45
63
 
46
64
  desc "Stop the app servers"
47
65
  remote_task :stop_app, :roles => :app do
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vlad-unicorn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
6
- segments:
7
- - 2
8
- - 2
9
- - 1
10
- version: 2.2.1
4
+ version: 2.3.1
11
5
  platform: ruby
12
6
  authors:
13
7
  - Kevin R. Bullock
@@ -15,40 +9,38 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2013-03-08 00:00:00 -06:00
19
- default_executable:
12
+ date: 2013-04-18 00:00:00 Z
20
13
  dependencies:
21
14
  - !ruby/object:Gem::Dependency
22
15
  name: vlad
23
16
  prerelease: false
24
17
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
18
  requirements:
27
19
  - - ~>
28
20
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 2
32
- - 0
33
21
  version: "2.0"
34
22
  type: :runtime
35
23
  version_requirements: *id001
36
24
  - !ruby/object:Gem::Dependency
37
- name: hoe
25
+ name: rdoc
38
26
  prerelease: false
39
27
  requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
28
  requirements:
42
- - - ">="
29
+ - - ~>
43
30
  - !ruby/object:Gem::Version
44
- hash: 47
45
- segments:
46
- - 2
47
- - 8
48
- - 0
49
- version: 2.8.0
31
+ version: "4.0"
50
32
  type: :development
51
33
  version_requirements: *id002
34
+ - !ruby/object:Gem::Dependency
35
+ name: hoe
36
+ prerelease: false
37
+ requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: "3.5"
42
+ type: :development
43
+ version_requirements: *id003
52
44
  description: |-
53
45
  Unicorn app server support for Vlad. Adds support for vlad:start_app and
54
46
  vlad:stop_app using Unicorn[http://unicorn.bogomips.org/].
@@ -76,10 +68,12 @@ files:
76
68
  - lib/vlad/unicorn_common.rb
77
69
  - lib/vlad/unicorn_rails.rb
78
70
  - test/test_vlad_unicorn.rb
79
- has_rdoc: true
71
+ - .gemtest
80
72
  homepage: http://bitbucket.org/krbullock/vlad-unicorn/
81
73
  licenses: []
82
74
 
75
+ metadata: {}
76
+
83
77
  post_install_message:
84
78
  rdoc_options:
85
79
  - --main
@@ -87,29 +81,20 @@ rdoc_options:
87
81
  require_paths:
88
82
  - lib
89
83
  required_ruby_version: !ruby/object:Gem::Requirement
90
- none: false
91
84
  requirements:
92
- - - ">="
85
+ - &id004
86
+ - ">="
93
87
  - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
88
  version: "0"
98
89
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
90
  requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
- version: "0"
91
+ - *id004
107
92
  requirements: []
108
93
 
109
94
  rubyforge_project: hitsquad
110
- rubygems_version: 1.3.7
95
+ rubygems_version: 2.0.3
111
96
  signing_key:
112
- specification_version: 3
97
+ specification_version: 4
113
98
  summary: Unicorn app server support for Vlad
114
99
  test_files:
115
100
  - test/test_vlad_unicorn.rb