Class: MinceMigrator::StatusReport

Inherits:
Object
  • Object
show all
Includes:
CommandLineReporter
Defined in:
lib/mince_migrator/status_report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(migration) ⇒ StatusReport

Returns a new instance of StatusReport.



9
10
11
# File 'lib/mince_migrator/status_report.rb', line 9

def initialize(migration)
  @migration = migration
end

Instance Attribute Details

#migrationObject (readonly)

Returns the value of attribute migration.



7
8
9
# File 'lib/mince_migrator/status_report.rb', line 7

def migration
  @migration
end

Instance Method Details

#runObject



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
# File 'lib/mince_migrator/status_report.rb', line 13

def run
  vertical_spacing 2
  header title: "Migration Details for #{migration.name}", bold: true, rule: true, align: 'center', width: 70, timestamp: true

  table border: false do
    row do
      column 'Name', width: 15
      column migration.name, width: 100
    end
    row do
      column 'Status'
      if migration.status == 'not ran'
        column migration.status, color: 'red'
      else
        column migration.status, color: 'green'
      end
    end
    row do
      column 'Age'
      column migration.age
    end
    row do
      column 'Date Created'
      column migration.time_created.strftime("%m/%d/%Y")
    end
  end
end