Class: Textus::Store::Geometry
- Inherits:
-
Object
- Object
- Textus::Store::Geometry
- Defined in:
- lib/textus/store/geometry.rb
Constant Summary collapse
- RUN =
".state"- DATA =
"data"- ASSETS =
"assets"
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#asset_path(kind, date_str, zone, filename) ⇒ Object
– asset paths –.
- #audit_dir_path ⇒ Object
- #audit_log_path ⇒ Object
- #cursor_path(role) ⇒ Object
-
#data_root ⇒ Object
– data paths –.
- #entry_path(mentry) ⇒ Object
-
#gitignore_body(untracked_entries: []) ⇒ Object
– gitignore –.
- #hooks_dir ⇒ Object
-
#initialize(root) ⇒ Geometry
constructor
A new instance of Geometry.
-
#lane_floor(path) ⇒ Object
– lane boundary (replaces Writer#zone_floor) –.
- #lane_path(lane_name) ⇒ Object
- #lock_path(name) ⇒ Object
-
#manifest_path ⇒ Object
– config paths –.
-
#run_root ⇒ Object
– runtime paths –.
- #schema_path(name) ⇒ Object
- #schemas_dir ⇒ Object
- #schemas_glob ⇒ Object
- #sentinels_root ⇒ Object
- #store_db_path ⇒ Object
- #template_path(name) ⇒ Object
- #workflow_dir ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
13 14 15 |
# File 'lib/textus/store/geometry.rb', line 13 def root @root end |
Instance Method Details
#asset_path(kind, date_str, zone, filename) ⇒ Object
– asset paths –
39 40 41 |
# File 'lib/textus/store/geometry.rb', line 39 def asset_path(kind, date_str, zone, filename) File.join(@root, ASSETS, kind, date_str, zone.to_s, filename) end |
#audit_dir_path ⇒ Object
33 |
# File 'lib/textus/store/geometry.rb', line 33 def audit_dir_path = File.join(run_root, "audit") |
#audit_log_path ⇒ Object
34 |
# File 'lib/textus/store/geometry.rb', line 34 def audit_log_path = File.join(audit_dir_path, "audit.log") |
#cursor_path(role) ⇒ Object
31 |
# File 'lib/textus/store/geometry.rb', line 31 def cursor_path(role) = File.join(run_root, "ephemeral", "cursors", role.to_s) |
#data_root ⇒ Object
– data paths –
16 |
# File 'lib/textus/store/geometry.rb', line 16 def data_root = File.join(@root, DATA) |
#entry_path(mentry) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/textus/store/geometry.rb', line 19 def entry_path(mentry) primary_ext = Format.for(mentry.format).extensions.first rel = normalize_relative_path(mentry.path) if File.extname(mentry.path) == "" File.join(@root, rel + primary_ext) else File.join(@root, rel) end end |
#gitignore_body(untracked_entries: []) ⇒ Object
– gitignore –
53 54 55 56 57 58 59 60 61 |
# File 'lib/textus/store/geometry.rb', line 53 def gitignore_body(untracked_entries: []) lines = ["# textus runtime artifacts — safe to delete, never commit", "#{RUN}/"] unless untracked_entries.empty? lines << "# tracked:false entries — protocol-readable, not committed" lines.concat(untracked_entries) end "#{lines.join("\n")}\n" end |
#hooks_dir ⇒ Object
49 |
# File 'lib/textus/store/geometry.rb', line 49 def hooks_dir = File.join(@root, "hooks") |
#lane_floor(path) ⇒ Object
– lane boundary (replaces Writer#zone_floor) –
64 65 66 67 68 69 70 |
# File 'lib/textus/store/geometry.rb', line 64 def lane_floor(path) prefix = "#{data_root}/" return nil unless path.start_with?(prefix) seg = path.delete_prefix(prefix).split("/").first seg && File.join(data_root, seg) end |
#lane_path(lane_name) ⇒ Object
17 |
# File 'lib/textus/store/geometry.rb', line 17 def lane_path(lane_name) = File.join(data_root, lane_name.to_s) |
#lock_path(name) ⇒ Object
32 |
# File 'lib/textus/store/geometry.rb', line 32 def lock_path(name) = File.join(run_root, "ephemeral", "locks", "#{name}.lock") |
#manifest_path ⇒ Object
– config paths –
44 |
# File 'lib/textus/store/geometry.rb', line 44 def manifest_path = File.join(@root, "manifest.yaml") |
#run_root ⇒ Object
– runtime paths –
30 |
# File 'lib/textus/store/geometry.rb', line 30 def run_root = File.join(@root, RUN) |
#schema_path(name) ⇒ Object
46 |
# File 'lib/textus/store/geometry.rb', line 46 def schema_path(name) = File.join(schemas_dir, "#{name}.yaml") |
#schemas_dir ⇒ Object
45 |
# File 'lib/textus/store/geometry.rb', line 45 def schemas_dir = File.join(@root, "schemas") |
#schemas_glob ⇒ Object
50 |
# File 'lib/textus/store/geometry.rb', line 50 def schemas_glob = File.join(schemas_dir, "**", "*") |
#sentinels_root ⇒ Object
35 |
# File 'lib/textus/store/geometry.rb', line 35 def sentinels_root = File.join(run_root, "tracking", "sentinels") |
#store_db_path ⇒ Object
36 |
# File 'lib/textus/store/geometry.rb', line 36 def store_db_path = File.join(run_root, "store.db") |
#template_path(name) ⇒ Object
47 |
# File 'lib/textus/store/geometry.rb', line 47 def template_path(name) = File.join(@root, "templates", name) |
#workflow_dir ⇒ Object
48 |
# File 'lib/textus/store/geometry.rb', line 48 def workflow_dir = File.join(@root, "workflows") |