Class: Yad::Web::Apache
- Inherits:
-
Object
- Object
- Yad::Web::Apache
- Defined in:
- lib/yad/web/apache.rb
Class Method Summary collapse
- .build_restart_command(options = {}) ⇒ Object
- .build_start_command(options = {}) ⇒ Object
- .build_stop_command(options = {}) ⇒ Object
- .define_tasks ⇒ Object
Class Method Details
.build_restart_command(options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/yad/web/apache.rb', line 16 def self.build_restart_command( = {}) = { :apache_command => 'apachectl' } = .merge() "#{[:apache_command]} restart" end |
.build_start_command(options = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/yad/web/apache.rb', line 4 def self.build_start_command( = {}) = { :apache_command => 'apachectl' } = .merge() "#{[:apache_command]} start" end |
.build_stop_command(options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/yad/web/apache.rb', line 10 def self.build_stop_command( = {}) = { :apache_command => 'apachectl' } = .merge() "#{[:apache_command]} stop" end |
.define_tasks ⇒ Object
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 = Rake::RemoteTask.(:apache_command) cmd = Yad::Web::Apache.build_start_command() 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 = Rake::RemoteTask.(:apache_command) cmd = Yad::Web::Apache.build_stop_command() 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 |