Class: Textus::Protocol::Layout
- Inherits:
-
Object
- Object
- Textus::Protocol::Layout
- Defined in:
- lib/textus/protocol/layout.rb
Constant Summary collapse
- DATA =
"data"- ASSETS =
"assets"
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #archive_path(source_path) ⇒ Object
- #asset_raw_dir(date_path, zone) ⇒ Object
- #asset_resolve(rel_path) ⇒ Object
- #asset_sentinel_path ⇒ Object
- #cursor_path(role) ⇒ Object
- #data_root ⇒ Object
- #db_path ⇒ Object
- #db_root ⇒ Object
- #entry_path(mentry) ⇒ Object
- #gitignore_body(untracked_entries: []) ⇒ Object
- #hooks_dir ⇒ Object
-
#initialize(root) ⇒ Layout
constructor
A new instance of Layout.
- #lane_floor(path) ⇒ Object
- #lane_path(lane_name) ⇒ Object
- #lock_path(name) ⇒ Object
- #log_root ⇒ Object
- #manifest_path ⇒ Object
- #run_root ⇒ Object
- #schema_path(name) ⇒ Object
- #schemas_dir ⇒ Object
- #schemas_glob ⇒ Object
- #sentinels_root ⇒ Object
- #template_path(name) ⇒ Object
- #track_root ⇒ Object
- #workflow_dir ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
12 13 14 |
# File 'lib/textus/protocol/layout.rb', line 12 def root @root end |
Instance Method Details
#archive_path(source_path) ⇒ Object
48 49 50 51 |
# File 'lib/textus/protocol/layout.rb', line 48 def archive_path(source_path) rel = source_path.delete_prefix("#{@root}/") File.join(@root, "archive", rel) end |
#asset_raw_dir(date_path, zone) ⇒ Object
36 37 38 |
# File 'lib/textus/protocol/layout.rb', line 36 def asset_raw_dir(date_path, zone) File.join(@root, ASSETS, "raw", date_path, zone.to_s) end |
#asset_resolve(rel_path) ⇒ Object
44 45 46 |
# File 'lib/textus/protocol/layout.rb', line 44 def asset_resolve(rel_path) File.join(@root, ASSETS, rel_path) end |
#asset_sentinel_path ⇒ Object
40 41 42 |
# File 'lib/textus/protocol/layout.rb', line 40 def asset_sentinel_path File.join(@root, ASSETS, ".gitignore") end |
#cursor_path(role) ⇒ Object
34 |
# File 'lib/textus/protocol/layout.rb', line 34 def cursor_path(role) = File.join(track_root, "cursors", role.to_s) |
#data_root ⇒ Object
14 |
# File 'lib/textus/protocol/layout.rb', line 14 def data_root = File.join(@root, DATA) |
#db_path ⇒ Object
28 |
# File 'lib/textus/protocol/layout.rb', line 28 def db_path = File.join(db_root, "store.db") |
#db_root ⇒ Object
27 |
# File 'lib/textus/protocol/layout.rb', line 27 def db_root = File.join(@root, "db") |
#entry_path(mentry) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/textus/protocol/layout.rb', line 17 def entry_path(mentry) primary_ext = Textus::Protocol::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
61 62 63 64 65 66 67 68 |
# File 'lib/textus/protocol/layout.rb', line 61 def gitignore_body(untracked_entries: []) lines = ["# textus runtime artifacts — safe to delete, never commit", *runtime_ignore_dirs] 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
58 |
# File 'lib/textus/protocol/layout.rb', line 58 def hooks_dir = File.join(@root, "hooks") |
#lane_floor(path) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/textus/protocol/layout.rb', line 70 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
15 |
# File 'lib/textus/protocol/layout.rb', line 15 def lane_path(lane_name) = File.join(data_root, lane_name.to_s) |
#lock_path(name) ⇒ Object
31 |
# File 'lib/textus/protocol/layout.rb', line 31 def lock_path(name) = File.join(run_root, "locks", "#{name}.lock") |
#log_root ⇒ Object
29 |
# File 'lib/textus/protocol/layout.rb', line 29 def log_root = File.join(@root, "log") |
#manifest_path ⇒ Object
53 |
# File 'lib/textus/protocol/layout.rb', line 53 def manifest_path = File.join(@root, "manifest.yaml") |
#run_root ⇒ Object
30 |
# File 'lib/textus/protocol/layout.rb', line 30 def run_root = File.join(@root, "run") |
#schema_path(name) ⇒ Object
55 |
# File 'lib/textus/protocol/layout.rb', line 55 def schema_path(name) = File.join(schemas_dir, "#{name}.yaml") |
#schemas_dir ⇒ Object
54 |
# File 'lib/textus/protocol/layout.rb', line 54 def schemas_dir = File.join(@root, "schemas") |
#schemas_glob ⇒ Object
59 |
# File 'lib/textus/protocol/layout.rb', line 59 def schemas_glob = File.join(schemas_dir, "**", "*") |
#sentinels_root ⇒ Object
33 |
# File 'lib/textus/protocol/layout.rb', line 33 def sentinels_root = File.join(track_root, "sentinels") |
#template_path(name) ⇒ Object
56 |
# File 'lib/textus/protocol/layout.rb', line 56 def template_path(name) = File.join(@root, "templates", name) |
#track_root ⇒ Object
32 |
# File 'lib/textus/protocol/layout.rb', line 32 def track_root = File.join(@root, "track") |
#workflow_dir ⇒ Object
57 |
# File 'lib/textus/protocol/layout.rb', line 57 def workflow_dir = File.join(@root, "workflows") |