Class: Soka::Generators::AgentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/soka/agent/agent_generator.rb

Overview

Generator for creating new Soka agent classes with their associated tests

Instance Method Summary collapse

Instance Method Details

#create_agent_fileObject



13
14
15
16
17
18
19
# File 'lib/generators/soka/agent/agent_generator.rb', line 13

def create_agent_file
  @agent_class_name = agent_class_name
  @tools_list = tools

  template 'agent.rb.tt',
           File.join('app/soka/agents', class_path, "#{agent_file_name}.rb")
end

#create_test_fileObject



21
22
23
24
25
26
27
28
# File 'lib/generators/soka/agent/agent_generator.rb', line 21

def create_test_file
  return unless rspec_installed?

  @agent_class_name = agent_class_name

  template 'agent_spec.rb.tt',
           File.join('spec/soka/agents', class_path, "#{agent_file_name}_spec.rb")
end