22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/yad/web/apache.rb', line 22
def self.define_tasks
return if @tasks_already_defined
@tasks_already_defined = true
namespace :yad do
namespace :web do
desc "Starts the web server"
remote_task :start, :roles => :web do
options = Rake::RemoteTask.get_options_hash(:apache_command)
cmd = Yad::Web::Apache.build_start_command(options)
use_sudo_for_apache = Rake::RemoteTask.fetch(:use_sudo_for_apache, true)
if use_sudo_for_apache
sudo(cmd)
else
run(cmd)
end
puts("Apache started on #{target_host}")
end
desc "Stops the web server"
remote_task :stop, :roles => :web do
options = Rake::RemoteTask.get_options_hash(:apache_command)
cmd = Yad::Web::Apache.build_stop_command(options)
use_sudo_for_apache = Rake::RemoteTask.fetch(:use_sudo_for_apache, true)
if use_sudo_for_apache
sudo(cmd)
else
run(cmd)
end
puts("Apache stopped on #{target_host}")
end
end
end
end
|