Class: RubyLens::Generator
- Inherits:
-
Object
- Object
- RubyLens::Generator
- Defined in:
- lib/rubylens/generator.rb
Constant Summary collapse
- DEFAULT_REPORT_NAME =
"rubylens-report.html"
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path: Dir.pwd, output: nil, lockfile: nil) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(path: Dir.pwd, output: nil, lockfile: nil) ⇒ Generator
Returns a new instance of Generator.
32 33 34 35 36 |
# File 'lib/rubylens/generator.rb', line 32 def initialize(path: Dir.pwd, output: nil, lockfile: nil) @path = path @output = output @lockfile = lockfile end |
Instance Method Details
#call ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubylens/generator.rb', line 38 def call root = File.realpath(@path) output = @output || DefaultOutput.resolve(root: root, name: DEFAULT_REPORT_NAME, description: "report") do |existing| ArtifactMarker.present?(existing, ReportWriter::MARKER) end model, warnings = GenerationPipeline.new(root:, lockfile: @lockfile).call output_path = ReportWriter.new.write(model, output: output) RubyLens::Result.new(output_path: output_path, counts: model.fetch("totals").freeze, warnings:) rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP => error raise Error, error. end |