Class: Textus::Store
- Inherits:
-
Object
- Object
- Textus::Store
- Defined in:
- lib/textus/store.rb
Instance Attribute Summary collapse
-
#audit_log ⇒ Object
readonly
Returns the value of attribute audit_log.
-
#bus ⇒ Object
readonly
Returns the value of attribute bus.
-
#file_store ⇒ Object
readonly
Returns the value of attribute file_store.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#schemas ⇒ Object
readonly
Returns the value of attribute schemas.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(root) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(root) ⇒ Store
Returns a new instance of Store.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/textus/store.rb', line 31 def initialize(root) @root = File.(root) @manifest = Manifest.load(@root) @schemas = Schemas.new(File.join(@root, "schemas")) @file_store = Infra::Storage::FileStore.new @audit_log = Infra::AuditLog.new(@root) @bus = Hooks::Bus.new Infra::AuditSubscriber.new(@audit_log).attach(@bus) Hooks::Builtin.register_all(@bus) Hooks::Loader.new(bus: @bus).load_dir(File.join(@root, "hooks")) ops = Operations.for(self, role: Role::DEFAULT) @bus.publish(:store_loaded, ctx: ops.hook_context) end |
Instance Attribute Details
#audit_log ⇒ Object (readonly)
Returns the value of attribute audit_log.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def audit_log @audit_log end |
#bus ⇒ Object (readonly)
Returns the value of attribute bus.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def bus @bus end |
#file_store ⇒ Object (readonly)
Returns the value of attribute file_store.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def file_store @file_store end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def manifest @manifest end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def root @root end |
#schemas ⇒ Object (readonly)
Returns the value of attribute schemas.
5 6 7 |
# File 'lib/textus/store.rb', line 5 def schemas @schemas end |
Class Method Details
.discover(start_dir = Dir.pwd, root: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/textus/store.rb', line 7 def self.discover(start_dir = Dir.pwd, root: nil) explicit = root || ENV.fetch("TEXTUS_ROOT", nil) return discover_explicit(explicit) if explicit dir = File.(start_dir) loop do candidate = File.join(dir, ".textus") return new(candidate) if File.directory?(candidate) && File.exist?(File.join(candidate, "manifest.yaml")) parent = File.dirname(dir) break if parent == dir dir = parent end raise IoError.new("no .textus directory found from #{start_dir}") end |