capistrano-play 0.0.1 → 0.0.2
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.
- data/lib/capistrano-play/deploy.rb +202 -201
- data/lib/capistrano-play/version.rb +1 -1
- metadata +2 -2
|
@@ -33,94 +33,91 @@ module Capistrano
|
|
|
33
33
|
# without this, there are problems with sudo on remote server
|
|
34
34
|
default_run_options[:pty] = true
|
|
35
35
|
|
|
36
|
-
namespace
|
|
37
|
-
task
|
|
38
|
-
play
|
|
39
|
-
|
|
36
|
+
namespace(:deploy) {
|
|
37
|
+
task(:start, :roles => :app, :except => { :no_release => true }) {
|
|
38
|
+
find_and_execute_task("play:start")
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
task
|
|
42
|
-
play
|
|
43
|
-
|
|
41
|
+
task(:restart, :roles => :app, :except => { :no_release => true }) {
|
|
42
|
+
find_and_execute_task("play:restart")
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
task
|
|
46
|
-
play
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
task(:stop, :roles => :app, :except => { :no_release => true }) {
|
|
46
|
+
find_and_execute_task("play:stop")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
49
|
|
|
50
50
|
after 'deploy:setup', 'play:setup'
|
|
51
51
|
after 'deploy:finalize_update', 'play:update'
|
|
52
52
|
|
|
53
|
-
namespace
|
|
54
|
-
_cset
|
|
55
|
-
_cset
|
|
53
|
+
namespace(:play) {
|
|
54
|
+
_cset(:play_version, '1.2.5')
|
|
55
|
+
_cset(:play_major_version) {
|
|
56
56
|
play_version.scan(/\d+/).first.to_i
|
|
57
|
-
|
|
58
|
-
_cset
|
|
57
|
+
}
|
|
58
|
+
_cset(:play_zip_url) {
|
|
59
59
|
"http://download.playframework.org/releases/#{File.basename(play_zip_file)}"
|
|
60
|
-
|
|
61
|
-
_cset
|
|
62
|
-
_cset
|
|
60
|
+
}
|
|
61
|
+
_cset(:play_preserve_zip, true)
|
|
62
|
+
_cset(:play_zip_file) {
|
|
63
63
|
File.join(shared_path, 'tools', 'play', "play-#{play_version}.zip")
|
|
64
|
-
|
|
65
|
-
_cset
|
|
64
|
+
}
|
|
65
|
+
_cset(:play_path) {
|
|
66
66
|
File.join(shared_path, 'tools', 'play', "play-#{play_version}")
|
|
67
|
-
|
|
68
|
-
_cset
|
|
67
|
+
}
|
|
68
|
+
_cset(:play_bin) {
|
|
69
69
|
File.join(play_path, 'play')
|
|
70
|
-
|
|
71
|
-
_cset
|
|
70
|
+
}
|
|
71
|
+
_cset(:play_cmd) {
|
|
72
72
|
if fetch(:play_java_home, nil)
|
|
73
73
|
"env JAVA_HOME=#{play_java_home} #{play_bin}"
|
|
74
74
|
else
|
|
75
75
|
play_bin
|
|
76
76
|
end
|
|
77
|
-
|
|
78
|
-
_cset
|
|
79
|
-
_cset
|
|
80
|
-
daemonize.__send__(play_daemonize_method)
|
|
81
|
-
end
|
|
82
|
-
_cset :play_pid_file do
|
|
77
|
+
}
|
|
78
|
+
_cset(:play_daemonize_method, :play)
|
|
79
|
+
_cset(:play_pid_file) {
|
|
83
80
|
fetch(:app_pid, File.join(shared_path, 'pids', 'server.pid')) # for backward compatibility
|
|
84
|
-
|
|
85
|
-
_cset
|
|
81
|
+
}
|
|
82
|
+
_cset(:play_use_precompile, true) # performe precompilation before restarting service if true
|
|
86
83
|
|
|
87
|
-
_cset
|
|
84
|
+
_cset(:play_zip_file_local) {
|
|
88
85
|
File.join(File.expand_path('.'), 'tools', 'play', "play-#{play_version}.zip")
|
|
89
|
-
|
|
90
|
-
_cset
|
|
86
|
+
}
|
|
87
|
+
_cset(:play_path_local) {
|
|
91
88
|
File.join(File.expand_path('.'), 'tools', 'play', "play-#{play_version}")
|
|
92
|
-
|
|
93
|
-
_cset
|
|
89
|
+
}
|
|
90
|
+
_cset(:play_bin_local) {
|
|
94
91
|
File.join(play_path_local, 'play')
|
|
95
|
-
|
|
96
|
-
_cset
|
|
92
|
+
}
|
|
93
|
+
_cset(:play_cmd_local) {
|
|
97
94
|
if fetch(:play_java_home_local, nil)
|
|
98
95
|
"env JAVA_HOME=#{play_java_home_local} #{play_bin_local}"
|
|
99
96
|
else
|
|
100
97
|
play_bin_local
|
|
101
98
|
end
|
|
102
|
-
|
|
103
|
-
_cset
|
|
99
|
+
}
|
|
100
|
+
_cset(:play_project_path) {
|
|
104
101
|
release_path
|
|
105
|
-
|
|
106
|
-
_cset
|
|
102
|
+
}
|
|
103
|
+
_cset(:play_project_path_local) {
|
|
107
104
|
File.expand_path('.')
|
|
108
|
-
|
|
109
|
-
_cset
|
|
105
|
+
}
|
|
106
|
+
_cset(:play_target_path) {
|
|
110
107
|
if play_major_version < 2
|
|
111
108
|
File.join(play_project_path, 'precompiled')
|
|
112
109
|
else
|
|
113
110
|
File.join(play_project_path, 'target')
|
|
114
111
|
end
|
|
115
|
-
|
|
116
|
-
_cset
|
|
112
|
+
}
|
|
113
|
+
_cset(:play_target_path_local) {
|
|
117
114
|
if play_major_version < 2
|
|
118
115
|
File.join(play_project_path_local, 'precompiled')
|
|
119
116
|
else
|
|
120
117
|
File.join(play_project_path_local, 'target')
|
|
121
118
|
end
|
|
122
|
-
|
|
123
|
-
_cset
|
|
119
|
+
}
|
|
120
|
+
_cset(:play_dependencies_path_map) {
|
|
124
121
|
if play_major_version < 2
|
|
125
122
|
{
|
|
126
123
|
File.join(play_project_path, 'lib') => File.join(play_project_path_local, 'lib'),
|
|
@@ -131,84 +128,84 @@ module Capistrano
|
|
|
131
128
|
play_target_path => play_target_path_local,
|
|
132
129
|
}
|
|
133
130
|
end
|
|
134
|
-
|
|
135
|
-
_cset
|
|
131
|
+
}
|
|
132
|
+
_cset(:play_subcmd_dependencies) {
|
|
136
133
|
if play_major_version < 2
|
|
137
134
|
"dependencies --forProd --sync"
|
|
138
135
|
else
|
|
139
136
|
"dependencies"
|
|
140
137
|
end
|
|
141
|
-
|
|
142
|
-
_cset
|
|
138
|
+
}
|
|
139
|
+
_cset(:play_subcmd_precompile) {
|
|
143
140
|
if play_major_version < 2
|
|
144
141
|
"precompile"
|
|
145
142
|
else
|
|
146
143
|
"compile"
|
|
147
144
|
end
|
|
148
|
-
|
|
149
|
-
_cset
|
|
145
|
+
}
|
|
146
|
+
_cset(:play_precompile_locally, false) # perform precompilation on localhost
|
|
150
147
|
|
|
151
|
-
desc
|
|
152
|
-
task
|
|
148
|
+
desc("install play if needed")
|
|
149
|
+
task(:setup) {
|
|
153
150
|
transaction {
|
|
154
151
|
setup_ivy if fetch(:play_setup_ivy, false)
|
|
155
152
|
install
|
|
156
153
|
setup_locally if play_precompile_locally
|
|
157
154
|
}
|
|
158
155
|
transaction {
|
|
159
|
-
|
|
156
|
+
find_and_execute_task("play:daemonize:#{play_daemonize_method}:setup") if play_daemonize_method
|
|
160
157
|
}
|
|
161
|
-
|
|
158
|
+
}
|
|
162
159
|
|
|
163
|
-
task
|
|
160
|
+
task(:setup_locally) {
|
|
164
161
|
transaction {
|
|
165
162
|
setup_ivy_locally if fetch(:play_setup_ivy_locally, false)
|
|
166
163
|
install_locally
|
|
167
164
|
}
|
|
168
|
-
|
|
165
|
+
}
|
|
169
166
|
|
|
170
|
-
_cset
|
|
171
|
-
_cset
|
|
167
|
+
_cset(:play_ivy_settings_template, File.join(File.dirname(__FILE__), 'templates', 'ivysettings.erb'))
|
|
168
|
+
_cset(:play_ivy_settings) {
|
|
172
169
|
File.join(capture('echo $HOME').chomp, '.ivy2', 'ivysettings.xml')
|
|
173
|
-
|
|
174
|
-
task
|
|
170
|
+
}
|
|
171
|
+
task(:setup_ivy, :roles => :app, :except => { :no_release => true }) {
|
|
175
172
|
tempfile = File.join('/tmp', File.basename(play_ivy_settings))
|
|
176
173
|
on_rollback {
|
|
177
|
-
run
|
|
174
|
+
run("rm -f #{tempfile}")
|
|
178
175
|
}
|
|
179
176
|
template = File.read(play_ivy_settings_template)
|
|
180
177
|
result = ERB.new(template).result(binding)
|
|
181
|
-
run(<<-EOS)
|
|
178
|
+
run((<<-EOS).gsub(/\s+/, ' '))
|
|
182
179
|
( test -d #{File.dirname(play_ivy_settings)} || mkdir -p #{File.dirname(play_ivy_settings)} ) &&
|
|
183
180
|
( test -f #{play_ivy_settings} && mv -f #{play_ivy_settings} #{play_ivy_settings}.orig; true );
|
|
184
181
|
EOS
|
|
185
182
|
put result, tempfile
|
|
186
|
-
run
|
|
187
|
-
|
|
183
|
+
run("diff #{play_ivy_settings} #{tempfile} || mv -f #{tempfile} #{play_ivy_settings}")
|
|
184
|
+
}
|
|
188
185
|
|
|
189
|
-
_cset
|
|
190
|
-
task
|
|
186
|
+
_cset(:play_ivy_settings_local, File.join(ENV['HOME'], '.ivy2', 'ivysettings.xml'))
|
|
187
|
+
task(:setup_ivy_locally, :except => { :no_release => true }) {
|
|
191
188
|
template = File.read(play_ivy_settings_template)
|
|
192
189
|
result = ERB.new(template).result(binding)
|
|
193
|
-
run_locally(<<-EOS)
|
|
190
|
+
run_locally((<<-EOS).gsub(/\s+/, ' '))
|
|
194
191
|
( test -d #{File.dirname(play_ivy_settings_local)} || mkdir -p #{File.dirname(play_ivy_settings_local)} ) &&
|
|
195
192
|
( test -f #{play_ivy_settings_local} && mv -f #{play_ivy_settings_local} #{play_ivy_settings_local}.orig; true );
|
|
196
193
|
EOS
|
|
197
194
|
File.open(play_ivy_settings_local, 'w') { |fp| fp.write(result) }
|
|
198
|
-
|
|
195
|
+
}
|
|
199
196
|
|
|
200
|
-
task
|
|
197
|
+
task(:install, :roles => :app, :except => { :no_release => true }) {
|
|
201
198
|
temp_zip = File.join('/tmp', File.basename(play_zip_file))
|
|
202
199
|
temp_dir = File.join('/tmp', File.basename(play_zip_file, '.zip'))
|
|
203
200
|
on_rollback {
|
|
204
201
|
files = [ play_path, temp_zip, temp_dir ]
|
|
205
202
|
files << play_zip_file unless play_preserve_zip
|
|
206
|
-
run
|
|
203
|
+
run("#{try_sudo} rm -rf #{files.join(' ')}")
|
|
207
204
|
}
|
|
208
|
-
run
|
|
205
|
+
run("#{try_sudo} rm -f #{play_zip_file}") unless play_preserve_zip
|
|
209
206
|
|
|
210
207
|
dirs = [ File.dirname(play_zip_file), File.dirname(play_path) ].uniq()
|
|
211
|
-
run(<<-EOS)
|
|
208
|
+
run((<<-EOS).gsub(/\s+/, ' '))
|
|
212
209
|
if ! test -x #{play_bin}; then
|
|
213
210
|
mkdir -p #{dirs.join(' ')} &&
|
|
214
211
|
( test -f #{play_zip_file} || ( wget --no-verbose -O #{temp_zip} #{play_zip_url} && #{try_sudo} mv -f #{temp_zip} #{play_zip_file}; true ) ) &&
|
|
@@ -216,16 +213,16 @@ module Capistrano
|
|
|
216
213
|
test -x #{play_bin};
|
|
217
214
|
fi;
|
|
218
215
|
EOS
|
|
219
|
-
run
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
task
|
|
216
|
+
run("#{try_sudo} rm -f #{play_zip_file}") unless play_preserve_zip
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
task(:install_locally, :except => { :no_release => true }) {
|
|
223
220
|
on_rollback {
|
|
224
221
|
files = [ play_path_local, play_zip_file_local ]
|
|
225
222
|
run_locally("rm -rf #{files.join(' ')}")
|
|
226
223
|
}
|
|
227
224
|
dirs = [ File.dirname(play_zip_file_local), File.dirname(play_path_local) ].uniq()
|
|
228
|
-
run_locally(<<-EOS)
|
|
225
|
+
run_locally((<<-EOS).gsub(/\s+/, ' '))
|
|
229
226
|
if ! test -x #{play_bin_local}; then
|
|
230
227
|
mkdir -p #{dirs.join(' ')} &&
|
|
231
228
|
( test -f #{play_zip_file_local} || ( wget --no-verbose -O #{play_zip_file_local} #{play_zip_url} ) ) &&
|
|
@@ -233,93 +230,93 @@ module Capistrano
|
|
|
233
230
|
test -x #{play_bin_local};
|
|
234
231
|
fi;
|
|
235
232
|
EOS
|
|
236
|
-
|
|
233
|
+
}
|
|
237
234
|
|
|
238
|
-
namespace
|
|
239
|
-
namespace
|
|
240
|
-
task
|
|
235
|
+
namespace(:daemonize) {
|
|
236
|
+
namespace(:play) {
|
|
237
|
+
task(:setup, :roles => :app, :except => { :no_release => true }) {
|
|
241
238
|
# nop
|
|
242
|
-
|
|
239
|
+
}
|
|
243
240
|
|
|
244
|
-
_cset
|
|
241
|
+
_cset(:play_start_options) {
|
|
245
242
|
options = []
|
|
246
243
|
options << "-Xss2048k"
|
|
247
244
|
options << "--%prod"
|
|
248
245
|
options
|
|
249
|
-
|
|
250
|
-
task
|
|
251
|
-
run
|
|
246
|
+
}
|
|
247
|
+
task(:start, :roles => :app, :except => { :no_release => true }) {
|
|
248
|
+
run("rm -f #{play_pid_file}") # FIXME: should check if the pid is active
|
|
252
249
|
play_start_options << "-Dprecompiled=true" if play_use_precompile
|
|
253
|
-
run
|
|
254
|
-
|
|
250
|
+
run("cd #{play_project_path} && nohup #{play_cmd} start --pid_file=#{play_pid_file} #{play_start_options.join(' ')}")
|
|
251
|
+
}
|
|
255
252
|
|
|
256
|
-
task
|
|
257
|
-
run
|
|
258
|
-
|
|
253
|
+
task(:stop, :roles => :app, :except => { :no_release => true }) {
|
|
254
|
+
run("cd #{play_project_path} && #{play_cmd} stop --pid_file=#{play_pid_file}")
|
|
255
|
+
}
|
|
259
256
|
|
|
260
|
-
task
|
|
257
|
+
task(:restart, :roles => :app, :except => { :no_release => true }) {
|
|
261
258
|
stop
|
|
262
259
|
start
|
|
263
|
-
|
|
260
|
+
}
|
|
264
261
|
|
|
265
|
-
task
|
|
266
|
-
run
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
task(:status, :roles => :app, :except => { :no_release => true }) {
|
|
263
|
+
run("cd #{play_project_path} && #{play_cmd} status --pid_file=#{play_pid_file}")
|
|
264
|
+
}
|
|
265
|
+
}
|
|
269
266
|
|
|
270
|
-
namespace
|
|
271
|
-
_cset
|
|
267
|
+
namespace(:upstart) {
|
|
268
|
+
_cset(:play_upstart_service) {
|
|
272
269
|
application
|
|
273
|
-
|
|
274
|
-
_cset
|
|
270
|
+
}
|
|
271
|
+
_cset(:play_upstart_config) {
|
|
275
272
|
File.join('/etc', 'init', "#{play_upstart_service}.conf")
|
|
276
|
-
|
|
277
|
-
_cset
|
|
278
|
-
_cset
|
|
273
|
+
}
|
|
274
|
+
_cset(:play_upstart_config_template, File.join(File.dirname(__FILE__), 'templates', 'upstart.erb'))
|
|
275
|
+
_cset(:play_upstart_options) {
|
|
279
276
|
options = []
|
|
280
277
|
options << "-Xss2048k"
|
|
281
278
|
options << "--%prod"
|
|
282
279
|
options
|
|
283
|
-
|
|
284
|
-
_cset
|
|
280
|
+
}
|
|
281
|
+
_cset(:play_upstart_runner) {
|
|
285
282
|
user
|
|
286
|
-
|
|
283
|
+
}
|
|
287
284
|
|
|
288
|
-
task
|
|
285
|
+
task(:setup, :roles => :app, :except => { :no_release => true }) {
|
|
289
286
|
tempfile = File.join('/tmp', File.basename(play_upstart_config))
|
|
290
287
|
on_rollback {
|
|
291
|
-
run
|
|
288
|
+
run("rm -f #{tempfile}")
|
|
292
289
|
}
|
|
293
290
|
play_upstart_options << "-Dprecompiled=true" if play_use_precompile
|
|
294
291
|
template = File.read(play_upstart_config_template)
|
|
295
292
|
result = ERB.new(template).result(binding)
|
|
296
293
|
put result, tempfile
|
|
297
|
-
run
|
|
298
|
-
|
|
294
|
+
run("diff #{play_upstart_config} #{tempfile} || #{sudo} mv -f #{tempfile} #{play_upstart_config}")
|
|
295
|
+
}
|
|
299
296
|
|
|
300
|
-
task
|
|
301
|
-
run
|
|
302
|
-
|
|
297
|
+
task(:start, :roles => :app, :except => { :no_release => true }) {
|
|
298
|
+
run("#{sudo} service #{play_upstart_service} start")
|
|
299
|
+
}
|
|
303
300
|
|
|
304
|
-
task
|
|
305
|
-
run
|
|
306
|
-
|
|
301
|
+
task(:stop, :roles => :app, :except => { :no_release => true }) {
|
|
302
|
+
run("#{sudo} service #{play_upstart_service} stop")
|
|
303
|
+
}
|
|
307
304
|
|
|
308
|
-
task
|
|
309
|
-
run
|
|
310
|
-
|
|
305
|
+
task(:restart, :roles => :app, :except => { :no_release => true }) {
|
|
306
|
+
run("#{sudo} service #{play_upstart_service} restart || #{sudo} service #{play_upstart_service} start")
|
|
307
|
+
}
|
|
311
308
|
|
|
312
|
-
task
|
|
313
|
-
run
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
task(:status, :roles => :app, :except => { :no_release => true }) {
|
|
310
|
+
run("#{sudo} service #{play_upstart_service} status")
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
317
314
|
|
|
318
|
-
desc
|
|
319
|
-
task
|
|
315
|
+
desc("update play runtime environment")
|
|
316
|
+
task(:update, :roles => :app, :except => { :no_release => true }) {
|
|
320
317
|
if play_major_version < 2
|
|
321
318
|
# FIXME: made tmp/ group writable since deploy:finalize_update creates non-group-writable tmp/
|
|
322
|
-
run
|
|
319
|
+
run("mkdir -p #{play_project_path}/tmp; #{try_sudo} chmod g+w #{play_project_path}/tmp") if fetch(:group_writable, true)
|
|
323
320
|
end
|
|
324
321
|
|
|
325
322
|
if play_use_precompile
|
|
@@ -337,95 +334,99 @@ module Capistrano
|
|
|
337
334
|
else
|
|
338
335
|
dependencies
|
|
339
336
|
end
|
|
340
|
-
|
|
337
|
+
}
|
|
341
338
|
|
|
342
|
-
task
|
|
343
|
-
run
|
|
344
|
-
|
|
339
|
+
task(:dependencies, :roles => :app, :except => { :no_release => true }) {
|
|
340
|
+
run("cd #{play_project_path} && #{play_cmd} #{play_subcmd_dependencies}")
|
|
341
|
+
}
|
|
345
342
|
|
|
346
|
-
task
|
|
343
|
+
task(:dependencies_locally, :roles => :app, :except => { :no_release => true }) {
|
|
347
344
|
if dry_run
|
|
348
345
|
logger.info("resolving play dependencies locally: #{play_project_path_local}")
|
|
349
346
|
else
|
|
347
|
+
logger.debug("cd #{play_project_path_local} && #{play_cmd_local} #{play_subcmd_dependencies}")
|
|
350
348
|
abort("error on resolving play dependencies.") unless system("cd #{play_project_path_local} && #{play_cmd_local} #{play_subcmd_dependencies}")
|
|
351
349
|
end
|
|
352
|
-
|
|
350
|
+
}
|
|
353
351
|
|
|
354
|
-
task
|
|
355
|
-
run
|
|
356
|
-
|
|
352
|
+
task(:precompile, :roles => :app, :except => { :no_release => true }) {
|
|
353
|
+
run("cd #{play_project_path} && #{play_cmd} #{play_subcmd_precompile}")
|
|
354
|
+
}
|
|
357
355
|
|
|
358
|
-
task
|
|
356
|
+
task(:precompile_locally, :roles => :app, :except => { :no_release => true }) {
|
|
359
357
|
on_rollback {
|
|
360
358
|
run_locally("cd #{play_project_path_local} && #{play_cmd_local} clean")
|
|
361
359
|
}
|
|
362
360
|
if dry_run
|
|
363
361
|
logger.info("compiling play application locally: #{play_project_path_local}")
|
|
364
362
|
else
|
|
363
|
+
logger.debug("cd #{play_project_path_local} && #{play_cmd_local} #{play_subcmd_precompile}")
|
|
365
364
|
abort("error on resolving play dependencies.") unless system("cd #{play_project_path_local} && #{play_cmd_local} #{play_subcmd_precompile}")
|
|
366
365
|
end
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
task
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
task(:upload_locally, :roles => :app, :except => { :no_release => true }) {
|
|
369
|
+
play_dependencies_path_map.merge(play_target_path => play_target_path_local).each { |dst, src|
|
|
370
|
+
begin
|
|
371
|
+
run_locally("mkdir -p #{src} && cd #{File.dirname(src)} && tar chzf #{src}.tar.gz #{File.basename(src)}") unless dry_run
|
|
372
|
+
upload "#{src}.tar.gz", "#{dst}.tar.gz"
|
|
373
|
+
run("mkdir -p #{File.dirname(dst)} && cd #{File.dirname(dst)} && tar xzf #{dst}.tar.gz && rm -f #{dst}.tar.gz")
|
|
374
|
+
run("chmod -R g+w #{dst}") if fetch(:group_writable, true)
|
|
375
|
+
ensure
|
|
376
|
+
run_locally("rm -f #{src}.tar.gz") rescue nil unless dry_run
|
|
377
|
+
end
|
|
376
378
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
run "tail -f #{shared_path}/log/#{application}.log" do |channel, stream, data|
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
desc("start play service")
|
|
382
|
+
task(:start, :roles => :app, :except => { :no_release => true }) {
|
|
383
|
+
find_and_execute_task("play:daemon:#{play_daemonize_method}:start") if play_daemonize_method
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
desc("stop play service")
|
|
387
|
+
task(:stop, :roles => :app, :except => { :no_release => true }) {
|
|
388
|
+
find_and_execute_task("play:daemon:#{play_daemonize_method}:stop") if play_daemonize_method
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
desc("restart play service")
|
|
392
|
+
task(:restart, :roles => :app, :except => { :no_release => true }) {
|
|
393
|
+
find_and_execute_task("play:daemon:#{play_daemonize_method}:restart") if play_daemonize_method
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
desc("view play status")
|
|
397
|
+
task(:status, :roles => :app, :except => { :no_release => true }) {
|
|
398
|
+
find_and_execute_task("play:daemon:#{play_daemonize_method}:status") if play_daemonize_method
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
desc("view play pid")
|
|
402
|
+
task(:pid, :roles => :app, :except => { :no_release => true }) {
|
|
403
|
+
run("cd #{play_project_path} && #{play_cmd} pid --pid_file=#{play_pid_file}")
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
desc("view play version")
|
|
407
|
+
task(:version, :roles => :app, :except => { :no_release => true }) {
|
|
408
|
+
run("cd #{play_project_path} && #{play_cmd} version --pid_file=#{play_pid_file}")
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
desc("view running play apps")
|
|
412
|
+
task(:ps, :roles => :app, :except => { :no_release => true }) {
|
|
413
|
+
run("ps -eaf | grep 'play'")
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
desc("kill play processes")
|
|
417
|
+
task(:kill, :roles => :app, :except => { :no_release => true }) {
|
|
418
|
+
run("ps -ef | grep 'play' | grep -v 'grep' | awk '{print $2}'| xargs -i kill {} ; echo ''")
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
desc("view logfiles")
|
|
422
|
+
task(:logs, :roles => :app, :except => { :no_release => true }) {
|
|
423
|
+
run("tail -f #{shared_path}/log/#{application}.log") do |channel, stream, data|
|
|
423
424
|
puts # for an extra line break before the host name
|
|
424
425
|
puts "#{channel[:host]}: #{data}"
|
|
425
426
|
break if stream == :err
|
|
426
427
|
end
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
}
|
|
429
|
+
}
|
|
429
430
|
}
|
|
430
431
|
end
|
|
431
432
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-play
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capistrano
|