Class: Yad::Maintenance::SharedSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/yad/maintenance/shared_system.rb

Class Method Summary collapse

Class Method Details

.build_turn_off_command(shared_directory, options = {}) ⇒ Object



8
9
10
# File 'lib/yad/maintenance/shared_system.rb', line 8

def self.build_turn_off_command(shared_directory, options = {})
  "rm -f #{shared_directory}/system/maintenance.html"
end

.build_turn_on_command(shared_directory, options = {}) ⇒ Object



4
5
6
# File 'lib/yad/maintenance/shared_system.rb', line 4

def self.build_turn_on_command(shared_directory, options = {})
  "cp -f #{shared_directory}/config/maintenance.html #{shared_directory}/system/"
end

.define_tasksObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/yad/maintenance/shared_system.rb', line 12

def self.define_tasks
  return if @tasks_already_defined
  @tasks_already_defined = true
  namespace :yad do
    namespace :maintenance do
      
      desc "Turns on the maintenance page for the application"
      remote_task :turn_on, :roles => :web do
        cmd = Yad::Maintenance::SharedSystem.build_turn_on_command(shared_path)
        run(cmd)
        puts("maintenance page turned on for #{target_host}")
      end

       desc "Turns off the maintenance page for the application"
      remote_task :turn_off, :roles => :web do
        cmd = Yad::Maintenance::SharedSystem.build_turn_off_command(shared_path)
        run(cmd)
        puts("maintenance page turned off for #{target_host}")
      end
      
    end
  end
end