capistrano-websocket-rails 0.1.5 → 0.1.6

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: 037c3b1c882247f15e79af1fb22a343f87bcf98a
4
- data.tar.gz: 21911c31285a74df594606f8034199ec1aad0e2d
3
+ metadata.gz: 4e3f495aa46f5dff46657f24a4325649de7bf0fd
4
+ data.tar.gz: 21b1e952f2dbbc50fafed529be4e9dc8d3748ed8
5
5
  SHA512:
6
- metadata.gz: 7300b0f4352c96f3f9c2052ddf58cd8c824706d0e4c8d994d9dd545a04874ec00f3a9e365079b3df2cb4fb49e6350c3566efa35c51d996b8e223c8fd524f901c
7
- data.tar.gz: e15c301121c1b4b106500991c7106e22a85c3b49c4fcbf69015235a87b0b4fe26c14cd38da1400c83f52dd78377e6dd0cac313743d219c76e4ced8b6063e4599
6
+ metadata.gz: 0e931a7b094b05e578469c2f6237de0ab045ce36a49e417877c6b6946de1c6494101fa6043f05fcfef80279ba1c573eece7949a74ef04e20fca38c13ac527155
7
+ data.tar.gz: b8664d10e5c81b000053dc84142cd4909a33ab08bb8071af4b796075575ad2c0190b1428fb8834d71c8230d41d6ea3219781f2b36a32bbfe235c3765d803db05
data/README.md CHANGED
@@ -19,15 +19,16 @@ And then execute:
19
19
  Add the following to your Capfile.
20
20
 
21
21
  ```ruby
22
- require 'capistrano/websocket-rails'
22
+ require 'capistrano/websocket-rails'
23
23
  ```
24
24
 
25
25
  Configurable options, shown here with defaults:
26
26
 
27
27
  ```ruby
28
- :websocket_rails_pid => current_path.join('tmp', 'pids', 'websocket_rails.pid')
29
- :websocket_rails_env => fetch(:rack_env, fetch(:rails_env, fetch(:stage)))
30
- :websocket_rails_role => :app
28
+ :websocket_rails_default_hooks => true
29
+ :websocket_rails_pid => shared_path.join('tmp', 'pids', 'websocket_rails.pid')
30
+ :websocket_rails_env => fetch(:rack_env, fetch(:rails_env, fetch(:stage)))
31
+ :websocket_rails_role => :app
31
32
  ```
32
33
 
33
34
  ## Contributing
@@ -1,15 +1,16 @@
1
1
  namespace :load do
2
+ set :websocket_rails_default_hooks, -> { true }
2
3
  set :websocket_rails_pid, -> { shared_path.join 'tmp', 'pids', 'websocket_rails.pid' }
3
4
  set :websocket_rails_env, -> { fetch :rack_env, fetch(:rails_env, fetch(:stage)) }
4
5
  set :websocket_rails_role, -> { :app }
5
6
  end
6
7
 
7
8
  namespace :deploy do
8
- # before :starting, :stop_websocket_server do
9
- # invoke 'websocket_rails:stop_server'
9
+ # before :starting, :check_websocket_rails_hooks do
10
+ # invoke 'websocket_rails:add_default_hooks' if fetch(:websocket_rails_default_hooks)
10
11
  # end
11
- after :publishing, :start_websocket_server do
12
- invoke 'websocket_rails:restart_server'
12
+ after :publishing, :restart_websocket_rails_server do
13
+ invoke 'websocket_rails:restart_server' if fetch(:websocket_rails_default_hooks)
13
14
  end
14
15
  end
15
16
 
@@ -17,44 +18,51 @@ namespace :websocket_rails do
17
18
 
18
19
  desc 'Start websocket-rails server'
19
20
  task :start_server do
20
- on roles(fetch(:websocket_rails_role)), in: :sequence, wait: 5 do
21
- within(release_path) { start_server }
21
+ on roles(fetch(:websocket_rails_role)) do
22
+ within(release_path) { start_server fetch(:websocket_rails_pid) }
22
23
  end
23
24
  end
24
25
 
25
26
  desc 'Stop websocket-rails server'
26
27
  task :stop_server do
27
- on roles(fetch(:websocket_rails_role)), in: :sequence, wait: 5 do
28
- within(current_path) { stop_server }
28
+ on roles(fetch(:websocket_rails_role)) do
29
+ within(release_path) { stop_server fetch(:websocket_rails_pid) }
29
30
  end
30
31
  end
31
32
 
32
33
  desc 'Restart websocket-rails server'
33
34
  task :restart_server do
34
- on roles(fetch(:websocket_rails_role)), in: :sequence, wait: 5 do
35
- within(release_path) { restart_server }
35
+ on roles(fetch(:websocket_rails_role)) do
36
+ within(release_path) { restart_server fetch(:websocket_rails_pid) }
36
37
  end
37
38
  end
38
39
 
39
- def start_server
40
+ task :add_default_hooks do
41
+ after 'deploy:updated', 'websocket_rails:stop_server'
42
+ after 'deploy:reverted', 'websocket_rails:stop_server'
43
+ after 'deploy:published', 'websocket_rails:start_server'
44
+ end
45
+
46
+ def start_server(pid_file)
40
47
  info 'Starting websocket-rails server...'
41
- run_rake_command! 'start_server'
48
+ run_rake_command 'start_server'
42
49
  info 'Websocket-rails server started.'
43
50
  end
44
- def stop_server
45
- if pid_file_exists?
51
+ def stop_server(pid_file)
52
+ if pid_file_exists? pid_file
46
53
  info 'Stopping websocket-rails server...'
47
- run_rake_command! 'stop_server'
54
+ run_rake_command 'stop_server'
48
55
  info 'Websocket-rails server stopped.'
49
56
  else
50
57
  info 'Websocket-rails server not running.'
51
58
  end
52
59
  end
53
- def restart_server; stop_server; start_server end
54
- def pid_file_exists?
55
- test "[ -f #{fetch(:websocket_rails_pid)} ]"
60
+ def restart_server(pid_file)
61
+ stop_server(pid_file)
62
+ start_server(pid_file)
56
63
  end
57
- def run_rake_command!(cmd)
64
+ def pid_file_exists?(pid_file); test "[ -f #{pid_file} ]" end
65
+ def run_rake_command(cmd)
58
66
  with rails_env: fetch(:websocket_rails_env) do
59
67
  rake "websocket_rails:#{cmd}"
60
68
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module WebsocketRails
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-websocket-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith