Class: Docit::Ai::AutodocRunner
- Inherits:
-
Object
- Object
- Docit::Ai::AutodocRunner
- Defined in:
- lib/docit/ai/autodoc_runner.rb
Constant Summary collapse
- MAX_INVALID_OUTPUT_RETRIES =
2
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(controller_filter: nil, dry_run: false, input: $stdin, output: $stdout) ⇒ AutodocRunner
constructor
A new instance of AutodocRunner.
- #run ⇒ Object
Constructor Details
#initialize(controller_filter: nil, dry_run: false, input: $stdin, output: $stdout) ⇒ AutodocRunner
Returns a new instance of AutodocRunner.
10 11 12 13 14 15 16 |
# File 'lib/docit/ai/autodoc_runner.rb', line 10 def initialize(controller_filter: nil, dry_run: false, input: $stdin, output: $stdout) @controller_filter = controller_filter @dry_run = dry_run @input = input @output = output @results = { gaps: [], generated: 0, files: [], tags: [] } end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
8 9 10 |
# File 'lib/docit/ai/autodoc_runner.rb', line 8 def results @results end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/docit/ai/autodoc_runner.rb', line 18 def run check_base_setup! config = load_config @output.puts "Using #{config.provider}" @output.puts "" gaps = detect_gaps @results[:gaps] = gaps if gaps.empty? @output.puts "All endpoints are documented!" return @results end print_gaps(gaps) if @dry_run @output.puts "[dry-run] No files written." return @results end confirm_source_upload!(config) generated = generate_docs(gaps, config) write_docs(generated) (generated) @output.puts "Review generated files and edit as needed." @results end |