Class: Protege::SystemToolkits
- Inherits:
-
Object
- Object
- Protege::SystemToolkits
- Defined in:
- app/services/protege/system_toolkits.rb
Overview
Maintains the engine's system toolkits — the two toolkit records the framework guarantees exist,
identified by a stable key (see Toolkit):
- All Tools (+all_tools+) — always holds every registered tool. Its membership is engine-owned: each sync rewrites it to the live tool manifest, so a tool added in code shows up automatically and an operator's edits don't stick.
- Default Tools (+default_tools+) — auto-attached to every new agent (see
Toolable). The engine only seeds it on first creation — with every engine built-in tool, so a fresh agent starts with the full generic baseline (reply, search, web, files) — and thereafter its membership is the operator's to curate, so later syncs leave it alone.
Sync is idempotent and safe to run repeatedly. It runs like any other seed data — not at boot (writing
to the DB from an initializer is an anti-pattern): the protege:toolkits:sync rake task on deploy and
the host's db/seeds.rb in development. Both eager-load the app first so the tool manifest is complete
(rake tasks don't eager-load by default), which is what makes All Tools capture every registered tool.
Class Method Summary collapse
-
.sync! ⇒ void
Ensure both system toolkits exist and refresh All Tools' membership.
Instance Method Summary collapse
-
#sync! ⇒ void
Ensure both system toolkits exist and refresh All Tools' membership.
Class Method Details
.sync! ⇒ void
This method returns an undefined value.
Ensure both system toolkits exist and refresh All Tools' membership.
24 25 26 |
# File 'app/services/protege/system_toolkits.rb', line 24 def sync! new.sync! end |
Instance Method Details
#sync! ⇒ void
This method returns an undefined value.
Ensure both system toolkits exist and refresh All Tools' membership.
32 33 34 35 |
# File 'app/services/protege/system_toolkits.rb', line 32 def sync! sync_all_tools ensure_default_tools end |