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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29b7fe87a7350db0c154f0ee25b1c6992c81aead3938cec537e383dc5e3f6a62
4
- data.tar.gz: 7dcf8de792102d368aefed72ced1ac3c2e5afd1fe0aea3ac106150fa59862a6b
3
+ metadata.gz: 49c52a1891465e485d3e8dd8d276edcd7ac3c1764953f194d887135927ecf5a2
4
+ data.tar.gz: 23ddba8746c67adbec04d74cec70704841dbdd9b30cebf9f21bf1b7e9b90ed82
5
5
  SHA512:
6
- metadata.gz: 904b3740de777c83a631b4b0b37f72ee22b698b2f1618110a906c6ca5adf979f0c46c84af08d1ae228f8b9aa90bcb54093e88de9c18dcf3961d72ea7e0d94d2c
7
- data.tar.gz: '0081303c531b38423d94f43423efcdcd80852201b0826f0078b276618b03dc7cde09e24dd599e8cee58ddf4ae8ce1f226d4684b4aa8592407728b9f911e30cc5'
6
+ metadata.gz: ea0acc2c5ad710b3b477f7d16cc1ef40bc442937efbea7c1dc0df79e9fa20fcbad3759cc8b147eefc9eebe6075e2320da0233338ea84bd13a562813b927d35fb
7
+ data.tar.gz: 22a40777f51a56d8d7661e14c6b195318904779af799c9e7bbe49e68388e8d490ead0e27a0df53ff0d04d9a90cbdc11cb01e356acba2aa4acc7dd645434bb788
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.34.1 2026-06-03
2
+
3
+ - Improve error display in browser, fix `SyntaxError` message and backtrace
4
+
1
5
  # 0.34.0 2026-06-03
2
6
 
3
7
  - Streamline options for CLI commands
@@ -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
+ }
@@ -1,7 +1,17 @@
1
1
  layout = import '_layout/default'
2
2
 
3
3
  export layout.apply {
4
- p {
5
- a 'Blog posts', href: '/posts'
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,7 @@
1
+ layout = import '_layout/default'
2
+
3
+ export layout.apply {
4
+ p {
5
+ span "Hello!"
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ storage/*
@@ -0,0 +1,3 @@
1
+ source 'https://gem.coop'
2
+
3
+ gem 'syntropy'
@@ -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,9 @@
1
+ export ->(db) {
2
+ # db.execute <<~SQL
3
+ # create table posts (
4
+ # id integer primary key autoincrement,
5
+ # title text,
6
+ # body text
7
+ # )
8
+ # SQL
9
+ }
@@ -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,7 @@
1
+ layout = import '_layout/default'
2
+
3
+ export layout.apply {
4
+ p {
5
+ span 'Hello!'
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ export(
2
+ storage: {
3
+ path: ENV['DATABASE_PATH'] || 'storage/development.db'
4
+ }
5
+ )
@@ -0,0 +1,4 @@
1
+ export(
2
+ storage:
3
+ path: ENV['DATABASE_PATH'] || 'storage/production.db'
4
+ )
@@ -0,0 +1,5 @@
1
+ export({
2
+ storage: {
3
+ path: ENV['DATABASE_PATH'] || Syntropy.tmp_path('test-db')
4
+ }
5
+ })
@@ -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: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
6
-
7
- big {
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 "Backtrace:"
16
+ p 'Backtrace:'
17
17
  ul {
18
18
  backtrace.each {
19
19
  li {
20
- a(it[:entry], href: it[:url])
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.map do
33
- if (m = it.match(/^(.+:\d+):/))
34
- location = m[1]
35
- { entry: it, url: "zed://file/#{location}" }
36
- else
37
- { entry: it, url: nil }
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
- end
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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Syntropy
4
- VERSION = '0.34.0'
4
+ VERSION = '0.34.1'
5
5
  end
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.0
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