Class: RedmineInstaller::Install

Inherits:
Task show all
Defined in:
lib/redmine-installer/install.rb

Direct Known Subclasses

Upgrade

Constant Summary

Constants included from Utils

Utils::PROGRESSBAR_FORMAT

Instance Attribute Summary collapse

Attributes inherited from Task

#options

Instance Method Summary collapse

Methods inherited from Task

#run

Methods included from Utils

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

Constructor Details

#initialize(package, redmine_root, **options) ⇒ Install

Returns a new instance of Install.



6
7
8
9
10
11
12
13
14
# File 'lib/redmine-installer/install.rb', line 6

def initialize(package, redmine_root, **options)
  super(**options)

  @environment = Environment.new(self)
  @package = Package.new(self, package)
  @target_redmine = Redmine.new(self, redmine_root)
  @temp_redmine = Redmine.new(self)
  @package_config = PackageConfig.new(@temp_redmine)
end

Instance Attribute Details

#package_configObject (readonly)

Returns the value of attribute package_config.



4
5
6
# File 'lib/redmine-installer/install.rb', line 4

def package_config
  @package_config
end

Instance Method Details

#downObject



43
44
45
46
47
48
49
# File 'lib/redmine-installer/install.rb', line 43

def down
  @temp_redmine.clean_up
  @package.clean_up

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

#upObject



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
# File 'lib/redmine-installer/install.rb', line 16

def up
  @temp_redmine.valid_options
  @environment.check
  @target_redmine.ensure_and_valid_root

  @package.ensure_and_valid_package
  @package.extract

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

  @temp_redmine.create_database_yml
  @temp_redmine.create_configuration_yml
  @temp_redmine.install

  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: 'install') }

  puts
  puts pastel.bold('Redmine was installed')
  logger.info('Redmine was installed')
end