Class: Redmine::Installer::Step::Backup

Inherits:
Base
  • Object
show all
Defined in:
lib/redmine-installer/steps/backup.rb

Constant Summary collapse

DEFAULT_BACKUP_DIR =
File.join(Dir.home, 'redmine-backups')

Instance Attribute Summary

Attributes inherited from Base

#base, #index, #ran

Instance Method Summary collapse

Methods inherited from Base

#initialize, #print_footer, #print_header, #print_title, #redmine_plugins

Methods included from Utils

included

Constructor Details

This class inherits a constructor from Redmine::Installer::Step::Base

Instance Method Details

#downObject



28
29
30
31
32
33
# File 'lib/redmine-installer/steps/backup.rb', line 28

def down
  if @database_backed_up
    say(:restoring_database)
    database_restore
  end
end

#final_stepObject



35
36
37
38
39
# File 'lib/redmine-installer/steps/backup.rb', line 35

def final_step
  if @current_backup_dir
    say t(:backup_is_stored_at, dir: @current_backup_dir), 2
  end
end

#load(configuration) ⇒ Object



46
47
48
49
# File 'lib/redmine-installer/steps/backup.rb', line 46

def load(configuration)
  @backup_type = configuration['backup_type']
  @backup_dir = configuration['backup_dir']
end

#save(configuration) ⇒ Object



41
42
43
44
# File 'lib/redmine-installer/steps/backup.rb', line 41

def save(configuration)
  configuration['backup_type'] = @backup_type
  configuration['backup_dir'] = @backup_dir
end

#upObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/redmine-installer/steps/backup.rb', line 9

def up
  choices = {}
  choices[:full_backup] = t(:full_backup)
  choices[:backup] = t(:backup)
  choices[:only_database] = t(:only_database)
  choices[:skip] = t(:skip)

  @backup_type ||= choose(:do_you_want_backup_redmine, choices, default: :backup)

  case @backup_type
  when :full_backup
    do_full_backup
  when :backup
    do_backup
  when :only_database
    database_backup
  end
end