Sha256: 9a3918a090df435b8d3a8aee14802b1b94c8aa3ff2f72e73b38e5c7b0ff00987
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
module Yad module Web class Apache def self.build_start_command(options = {}) default_options = { :apache_command => 'apachectl' } options = default_options.merge(options) "#{options[:apache_command]} start" end def self.build_stop_command(options = {}) default_options = { :apache_command => 'apachectl' } options = default_options.merge(options) "#{options[:apache_command]} stop" end def self.build_restart_command(options = {}) default_options = { :apache_command => 'apachectl' } options = default_options.merge(options) "#{options[:apache_command]} restart" end 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 end # class Apache end # module Web end # module Yad
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yad-0.0.4 | lib/yad/web/apache.rb |