Class: Testgenai::CLI
- Inherits:
-
Thor
- Object
- Thor
- Testgenai::CLI
- Defined in:
- lib/testgenai/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
14 15 16 |
# File 'lib/testgenai/cli.rb', line 14 def self.exit_on_failure? true end |
Instance Method Details
#context ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/testgenai/cli.rb', line 35 def context config = build_config scanner = build_scanner(config) methods = scanner.scan ctx_builder = ContextBuilder.new methods.each do |method_info| ctx = ctx_builder.build(method_info) reporter.context_result(method_info, ctx) end end |
#generate ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/testgenai/cli.rb', line 49 def generate config = build_config scanner = build_scanner(config) methods = scanner.scan if methods.empty? reporter.scan_results(methods) exit 0 end conventions = [:conventions] ? ConventionsSynthesizer.new(config).synthesize : nil generator = config.generator_class.new(config) validator = config.validator_class.new single_pipeline = Pipeline.new(generator, validator) ctx_builder = ContextBuilder.new batch = BatchPipeline.new(config, ctx_builder, single_pipeline, reporter, conventions: conventions) results = batch.run(methods) reporter.summary(results) exit(results[:successful].empty? ? 1 : 0) rescue ConfigurationError => e warn "Error: #{e.}" exit 2 end |
#scan ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/testgenai/cli.rb', line 26 def scan config = build_config scanner = build_scanner(config) warn "Scanning source files..." methods = scanner.scan reporter.scan_results(methods, files_scanned: scanner.files_scanned) end |