Class: RedmineInstaller::Upgrade

Inherits:
Install show all
Defined in:
lib/redmine-installer/upgrade.rb

Constant Summary

Constants included from Utils

RedmineInstaller::Utils::PROGRESSBAR_FORMAT

Instance Attribute Summary

Attributes inherited from Install

#package_config

Attributes inherited from Task

#options

Instance Method Summary collapse

Methods inherited from Install

#initialize

Methods inherited from Task

#initialize, #run

Methods included from Utils

#class_name, #create_dir, #env_user, #error, #logger, #ok, #pastel, #print_title, #prompt, #run_command

Constructor Details

This class inherits a constructor from RedmineInstaller::Install

Instance Method Details

#downObject



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/redmine-installer/upgrade.rb', line 49

def down
  @temp_redmine.clean_up
  @package.clean_up

  if @target_redmine.database && @target_redmine.database.backuped?
    puts
    puts "Database have been backed up on #{pastel.bold(@target_redmine.database.backup)}"
  end

  puts
  puts "(Log is located on #{pastel.bold(logger.path)})"
end

#upObject



4
5
6
7
8
9
10
11
12
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
# File 'lib/redmine-installer/upgrade.rb', line 4

def up
  if options.profile
    @profile = Profile.get!(options.profile)
  end

  if @profile
    @target_redmine.load_profile(@profile)
  end

  @environment.check
  @target_redmine.ensure_and_valid_root
  @target_redmine.validate
  @target_redmine.check_running_state

  @package.ensure_and_valid_package
  @package.extract

  @temp_redmine.root = @package.redmine_root
  @package_config.check_version
  @temp_redmine.validate

  @target_redmine.make_backup

  @temp_redmine.copy_importants_from(@target_redmine)
  @temp_redmine.copy_missing_plugins_from(@target_redmine)

  @temp_redmine.upgrade

  print_title('Finishing installation')
  ok('Cleaning root'){ @target_redmine.delete_root }
  ok('Moving redmine to target directory'){ @target_redmine.move_from(@temp_redmine) }
  ok('Cleanning up'){ @package.clean_up }
  ok('Moving installer log'){ logger.move_to(@target_redmine, suffix: 'upgrade') }

  puts
  puts pastel.bold('Redmine was upgraded')
  logger.info('Redmine was upgraded')

  if @profile.nil? && prompt.yes?('Do you want save steps for further use?', default: false)
    profile = Profile.new
    @target_redmine.save_profile(profile)
    profile.save
  end
end