Class: Migflow::Services::ReportGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/migflow/services/report_generator.rb

Instance Method Summary collapse

Instance Method Details

#call(migrations_path:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/migflow/services/report_generator.rb', line 11

def call(migrations_path:)
  migrations = Parsers::MigrationParser.call(migrations_path: migrations_path)
  scorer = RiskScorer.new

  analyzed = migrations.map { |m| analyze(m, migrations, scorer) }

  {
    generated_at: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
    summary: build_summary(analyzed),
    migrations: analyzed
  }
end