Class: Themigrator::MigrationProgress

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/themigrator/migration_progress.rb

Overview

MigrationProgress takes the main log fails and parse it.

Constant Summary

Constants included from Logger

Logger::MAINLOGFILE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#close_logger, #init_logger, #log, #log_dir, #log_path, #logger, #main_log_path

Constructor Details

#initialize(dir, run_id) ⇒ MigrationProgress

:has_roles :start_action :start_role_action :end_action :end_role_action :start_migration :end_migration



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/themigrator/migration_progress.rb', line 24

def initialize(dir, run_id)
  @dir = dir
  @run_id = run_id
  @log_file_path = main_log_path(dir, run_id)
  @roles = []
  @current_action = nil
  @cbks = {}
  @actions = Hash.new do |h, k|
    h[k] = {
      start_time: nil,
      roles: Hash.new { |rh, rk| rh[rk] = {} },
      end_time: nil
    }
  end
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def actions
  @actions
end

#cbks=(value) ⇒ Object (writeonly)

Sets the attribute cbks

Parameters:

  • value

    the value to set the attribute cbks to.



11
12
13
# File 'lib/themigrator/migration_progress.rb', line 11

def cbks=(value)
  @cbks = value
end

#current_actionObject (readonly)

Returns the value of attribute current_action.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def current_action
  @current_action
end

#pidObject (readonly)

Returns the value of attribute pid.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def pid
  @pid
end

#rolesObject (readonly)

Returns the value of attribute roles.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def roles
  @roles
end

#run_idObject (readonly)

Returns the value of attribute run_id.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def run_id
  @run_id
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def start_time
  @start_time
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/themigrator/migration_progress.rb', line 9

def status
  @status
end

Instance Method Details

#log_file(role, action) ⇒ Object



40
41
42
# File 'lib/themigrator/migration_progress.rb', line 40

def log_file(role, action)
  log_path(@dir, @run_id, role, action)
end

#startObject



44
45
46
# File 'lib/themigrator/migration_progress.rb', line 44

def start
  start_log_parser
end