mina-puma 0.2.0 → 0.3.0

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: 7154bd6439bcb482781051875994f1be4f4accfc
4
- data.tar.gz: 9ecf6aaa9bba1df43bbcb4484b5f5782030cea5a
3
+ metadata.gz: cbed1e584caa959bbc8ce546e651e978dd073c39
4
+ data.tar.gz: 416d5036fef3276f518566f6bb3621160eacb029
5
5
  SHA512:
6
- metadata.gz: 2ed89a5bd08c17de9a3c70e96aba2d42098b0e3865beea8696708953ad9298056b2d67f9297091d6e9a4685bc4dce9731dbf3b80862dabd57f4f075c5473dd66
7
- data.tar.gz: 49a88bd9c1b722a9c247cce5d32183d3605ae038490a4f6348bcb451cfab6a16481f71d300d00d0e2885c518a5420cfe48133a4dbc802ec1ccbbe797ac8a1074
6
+ metadata.gz: 6d67de609987ad03db27f5d58560dfc344cf55cf708ad4d9b56f0d1fd158d89bd925a08a84970e2900a86b62325424aba234de4657a6a4345323a5d261d98491
7
+ data.tar.gz: 431f8c240baf07e03e4084a953d3dfb671ebfc72bd3fd4448f1eef8631c2f0f318a0048cd4e30dfabcadd8300e0fc899c6bf33a7e8130f40bd6603fd75be3b8f
data/README.md CHANGED
@@ -5,8 +5,9 @@
5
5
 
6
6
  This gem provides several mina tasks:
7
7
 
8
- mina puma:phased_restart # Restart puma (with zero-downtime)
9
- mina puma:restart # Restart puma
8
+ mina puma:phased_restart # Restart puma (using phased restart)
9
+ mina puma:hard_restart # Restart puma (using stop, then start)
10
+ mina puma:restart # Restart puma (using pumactl)
10
11
  mina puma:start # Start puma
11
12
  mina puma:stop # Stop puma
12
13
 
@@ -55,32 +56,36 @@ $ mina puma:start
55
56
  ```
56
57
 
57
58
  ## Example
59
+ ```ruby
60
+ require 'mina/puma'
58
61
 
59
- require 'mina/puma'
62
+ task :setup => :environment do
63
+ # Puma needs a place to store its pid file and socket file.
64
+ queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
65
+ queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
66
+ queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
67
+ queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
60
68
 
61
- task :setup => :environment do
62
- # Puma needs a place to store its pid file and socket file.
63
- queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
64
- queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
65
- queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
66
- queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
69
+ ...
67
70
 
68
- ...
71
+ end
69
72
 
70
- end
73
+ # Add pids and sockets directories to shared paths
74
+ set :shared_paths, ['config/database.yml', 'tmp/pids', 'tmp/sockets']
71
75
 
72
- task :deploy do
73
- deploy do
74
- invoke :'git:clone'
75
- invoke :'deploy:link_shared_paths'
76
- ...
77
-
78
- to :launch do
79
- ...
80
- invoke :'puma:phased_restart'
81
- end
82
- end
76
+ task :deploy do
77
+ deploy do
78
+ invoke :'git:clone'
79
+ invoke :'deploy:link_shared_paths'
80
+ ...
81
+
82
+ to :launch do
83
+ ...
84
+ invoke :'puma:phased_restart'
83
85
  end
86
+ end
87
+ end
88
+ ```
84
89
 
85
90
  ## Contributing
86
91
 
@@ -23,7 +23,7 @@ namespace :puma do
23
23
  if [ -e '#{puma_config}' ]; then
24
24
  cd #{deploy_to}/#{current_path} && #{puma_cmd} -q -d -e #{puma_env} -C #{puma_config}
25
25
  else
26
- cd #{deploy_to}/#{current_path} && #{puma_cmd} -q -d -e #{puma_env} -b 'unix://#{puma_socket}' -S #{puma_state} --control 'unix://#{pumactl_socket}'
26
+ cd #{deploy_to}/#{current_path} && #{puma_cmd} -q -d -e #{puma_env} -b 'unix://#{puma_socket}' -S #{puma_state} --pidfile #{puma_pid} --control 'unix://#{pumactl_socket}'
27
27
  fi
28
28
  fi
29
29
  ]
@@ -31,27 +31,34 @@ namespace :puma do
31
31
 
32
32
  desc 'Stop puma'
33
33
  task stop: :environment do
34
- queue! %[
35
- if [ -e '#{pumactl_socket}' ]; then
36
- cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -S #{puma_state} stop
37
- rm -f '#{pumactl_socket}'
38
- else
39
- echo 'Puma is not running!';
40
- fi
41
- ]
34
+ pumactl_command 'stop'
35
+ queue! %[rm -f '#{pumactl_socket}']
42
36
  end
43
37
 
44
38
  desc 'Restart puma'
45
39
  task restart: :environment do
46
- invoke :'puma:stop'
47
- invoke :'puma:start'
40
+ pumactl_command 'restart'
48
41
  end
49
42
 
50
43
  desc 'Restart puma (phased restart)'
51
44
  task phased_restart: :environment do
45
+ pumactl_command 'phased-restart'
46
+ end
47
+
48
+ desc 'Restart puma (hard restart)'
49
+ task hard_restart: :environment do
50
+ invoke 'puma:stop'
51
+ invoke 'puma:start'
52
+ end
53
+
54
+ def pumactl_command(command)
52
55
  queue! %[
53
56
  if [ -e '#{pumactl_socket}' ]; then
54
- cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -S #{puma_state} phased-restart
57
+ if [ -e '#{puma_config}' ]; then
58
+ cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -F #{puma_config} #{command}
59
+ else
60
+ cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -S #{puma_state} -C 'unix://#{pumactl_socket}' --pidfile #{puma_pid} #{command}
61
+ fi
55
62
  else
56
63
  echo 'Puma is not running!';
57
64
  fi
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module Puma
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
data/mina-puma.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'mina'
22
+ spec.add_dependency 'puma', '>= 2.13'
22
23
 
23
24
  spec.add_development_dependency 'bundler', '~> 1.3'
24
25
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Sandelius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mina
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: puma
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.13'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.13'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
102
  version: '0'
89
103
  requirements: []
90
104
  rubyforge_project:
91
- rubygems_version: 2.2.2
105
+ rubygems_version: 2.4.5.1
92
106
  signing_key:
93
107
  specification_version: 4
94
108
  summary: Puma tasks for Mina