Class: Backup2s3Generator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



3
4
5
# File 'lib/generators/backup2s3/backup2s3_generator.rb', line 3

def self.source_root
  @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#generateObject



7
8
9
10
11
# File 'lib/generators/backup2s3/backup2s3_generator.rb', line 7

def generate
  copy_file("backup2s3.rake", "lib/tasks/backup2s3.rake")
  copy_file("backup2s3.yml", "config/backup2s3.yml")
  puts message
end

#messageObject



13
14
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
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/generators/backup2s3/backup2s3_generator.rb', line 13

def message
  <<-MESSAGE

  -------------------------------------------------------------------

  You have successfully installed backup2s3!

  1. Modify your configuration file:

    config/backup2s3.yml

  2. Get started.

    Backup tasks

      Create -- Creates a backup and moves it to S3
             -- comment - Add notes here to mark specific backups (optional)

        rake backup2s3:backup:create
        rake backup2s3:backup:create  comment='put notes about backup here if needed'


      Delete  -- Deletes a backup specified by id parameter
              -- id - Backup to delete, backup ids will be found using List

        rake backup2s3:backup:delete  id='20100913180541'


      List    -- Lists all backups that are currently on S3
              -- details - Setting details to true will display backup file names
                           and backup comments (optional)

        rake backup2s3:backup:list
        rake backup2s3:backup:list  details=true


      Restore -- Restores a backup specified by id parameter
              -- id - Backup to restore, backup ids will be found using List

        rake backup2s3:backup:restore id='20100913180541'

  -------------------------------------------------------------------

  MESSAGE
end