cap-puma 0.0.2 → 0.0.4

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: 4ff6eb513d0b18870a1b47cc11aa1f2152ba322e
4
- data.tar.gz: 64a27a4bd06578d529846b442096585e0440aef9
3
+ metadata.gz: e2f8f13cc63f4ebd39fc162dfd2ed26e5289351a
4
+ data.tar.gz: 13c52eb93d4bdf0ebbd288e10f0da371b91bd64a
5
5
  SHA512:
6
- metadata.gz: e810cb469065f3ee15c4dd3813536f4eb45638790f8bbee5e5c823d118c450897aa7f51f96c52dec3b215a21d341277f93ef26650d145becda995eddb183c838
7
- data.tar.gz: cb03d1615ae9019274277df5fb622cc9a301bdf88e15d2e949f089a82ff94cea155de7d91f03c41b9b4ae8e44b422185e16e4f14cd76802973d6b89f6bacd9d1
6
+ metadata.gz: 6b2e959c2944f513fc263a66889d91a1cb2fca03d9042af1a54802bf0a1e3fd001852572ccce088ec38a115a434f8e977efc2e45261a7d336790ad8b7f94d099
7
+ data.tar.gz: fbdcbc47f2db3611baac566d21cc6dd06387a8c469459cf0e69105ffa6c3866ec277dd82594a2400ba063a4febfda1010a8cb89640eb252ec1b51c7680e75d93
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Capistrano::Puma
1
+ # Capistrano Puma Rake Tasks
2
2
 
3
3
  Puma Rake tasks for Capistrano >= 3.0.0
4
4
 
5
- These tasks have been taken directly from the puma gem
5
+ These tasks have been taken directly from the puma gem and upgraded to Rake
6
6
 
7
7
  Includes the following commands;
8
8
 
@@ -16,7 +16,7 @@ Includes the following commands;
16
16
  Add this line to your application's Gemfile:
17
17
 
18
18
  gem 'capistrano', '~> 3.0.0'
19
- gem 'capistrano-puma'
19
+ gem 'cap-puma'
20
20
 
21
21
  And then execute:
22
22
 
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.2'
7
+ spec.version = '0.0.4'
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,43 +1,61 @@
1
1
  namespace :puma do
2
+ task :defaults do
3
+ set :puma_cmd, fetch(:puma_cmd, "bundle exec puma")
4
+ set :pumactl_cmd, fetch(:pumactl_cmd, "bundle exec pumactl")
5
+ set :puma_env, fetch(:puma_env, fetch(:rack_env, fetch(:rails_env, 'production')))
6
+ set :puma_state, fetch(:puma_state, "#{shared_path}/sockets/puma.state")
7
+ set :puma_socket, fetch(:puma_socket, "unix://#{shared_path}/sockets/puma.sock")
8
+ set :puma_role, fetch(:puma_role, :app)
9
+ end
10
+
11
+ # https://github.com/leehambley/sshkit/blob/master/EXAMPLES.md#run-a-command-without-it-being-command-mapped
12
+ def execute_current_path(cmd)
13
+ execute "cd #{current_path} && #{cmd}"
14
+ end
15
+
2
16
  desc 'Start puma'
3
- task :start do
17
+ task :start => [:defaults] do
4
18
  on roles fetch(:puma_role) do
5
19
  within current_path do
6
- execute fetch(:puma_cmd), "#{start_options}"
20
+ execute_current_path("#{fetch(:puma_cmd)} #{start_options}")
7
21
  end
8
22
  end
9
23
  end
10
24
 
11
25
  desc 'ensure directories exist'
12
- task :directories do
26
+ task :directories => [:defaults] do
13
27
  on roles fetch(:puma_role) do
14
- execute :mkdir, '-pv', shared_path, "sockets"
28
+ execute :mkdir, '-pv', File.join(shared_path, "sockets")
15
29
  end
16
30
  end
17
31
 
18
32
  desc 'Stop puma'
19
- task :stop do
33
+ task :stop => [:defaults] do
20
34
  on roles fetch(:puma_role) do
21
35
  within current_path do
22
- execute fetch(:pumactl_cmd), "-S #{state_path} stop"
36
+ execute_current_path("#{fetch(:pumactl_cmd)} -S #{state_path} stop")
23
37
  end
24
38
  end
25
39
  end
26
40
 
27
41
  desc 'Restart puma'
28
- task :restart do
42
+ task :restart => [:defaults] do
29
43
  on roles fetch(:puma_role) do
30
44
  within current_path do
31
- execute fetch(:pumactl_cmd), "-S #{state_path} restart"
45
+ begin
46
+ execute_current_path("#{fetch(:pumactl_cmd)} -S #{state_path} restart")
47
+ rescue SSHKit::StandardError
48
+ Rake::Task["puma:start"].invoke
49
+ end
32
50
  end
33
51
  end
34
52
  end
35
53
 
36
54
  desc 'Restart puma (phased restart)'
37
- task :phased_restart do
55
+ task :phased_restart => [:defaults] do
38
56
  on roles fetch(:puma_role) do
39
57
  within current_path do
40
- execute fetch(:pumactl_cmd), "-S #{state_path} phased-restart"
58
+ execute_current_path("#{fetch(:pumactl_cmd)} -S #{state_path} phased-restart")
41
59
  end
42
60
  end
43
61
  end
@@ -77,13 +95,3 @@ namespace :puma do
77
95
  after 'deploy:finishing', 'puma:restart'
78
96
  end
79
97
 
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
89
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John D'Agostino