mina-puma 0.3.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af9f8cd34d7ef22a969cd570647da2f111327368
4
- data.tar.gz: ac6df3fa3d29f4ff42e4fe9881dbcd999075e598
3
+ metadata.gz: ffb5c8a885cccb123942b259db41dd99aa613d77
4
+ data.tar.gz: f389dafb16b8d3027861c2496f46143166eed20c
5
5
  SHA512:
6
- metadata.gz: dfd33110d2af4e327bbd2ee9961bf2b1bd7e96833dbef50772cd18ab1efd68beb5ef2b9348b999248d1b577a885299501bbc1483085a7dc37e26adda94b25fdf
7
- data.tar.gz: 69421ec3febad20a175e4e1e3c590433fdc731d7acc5128e3b2bb12c747132dbd69ce26a4bc66366559b3523ab119d6d163f248b32f87baa1ee27e23a31de319
6
+ metadata.gz: 37d58ac13d159452dbb392816b9a8e0379b4a48785bb80ebe525835119df348845ef3c8ab8a94127a88c96899fb4ee52557ef00268a3e41b9653c2ccaa4216aa
7
+ data.tar.gz: f71195b5edca9e1ae111a6fcdeffd31ce9582f0484181e66649a11bdd3d47dbd5ffc54b3c1db91f3e62d93cf6d8f93c8c3f675b5b6b928f36709cb1c4eb37b4a
data/README.md CHANGED
@@ -25,7 +25,7 @@ And then execute:
25
25
  Or install it yourself as:
26
26
 
27
27
  $ gem install mina-puma
28
-
28
+
29
29
  Note: by just including this gem, does not mean your development server will be Puma, for that, you need explicitly add `gem 'puma'` to your Gemfile.
30
30
 
31
31
  ## Usage
@@ -49,6 +49,7 @@ OR you can set other directories by setting follow variables:
49
49
  * `puma_pid` - puma pid file, default `shared/tmp/pids/puma.pid`
50
50
  * `puma_state` - puma state file, default `shared/tmp/sockets/puma.state`
51
51
  * `pumactl_socket` - pumactl socket file, default `shared/tmp/sockets/pumactl.sock`
52
+ * `puma_root_path` - puma command execute root path, default `current`
52
53
 
53
54
  Then:
54
55
 
@@ -62,10 +63,10 @@ require 'mina/puma'
62
63
 
63
64
  task :setup => :environment do
64
65
  # Puma needs a place to store its pid file and socket file.
65
- queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
66
- queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
67
- queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
68
- queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
66
+ command %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
67
+ command %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
68
+ command %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
69
+ command %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
69
70
 
70
71
  ...
71
72
 
@@ -4,28 +4,30 @@ require 'mina/rails'
4
4
  namespace :puma do
5
5
  set :web_server, :puma
6
6
 
7
- set_default :puma_role, -> { user }
8
- set_default :puma_env, -> { fetch(:rails_env, 'production') }
9
- set_default :puma_config, -> { "#{deploy_to}/#{shared_path}/config/puma.rb" }
10
- set_default :puma_socket, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.sock" }
11
- set_default :puma_state, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.state" }
12
- set_default :puma_pid, -> { "#{deploy_to}/#{shared_path}/tmp/pids/puma.pid" }
13
- set_default :puma_cmd, -> { "#{bundle_prefix} puma" }
14
- set_default :pumactl_cmd, -> { "#{bundle_prefix} pumactl" }
15
- set_default :pumactl_socket, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/pumactl.sock" }
7
+ set :puma_role, -> { fetch(:user) }
8
+ set :puma_env, -> { fetch(:rails_env, 'production') }
9
+ set :puma_config, -> { "#{fetch(:shared_path)}/config/puma.rb" }
10
+ set :puma_socket, -> { "#{fetch(:shared_path)}/tmp/sockets/puma.sock" }
11
+ set :puma_state, -> { "#{fetch(:shared_path)}/tmp/sockets/puma.state" }
12
+ set :puma_pid, -> { "#{fetch(:shared_path)}/tmp/pids/puma.pid" }
13
+ set :puma_cmd, -> { "#{fetch(:bundle_prefix)} puma" }
14
+ set :pumactl_cmd, -> { "#{fetch(:bundle_prefix)} pumactl" }
15
+ set :pumactl_socket, -> { "#{fetch(:shared_path)}/tmp/sockets/pumactl.sock" }
16
+ set :puma_root_path, -> { fetch(:current_path) }
16
17
 
17
18
  desc 'Start puma'
18
19
  task :start => :environment do
19
- puma_port_option = "-p #{puma_port}" if puma_port
20
+ puma_port_option = "-p #{fetch(:puma_port)}" if set?(:puma_port)
20
21
 
21
- queue! %[
22
- if [ -e '#{pumactl_socket}' ]; then
22
+ comment "Starting Puma..."
23
+ command %[
24
+ if [ -e '#{fetch(:pumactl_socket)}' ]; then
23
25
  echo 'Puma is already running!';
24
26
  else
25
- if [ -e '#{puma_config}' ]; then
26
- cd #{deploy_to}/#{current_path} && #{puma_cmd} -q -d -e #{puma_env} -C #{puma_config}
27
+ if [ -e '#{fetch(:puma_config)}' ]; then
28
+ cd #{fetch(:puma_root_path)} && #{fetch(:puma_cmd)} -q -d -e #{fetch(:puma_env)} -C #{fetch(:puma_config)}
27
29
  else
28
- cd #{deploy_to}/#{current_path} && #{puma_cmd} -q -d -e #{puma_env} -b 'unix://#{puma_socket}' #{puma_port_option} -S #{puma_state} --pidfile #{puma_pid} --control 'unix://#{pumactl_socket}'
30
+ cd #{fetch(:puma_root_path)} && #{fetch(:puma_cmd)} -q -d -e #{fetch(:puma_env)} -b 'unix://#{fetch(:puma_socket)}' #{puma_port_option} -S #{fetch(:puma_state)} --pidfile #{fetch(:puma_pid)} --control 'unix://#{fetch(:pumactl_socket)}'
29
31
  fi
30
32
  fi
31
33
  ]
@@ -33,42 +35,48 @@ namespace :puma do
33
35
 
34
36
  desc 'Stop puma'
35
37
  task stop: :environment do
38
+ comment "Stopping Puma..."
36
39
  pumactl_command 'stop'
37
- queue! %[rm -f '#{pumactl_socket}']
40
+ command %[rm -f '#{fetch(:pumactl_socket)}']
38
41
  end
39
42
 
40
43
  desc 'Restart puma'
41
44
  task restart: :environment do
45
+ comment "Restart Puma...."
42
46
  pumactl_command 'restart'
43
47
  end
44
48
 
45
49
  desc 'Restart puma (phased restart)'
46
50
  task phased_restart: :environment do
51
+ comment "Restart Puma -- phased..."
47
52
  pumactl_command 'phased-restart'
48
53
  end
49
54
 
50
55
  desc 'Restart puma (hard restart)'
51
56
  task hard_restart: :environment do
57
+ comment "Restart Puma -- hard..."
52
58
  invoke 'puma:stop'
53
59
  invoke 'puma:start'
54
60
  end
55
-
61
+
56
62
  desc 'Get status of puma'
57
63
  task status: :environment do
64
+ comment "Puma status..."
58
65
  pumactl_command 'status'
59
66
  end
60
67
 
61
68
  def pumactl_command(command)
62
- queue! %[
63
- if [ -e '#{pumactl_socket}' ]; then
64
- if [ -e '#{puma_config}' ]; then
65
- cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -F #{puma_config} #{command}
69
+ cmd = %{
70
+ if [ -e '#{fetch(:pumactl_socket)}' ]; then
71
+ if [ -e '#{fetch(:puma_config)}' ]; then
72
+ cd #{fetch(:puma_root_path)} && #{fetch(:pumactl_cmd)} -F #{fetch(:puma_config)} #{command}
66
73
  else
67
- cd #{deploy_to}/#{current_path} && #{pumactl_cmd} -S #{puma_state} -C 'unix://#{pumactl_socket}' --pidfile #{puma_pid} #{command}
74
+ cd #{fetch(:puma_root_path)} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} -C 'unix://#{fetch(:pumactl_socket)}' --pidfile #{fetch(:puma_pid)} #{command}
68
75
  fi
69
76
  else
70
77
  echo 'Puma is not running!';
71
78
  fi
72
- ]
79
+ }
80
+ command cmd
73
81
  end
74
82
  end
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module Puma
3
- VERSION = "0.3.2"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'mina', '< 1.0.0'
21
+ spec.add_dependency 'mina', '~> 1.0.0'
22
22
  spec.add_dependency 'puma', '>= 2.13'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 1.0.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: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mina
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency