syntropy 0.34.0 → 0.34.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/examples/blog/app/_layout/default.rb +3 -0
- data/examples/blog/app/assets/style.css +20 -0
- data/examples/blog/app/index.rb +12 -2
- data/examples/blog/app/test.rb +7 -0
- data/examples/template/.gitignore +2 -0
- data/examples/template/Gemfile +3 -0
- data/examples/template/app/_layout/default.rb +14 -0
- data/examples/template/app/_lib/database.rb +13 -0
- data/examples/template/app/_schema/2026-01-01-initial.rb +9 -0
- data/examples/template/app/assets/style.css +25 -0
- data/examples/template/app/index.rb +27 -0
- data/examples/template/app/test.rb +7 -0
- data/examples/template/config/development.rb +5 -0
- data/examples/template/config/production.rb +4 -0
- data/examples/template/config/test.rb +5 -0
- data/examples/template/test/test_app.rb +14 -0
- data/lib/syntropy/applets/builtin/default_error_handler/style.css +4 -8
- data/lib/syntropy/applets/builtin/default_error_handler.rb +18 -9
- data/lib/syntropy/module_loader.rb +11 -0
- data/lib/syntropy/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49c52a1891465e485d3e8dd8d276edcd7ac3c1764953f194d887135927ecf5a2
|
|
4
|
+
data.tar.gz: 23ddba8746c67adbec04d74cec70704841dbdd9b30cebf9f21bf1b7e9b90ed82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea0acc2c5ad710b3b477f7d16cc1ef40bc442937efbea7c1dc0df79e9fa20fcbad3759cc8b147eefc9eebe6075e2320da0233338ea84bd13a562813b927d35fb
|
|
7
|
+
data.tar.gz: 22a40777f51a56d8d7661e14c6b195318904779af799c9e7bbe49e68388e8d490ead0e27a0df53ff0d04d9a90cbdc11cb01e356acba2aa4acc7dd645434bb788
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@ export template { |**props|
|
|
|
2
2
|
html {
|
|
3
3
|
head {
|
|
4
4
|
title "My awesome blog"
|
|
5
|
+
meta charset: 'utf-8'
|
|
6
|
+
meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
|
|
7
|
+
link rel: "stylesheet", type: "text/css", href: "/assets/style.css"
|
|
5
8
|
}
|
|
6
9
|
body {
|
|
7
10
|
render_children(**props)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
body {
|
|
2
|
+
max-width: 800px;
|
|
3
|
+
margin: 4em auto;
|
|
4
|
+
|
|
5
|
+
font-family: sans-serif;
|
|
6
|
+
/*Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro,
|
|
7
|
+
sans-serif;*/
|
|
8
|
+
|
|
9
|
+
big {
|
|
10
|
+
display: block;
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
font-size: 10em;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media (max-width: 768px) {
|
|
17
|
+
body {
|
|
18
|
+
margin-inline: 1em;
|
|
19
|
+
}
|
|
20
|
+
}
|
data/examples/blog/app/index.rb
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
layout = import '_layout/default'
|
|
2
2
|
|
|
3
3
|
export layout.apply {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
div(style: 'text-align: center; font-size: 2em; font-weight: normal') {
|
|
5
|
+
h1 {
|
|
6
|
+
a(
|
|
7
|
+
'Syntropy',
|
|
8
|
+
style: 'color: #238',
|
|
9
|
+
href: 'https://github.com/digital-fabric/syntropy',
|
|
10
|
+
target: 'none'
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
p {
|
|
14
|
+
a 'Blog posts', href: '/posts'
|
|
15
|
+
}
|
|
6
16
|
}
|
|
7
17
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export template { |**props|
|
|
2
|
+
html {
|
|
3
|
+
head {
|
|
4
|
+
title "My awesome Syntropy web app"
|
|
5
|
+
meta charset: 'utf-8'
|
|
6
|
+
meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
|
|
7
|
+
link rel: "stylesheet", type: "text/css", href: "/assets/style.css"
|
|
8
|
+
}
|
|
9
|
+
body {
|
|
10
|
+
render_children(**props)
|
|
11
|
+
auto_refresh!
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export self
|
|
2
|
+
|
|
3
|
+
def connection_pool
|
|
4
|
+
@connection_pool ||= DB::ConnectionPool.new(@machine, @env[:config][:storage][:path], 4)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def schema
|
|
8
|
+
DB::Schema.new(module_loader: @module_loader, schema_root: '_schema')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def migrate!
|
|
12
|
+
schema.apply(connection_pool)
|
|
13
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
* {
|
|
2
|
+
border: 0;
|
|
3
|
+
font: inherit;
|
|
4
|
+
font-size: 100%;
|
|
5
|
+
vertical-align: baseline;
|
|
6
|
+
line-height: 1.5em;
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
background-color: #f8f8f8;
|
|
10
|
+
color: #222;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
max-width: 800px;
|
|
15
|
+
margin: 4em auto;
|
|
16
|
+
|
|
17
|
+
font-size: 1.5em;
|
|
18
|
+
font-family: sans-serif;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (max-width: 768px) {
|
|
22
|
+
body {
|
|
23
|
+
margin-inline: 1em;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
layout = import '_layout/default'
|
|
2
|
+
|
|
3
|
+
require 'papercraft/version'
|
|
4
|
+
|
|
5
|
+
export layout.apply {
|
|
6
|
+
div(style: 'text-align: center; font-size: 2em; font-weight: bold; margin-bottom: 0.5em') {
|
|
7
|
+
h1 {
|
|
8
|
+
a(
|
|
9
|
+
'Syntropy',
|
|
10
|
+
style: 'color: #238',
|
|
11
|
+
href: 'https://github.com/digital-fabric/syntropy',
|
|
12
|
+
target: 'none'
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
div(style: 'text-align: center') {
|
|
17
|
+
p {
|
|
18
|
+
a 'Test page', href: '/test'
|
|
19
|
+
}
|
|
20
|
+
div(style: 'font-size: 0.8em; margin-top: 1em') {
|
|
21
|
+
div { span 'Syntropy version: '; span Syntropy::VERSION }
|
|
22
|
+
div { span 'Papercraft version: '; span Papercraft::VERSION }
|
|
23
|
+
div { span 'UringMachine version: '; span UM::VERSION }
|
|
24
|
+
div { span 'Ruby version: '; span RUBY_VERSION }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AppTest < Syntropy::Test
|
|
4
|
+
def test_routing
|
|
5
|
+
req = get('/')
|
|
6
|
+
assert_equal HTTP::OK, req.response_status
|
|
7
|
+
|
|
8
|
+
req = get('/test')
|
|
9
|
+
assert_equal HTTP::OK, req.response_status
|
|
10
|
+
|
|
11
|
+
req = get('/foo')
|
|
12
|
+
assert_equal HTTP::NOT_FOUND, req.response_status
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -2,17 +2,13 @@ body {
|
|
|
2
2
|
max-width: 800px;
|
|
3
3
|
margin: 4em auto;
|
|
4
4
|
|
|
5
|
-
font-family:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
display: block;
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
font-size: 10em;
|
|
11
|
-
}
|
|
5
|
+
font-family:
|
|
6
|
+
Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro,
|
|
7
|
+
sans-serif;
|
|
12
8
|
}
|
|
13
9
|
|
|
14
10
|
@media (max-width: 768px) {
|
|
15
11
|
body {
|
|
16
12
|
margin-inline: 1em;
|
|
17
13
|
}
|
|
18
|
-
}
|
|
14
|
+
}
|
|
@@ -13,11 +13,11 @@ ErrorPage = ->(error:, status:, backtrace:) {
|
|
|
13
13
|
big status
|
|
14
14
|
h2 error.message
|
|
15
15
|
if backtrace
|
|
16
|
-
p
|
|
16
|
+
p 'Backtrace:'
|
|
17
17
|
ul {
|
|
18
18
|
backtrace.each {
|
|
19
19
|
li {
|
|
20
|
-
a(it[:
|
|
20
|
+
a(it[:title], href: it[:url])
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -28,15 +28,24 @@ ErrorPage = ->(error:, status:, backtrace:) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
GEMS_DIR = Gem.dir
|
|
32
|
+
SYNTROPY_DIR = File.expand_path(File.join(__dir__, '../../../..'))
|
|
33
|
+
|
|
31
34
|
def transform_backtrace(backtrace)
|
|
32
|
-
backtrace
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
backtrace
|
|
36
|
+
.map do
|
|
37
|
+
if (m = it.match(/^(.+:\d+):?/))
|
|
38
|
+
location = m[1]
|
|
39
|
+
title = location.sub(GEMS_DIR, '...').sub(SYNTROPY_DIR, '...')
|
|
40
|
+
{ entry: it, url: "zed://file/#{location}", title: }
|
|
41
|
+
else
|
|
42
|
+
{ entry: it, url: nil, title: it }
|
|
43
|
+
end
|
|
38
44
|
end
|
|
39
|
-
|
|
45
|
+
rescue Exception => e
|
|
46
|
+
p e
|
|
47
|
+
p e.backtrace
|
|
48
|
+
exit!
|
|
40
49
|
end
|
|
41
50
|
|
|
42
51
|
def error_response_html(req, error)
|
|
@@ -198,6 +198,17 @@ module Syntropy
|
|
|
198
198
|
m.instance_eval(code, fn)
|
|
199
199
|
env[:logger]&.info(message: "Loaded module at #{fn}")
|
|
200
200
|
m
|
|
201
|
+
rescue SyntaxError => e
|
|
202
|
+
STDERR.puts("\n#{e.message}")
|
|
203
|
+
|
|
204
|
+
if (m = e.message.match(/^(.+)\: syntax/))
|
|
205
|
+
location = m[1]
|
|
206
|
+
e2 = SyntaxError.new("Syntax errors found in module #{env[:ref]}")
|
|
207
|
+
e2.set_backtrace([location] + e.backtrace)
|
|
208
|
+
raise e2
|
|
209
|
+
else
|
|
210
|
+
raise e
|
|
211
|
+
end
|
|
201
212
|
end
|
|
202
213
|
|
|
203
214
|
# Initializes a module with the given environment hash.
|
data/lib/syntropy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: syntropy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.34.
|
|
4
|
+
version: 0.34.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sharon Rosner
|
|
@@ -209,11 +209,13 @@ files:
|
|
|
209
209
|
- examples/blog/app/_lib/database.rb
|
|
210
210
|
- examples/blog/app/_lib/posts.rb
|
|
211
211
|
- examples/blog/app/_schema/2026-01-01-initial.rb
|
|
212
|
+
- examples/blog/app/assets/style.css
|
|
212
213
|
- examples/blog/app/index.rb
|
|
213
214
|
- examples/blog/app/posts/[id]/edit.rb
|
|
214
215
|
- examples/blog/app/posts/[id]/index.rb
|
|
215
216
|
- examples/blog/app/posts/index.rb
|
|
216
217
|
- examples/blog/app/posts/new.rb
|
|
218
|
+
- examples/blog/app/test.rb
|
|
217
219
|
- examples/blog/config/development.rb
|
|
218
220
|
- examples/blog/config/production.rb
|
|
219
221
|
- examples/blog/config/test.rb
|
|
@@ -233,6 +235,18 @@ files:
|
|
|
233
235
|
- examples/mcp-oauth/app/signin.rb
|
|
234
236
|
- examples/mcp-oauth/test/test_app.rb
|
|
235
237
|
- examples/mcp-oauth/test/test_oauth.rb
|
|
238
|
+
- examples/template/.gitignore
|
|
239
|
+
- examples/template/Gemfile
|
|
240
|
+
- examples/template/app/_layout/default.rb
|
|
241
|
+
- examples/template/app/_lib/database.rb
|
|
242
|
+
- examples/template/app/_schema/2026-01-01-initial.rb
|
|
243
|
+
- examples/template/app/assets/style.css
|
|
244
|
+
- examples/template/app/index.rb
|
|
245
|
+
- examples/template/app/test.rb
|
|
246
|
+
- examples/template/config/development.rb
|
|
247
|
+
- examples/template/config/production.rb
|
|
248
|
+
- examples/template/config/test.rb
|
|
249
|
+
- examples/template/test/test_app.rb
|
|
236
250
|
- lib/syntropy.rb
|
|
237
251
|
- lib/syntropy/app.rb
|
|
238
252
|
- lib/syntropy/applets/builtin/auto_refresh/watch.js
|