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 +4 -4
- data/README.md +5 -4
- data/lib/capistrano/tasks/websocket-rails.rake +27 -19
- data/lib/capistrano/websocket-rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3f495aa46f5dff46657f24a4325649de7bf0fd
|
4
|
+
data.tar.gz: 21b1e952f2dbbc50fafed529be4e9dc8d3748ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
22
|
+
require 'capistrano/websocket-rails'
|
23
23
|
```
|
24
24
|
|
25
25
|
Configurable options, shown here with defaults:
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
|
29
|
-
|
30
|
-
|
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, :
|
9
|
-
# invoke 'websocket_rails:
|
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, :
|
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))
|
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))
|
28
|
-
within(
|
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))
|
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
|
-
|
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
|
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
|
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
|
54
|
-
|
55
|
-
|
60
|
+
def restart_server(pid_file)
|
61
|
+
stop_server(pid_file)
|
62
|
+
start_server(pid_file)
|
56
63
|
end
|
57
|
-
def
|
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
|