activeagent 0.4.2.rc1 → 0.4.2.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active_agent/version.rb +1 -1
- data/lib/generators/USAGE +25 -0
- data/lib/generators/active_agent/USAGE +17 -5
- data/lib/generators/active_agent/install_generator.rb +17 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac9862cc06ad052e647933e771cb13ee76b4dbf43f5cdd61b871e017d685477
|
4
|
+
data.tar.gz: cf42d4608113a3ca73432fdd404c319f97ddde53919440c54a0247c1002b3f00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23f7ccf62009efc9a46f0fb3e200866850519178bec86a36edb00e0d7252023bb1bbeb88da3087d2eaa565749ac0c3ae43e25e576615804fa7368617c6010c71
|
7
|
+
data.tar.gz: bda215bf93b1e86352871be452fec8bbb7c77d3638ffa608e44ca4694b87a5dd5f9cf08bd1d87687e6116e65347aa3253b50970b012b9b76522ae6c4e3070016
|
data/lib/active_agent/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
Description:
|
2
|
+
Sets up ActiveAgent in your Rails application by creating the necessary
|
3
|
+
configuration files and application agent class.
|
4
|
+
|
5
|
+
This generator creates:
|
6
|
+
- Configuration file (config/active_agent.yml)
|
7
|
+
- Application agent base class (app/agents/application_agent.rb)
|
8
|
+
- Layout templates for agent views (via template engine hooks)
|
9
|
+
|
10
|
+
Examples:
|
11
|
+
`bin/rails generate active_agent:install`
|
12
|
+
|
13
|
+
creates the basic ActiveAgent setup:
|
14
|
+
Config: config/active_agent.yml
|
15
|
+
Base Agent: app/agents/application_agent.rb
|
16
|
+
Layouts: app/views/layouts/agent.html.erb
|
17
|
+
app/views/layouts/agent.text.erb
|
18
|
+
app/views/layouts/agent.json.erb
|
19
|
+
|
20
|
+
`bin/rails generate active_agent:install --template-engine=haml`
|
21
|
+
|
22
|
+
creates ActiveAgent setup with Haml layouts instead of ERB.
|
23
|
+
|
24
|
+
After running this generator, you can create individual agents with:
|
25
|
+
`bin/rails generate active_agent:agent AGENT_NAME ACTION_NAME`
|
@@ -1,18 +1,30 @@
|
|
1
1
|
Description:
|
2
2
|
Generates a new agent and its views. Passes the agent name, either
|
3
|
-
CamelCased or under_scored, and an optional list of
|
3
|
+
CamelCased or under_scored, and an optional list of actions as arguments.
|
4
4
|
|
5
|
-
This generates
|
6
|
-
engine and test framework generators.
|
5
|
+
This generates an agent class in app/agents and invokes your template
|
6
|
+
engine and test framework generators. If no ApplicationAgent exists,
|
7
|
+
it will be created automatically.
|
8
|
+
|
9
|
+
Views are created for each action in three formats:
|
10
|
+
- HTML (.html.erb) - for rich text responses
|
11
|
+
- Text (.text.erb) - for plain text responses
|
12
|
+
- JSON (.json.erb) - for structured function calling responses
|
7
13
|
|
8
14
|
Examples:
|
9
15
|
`bin/rails generate active_agent:agent inventory search`
|
10
16
|
|
11
17
|
creates an inventory agent class, views, and test:
|
12
|
-
Agent:
|
13
|
-
Views: app/views/inventory_agent/search.
|
18
|
+
Agent: app/agents/inventory_agent.rb
|
19
|
+
Views: app/views/inventory_agent/search.html.erb
|
20
|
+
app/views/inventory_agent/search.text.erb
|
21
|
+
app/views/inventory_agent/search.json.erb
|
14
22
|
Test: test/agents/inventory_agent_test.rb
|
15
23
|
|
16
24
|
`bin/rails generate active_agent:agent inventory search update report`
|
17
25
|
|
18
26
|
creates an inventory agent with search, update, and report actions.
|
27
|
+
|
28
|
+
`bin/rails generate active_agent:agent admin/user create --template-engine=haml`
|
29
|
+
|
30
|
+
creates a namespaced admin/user agent with Haml templates.
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module ActiveAgent
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
def self.usage_path
|
7
|
+
@usage_path ||= File.expand_path("../USAGE", __dir__)
|
8
|
+
end
|
6
9
|
source_root File.expand_path("templates", __dir__)
|
7
10
|
|
8
11
|
hook_for :template_engine, :test_framework
|
@@ -10,6 +13,20 @@ module ActiveAgent
|
|
10
13
|
def create_configuration
|
11
14
|
template "active_agent.yml", "config/active_agent.yml"
|
12
15
|
end
|
16
|
+
|
17
|
+
def create_application_agent
|
18
|
+
in_root do
|
19
|
+
if !File.exist?(application_agent_file_name)
|
20
|
+
template "application_agent.rb", application_agent_file_name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def application_agent_file_name
|
28
|
+
"app/agents/application_agent.rb"
|
29
|
+
end
|
13
30
|
end
|
14
31
|
end
|
15
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.2.
|
4
|
+
version: 0.4.2.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Bowen
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/active_agent/test_case.rb
|
185
185
|
- lib/active_agent/version.rb
|
186
186
|
- lib/activeagent.rb
|
187
|
+
- lib/generators/USAGE
|
187
188
|
- lib/generators/active_agent/USAGE
|
188
189
|
- lib/generators/active_agent/agent_generator.rb
|
189
190
|
- lib/generators/active_agent/install_generator.rb
|