Class: Raif::CLI::Evals
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Raif::CLI::Base
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 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 |
# File 'lib/raif/cli/evals.rb', line 9 def run # Set test environment by default for evals ENV["RAILS_ENV"] ||= "test" ENV["RAIF_RUNNING_EVALS"] = "true" OptionParser.new do |opts| opts. = "Usage: raif evals [options] [FILE_PATHS]" opts.on("-e", "--environment ENV", "Rails environment (default: test)") do |env| ENV["RAILS_ENV"] = env end opts.on("-h", "--help", "Show this help message") do puts opts exit end end.parse!(args) # Parse file paths with optional line numbers file_paths = args.map do |arg| if arg.include?(":") file_path, line_number = arg.split(":", 2) { file_path: file_path, line_number: line_number.to_i } else { file_path: arg, line_number: nil } end end if args.any? # Find and load Rails application load_rails_application require "raif/evals" run = Raif::Evals::Run.new(file_paths: file_paths) run.execute end |