20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/textus/init.rb', line 20
def self.run(target_root)
raise UsageError.new(".textus/ already exists at #{target_root}") if File.directory?(target_root)
FileUtils.mkdir_p(File.join(target_root, "schemas"))
FileUtils.mkdir_p(File.join(target_root, "templates"))
FileUtils.mkdir_p(File.join(target_root, "extensions"))
ZONES.each do |z|
dir = File.join(target_root, "zones", z)
FileUtils.mkdir_p(dir)
File.write(File.join(dir, ".gitkeep"), "")
end
File.write(File.join(target_root, "extensions", "README.md"), <<~MD)
# Extensions
Drop one Ruby file per extension. Four verbs are available:
```ruby
Textus.action(:name) { |config:, store:, args:| ... }
Textus.reducer(:name) { |rows:, config:| ... }
Textus.hook(:event, :name) { |key:, envelope:, **kw| ... }
Textus.doctor_check(:name) { |store:| ... }
```
Events: :put, :delete, :refresh, :build, :accept.
See SPEC.md ยง5.11 for the full contract.
MD
File.write(File.join(target_root, "manifest.yaml"), DEFAULT_MANIFEST)
{ "protocol" => PROTOCOL, "initialized" => target_root }
end
|