Class: BackupGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/backup/backup_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_filesObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/backup/backup_generator.rb', line 4

def copy_files
  copy_file 'backup.rake',              'lib/tasks/backup.rake'
  copy_file 'backup.rb',                'config/backup.rb'
  
  unless Dir["#{Rails.root}/db/migrate/*create_backup_tables.rb"].any?
    copy_file 'create_backup_tables.rb',  "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_backup_tables.rb"
  end
  
  puts message
end

#messageObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/generators/backup/backup_generator.rb', line 15

def message
<<-MESSAGE


==============================================================
Backup's files have been generated!
==============================================================

1: Migrate the database!

  rake db:migrate


2: Set up some "Backup Settings" inside the backup configuration file!

  config/backup.rb


3: Run the backups! Enjoy.

  rake backup:run trigger="your-specified-trigger"


For More Information:
http://github.com/meskyanichi/backup

==============================================================


MESSAGE
end