Class: ActiveAgent::Generators::AgentGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ActiveAgent::Generators::AgentGenerator
- Defined in:
- lib/generators/active_agent/agent_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_agent_file ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/active_agent/agent_generator.rb', line 12 def create_agent_file template "agent.rb", File.join("app/agents", class_path, "#{file_name}_agent.rb") in_root do if behavior == :invoke && !File.exist?(application_agent_file_name) template "application_agent.rb", application_agent_file_name end end end |
#create_test_file ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/generators/active_agent/agent_generator.rb', line 22 def create_test_file if test_framework == :rspec template "agent_spec.rb", File.join("spec/agents", class_path, "#{file_name}_agent_spec.rb") else template "agent_test.rb", File.join("test/agents", class_path, "#{file_name}_agent_test.rb") end end |
#create_view_files ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/generators/active_agent/agent_generator.rb', line 30 def create_view_files actions.each do |action| @action = action @schema_path = File.join("app/views", class_path, file_name, "#{action}.json.jbuilder") @view_path = File.join("app/views", class_path, file_name, "#{action}.html.#{template_engine}") template "action.json.jbuilder", @schema_path template "action.html.#{template_engine}", @view_path end end |