Sha256: d037bfc24f3872b147770bd33e0f78e3191fbf338bf7c994d5b712fa345f1bc0
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module AIRefactor module Refactors class Custom < BaseRefactor def run logger.verbose "Custom refactor to #{input_file}... (using user supplied prompt #{prompt_file_path})" logger.verbose "Write output to #{output_file_path}..." if output_file_path begin output_content = process!(strip_ticks: false) rescue => e logger.error "Failed to process #{input_file}: #{e.message}" return false end return false unless output_content output_file_path ? true : output_content end def self.description "Generic refactor using user supplied prompt" end private def prompt_file_path specified_prompt_path = options[:prompt_file_path] if specified_prompt_path&.length&.positive? if File.exist?(specified_prompt_path) return specified_prompt_path else logger.error "No prompt file '#{specified_prompt_path}' found" end else logger.error "No prompt file was specified!" end exit 1 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ai_refactor-0.5.2 | lib/ai_refactor/refactors/custom.rb |
ai_refactor-0.5.1 | lib/ai_refactor/refactors/custom.rb |
ai_refactor-0.5.0 | lib/ai_refactor/refactors/custom.rb |