Class: GreatAxe::PluginCommands

Inherits:
Thor
  • Object
show all
Includes:
AiSupport
Defined in:
lib/great_axe.rb

Instance Method Summary collapse

Instance Method Details

#cucumber(prompt) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/great_axe.rb', line 44

def cucumber(prompt)
  feature_path = "features/#{options[:path]}.feature" if options[:path]
  feature_prompt = "create cucumber feature file in ruby for #{prompt}"
  make(feature_prompt, feature_path)
  prompt_step = "create ruby cucumber step definitions in ruby for #{prompt}"
  step_path = "features/step_definitions/#{options[:path]}_steps.rb" if options[:path]
  make(prompt_step, step_path)
end

#list_modelsObject



80
81
82
# File 'lib/great_axe.rb', line 80

def list_models
  pp OpenAiHelper.list_models
end

#make(request, path = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/great_axe.rb', line 23

def make(request, path = nil)
  path ||= options[:path]
  edit_path = options[:edit]
  if edit_path
    pp 'Editing File...'
    OpenAiHelper.edit_file(path: edit_path, request: request)
    pp "File #{edit_path} edited"
  elsif path
    pp 'Generating File...'
    OpenAiHelper.create_file(path: path, request: request)
    pp "File created in #{path}"
  else
    puts OpenAiHelper.output(request: request)
  end
end

#model(model) ⇒ Object



66
67
68
69
# File 'lib/great_axe.rb', line 66

def model(model)
  OpenAiHelper.update_setting('model', model)
  pp "Model set to #{model}"
end

#model_info(model) ⇒ Object



86
87
88
# File 'lib/great_axe.rb', line 86

def model_info(model)
  pp OpenAiHelper.model_info(model)
end

#setupObject



13
14
15
# File 'lib/great_axe.rb', line 13

def setup
  SettingsGenerator.start
end

#steps(prompt) ⇒ Object



58
59
60
61
62
# File 'lib/great_axe.rb', line 58

def steps(prompt)
  prompt_step = "create ruby cucumber step definitions in ruby for #{prompt}"
  file_path = File.expand_path(options[:path]) if options[:path]
  make(prompt_step, file_path)
end

#temperature(temp) ⇒ Object



73
74
75
76
# File 'lib/great_axe.rb', line 73

def temperature(temp)
  OpenAiHelper.update_setting('temperature', temp)
  pp "Temperature set to #{temp}"
end