cap-puma 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6cff304d389f27a1734f05e93e166879f709df8
4
- data.tar.gz: 244edc01dc21ac73caead0cf0361bf04b4d73324
3
+ metadata.gz: 4ff6eb513d0b18870a1b47cc11aa1f2152ba322e
4
+ data.tar.gz: 64a27a4bd06578d529846b442096585e0440aef9
5
5
  SHA512:
6
- metadata.gz: 93267d79137bf75b883d69132071053a14e3c1c65638fbf10c94cfda6f93b3613050d0192671224fd1a0c911244a6950e4cddc1fd5ff1c9a86d7b21eb82f7656
7
- data.tar.gz: cf4ffbec2d23c9abee1db28ec99485da9426e3967af79852c8b6e38936a3be77e67e9c1105dd62a3f320bd4b40596242c36fbbaa968891c4e3eee61f4836d820
6
+ metadata.gz: e810cb469065f3ee15c4dd3813536f4eb45638790f8bbee5e5c823d118c450897aa7f51f96c52dec3b215a21d341277f93ef26650d145becda995eddb183c838
7
+ data.tar.gz: cb03d1615ae9019274277df5fb622cc9a301bdf88e15d2e949f089a82ff94cea155de7d91f03c41b9b4ae8e44b422185e16e4f14cd76802973d6b89f6bacd9d1
data/cap-puma.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "cap-puma"
7
- spec.version = '0.0.1'
7
+ spec.version = '0.0.2'
8
8
  spec.authors = ["John D'Agostino"]
9
9
  spec.email = ["john.dagostino@gmail.com"]
10
10
  spec.description = %q{Capistrano v3 Rake tasks for Puma}
@@ -1,25 +1,25 @@
1
1
  namespace :puma do
2
- before 'deploy:started', :configure do
3
- set :puma_cmd, "bundle exec puma"
4
- set :pumactl_cmd, "bundle exec pumactl"
5
- set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
6
- set :puma_state, "#{shared_path}/sockets/puma.state"
7
- set :puma_socket, "unix://#{shared_path}/sockets/puma.sock"
8
- set :puma_role, :app
9
- end
10
-
11
2
  desc 'Start puma'
12
3
  task :start do
13
4
  on roles fetch(:puma_role) do
14
- run "#{puma_cmd} #{start_options}", :pty => false
5
+ within current_path do
6
+ execute fetch(:puma_cmd), "#{start_options}"
7
+ end
8
+ end
9
+ end
10
+
11
+ desc 'ensure directories exist'
12
+ task :directories do
13
+ on roles fetch(:puma_role) do
14
+ execute :mkdir, '-pv', shared_path, "sockets"
15
15
  end
16
16
  end
17
17
 
18
18
  desc 'Stop puma'
19
19
  task :stop do
20
20
  on roles fetch(:puma_role) do
21
- within release_path do
22
- run "#{pumactl_cmd} -S #{state_path} stop"
21
+ within current_path do
22
+ execute fetch(:pumactl_cmd), "-S #{state_path} stop"
23
23
  end
24
24
  end
25
25
  end
@@ -27,13 +27,8 @@ namespace :puma do
27
27
  desc 'Restart puma'
28
28
  task :restart do
29
29
  on roles fetch(:puma_role) do
30
- within release_path do
31
- begin
32
- run "#{pumactl_cmd} -S #{state_path} restart"
33
- rescue Capistrano::CommandError => ex
34
- puts "Failed to restart puma: #{ex}\nAssuming not started."
35
- start
36
- end
30
+ within current_path do
31
+ execute fetch(:pumactl_cmd), "-S #{state_path} restart"
37
32
  end
38
33
  end
39
34
  end
@@ -41,8 +36,8 @@ namespace :puma do
41
36
  desc 'Restart puma (phased restart)'
42
37
  task :phased_restart do
43
38
  on roles fetch(:puma_role) do
44
- within release_path do
45
- run "#{pumactl_cmd} -S #{state_path} phased-restart"
39
+ within current_path do
40
+ execute fetch(:pumactl_cmd), "-S #{state_path} phased-restart"
46
41
  end
47
42
  end
48
43
  end
@@ -51,24 +46,24 @@ namespace :puma do
51
46
  if config_file
52
47
  "-q -d -e #{puma_env} -C #{config_file}"
53
48
  else
54
- "-q -d -e #{puma_env} -b '#{puma_socket}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
49
+ "-q -d -e #{puma_env} -b '#{fetch(:puma_socket)}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
55
50
  end
56
51
  end
57
52
 
58
53
  def config_file
59
54
  @_config_file ||= begin
60
55
  file = fetch(:puma_config_file, nil)
61
- file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
56
+ file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{fetch(:puma_env)}.rb")
62
57
  file
63
58
  end
64
59
  end
65
60
 
66
61
  def puma_env
67
- fetch(:rack_env, fetch(:rails_env, 'production'))
62
+ fetch(:puma_env)
68
63
  end
69
64
 
70
65
  def state_path
71
- (config_file ? configuration.options[:state] : nil) || puma_state
66
+ (config_file ? configuration.options[:state] : nil) || fetch(:puma_state)
72
67
  end
73
68
 
74
69
  def configuration
@@ -79,5 +74,16 @@ namespace :puma do
79
74
  config
80
75
  end
81
76
 
82
- after 'deploy:finishing', :reset
77
+ after 'deploy:finishing', 'puma:restart'
78
+ end
79
+
80
+ namespace :load do
81
+ task :defaults do
82
+ set :puma_cmd, fetch(:puma_cmd, "bundle exec puma")
83
+ set :pumactl_cmd, fetch(:pumactl_cmd, "bundle exec pumactl")
84
+ set :puma_env, fetch(:puma_env, fetch(:rack_env, fetch(:rails_env, 'production')))
85
+ set :puma_state, fetch(:puma_state, "#{shared_path}/sockets/puma.state")
86
+ set :puma_socket, fetch(:puma_socket, "unix://#{shared_path}/sockets/puma.sock")
87
+ set :puma_role, fetch(:puma_role, :app)
88
+ end
83
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John D'Agostino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-29 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler