Class: Llm::Functions::ExecRspecTest
- Defined in:
- lib/llm/functions/exec_rspec_test.rb
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#definition ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/llm/functions/exec_rspec_test.rb', line 8 def definition return @definition unless @definition.nil? @definition = { name: self.function_name, description: I18n.t("ghostest.functions.#{self.function_name}.description"), parameters: { type: :object, properties: { file_or_dir_path: { type: :string, description: I18n.t("ghostest.functions.#{self.function_name}.parameters.file_or_dir_path"), }, }, required: [:file_or_dir_path], }, } @definition end |
#execute_and_generate_message(args) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/llm/functions/exec_rspec_test.rb', line 28 def (args) if args[:file_or_dir_path].nil? || args[:file_or_dir_path].empty? raise Ghostest::Error.new("Please specify the file or directory path.") end script = "bundle exec rspec '#{args['file_or_dir_path']}'" stdout, stderr, status = Open3.capture3(script) { stdout:, stderr:, exit_status: status.exitstatus } end |
#function_name ⇒ Object
4 5 6 |
# File 'lib/llm/functions/exec_rspec_test.rb', line 4 def function_name :exec_rspec_test end |