ro 1.4.6 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. checksums.yaml +6 -14
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +64 -0
  4. data/LICENSE +1 -0
  5. data/README.md +276 -105
  6. data/README.md.erb +159 -0
  7. data/Rakefile +129 -78
  8. data/bin/ro +241 -68
  9. data/lib/ro/_lib.rb +107 -0
  10. data/lib/ro/asset.rb +55 -0
  11. data/lib/ro/collection/list.rb +23 -0
  12. data/lib/ro/collection.rb +211 -0
  13. data/lib/ro/config.rb +72 -0
  14. data/lib/ro/error.rb +11 -0
  15. data/lib/ro/html.rb +23 -0
  16. data/lib/ro/html_safe.rb +143 -0
  17. data/lib/ro/klass.rb +25 -0
  18. data/lib/ro/methods.rb +295 -0
  19. data/lib/ro/model.rb +83 -114
  20. data/lib/ro/node.rb +209 -349
  21. data/lib/ro/pagination.rb +7 -4
  22. data/lib/ro/path.rb +229 -0
  23. data/lib/ro/root.rb +52 -31
  24. data/lib/ro/script/builder.rb +221 -0
  25. data/lib/ro/script/console.rb +47 -0
  26. data/lib/ro/script/server.rb +76 -0
  27. data/lib/ro/script.rb +189 -0
  28. data/lib/ro/slug.rb +19 -18
  29. data/lib/ro/template/rouge_formatter.rb +42 -0
  30. data/lib/ro/template.rb +145 -51
  31. data/lib/ro/text.rb +120 -0
  32. data/lib/ro.rb +89 -317
  33. data/public/api/ro/index-1.json +1065 -0
  34. data/public/api/ro/index.json +1055 -0
  35. data/public/api/ro/nerd/fastest-possible-embeddings/index.json +90 -0
  36. data/public/api/ro/nerd/ima/index.json +49 -0
  37. data/public/api/ro/nerd/index/index.json +74 -0
  38. data/public/api/ro/nerd/index-1.json +204 -0
  39. data/public/api/ro/nerd/index.json +194 -0
  40. data/public/api/ro/pages/about/index.json +60 -0
  41. data/public/api/ro/pages/contact/index.json +50 -0
  42. data/public/api/ro/pages/cv/index.json +49 -0
  43. data/public/api/ro/pages/disco/index.json +117 -0
  44. data/public/api/ro/pages/index/index.json +30 -0
  45. data/public/api/ro/pages/index-1.json +366 -0
  46. data/public/api/ro/pages/index.json +356 -0
  47. data/public/api/ro/pages/jess/index.json +62 -0
  48. data/public/api/ro/pages/now/index.json +43 -0
  49. data/public/api/ro/posts/almost-died-in-an-ice-cave/index.json +265 -0
  50. data/public/api/ro/posts/facebook-and-global-extremism/index.json +90 -0
  51. data/public/api/ro/posts/index-1.json +527 -0
  52. data/public/api/ro/posts/index.json +517 -0
  53. data/public/api/ro/posts/lemmings-considered-harmful/index.json +49 -0
  54. data/public/api/ro/posts/lost-in-the-desert/index.json +49 -0
  55. data/public/api/ro/posts/mission/index.json +49 -0
  56. data/public/api/ro/posts/return-your-laptop/index.json +61 -0
  57. data/public/ro/nerd/fastest-possible-embeddings/assets/giraffe.jpeg +0 -0
  58. data/public/ro/nerd/fastest-possible-embeddings/assets/let-me-in.jpg +0 -0
  59. data/public/ro/nerd/fastest-possible-embeddings/assets/src/fastembed.js +70 -0
  60. data/public/ro/nerd/fastest-possible-embeddings/assets/src/fastembed.rs +68 -0
  61. data/public/ro/nerd/fastest-possible-embeddings/assets/terminal.jpg +0 -0
  62. data/public/ro/nerd/fastest-possible-embeddings/attributes.yml +7 -0
  63. data/public/ro/nerd/fastest-possible-embeddings/body.md +266 -0
  64. data/public/ro/nerd/ima/assets/og.jpeg +0 -0
  65. data/public/ro/nerd/ima/attributes.yml +8 -0
  66. data/public/ro/nerd/ima/body.md +22 -0
  67. data/public/ro/nerd/index/assets/giraffe.jpeg +0 -0
  68. data/public/ro/nerd/index/assets/let-me-in.jpg +0 -0
  69. data/public/ro/nerd/index/assets/terminal.jpg +0 -0
  70. data/public/ro/nerd/index/attributes.yml +7 -0
  71. data/public/ro/nerd/index/body.md +130 -0
  72. data/public/ro/pages/about/assets/og.jpeg +0 -0
  73. data/public/ro/pages/about/assets/speak-english-pulp-fiction.gif +0 -0
  74. data/public/ro/pages/about/body.md +40 -0
  75. data/public/ro/pages/contact/assets/giraffe.jpeg +0 -0
  76. data/public/ro/pages/contact/attributes.yml +7 -0
  77. data/public/ro/pages/contact/body.md +9 -0
  78. data/public/ro/pages/cv/assets/ara.jpg +0 -0
  79. data/public/ro/pages/cv/attributes.yml +6 -0
  80. data/public/ro/pages/cv/body.md +122 -0
  81. data/public/ro/pages/disco/assets/disco.jpg +0 -0
  82. data/public/ro/pages/disco/assets/disco.png +0 -0
  83. data/public/ro/pages/disco/assets/speak-english-pulp-fiction.gif +0 -0
  84. data/public/ro/pages/disco/assets/src/environment.md +2354 -0
  85. data/public/ro/pages/disco/assets/src/fortune-500.md +2518 -0
  86. data/public/ro/pages/disco/assets/src/greed.md +2703 -0
  87. data/public/ro/pages/disco/assets/src/up-at-night.md +2337 -0
  88. data/public/ro/pages/disco/attributes.yml +9 -0
  89. data/public/ro/pages/disco/body.md +99 -0
  90. data/public/ro/pages/disco/samples/environment.md +2354 -0
  91. data/public/ro/pages/disco/samples/fortune-500.md +2518 -0
  92. data/public/ro/pages/disco/samples/greed.md +2703 -0
  93. data/public/ro/pages/disco/samples/up-at-night.md +2337 -0
  94. data/public/ro/pages/index/attributes.yml +1 -0
  95. data/public/ro/pages/index/body.md +15 -0
  96. data/public/ro/pages/jess/assets/og.jpg +0 -0
  97. data/public/ro/pages/jess/assets/speak-english-pulp-fiction.gif +0 -0
  98. data/public/ro/pages/jess/attributes.yml +7 -0
  99. data/public/ro/pages/jess/body.md +3 -0
  100. data/public/ro/pages/now/assets/speak-english-pulp-fiction.gif +0 -0
  101. data/public/ro/pages/now/attributes.yml +1 -0
  102. data/public/ro/pages/now/body.md +24 -0
  103. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image1.png +0 -0
  104. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image10.png +0 -0
  105. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image11.png +0 -0
  106. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image12.png +0 -0
  107. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image13.png +0 -0
  108. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image14.png +0 -0
  109. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image15.png +0 -0
  110. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image2.png +0 -0
  111. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image3.png +0 -0
  112. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image4.png +0 -0
  113. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image5.png +0 -0
  114. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image6.png +0 -0
  115. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image7.png +0 -0
  116. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image8.png +0 -0
  117. data/public/ro/posts/almost-died-in-an-ice-cave/assets/image9.png +0 -0
  118. data/public/ro/posts/almost-died-in-an-ice-cave/assets/josh-pointing.jpg +0 -0
  119. data/public/ro/posts/almost-died-in-an-ice-cave/assets/levi-rawr.png +0 -0
  120. data/public/ro/posts/almost-died-in-an-ice-cave/assets/og.jpg +0 -0
  121. data/public/ro/posts/almost-died-in-an-ice-cave/assets/purple-heart.jpg +0 -0
  122. data/public/ro/posts/almost-died-in-an-ice-cave/attributes.yml +6 -0
  123. data/public/ro/posts/almost-died-in-an-ice-cave/body.md +419 -0
  124. data/public/ro/posts/facebook-and-global-extremism/assets/background.html +125 -0
  125. data/public/ro/posts/facebook-and-global-extremism/assets/background.md +95 -0
  126. data/public/ro/posts/facebook-and-global-extremism/assets/og.jpg +0 -0
  127. data/public/ro/posts/facebook-and-global-extremism/assets/prompt.txt +122 -0
  128. data/public/ro/posts/facebook-and-global-extremism/assets/results.md +183 -0
  129. data/public/ro/posts/facebook-and-global-extremism/assets/survey.txt +190 -0
  130. data/public/ro/posts/facebook-and-global-extremism/attributes.yml +7 -0
  131. data/public/ro/posts/facebook-and-global-extremism/body.md +393 -0
  132. data/public/ro/posts/lemmings-considered-harmful/assets/lemming.jpeg +0 -0
  133. data/public/ro/posts/lemmings-considered-harmful/attributes.yml +6 -0
  134. data/public/ro/posts/lemmings-considered-harmful/body.md +43 -0
  135. data/public/ro/posts/lost-in-the-desert/assets/og.jpg +0 -0
  136. data/public/ro/posts/lost-in-the-desert/attributes.yml +6 -0
  137. data/public/ro/posts/lost-in-the-desert/body.md +7 -0
  138. data/public/ro/posts/mission/assets/og.jpg +0 -0
  139. data/public/ro/posts/mission/attributes.yml +6 -0
  140. data/public/ro/posts/mission/body.md +4 -0
  141. data/public/ro/posts/return-your-laptop/assets/og.jpg +0 -0
  142. data/public/ro/posts/return-your-laptop/assets/return-your-laptop.png +0 -0
  143. data/public/ro/posts/return-your-laptop/attributes.yml +6 -0
  144. data/public/ro/posts/return-your-laptop/body.md +58 -0
  145. data/ro.gemspec +217 -28
  146. data/scripts/speedtest.rb +324 -0
  147. data/tmp/gem-details.oe +0 -0
  148. metadata +214 -74
  149. data/TODO.md +0 -50
  150. data/lib/ro/blankslate.rb +0 -7
  151. data/lib/ro/cache.rb +0 -26
  152. data/lib/ro/git.rb +0 -374
  153. data/lib/ro/initializers/env.rb +0 -5
  154. data/lib/ro/initializers/tilt.rb +0 -104
  155. data/lib/ro/lock.rb +0 -53
  156. data/lib/ro/node/list.rb +0 -142
  157. data/notes/ara.txt +0 -215
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NGU2NmU2NTUwNTgxZmM3OTUwYzYzNmFiZWQ3NzMyYzc3YmE0ODM2OQ==
5
- data.tar.gz: !binary |-
6
- YWM3ZjJhOWRmMWZiZWRlZmFmZWMzNTM1NzRlNzNkZTFkZmMxMzFmZA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NmQ3Y2U2NTk3NWJhM2MyY2E0MmE2NWRkZWMwOGUwMGI3ZjMwZjgyNjI1ZjZk
10
- NjI1NTJmZWExMzQ5YmY4M2ExZDUwZTE2OTI5NWY3YjM4ODkxNDk1YTc3ZDYw
11
- NTZmODg5MjRlYTQzN2MxZGY1NGQxNDk3N2ZlODA5OWNiMGIxMjQ=
12
- data.tar.gz: !binary |-
13
- ODU5MWMwODIyNTM0NzdhMmFlMjczNjUyNWZjMTdmYzFkMmEwYmMwMWY0ZWUw
14
- NTQ5NTE3ZTU0NzUyZTcyM2QyNTFhOTUzYWNlMjhkMzE4Y2JhZjJlMWYwMDM5
15
- MGY4NDQxNzQ4NzcwMWIwZDA2MWE3NDFhYzgzOTIyNmJhNTBlMjM=
2
+ SHA256:
3
+ metadata.gz: 9b56a7cf51b2b6e2140b3be71875fe284e77a59d0e7fa108fd45d39369aba51b
4
+ data.tar.gz: 02da6783adba57026d22c2e95841ad3b3acc4979c538bd86896b7f293037178b
5
+ SHA512:
6
+ metadata.gz: b704d4f58a18df10308884c353dc05293d294d46ddfb46b8241e5047691500dcf5471f5dac5522a8126e59885c61b49fd03deba036e54db6f2191145706f0450
7
+ data.tar.gz: 3bcf32a9c1096c33c898b582f4d038625771c44203ce49792017d07b097285327ce6e90f0c3136bfdda1e185c0d826a50eefbf377dfd2e6e9fc126b8bfed80bf
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ro (4.2.1)
5
+ ak47 (~> 0.2)
6
+ image_size (~> 3.0)
7
+ kramdown (~> 2.4, >= 2.4.0)
8
+ kramdown-parser-gfm (~> 1.1, >= 1.1.0)
9
+ map (~> 6.6, >= 6.6.0)
10
+ rouge (~> 4.1, >= 4.1.1)
11
+ webrick (~> 1.8.1)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ ak47 (0.2.5)
17
+ guard (~> 0.10.0)
18
+ shell_tools (~> 0.1.0)
19
+ smart_colored
20
+ ffi (1.17.0)
21
+ ffi (1.17.0-aarch64-linux-gnu)
22
+ ffi (1.17.0-aarch64-linux-musl)
23
+ ffi (1.17.0-arm-linux-gnu)
24
+ ffi (1.17.0-arm-linux-musl)
25
+ ffi (1.17.0-arm64-darwin)
26
+ ffi (1.17.0-x86-linux-gnu)
27
+ ffi (1.17.0-x86-linux-musl)
28
+ ffi (1.17.0-x86_64-darwin)
29
+ ffi (1.17.0-x86_64-linux-gnu)
30
+ ffi (1.17.0-x86_64-linux-musl)
31
+ guard (0.10.0)
32
+ ffi (>= 0.5.0)
33
+ thor (~> 0.14.6)
34
+ image_size (3.4.0)
35
+ kramdown (2.4.0)
36
+ rexml
37
+ kramdown-parser-gfm (1.1.0)
38
+ kramdown (~> 2.0)
39
+ map (6.6.0)
40
+ rexml (3.3.9)
41
+ rouge (4.4.0)
42
+ shell_tools (0.1.2)
43
+ smart_colored (1.1.1)
44
+ thor (0.14.6)
45
+ webrick (1.8.2)
46
+
47
+ PLATFORMS
48
+ aarch64-linux-gnu
49
+ aarch64-linux-musl
50
+ arm-linux-gnu
51
+ arm-linux-musl
52
+ arm64-darwin
53
+ ruby
54
+ x86-linux-gnu
55
+ x86-linux-musl
56
+ x86_64-darwin
57
+ x86_64-linux-gnu
58
+ x86_64-linux-musl
59
+
60
+ DEPENDENCIES
61
+ ro!
62
+
63
+ BUNDLED WITH
64
+ 2.5.22
data/LICENSE ADDED
@@ -0,0 +1 @@
1
+ Nonstandard
data/README.md CHANGED
@@ -1,170 +1,341 @@
1
- NAME
2
- ----
1
+ TL;DR:
2
+ ------
3
+
4
+ `ro` stands for `read only`, and it is the tiniest, best, headless cms.
5
+
6
+ it lets you keep all your content in github, as god intended.
7
+
8
+ it is one part cms, one part database, one part api, and one part magic.
9
+
10
+ if you used a headless cms, it's like that, before they existed, except way better, and free.
11
+
12
+ with `ro`, you can seperate your content from presentation, like a sane and decent human being.
13
+
14
+ > silent code whispers
15
+ > github's gentle, peaceful hush
16
+ > simplicity reigns
17
+
18
+ README
19
+ ------
20
+
21
+ `ro` is has been in professional, production use for over a decade, powering
22
+ many, many websites built by http://dojo4.com, and others.
23
+
24
+ from static sites, to rails monoliths, to simple ruby sites, to javascript
25
+ sites built on next.js, `ro` is the portable, simple, future-proof content
26
+ system you always dreamed about then started to write but found out the web is
27
+ a mess.
28
+
29
+ with `ro`, your shit will be *clean*.
3
30
 
4
- ro
31
+ ---
32
+
33
+ to grok `ro` it is best to start with an example of some real content,
34
+ for a real site.
5
35
 
6
36
 
7
- TL;DR
8
- -----
37
+ ```sh
9
38
 
10
- <pre>
39
+ drawohara@drawohara.dev:ro[main] #=> tree public/ro/posts/almost-died-in-an-ice-cave/
40
+ public/ro/posts/almost-died-in-an-ice-cave/
41
+ ├── assets
42
+ │ ├── image1.png
43
+ │ ├── image2.png
44
+ │ ├── image3.png
45
+ │ ├── og.jpg
46
+ │ └── purple-heart.jpg
47
+ ├── attributes.yml
48
+ └── body.md
49
+
50
+ ```
11
51
 
12
- ro
13
- ├── people
14
- │   ├── ara
15
- │   │   ├── assets
16
- │   │   │   ├── ara-glacier.jpg
17
- │   │   │   └── source
18
- │   │   │   └── a.rb
19
- │   │   ├── attributes.yml
20
- │   │   └── bio.md.erb
21
- │   └── noah
22
- │   └── attributes.yml
23
- └── posts
24
- ├── foobar
25
- ├── hello-world
26
- │   ├── attributes.yml
27
- │   └── body.md
28
- └── second-awesome-post
29
- ├── attributes.yml
30
- └── body.md
52
+ in this example you can see a few things, regarding the layout of a `ro` directory:
31
53
 
32
- </pre>
54
+ - `ro` content often, but is not required, to live in `public`. more on this below.
33
55
 
56
+ - the essential layout is
34
57
 
35
58
  ```ruby
36
59
 
37
- ro
38
- #=> all the content nodes
60
+ @root = "ro"
61
+ @collection = "posts"
62
+ @id = "almost-died-in-an-ice-cave"
39
63
 
40
- ro.posts
41
- #=> all the post nodes
64
+ "#{ @root }/#{ @collection }/#{ @id }"
42
65
 
43
- ro.people
44
- #=> all people nodes
66
+ ```
45
67
 
46
- ro[:people]
47
- #=> same thing
68
+ if you learn best by example, you can examine the `ro` directory of my own website here -> https://github.com/ahoward/drawohara.io/tree/main/public/ro
48
69
 
49
- ro.people.ara
50
- #=> data for the person named 'ara'
70
+ - several environment variables control how `ro` works, most notably
51
71
 
52
- ro[:people][:ara]
53
- #=> same thing
72
+ ```ruby
54
73
 
55
- ro['people']['ara']
56
- #=> same thing
74
+ # this is the fs root of all ro content
75
+ #
57
76
 
58
- ro.people.ara.first_name
59
- #=> give you *one* guess ;-) !
77
+ Ro.root = ENV['RO_ROOT'] || './public/ro'
60
78
 
61
- ro.people.ara.url_for('ara-glacier.jpg')
62
- #=> external timestamped url for this asset
79
+ # this is the url where ro content, especially images, will be expected to
80
+ # live at when live
63
81
 
64
- ro.people.ara.source('a.rb')
65
- #=> syntax highlighted source yo!
82
+ Ro.url = ENV['RO_URL'] || '/ro'
66
83
 
67
- ro.posts.find('second-awesome-post').body
68
- #=> html-z yo
84
+ ```
69
85
 
70
- ro.people.ara.related(:posts)
71
- #=> all related posts
86
+ more about this can be rtfm'd here -> https://github.com/ahoward/ro/blob/main/lib/ro.rb#L29-L55
72
87
 
73
- ro.people.ara.related(:featured_posts)
74
- #=> all featured posts
75
-
88
+ because not having a repl sucks, so `ro` has one. you should too.
89
+
90
+ ```sh
91
+
92
+ # fire up the KONSOULLLLL!
93
+
94
+ ~> ro console ./public/ro/
76
95
 
77
96
  ```
78
97
 
79
- TRY
80
- ---
98
+ ```ruby
81
99
 
82
- ```bash
100
+ ro.posts.almost_died_in_an_ice_cave.attributes.keys #=>
83
101
 
84
- ~ > git clone https://github.com/ahoward/ro.git
85
- ~ > cd ro
86
- ~> ./bin/ro console
102
+ ["og", "body", "assets", "_meta"]
87
103
 
104
+ ro.posts.almost_died_in_an_ice_cave.attributes.og #=>
88
105
 
89
- a:~/git/ahoward/ro $ ./bin/ro console
90
- Ro(./ro):001:0> ro.people
91
- => [people/ara, people/noah]
106
+ {"image"=>{"url"=>"/ro/posts/almost-died-in-an-ice-cave/assets/og.jpg"},
107
+ "title"=>"Almost Died In An Ice Cave",
108
+ "description"=>"On April of 2024, I, along with 6 of my friends, dug for our lives to come out on the other side."}
92
109
 
93
- Ro(./ro):002:0> ro.people.ara
94
- => people/ara
110
+ ro.posts.almost_died_in_an_ice_cave.attributes.body.slice(0,420) #=>
95
111
 
96
- Ro(./ro):003:0> ro.people.ara.first_name
97
- => "Ara"
112
+ "<div class=\"ro markdown\">\n <p><a href=\"#tl;dr;\">tl;dr;</a></p>\n\n<blockquote>\n <p>in april, 2024, myself, and 6 brave men attempted to cross the harding\nicefield.</p>\n\n <p>in celebration of <a href=\"https://en.wikipedia.org/wiki/Harding_Icefield#History\">yule kilcher’s 1968 crossing</a></p>\n\n <p>midway through our trip, at the point of no return, we were beseiged by a storm of storms.</p>\n\n <p>we dug shoulder to "
98
113
 
99
- Ro(./ro):004:0> ro.people.ara.bio
100
- => "<ul>\n<li>one</li>\n<li>two</li>\n<li>three</li>\n</ul>\n\n<p>pretty syntax highlighting</p>\n<div class=\"highlight\"><pre> <span class=\"vi\">@a</span> <span class=\"o\">=</span> <span class=\"mi\">42</span>\n</pre></div>\n<p>Ara</p>\n\n<p>/ro/people/ara/assets/ara-glacier.jpg?_=1382999368</p>\n"
114
+ ro.posts.almost_died_in_an_ice_cave.assets.first #=>
101
115
 
102
- Ro(./ro):005:0> ro.people.ara.url_for('ara-glacier')
103
- => "/ro/people/ara/assets/ara-glacier.jpg?_=1382999368"
116
+ "public/ro/posts/almost-died-in-an-ice-cave/assets/image1.png"
104
117
 
105
- Ro(./ro):006:0> ro.people.ara.related
106
- => [posts/hello-world, posts/second-awesome-post]
118
+ ro.posts.almost_died_in_an_ice_cave.assets.first.url #=>
107
119
 
108
- Ro(./ro):007:0> ro.people.ara.related.posts
109
- => [posts/hello-world, posts/second-awesome-post]
120
+ "/ro/posts/almost-died-in-an-ice-cave/assets/image1.png"
110
121
 
111
- Ro(./ro):008:0> ro.people.ara.related(:featured_posts)
112
- => [posts/second-awesome-post]
113
122
 
114
123
  ```
115
124
 
116
- DESCRIPTION
117
- -----------
125
+ __boom__ // **now we're cooking with gas!**
118
126
 
119
- ro is library for managing your site's content in git, as god intended.
127
+ serveral things will be obvious to the non-ai enabled observer:
120
128
 
121
- it features:
129
+ - every node has a hash of attributes
130
+ - 'file' attributes are *rendered* based on file type
131
+ - assets in rendered content are __url aware__
122
132
 
123
- - super fast loading via a robust caching/promise strategy
124
- - *all* teh templates supported via tilt (https://github.com/rtomayko/tilt)
125
- - the awesomest markdown ever, with syntax highlighting and even erb evaluation
126
- - an awesome command line tool for introspecting your data (./ro console)
127
- - data driven relationships
133
+ you can see the list of file types `ro` supports here -> https://github.com/ahoward/ro/blob/main/lib/ro/template.rb#L43-L63
128
134
 
135
+ if you can't build a website with just these...
129
136
 
130
- ro is the *perfect* companion to a site built by a static site generator such
131
- as middleman (http://middlemanapp.com/). especially a middleman site with a
132
- companion rails' application doing concurrent modifications of the site's
133
- content... (ref: http://dojo4.com/blog/static-is-the-new-black) ;-)
137
+ 🙊 [you've come to the wrong place!](https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExd2NpbmsxMHRxNnRsNjFzNWczN2JtejE5aXc0YXA3MHV3a3pwb3hodyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/vDlw1tKNwx40BGbWcQ/giphy.gif)
134
138
 
139
+ ---
140
+ now, about that rendering process...
135
141
 
136
- INSTALL
137
- -------
142
+ for any 'html-ish' type, links to relative assets, will be expanded such that
143
+ images will be resolved to thier final deployment destination.
138
144
 
139
- gem install ro
145
+ eg. given __ro/posts/foo-bar/body.md__ containing the markdown
140
146
 
147
+ ```markdown
141
148
 
142
- CONFIG
143
- ------
149
+ [linky](./assets/report.pdf)
150
+
151
+ ![alty](./assets/pretty.png)
152
+
153
+ ```
154
+
155
+ you will end up with html that looks like so:
156
+
157
+ ```html
158
+
159
+ <a href='/ro/posts/foo-bar/assets/report.pdf'>linky</a>
160
+
161
+ <img src='/ro/posts/foo-bar/assets/pretty.png'>alty</a>
162
+
163
+
164
+ ```
144
165
 
145
- if you are using the url methods you'll need to make sure your application can
146
- route to the assets. by default ro assumes that the urls it generates are
147
- routeable under '/ro' so it is up to you to make sure this works.
166
+ ---
167
+ __OH MAN THAT SUX I DO NOT WANT MY IMAGES STORED IN GH!!!!__
168
+
169
+ *sit down... breathe...*
170
+
171
+ and enable [git-lfs](https://git-lfs.com/)
172
+
173
+ it used to be fragile but, since everyone the in the world is now checking in massive jupyter notebooks it 'just works'
174
+
175
+ ---
176
+ now, recall what we said about `public` and `RO_URL`? by default, this is is `/ro`...
177
+
178
+ therefore, if we have:
148
179
 
149
- for a rails app this might mean writing a 'RoController' or, more simply, just
150
- putting your ro data in ./public/ro.
180
+ `./public/ro/posts/foobar/...'
151
181
 
152
- for a middleman app this might mean putting your ro data in ./source/ro.
182
+ paths found under `public` are going to start with `/ro`...
153
183
 
154
- if you choose a non-standard approach you'll need to
184
+ > are you tracking yet?
155
185
 
186
+ also, if you do not host your `ro` directory under public (but why not? it
187
+ *is* public content after all..), then you will need to set `RO_URL` to be the
188
+ ultimate destination of your image deployment. this can be cloudinary, s3,
189
+ whatever. it just needs to be the url prefix to whack in front of relative
190
+ image urls.
191
+
192
+ note - not only html has this 'expansion' applied, relative assets in your
193
+ attributes will be expanded too, at any depth. eg. -> https://github.com/ahoward/ro/blob/main/lib/ro/methods.rb#L233-L260
194
+
195
+ this means code like this:
196
+
197
+ ```yaml
198
+ # file: public/ro/posts/foo-bar/attributes.yml
199
+
200
+ og:
201
+ image: ./assets/og.jpg
156
202
  ```
157
203
 
158
- Ro.route = '/my-custom-route'
204
+ will 'just work'. of course, this assumes that 'public/ro/foo-bar/assets/og.jpg' exists!
205
+
206
+ the code is rather robust here, and is not a simple string bashing approach.
207
+
208
+ it's tight, and you can trust it.
159
209
 
210
+ ---
211
+ a bit about markdown...
212
+
213
+ markdown is. the web. also AI, but i digress... if you aren't writing in
214
+ markdown, you are probably writing `perl`... (nothing wrong with that btw!)
215
+
216
+ but markdown has a lot of edge cases, not least of which syntax highlighting
217
+ and bs css to deal with.
218
+
219
+ `ro`, again, 'just works' here.
220
+
221
+ - it uses github flavored markdown (gfm), extracts front-matter and folds it
222
+ into `attributes`, auto-links stuff (gfm does not), and inlines the css
223
+ styles for speed and so you don't have to eff with the css to render src
224
+ code all pretty. see https://github.com/ahoward/ro/blob/main/lib/ro/template.rb#L117-L143
225
+
226
+ - you can set the gfm theme via the `RO_MD_THEME` ENV var. this supports
227
+ anything [rouge](https://github.com/rouge-ruby/rouge) does.
228
+
229
+
230
+ ---
231
+ > __I HATE RUBY!!!! RAWR__
232
+
233
+ whatever. use javascript. `ro` is also a 'static cms api builder`.
234
+
235
+ *WUT*?
236
+
237
+ it can compile your entire content db into a static api of js, designed to be
238
+ ultra, ultra, ultra easy to consume. no stupid graphql thing, no bullsxxx
239
+ api_key, no vendor lock-in to prismic, dato, contentful, or some other
240
+ extorsionist regime., just a lil `fetch` and you are __GTG BRO!__
241
+
242
+ you don't even have to render the stuff, it's pre-rendered html in the api ready to `dangerouslySetInnerHTM`!
243
+
244
+ __(alsoCamelCaseMakeAPIHARDToReadWithEMPHASIS)__
245
+
246
+ you can see an example here -> https://github.com/ahoward/ro/tree/main/public/api/ro
247
+
248
+ i won't explain more now except to say that all you need to do to make a js
249
+ bundle is
250
+
251
+ ```sh
252
+
253
+ ~> ro build
160
254
 
161
255
  ```
162
256
 
163
- in all cases ro urls will be prefixed by the route, so be sure that this prefix
164
- is either automatically, or manually, exposed.
257
+ and then look carefully, it makes it easy to 'grab everything stupid style' or
258
+ to paginate client side. each collection has a `index.js` with everything, a
259
+ `index-$pageno.js` with details about the next page, iff any, and of course, it
260
+ produces an `index.json` file, complete with those gnarly *width* and *height*
261
+ numbers you need to *fight FUOC* and layout shift.
262
+
263
+ if you don't know what that means, probably use [wordpress](https://drawohara.io/dojo4/archive/irish-dance-and-wordpress-the-soul-destroyer/)
264
+
265
+ lil detail about that link^, it is from *10 years ago*, when dojo4 was still running, and running on `ro`.
266
+
267
+ ---
268
+
269
+ one super comman pattern, is to add a build step to a github workflow, and
270
+ then publish the js api via gh-pages. see an example here:
271
+
272
+ https://github.com/ahoward/ro/blob/main/.github/workflows/gh-pages.yml
273
+
274
+ __WUT!?!?!___
275
+
276
+ - your content is in github
277
+ - you want to consume it in js
278
+ - add a build step to build the js api and deploy it via gh-pages
279
+ - consume that 'static cms api' via fetch
165
280
 
281
+ *free*, image ready, headless CMS. yep.
282
+
283
+ ... 🤯🤯🤯
284
+
285
+ ---
286
+
287
+ finally, and, truly, this is possibly the *coup de grâce*, you can just
288
+ friggin use github as your CMS now! why? because the markdown previw on
289
+ gh... just works. 🤤
290
+
291
+ eg. https://github.com/ahoward/ro/blob/main/public/ro/posts/almost-died-in-an-ice-cave/body.md
292
+
293
+ ADVANCED
294
+ ---------
295
+
296
+ - include the public directory in your gh-pages, pull that shit through
297
+ cloudinary/imgix/etc as the img src... responsive images, with client side
298
+ processing. zero work.
299
+
300
+ - use ro in your rails app/models with the `active_model` adapter.
301
+ https://github.com/ahoward/ro/blob/main/lib/ro/model.rb , it supports
302
+ pagination and all the things. rails ready.
303
+
304
+ - explore built-in support for syntax highlighted source code. just put a
305
+ file in ./assets/src/a.rb and it 'just works'
306
+
307
+ - explore the api in the repl, you'll find POLS stuff like
308
+
309
+ ```ruby
310
+
311
+ ro.get('posts').get('almost-died-in-an-ice-cave')
312
+
313
+ ro.get('posts/almost-died-in-an-ice-cave')
314
+
315
+ ro.get('posts').get('almost-died-in-an-ice-cave').assets.first.img
316
+
317
+ #=> {:format=>"png", :width=>1456, :height=>817}
318
+
319
+ ```
166
320
 
167
321
  DOCS
168
322
  ----
323
+ 1) vibe it AI
324
+ 2) RTFC
325
+
326
+ BORING SHIT
327
+ -----------
328
+
329
+ ```sh
330
+
331
+ ~> gem install ro
332
+
333
+ ```
334
+
335
+ LICENSE
336
+ -------
337
+ https://github.com/LGUG2Z/komorebi-license
169
338
 
170
- RTFC
339
+ AI
340
+ --
341
+ suck it 🤖s!