Class: Protege::SystemToolkits

Inherits:
Object
  • Object
show all
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 (with send_email, so a fresh agent can at least reply) on first creation; 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

Instance Method Summary collapse

Class Method Details

.sync!void

This method returns an undefined value.

Ensure both system toolkits exist and refresh All Tools' membership.



23
24
25
# File 'app/services/protege/system_toolkits.rb', line 23

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.



31
32
33
34
# File 'app/services/protege/system_toolkits.rb', line 31

def sync!
  sync_all_tools
  ensure_default_tools
end