Class: RedmineInstaller::Task

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/redmine-installer/task.rb

Direct Known Subclasses

Backup, Install, RestoreDB

Constant Summary

Constants included from Utils

Utils::PROGRESSBAR_FORMAT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

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

Constructor Details

#initialize(**options) ⇒ Task

Returns a new instance of Task.



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

def initialize(**options)
  @options = OpenStruct.new(options)

  logger.info "#{class_name} initialized with #{options}"
  logger.info "RUBY_VERSION: #{RUBY_VERSION}"
  logger.info "VERSION: #{RedmineInstaller::VERSION}"
  logger.info "USER: #{env_user}"
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/redmine-installer/task.rb', line 5

def options
  @options
end

Instance Method Details

#downObject



33
34
# File 'lib/redmine-installer/task.rb', line 33

def down
end

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/redmine-installer/task.rb', line 16

def run
  up
rescue => e
  @error = e

  logger.error(e.message)
  logger.error(*e.backtrace)

  puts pastel.red(e.message)

  down
end

#upObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/redmine-installer/task.rb', line 29

def up
  raise NotImplementedError
end