Module: LiquidBackup::Job::Folder

Included in:
LiquidBackup::Job
Defined in:
lib/liquid_backup/job/modules/folder_module.rb

Defined Under Namespace

Modules: StepCallbacks

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(parent) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/liquid_backup/job/modules/folder_module.rb', line 4

def Folder.included(parent)
  parent.class_eval <<-CALLBACK
    include Folder::StepCallbacks
    set_callback :upload, :before do |object|
      compress_folder
    end
    
    set_callback :backup, :before do |object|
      FileUtils.mkdir_p File.join(current_backup_path,'folders')
    end

    set_callback :upload, :after do 
      FileUtils.rm_rf(File.join(current_backup_path,'folders'))
    end
  CALLBACK
end

Instance Method Details

#folder(path, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/liquid_backup/job/modules/folder_module.rb', line 32

def folder(path, options = {})
  @_fire_database_callbacks = true
  
  source        = File.join(application_directory,'current',path)
  destination   = File.join(current_backup_path,'folders',path.gsub('/','_') + '.tar.gz')
  
  compress(source, destination)
end