utopia 2.14.0 → 2.16.2

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 (261) hide show
  1. checksums.yaml +4 -4
  2. data/bake/utopia/{yarn.rb → node.rb} +11 -5
  3. data/lib/utopia/command.rb +2 -2
  4. data/lib/utopia/command/site.rb +1 -1
  5. data/lib/utopia/content.rb +7 -5
  6. data/lib/utopia/content/markup.rb +1 -1
  7. data/lib/utopia/content/node.rb +2 -2
  8. data/lib/utopia/content/response.rb +3 -3
  9. data/lib/utopia/controller.rb +0 -17
  10. data/lib/utopia/controller/base.rb +27 -3
  11. data/lib/utopia/controller/respond.rb +50 -107
  12. data/lib/utopia/extensions/array_split.rb +2 -2
  13. data/lib/utopia/http.rb +3 -3
  14. data/lib/utopia/middleware.rb +2 -2
  15. data/lib/utopia/path.rb +13 -5
  16. data/lib/utopia/redirection.rb +0 -2
  17. data/lib/utopia/responder.rb +76 -0
  18. data/lib/utopia/version.rb +1 -1
  19. data/setup/site/.gitignore +8 -7
  20. metadata +71 -396
  21. data/.codeclimate.yml +0 -5
  22. data/.github/workflows/development.yml +0 -62
  23. data/.gitignore +0 -8
  24. data/.rspec +0 -4
  25. data/.yardopts +0 -2
  26. data/Gemfile +0 -28
  27. data/README.md +0 -90
  28. data/benchmark/call_vs_check.rb +0 -38
  29. data/benchmark/const_vs_hash.rb +0 -35
  30. data/benchmark/hash_vs_openstruct.rb +0 -54
  31. data/benchmark/string_vs_symbol.rb +0 -14
  32. data/benchmark/struct_vs_class.rb +0 -91
  33. data/docs/.nojekyll +0 -0
  34. data/docs/_components/jquery-litebox/jquery.litebox.css +0 -23
  35. data/docs/_components/jquery-litebox/jquery.litebox.gallery.css +0 -48
  36. data/docs/_components/jquery-litebox/jquery.litebox.js +0 -30
  37. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +0 -12
  38. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +0 -5
  39. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +0 -8
  40. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +0 -6
  41. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +0 -4
  42. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +0 -6
  43. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.css.css +0 -14
  44. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +0 -16
  45. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.html.css +0 -5
  46. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +0 -3
  47. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +0 -2
  48. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.python.css +0 -6
  49. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +0 -2
  50. data/docs/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +0 -18
  51. data/docs/_components/jquery-syntax/base/jquery.syntax.core.css +0 -58
  52. data/docs/_components/jquery-syntax/base/jquery.syntax.editor.css +0 -6
  53. data/docs/_components/jquery-syntax/base/theme.js +0 -1
  54. data/docs/_components/jquery-syntax/bright/jquery.syntax.core.css +0 -27
  55. data/docs/_components/jquery-syntax/bright/theme.js +0 -1
  56. data/docs/_components/jquery-syntax/jquery.syntax.brush.apache.js +0 -3
  57. data/docs/_components/jquery-syntax/jquery.syntax.brush.applescript.js +0 -5
  58. data/docs/_components/jquery-syntax/jquery.syntax.brush.assembly.js +0 -3
  59. data/docs/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +0 -4
  60. data/docs/_components/jquery-syntax/jquery.syntax.brush.bash.js +0 -2
  61. data/docs/_components/jquery-syntax/jquery.syntax.brush.basic.js +0 -5
  62. data/docs/_components/jquery-syntax/jquery.syntax.brush.clang.js +0 -5
  63. data/docs/_components/jquery-syntax/jquery.syntax.brush.csharp.js +0 -4
  64. data/docs/_components/jquery-syntax/jquery.syntax.brush.css.js +0 -5
  65. data/docs/_components/jquery-syntax/jquery.syntax.brush.diff.js +0 -2
  66. data/docs/_components/jquery-syntax/jquery.syntax.brush.go.js +0 -3
  67. data/docs/_components/jquery-syntax/jquery.syntax.brush.haskell.js +0 -3
  68. data/docs/_components/jquery-syntax/jquery.syntax.brush.html.js +0 -4
  69. data/docs/_components/jquery-syntax/jquery.syntax.brush.io.js +0 -3
  70. data/docs/_components/jquery-syntax/jquery.syntax.brush.java.js +0 -4
  71. data/docs/_components/jquery-syntax/jquery.syntax.brush.javascript.js +0 -3
  72. data/docs/_components/jquery-syntax/jquery.syntax.brush.kai.js +0 -2
  73. data/docs/_components/jquery-syntax/jquery.syntax.brush.lisp.js +0 -2
  74. data/docs/_components/jquery-syntax/jquery.syntax.brush.lua.js +0 -3
  75. data/docs/_components/jquery-syntax/jquery.syntax.brush.nginx.js +0 -2
  76. data/docs/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +0 -4
  77. data/docs/_components/jquery-syntax/jquery.syntax.brush.ooc.js +0 -4
  78. data/docs/_components/jquery-syntax/jquery.syntax.brush.pascal.js +0 -4
  79. data/docs/_components/jquery-syntax/jquery.syntax.brush.perl5.js +0 -3
  80. data/docs/_components/jquery-syntax/jquery.syntax.brush.php-script.js +0 -4
  81. data/docs/_components/jquery-syntax/jquery.syntax.brush.php.js +0 -2
  82. data/docs/_components/jquery-syntax/jquery.syntax.brush.plain.js +0 -2
  83. data/docs/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +0 -3
  84. data/docs/_components/jquery-syntax/jquery.syntax.brush.python.js +0 -5
  85. data/docs/_components/jquery-syntax/jquery.syntax.brush.ruby.js +0 -5
  86. data/docs/_components/jquery-syntax/jquery.syntax.brush.scala.js +0 -4
  87. data/docs/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +0 -2
  88. data/docs/_components/jquery-syntax/jquery.syntax.brush.sql.js +0 -4
  89. data/docs/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +0 -3
  90. data/docs/_components/jquery-syntax/jquery.syntax.brush.swift.js +0 -3
  91. data/docs/_components/jquery-syntax/jquery.syntax.brush.trenni.js +0 -2
  92. data/docs/_components/jquery-syntax/jquery.syntax.brush.xml.js +0 -4
  93. data/docs/_components/jquery-syntax/jquery.syntax.brush.yaml.js +0 -2
  94. data/docs/_components/jquery-syntax/jquery.syntax.cache.js +0 -7
  95. data/docs/_components/jquery-syntax/jquery.syntax.core.js +0 -34
  96. data/docs/_components/jquery-syntax/jquery.syntax.editor.js +0 -11
  97. data/docs/_components/jquery-syntax/jquery.syntax.js +0 -8
  98. data/docs/_components/jquery-syntax/jquery.syntax.min.js +0 -13
  99. data/docs/_components/jquery-syntax/paper/jquery.syntax.core.css +0 -31
  100. data/docs/_components/jquery-syntax/paper/theme.js +0 -1
  101. data/docs/_components/jquery/jquery.js +0 -10872
  102. data/docs/_components/jquery/jquery.min.js +0 -2
  103. data/docs/_components/jquery/jquery.min.map +0 -1
  104. data/docs/_components/jquery/jquery.slim.js +0 -8777
  105. data/docs/_components/jquery/jquery.slim.min.js +0 -2
  106. data/docs/_components/jquery/jquery.slim.min.map +0 -1
  107. data/docs/_static/icon.png +0 -0
  108. data/docs/_static/site.css +0 -191
  109. data/docs/development-environment-setup/index.html +0 -54
  110. data/docs/faq/what-is-xnode/index.html +0 -73
  111. data/docs/index.html +0 -86
  112. data/docs/javascript/index.html +0 -108
  113. data/docs/middleware/content/index.html +0 -58
  114. data/docs/middleware/controller/actions/index.html +0 -111
  115. data/docs/middleware/controller/index.html +0 -98
  116. data/docs/middleware/controller/rewrite/index.html +0 -105
  117. data/docs/middleware/localization/index.html +0 -53
  118. data/docs/middleware/redirection/index.html +0 -55
  119. data/docs/middleware/session/index.html +0 -65
  120. data/docs/middleware/static/index.html +0 -51
  121. data/docs/server-setup/index.html +0 -87
  122. data/docs/testing/index.html +0 -53
  123. data/docs/updating-utopia/index.html +0 -102
  124. data/docs/your-first-page/index.html +0 -74
  125. data/materials/utopia.png +0 -0
  126. data/materials/utopia.svg +0 -1
  127. data/setup/site/.yarnrc +0 -1
  128. data/spec/mock_node.rb +0 -16
  129. data/spec/spec_helper.rb +0 -13
  130. data/spec/utopia/command_spec.rb +0 -164
  131. data/spec/utopia/content/document_spec.rb +0 -60
  132. data/spec/utopia/content/links/bar/index.xnode +0 -0
  133. data/spec/utopia/content/links/bar/parent/child/index.en.xnode +0 -0
  134. data/spec/utopia/content/links/bar/parent/child/index.ja.xnode +0 -0
  135. data/spec/utopia/content/links/bar/parent/links.yaml +0 -2
  136. data/spec/utopia/content/links/foo/index.xnode +0 -0
  137. data/spec/utopia/content/links/foo/links.yaml +0 -2
  138. data/spec/utopia/content/links/foo/test.de.xnode +0 -0
  139. data/spec/utopia/content/links/foo/test.en.xnode +0 -0
  140. data/spec/utopia/content/links/index.xnode +0 -0
  141. data/spec/utopia/content/links/links.yaml +0 -18
  142. data/spec/utopia/content/links/redirect/links.yaml +0 -2
  143. data/spec/utopia/content/links/welcome.xnode +0 -0
  144. data/spec/utopia/content/links_spec.rb +0 -218
  145. data/spec/utopia/content/localized/five/index.en.xnode +0 -0
  146. data/spec/utopia/content/localized/four/index.en.xnode +0 -0
  147. data/spec/utopia/content/localized/four/index.zh.xnode +0 -0
  148. data/spec/utopia/content/localized/four/links.yaml +0 -4
  149. data/spec/utopia/content/localized/links.yaml +0 -13
  150. data/spec/utopia/content/localized/one.xnode +0 -0
  151. data/spec/utopia/content/localized/three/index.xnode +0 -0
  152. data/spec/utopia/content/localized/two.en.xnode +0 -0
  153. data/spec/utopia/content/localized/two.zh.xnode +0 -0
  154. data/spec/utopia/content/markup_spec.rb +0 -96
  155. data/spec/utopia/content/namespace_spec.rb +0 -45
  156. data/spec/utopia/content/node/lookup/content.xnode +0 -1
  157. data/spec/utopia/content/node/lookup/index.xnode +0 -1
  158. data/spec/utopia/content/node/ordered/first.xnode +0 -0
  159. data/spec/utopia/content/node/ordered/index.xnode +0 -0
  160. data/spec/utopia/content/node/ordered/links.yaml +0 -4
  161. data/spec/utopia/content/node/ordered/second.xnode +0 -0
  162. data/spec/utopia/content/node/related/foo.en.xnode +0 -0
  163. data/spec/utopia/content/node/related/foo.ja.xnode +0 -0
  164. data/spec/utopia/content/node/related/links.yaml +0 -4
  165. data/spec/utopia/content/node_spec.rb +0 -97
  166. data/spec/utopia/content/response_spec.rb +0 -54
  167. data/spec/utopia/content/tags_spec.rb +0 -82
  168. data/spec/utopia/content_spec.rb +0 -100
  169. data/spec/utopia/content_spec.ru +0 -6
  170. data/spec/utopia/content_spec/_heading.xnode +0 -1
  171. data/spec/utopia/content_spec/content/_show-value.xnode +0 -1
  172. data/spec/utopia/content_spec/content/links.yaml +0 -2
  173. data/spec/utopia/content_spec/content/test-partial.xnode +0 -1
  174. data/spec/utopia/content_spec/index.xnode +0 -1
  175. data/spec/utopia/content_spec/node/index.xnode +0 -1
  176. data/spec/utopia/content_spec/test.xnode +0 -10
  177. data/spec/utopia/controller/actions_spec.rb +0 -62
  178. data/spec/utopia/controller/middleware_spec.rb +0 -88
  179. data/spec/utopia/controller/middleware_spec.ru +0 -6
  180. data/spec/utopia/controller/middleware_spec/controller/controller.rb +0 -27
  181. data/spec/utopia/controller/middleware_spec/controller/index.xnode +0 -1
  182. data/spec/utopia/controller/middleware_spec/controller/nested/controller.rb +0 -7
  183. data/spec/utopia/controller/middleware_spec/empty/controller.rb +0 -0
  184. data/spec/utopia/controller/middleware_spec/redirect/controller.rb +0 -12
  185. data/spec/utopia/controller/middleware_spec/redirect/test/controller.rb +0 -9
  186. data/spec/utopia/controller/respond_spec.rb +0 -174
  187. data/spec/utopia/controller/respond_spec.ru +0 -12
  188. data/spec/utopia/controller/respond_spec/api/controller.rb +0 -28
  189. data/spec/utopia/controller/respond_spec/errors/controller.rb +0 -14
  190. data/spec/utopia/controller/respond_spec/errors/file-not-found.xnode +0 -8
  191. data/spec/utopia/controller/respond_spec/html/controller.rb +0 -11
  192. data/spec/utopia/controller/respond_spec/rewrite/controller.rb +0 -13
  193. data/spec/utopia/controller/rewrite_spec.rb +0 -80
  194. data/spec/utopia/controller/sequence_spec.rb +0 -135
  195. data/spec/utopia/controller/variables_spec.rb +0 -59
  196. data/spec/utopia/controller/websocket_spec.rb +0 -68
  197. data/spec/utopia/controller/websocket_spec.ru +0 -5
  198. data/spec/utopia/controller/websocket_spec/server/controller.rb +0 -11
  199. data/spec/utopia/exceptions/handler_spec.rb +0 -47
  200. data/spec/utopia/exceptions/handler_spec.ru +0 -8
  201. data/spec/utopia/exceptions/handler_spec/controller.rb +0 -19
  202. data/spec/utopia/exceptions/mailer_spec.rb +0 -43
  203. data/spec/utopia/exceptions/mailer_spec.ru +0 -10
  204. data/spec/utopia/extensions_spec.rb +0 -73
  205. data/spec/utopia/http/status_spec.rb +0 -44
  206. data/spec/utopia/locale_spec.rb +0 -58
  207. data/spec/utopia/localization_spec.rb +0 -92
  208. data/spec/utopia/localization_spec.ru +0 -15
  209. data/spec/utopia/localization_spec/controller.rb +0 -21
  210. data/spec/utopia/localization_spec/localized.de.txt +0 -1
  211. data/spec/utopia/localization_spec/localized.en.txt +0 -1
  212. data/spec/utopia/localization_spec/localized.ja.txt +0 -1
  213. data/spec/utopia/localization_spec/test.txt +0 -1
  214. data/spec/utopia/middleware_spec.rb +0 -31
  215. data/spec/utopia/path/matcher_spec.rb +0 -66
  216. data/spec/utopia/path_spec.rb +0 -207
  217. data/spec/utopia/performance_spec.rb +0 -92
  218. data/spec/utopia/performance_spec/cache/head/readme.txt +0 -1
  219. data/spec/utopia/performance_spec/cache/meta/readme.txt +0 -1
  220. data/spec/utopia/performance_spec/config.ru +0 -35
  221. data/spec/utopia/performance_spec/lib/readme.txt +0 -1
  222. data/spec/utopia/performance_spec/pages/_heading.xnode +0 -2
  223. data/spec/utopia/performance_spec/pages/_page.xnode +0 -26
  224. data/spec/utopia/performance_spec/pages/api/controller.rb +0 -8
  225. data/spec/utopia/performance_spec/pages/errors/exception.xnode +0 -5
  226. data/spec/utopia/performance_spec/pages/errors/file-not-found.xnode +0 -5
  227. data/spec/utopia/performance_spec/pages/links.yaml +0 -2
  228. data/spec/utopia/performance_spec/pages/welcome/index.xnode +0 -17
  229. data/spec/utopia/rack_helper.rb +0 -32
  230. data/spec/utopia/redirection_spec.rb +0 -77
  231. data/spec/utopia/redirection_spec.ru +0 -27
  232. data/spec/utopia/session_spec.rb +0 -189
  233. data/spec/utopia/session_spec.ru +0 -24
  234. data/spec/utopia/setup_spec.rb +0 -56
  235. data/spec/utopia/static_spec.rb +0 -49
  236. data/spec/utopia/static_spec.ru +0 -5
  237. data/spec/utopia/static_spec/test.txt +0 -1
  238. data/utopia.gemspec +0 -52
  239. data/wiki/Gemfile +0 -9
  240. data/wiki/config.ru +0 -7
  241. data/wiki/pages/development-environment-setup/index.md +0 -16
  242. data/wiki/pages/faq/links.yaml +0 -2
  243. data/wiki/pages/faq/what-is-xnode/index.md +0 -37
  244. data/wiki/pages/faq/what-is-xnode/links.yaml +0 -2
  245. data/wiki/pages/index.md +0 -35
  246. data/wiki/pages/javascript/index.md +0 -77
  247. data/wiki/pages/javascript/links.yaml +0 -2
  248. data/wiki/pages/links.yaml +0 -2
  249. data/wiki/pages/middleware/content/index.md +0 -21
  250. data/wiki/pages/middleware/controller/actions/index.md +0 -76
  251. data/wiki/pages/middleware/controller/index.md +0 -62
  252. data/wiki/pages/middleware/controller/links.yaml +0 -4
  253. data/wiki/pages/middleware/controller/rewrite/index.md +0 -69
  254. data/wiki/pages/middleware/localization/index.md +0 -16
  255. data/wiki/pages/middleware/redirection/index.md +0 -17
  256. data/wiki/pages/middleware/session/index.md +0 -29
  257. data/wiki/pages/middleware/static/index.md +0 -13
  258. data/wiki/pages/server-setup/index.md +0 -52
  259. data/wiki/pages/testing/index.md +0 -15
  260. data/wiki/pages/updating-utopia/index.md +0 -63
  261. data/wiki/pages/your-first-page/index.md +0 -38
@@ -1,65 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Session</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../../_static/icon.png"/>
10
- <link rel="stylesheet" href="../../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../../_components/jquery/jquery.min.js"></script>
13
- <script src="../../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../../index.html">Wiki</a> › <span>Middleware</span> › <a href="index.html">Session</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="session">Session</h1>
31
-
32
- <p>The session management uses symmetric private key encryption to store data on the client and avoid tampering.</p>
33
-
34
- <pre><code class="language-ruby">use Utopia::Session,
35
- :expires_after =&gt; 3600,
36
- :secret =&gt; '40 or more random characters for your secret key'
37
- </code></pre>
38
-
39
- <p>All session data is stored on the client, but it’s encrypted with a salt and the secret key. It would be hard for the client to decrypt the data without the secret.</p>
40
-
41
- <h2 id="using-environmentyaml">Using <code>environment.yaml</code></h2>
42
-
43
- <p>The session secret should not be shared or ideally, not stored in source code. This can be easily achieved using an environment variable, stored in <code>environment.yaml</code> on the production server:</p>
44
-
45
- <pre><code class="language-ruby">use Utopia::Session,
46
- :expires_after =&gt; 3600,
47
- :secret =&gt; ENV['UTOPIA_SESSION_SECRET']
48
- </code></pre>
49
-
50
- <p>In development, the secret would be reset every time the server is restarted. To set a fixed secret on production, run the following:</p>
51
-
52
- <pre><code class="language-bash">$ utopia server environment UTOPIA_SESSION_SECRET=$(head /dev/urandom | shasum | base64 | head -c 40)
53
- </code></pre>
54
-
55
- <p>This is done by default when using <code>utopia server create</code> and <code>utopia server update</code>.</p>
56
-
57
- </main>
58
-
59
- <footer>
60
- Last Modified: 2020-04-28 11:35:36 +1200
61
- — middleware/session/index.md
62
- </footer>
63
-
64
- </body>
65
- </html>
@@ -1,51 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Static</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../../_static/icon.png"/>
10
- <link rel="stylesheet" href="../../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../../_components/jquery/jquery.min.js"></script>
13
- <script src="../../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../../index.html">Wiki</a> › <span>Middleware</span> › <a href="index.html">Static</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="static">Static</h1>
31
-
32
- <p>This middleware serves static files using the <code>mime-types</code> library. By default, it works with <code>Rack::Sendfile</code> and supports <code>ETag</code> based caching. Normally, you’d prefer to put static files into <code>public/_static</code> but it’s also acceptable to put static content into <code>pages/</code> if it makes sense.</p>
33
-
34
- <pre><code class="language-ruby">use Utopia::Static,
35
- # The root path to serve files from:
36
- root: "path/to/root",
37
- # The mime-types to recognize/serve:
38
- types: [:default, :xiph],
39
- # Cache-Control header for files:
40
- cache_control: 'public, max-age=7200'
41
- </code></pre>
42
-
43
- </main>
44
-
45
- <footer>
46
- Last Modified: 2020-04-28 11:35:36 +1200
47
- — middleware/static/index.md
48
- </footer>
49
-
50
- </body>
51
- </html>
@@ -1,87 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Server Setup</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../_static/icon.png"/>
10
- <link rel="stylesheet" href="../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../_components/jquery/jquery.min.js"></script>
13
- <script src="../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../index.html">Wiki</a> › <a href="index.html">Server Setup</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="server-setup">Server Setup</h1>
31
-
32
- <p>Utopia is designed to make deployment to remote servers easy.</p>
33
-
34
- <h2 id="deployment">Deployment</h2>
35
-
36
- <p>The preferred method of deployment to a production server is via git. The <code>utopia</code> command assists with setup of a remote git repository on the server. It will setup a <code>git</code> <code>post-update</code> hook which will deploy the site correctly and restart the application server for that site.</p>
37
-
38
- <p>To setup a server for deployment:</p>
39
-
40
- <pre><code class="language-bash">$ mkdir /srv/http/www.example.com
41
- $ cd /srv/http/www.example.com
42
- $ sudo -u http utopia server create
43
- </code></pre>
44
-
45
- <p>On your development machine, you should setup the git remote:</p>
46
-
47
- <pre><code class="language-bash">$ git remote add production ssh://remote/srv/http/www.example.com
48
- $ git push --set-upstream production master
49
- </code></pre>
50
-
51
- <h3 id="default-environment">Default Environment</h3>
52
-
53
- <p>Utopia will load <code>config/environment.yaml</code> and update <code>ENV</code> before executing any code. You can set default environment values using the <code>utopia</code> command:</p>
54
-
55
- <pre><code class="language-bash">$ sudo -u http utopia environment RACK_ENV=production DATABASE_ENV=production_cluster_primary
56
- ENV["RACK_ENV"] will default to "production" unless otherwise specified.
57
- ENV["DATABASE_ENV"] will default to "production_cluster_primary" unless otherwise specified.
58
- </code></pre>
59
-
60
- <p>To set a value, write <code>KEY=VALUE</code>. To unset a key, write <code>KEY</code>.</p>
61
-
62
- <p>When you run <code>rake</code> tasks or spawn a server, the values in <code>config/environment.yaml</code> will be the defaults. You can override them by manually specifying them, e.g. <code>DATABASE_ENV=development rake db:info</code>.</p>
63
-
64
- <h2 id="platform">Platform</h2>
65
-
66
- <p>The best deployment platform for Utopia is Linux, using <a href="https://github.com/socketry/falcon">falcon</a>.</p>
67
-
68
- <h3 id="sudo-setup">Sudo Setup</h3>
69
-
70
- <p>Create a file <code>/etc/sudoers.d/http</code> with the following contents:</p>
71
-
72
- <pre><code class="language-sudoers"># Allow user samuel to check out code as user http using git:
73
- %wheel ALL=(http) NOPASSWD: ALL
74
- </code></pre>
75
-
76
- <p>This allows the deploy task to correctly checkout code as user <code>http</code>.</p>
77
-
78
-
79
- </main>
80
-
81
- <footer>
82
- Last Modified: 2020-04-28 11:35:36 +1200
83
- — server-setup/index.md
84
- </footer>
85
-
86
- </body>
87
- </html>
@@ -1,53 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Testing</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../_static/icon.png"/>
10
- <link rel="stylesheet" href="../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../_components/jquery/jquery.min.js"></script>
13
- <script src="../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../index.html">Wiki</a> › <a href="index.html">Testing</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="testing">Testing</h1>
31
-
32
- <p>Utopia websites include a default set of tests, and associated <code>rake test</code> tasks. These specs can test against the actual running website. By default, <a href="https://github.com/socketry/covered">covered</a> is included for coverage testing.</p>
33
-
34
- <pre><code class="language-bash">$ rake coverage test
35
-
36
- my website
37
- should have an accessible front page
38
-
39
- Finished in 0.44849 seconds (files took 0.15547 seconds to load)
40
- 1 example, 0 failures
41
-
42
- Coverage report generated for RSpec. 5 / 5 LOC (100.0%) covered.
43
- </code></pre>
44
-
45
- </main>
46
-
47
- <footer>
48
- Last Modified: 2020-04-28 11:35:36 +1200
49
- — testing/index.md
50
- </footer>
51
-
52
- </body>
53
- </html>
@@ -1,102 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Updating Utopia</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../_static/icon.png"/>
10
- <link rel="stylesheet" href="../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../_components/jquery/jquery.min.js"></script>
13
- <script src="../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../index.html">Wiki</a> › <a href="index.html">Updating Utopia</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="updating-utopia">Updating Utopia</h1>
31
-
32
- <p>Utopia provides a model for both local development (<code>utopia site create</code>) and deployment (<code>utopia server create</code>). In addition, Utopia provides a basic upgrade path for existing sites when things within the framework change. These are not always automatic, so below are some recipes for how to update your site.</p>
33
-
34
- <h2 id="site-update">Site Update</h2>
35
-
36
- <p>Utopia as a framework introduces changes and versions change according to semantic versioning.</p>
37
-
38
- <h3 id="controller-update-19x-to-2x">Controller Update 1.9.x to 2.x</h3>
39
-
40
- <p>The controller layer no longer automatically prepends the <code>Actions</code> layer. The following program does a best effort attempt to update existing controllers:</p>
41
-
42
- <pre><code class="language-ruby">#!/usr/bin/env ruby
43
-
44
- paths = Dir.glob("**/controller.rb")
45
-
46
- paths.each do |path|
47
- lines = File.readlines(path)
48
-
49
- prepend_line_index = lines.first(5).find_index{|line| line =~ /prepend/}
50
-
51
- unless prepend_line_index
52
- puts "Updating #{path}.."
53
- File.open(path, "w") do |file|
54
- file.puts "\nprepend Actions"
55
- file.write lines.join
56
- end
57
- else
58
- prepend_line = lines[prepend_line_index]
59
-
60
- unless prepend_line =~ /Actions/
61
- if lines.any?{|line| line =~ /on/}
62
- lines[prepend_line_index] = "#{prepend_line.chomp}, Actions\n"
63
-
64
- puts "Updating #{path}.."
65
- File.open(path, "w") do |file|
66
- file.write lines.join
67
- end
68
- end
69
- end
70
- end
71
- end
72
- </code></pre>
73
-
74
- <h3 id="view-update-19x-to-2x">View Update 1.9.x to 2.x</h3>
75
-
76
- <p>Dynamic tags in 2.x require namespaces. This affects all <code>.xnode</code> files, in particular the following 3 cases:</p>
77
-
78
- <ol>
79
- <li>Rewrite <code>&lt;(/?)(NAME)(\W)</code> to <code>&lt;$1content:$2$3</code> where NAME is a tag which would expand using a <code>_NAME.xnode</code> file.</li>
80
- <li>Rewrite <code>&lt;content/&gt;</code> to <code>&lt;utopia:content/&gt;</code>. This affects <code>&lt;node&gt;</code>, <code>&lt;deferred&gt;</code>, <code>&lt;environment&gt;</code> tags.</li>
81
- <li>Rewrite <code>partial 'NAME'</code> to be <code>partial 'content:NAME'</code>.</li>
82
- </ol>
83
-
84
- <h2 id="server-update">Server Update</h2>
85
-
86
- <p>The utopia server git hooks are updated occasionally to improve the deployment process or to handle changes in the underlying process.</p>
87
-
88
- <p>You can run the update process on the server to bring the git hooks up to the latest version.</p>
89
-
90
- <pre><code class="language-bash">$ cd /srv/http/website
91
- $ utopia server update
92
- </code></pre>
93
-
94
- </main>
95
-
96
- <footer>
97
- Last Modified: 2020-04-28 11:35:36 +1200
98
- — updating-utopia/index.md
99
- </footer>
100
-
101
- </body>
102
- </html>
@@ -1,74 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
-
5
- <title>Your First Page</title>
6
-
7
- <meta charset="UTF-8"/>
8
-
9
- <link rel="icon" type="image/png" href="../_static/icon.png"/>
10
- <link rel="stylesheet" href="../_static/site.css" type="text/css" media="screen"/>
11
-
12
- <script src="../_components/jquery/jquery.min.js"></script>
13
- <script src="../_components/jquery-syntax/jquery.syntax.min.js"></script>
14
-
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- jQuery(function($) {
18
- $.syntax();
19
- });
20
- //]]>
21
- </script>
22
- </head>
23
-
24
- <body class="show">
25
-
26
- <nav> › <a href="../index.html">Wiki</a> › <a href="index.html">Your First Page</a></nav>
27
-
28
-
29
- <main>
30
- <h1 id="your-first-page">Your First Page</h1>
31
-
32
- <p>To setup the default site, simply create a directory and use the <code>utopia</code> command:</p>
33
-
34
- <pre><code class="language-bash">$ mkdir www.example.com
35
- $ cd www.example.com
36
- $ utopia site create
37
- $ rake server
38
- </code></pre>
39
-
40
- <p>You will now have a basic template site running on <code>https://localhost:9292</code>.</p>
41
-
42
- <h2 id="welcome-page">Welcome Page</h2>
43
-
44
- <p>Utopia includes a redirection middleware to redirect all root-level requests to a given URI. The default being <code>/welcome/index</code>:</p>
45
-
46
- <pre><code class="language-ruby"># in config.ru
47
-
48
- use Utopia::Redirection::Rewrite,
49
- '/' =&gt; '/welcome/index'
50
- </code></pre>
51
-
52
- <p>This page includes a basic overview of Utopia. Most of it’s standard HTML, except for the outer <code>&lt;content:page&gt;</code> tag. Utopia uses the name <code>page</code> to lookup the file-system hierarchy. First, it looks for <code>/welcome/_page.xnode</code>, and then it looks for <code>/_page.xnode</code> which it finds. This page template includes a tag <code>&lt;utopia:content/&gt;</code> which is replaced with the inner body of the <code>&lt;content:page&gt;</code> tag. This recursive lookup is the heart of Utopia.</p>
53
-
54
- <h2 id="links">Links</h2>
55
-
56
- <p>Utopia is a content-centric web application platform. It leverages the file-system to provide a mapping between logical resources and files on disk. The primary mode of mapping incoming requests to specific nodes (content) is done using the <code>links.yaml</code> file.</p>
57
-
58
- <p>The links file associates metadata with node names for a given directory. This can include things like redirects, titles, descriptions, etc. You can add any metadata you like, to support your specific use-case. The primary use of the links files is to provide site structure, e.g. menus. In addition, they can function as a rudimentary data-store for static information, e.g. a list of applications (each with it’s own page), a list of features, etc.</p>
59
-
60
- <p>You’ll notice that there is a file <code>/links.yaml</code>. This file contains important metadata relating to the <code>errors</code> subdirectory. As we don’t want these nodes showing up in a top level menu, we mark them as <code>display: false</code></p>
61
-
62
- <pre><code class="language-yaml">errors:
63
- display: false
64
- </code></pre>
65
-
66
- </main>
67
-
68
- <footer>
69
- Last Modified: 2020-04-28 23:17:10 +1200
70
- — your-first-page/index.md
71
- </footer>
72
-
73
- </body>
74
- </html>
Binary file
@@ -1 +0,0 @@
1
- <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 420 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g><rect x="0" y="0" width="420" height="56" style="fill:#f79433;"/><rect x="0" y="56" width="420" height="24" style="fill:#4e8dd8;"/><g><path d="M75.145,70.819c2.37,-3.097 4.173,-6.921 5.111,-11.365c0.91,-4.318 1.498,-9.261 1.498,-14.692l0,-44.762l-62.754,0l0,44.762c0,2.628 0.244,5.333 0.407,8.035c0.168,2.782 0.674,5.515 1.345,8.118c0.68,2.644 1.739,5.173 3.067,7.517c1.363,2.405 3.263,4.526 5.609,6.303c2.319,1.755 5.245,3.163 8.677,4.172c1.617,0.478 3.416,1.093 5.354,1.093l13.856,0c3.071,0 5.797,-1.058 8.131,-2.001c4.042,-1.631 7.305,-4.049 9.699,-7.18Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M151.481,18.701l0,-18.701l-62.754,-0.022l0,18.723l22.246,0l0.02,61.299l17.93,0l-0.02,-61.299l22.578,0Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M229.926,39.999c0,-22.051 -16.979,-39.992 -37.852,-39.992c-20.872,0 -37.851,17.942 -37.851,39.992c0,22.054 16.979,39.994 37.851,39.994c20.873,0 37.852,-17.94 37.852,-39.994Z" style="fill:#fff;fill-rule:nonzero;"/><path d="M269.238,50.909c9.717,0 17.181,-2.066 22.183,-6.395c5.087,-4.399 7.667,-10.942 7.667,-19.575c0,-3.257 -0.393,-5.962 -1.167,-8.476c-0.778,-2.528 -1.883,-4.934 -3.281,-6.814c-1.401,-1.882 -3.098,-3.458 -5.045,-4.703c-1.895,-1.21 -4.003,-2.198 -6.264,-2.943c-2.239,-0.737 -4.64,-1.263 -7.139,-1.56c-2.464,-0.292 -5.016,-0.443 -7.587,-0.443l-29.468,0l0,80l17.93,0l0,-29.091l12.171,0Z" style="fill:#fff;fill-rule:nonzero;"/><rect x="304.879" y="0" width="17.93" height="80" style="fill:#fff;"/><path d="M362.589,0l-29.477,80l75.888,0l-31.247,-80l-15.164,0Z" style="fill:#fff;fill-rule:nonzero;"/></g></g></svg>
@@ -1 +0,0 @@
1
- --modules-folder lib/components
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class MockNode
4
- def initialize(namespaces = {}, &block)
5
- @namespaces = namespaces
6
- define_singleton_method(:call, block)
7
- end
8
-
9
- def lookup_tag(tag)
10
- namespace, name = Trenni::Tag.split(tag.name)
11
-
12
- if library = @namespaces[namespace]
13
- library.call(name, self)
14
- end
15
- end
16
- end