vlad-daemon_kit 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +6 -0
- data/lib/vlad/daemon_kit.rb +29 -7
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 1.1.0 / 2009-11-04
|
2
|
+
|
3
|
+
* 3 enhancements
|
4
|
+
|
5
|
+
* Added 'arguments' support for start_app, including in task:
|
6
|
+
rake vlad:start_app[--help]
|
7
|
+
* Added vlad:run_app - runs the application on remote, in foreground
|
8
|
+
* Added vlad:console - runs script/console on remote
|
9
|
+
* Added vlad:tail - tails the log on remote
|
10
|
+
|
1
11
|
=== 1.0.1 / 2009-11-04
|
2
12
|
|
3
13
|
* 2 minor enhancements
|
data/README.rdoc
CHANGED
data/lib/vlad/daemon_kit.rb
CHANGED
@@ -1,24 +1,46 @@
|
|
1
1
|
require 'vlad'
|
2
2
|
|
3
3
|
class Vlad::DaemonKit
|
4
|
-
VERSION = '1.0
|
4
|
+
VERSION = '1.1.0'
|
5
5
|
|
6
6
|
set :mkdirs, 'tmp'
|
7
7
|
set :shared_paths, { 'log' => 'log' }
|
8
8
|
set :environment, 'production'
|
9
|
+
set :arguments, []
|
9
10
|
|
10
11
|
namespace :vlad do
|
12
|
+
desc "Run the daemon in the foreground"
|
13
|
+
remote_task(:run_app, :extra_args, {:roles => :app}) do |task, args|
|
14
|
+
extra_args = args[:extra_args]
|
15
|
+
run "cd #{current_path} && bin/#{application} -e #{environment} #{arguments.join(' ')} #{extra_args} run"
|
16
|
+
end
|
17
|
+
|
11
18
|
desc "Start the daemon"
|
12
|
-
remote_task :
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
run commands.join(' && ')
|
19
|
+
remote_task({:start_app => :stop_app}, :extra_args, {:roles => :app}) do |task, args|
|
20
|
+
extra_args = args[:extra_args]
|
21
|
+
run "cd #{current_path} && bin/#{application} -e #{environment} #{arguments.join(' ')} #{extra_args} start"
|
17
22
|
end
|
18
23
|
|
19
24
|
desc "Stop the daemon"
|
20
25
|
remote_task :stop_app, :roles => :app do
|
21
|
-
run "
|
26
|
+
run "cd #{current_path} && bin/#{application} -e #{environment} stop"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run script/console on the remove"
|
30
|
+
task :console do
|
31
|
+
ssh_flags << ' -t'
|
32
|
+
cmd = "'cd #{current_path} && script/console #{environment}'"
|
33
|
+
sh [ssh_cmd, ssh_flags, domain, cmd].join(' ')
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Tail the log"
|
37
|
+
task(:tail_app, :extra_args) do |t, args|
|
38
|
+
# We don't use a remote task, because it won't terminate cleanly on
|
39
|
+
# CTRL+C, which breaks -f args, etc.
|
40
|
+
ssh_flags << ' -t'
|
41
|
+
extra_args = args[:extra_args]
|
42
|
+
cmd = "'cd #{current_path} && tail #{extra_args} log/#{environment}.log'"
|
43
|
+
sh [ssh_cmd, ssh_flags, domain, cmd].join(' ')
|
22
44
|
end
|
23
45
|
end
|
24
46
|
end
|