utopia 2.18.3 → 2.19.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/bake/utopia/node.rb +22 -2
- data/lib/utopia/command/site.rb +2 -2
- data/lib/utopia/content/link.rb +11 -5
- data/lib/utopia/content/links.rb +4 -2
- data/lib/utopia/content.rb +3 -5
- data/lib/utopia/controller/actions.md +1 -1
- data/lib/utopia/controller/base.rb +9 -11
- data/lib/utopia/path.rb +6 -0
- data/lib/utopia/version.rb +1 -1
- data/setup/site/README.md +2 -2
- data/setup/site/config.ru +2 -0
- data/setup/site/gems.rb +1 -0
- data/setup/site/pages/_page.xnode +1 -1
- data/setup/site/public/_static/icon.svg +20 -0
- data/setup/site/public/_static/utopia-background.svg +11 -1
- data/setup/site/public/_static/utopia.svg +19 -1
- data/setup/site/spec/website_context.rb +7 -5
- metadata +18 -4
- data/setup/site/public/_static/icon.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df0d36fb6627871090306a7049fcbd487139fa7e30c861c6c2abf270a3ad07ec
|
4
|
+
data.tar.gz: d6b3592a95d1652a9069d5841a5aa9ff7bf43d73c1a171b9be212602f888989c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00e3a8f9df669e72d419c490fd86f255981a3e05ab05a0f740d468e306494879c4e78449332b0c88151a64e2296a0968e117b8965e556c6225ec95f5795cd261
|
7
|
+
data.tar.gz: 9764e94964545f5b8bdd6f99763872d0391d71eef1327e3121c045e555f2a1b3821641640037d6d77c934f2f5145b9aa40e515096a9694d7c3698aa7044b45b5
|
data/bake/utopia/node.rb
CHANGED
@@ -15,9 +15,11 @@ def update
|
|
15
15
|
|
16
16
|
install_root = root + "public/_components"
|
17
17
|
|
18
|
-
package_root
|
18
|
+
package_paths = expand_package_paths(package_root)
|
19
|
+
|
20
|
+
package_paths.each do |package_path|
|
21
|
+
package_directory = package_path.relative_path_from(package_root)
|
19
22
|
install_path = install_root + package_directory
|
20
|
-
package_path = package_root + package_directory
|
21
23
|
|
22
24
|
dist_path = package_path + 'dist'
|
23
25
|
|
@@ -34,3 +36,21 @@ def update
|
|
34
36
|
FileUtils::Verbose.cp_r File.expand_path(link_path, install_path), install_path
|
35
37
|
end
|
36
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def expand_package_paths(root, into = [])
|
43
|
+
paths = root.children.select(&:directory?)
|
44
|
+
|
45
|
+
paths.each do |path|
|
46
|
+
basename = path.basename.to_s
|
47
|
+
# Handle organisation sub-directories which start with an '@' symbol:
|
48
|
+
if basename.start_with?('@')
|
49
|
+
expand_package_paths(path, into)
|
50
|
+
else
|
51
|
+
into << path
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
return into
|
56
|
+
end
|
data/lib/utopia/command/site.rb
CHANGED
@@ -110,10 +110,10 @@ module Utopia
|
|
110
110
|
puts "make your life easier and more enjoyable.".center(78)
|
111
111
|
puts ""
|
112
112
|
puts "To start the development server, run:".center(78)
|
113
|
-
puts "
|
113
|
+
puts "bake utopia:development".center(78)
|
114
114
|
puts ""
|
115
115
|
puts "For extreme productivity, please consult the online documentation".center(78)
|
116
|
-
puts "https://github.com/
|
116
|
+
puts "https://github.com/socketry/utopia".center(78)
|
117
117
|
puts " ~ Samuel. ".rjust(78)
|
118
118
|
end
|
119
119
|
end
|
data/lib/utopia/content/link.rb
CHANGED
@@ -50,6 +50,12 @@ module Utopia
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
def full_path(root, extension = XNODE_EXTENSION)
|
54
|
+
if @path&.file?
|
55
|
+
File.join(root, @path.dirname, self.key + XNODE_EXTENSION)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
53
59
|
def href
|
54
60
|
@href ||= @info.fetch(:uri) do
|
55
61
|
@info.fetch(:href) do
|
@@ -96,17 +102,17 @@ module Utopia
|
|
96
102
|
def to_anchor(base: nil, content: self.title, builder: nil, **attributes)
|
97
103
|
attributes[:class] ||= 'link'
|
98
104
|
|
99
|
-
Trenni::Builder.fragment(builder) do |
|
105
|
+
Trenni::Builder.fragment(builder) do |inner_builder|
|
100
106
|
if href?
|
101
107
|
attributes[:href] ||= relative_href(base)
|
102
108
|
attributes[:target] ||= @info[:target]
|
103
109
|
|
104
|
-
|
105
|
-
|
110
|
+
inner_builder.inline('a', attributes) do
|
111
|
+
inner_builder.text(content)
|
106
112
|
end
|
107
113
|
else
|
108
|
-
|
109
|
-
|
114
|
+
inner_builder.inline('span', attributes) do
|
115
|
+
inner_builder.text(content)
|
110
116
|
end
|
111
117
|
end
|
112
118
|
end
|
data/lib/utopia/content/links.rb
CHANGED
@@ -142,8 +142,10 @@ module Utopia
|
|
142
142
|
def load_metadata(path)
|
143
143
|
yaml_path = File.join(path, LINKS_YAML)
|
144
144
|
|
145
|
-
if File.exist?(yaml_path)
|
146
|
-
|
145
|
+
if File.exist?(yaml_path)
|
146
|
+
if data = YAML.safe_load(File.read(yaml_path), permitted_classes: [Date, Time])
|
147
|
+
return symbolize_keys(data)
|
148
|
+
end
|
147
149
|
else
|
148
150
|
return {}
|
149
151
|
end
|
data/lib/utopia/content.rb
CHANGED
@@ -92,7 +92,7 @@ module Utopia
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
# @param path [Path] the
|
95
|
+
# @param path [Path] the request path is an absolute uri path, e.g. `/foo/bar`. If an xnode file exists on disk for this exact path, it is instantiated, otherwise nil.
|
96
96
|
def lookup_node(path, locale = nil)
|
97
97
|
resolve_link(
|
98
98
|
@links.for(path, locale)
|
@@ -100,11 +100,9 @@ module Utopia
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def resolve_link(link)
|
103
|
-
if
|
104
|
-
full_path = File.join(@root, path.dirname, link.key + XNODE_EXTENSION)
|
105
|
-
|
103
|
+
if full_path = link&.full_path(@root)
|
106
104
|
if File.exist?(full_path)
|
107
|
-
return Node.new(self, path, path, full_path)
|
105
|
+
return Node.new(self, link.path, link.path, full_path)
|
108
106
|
end
|
109
107
|
end
|
110
108
|
end
|
@@ -73,4 +73,4 @@ otherwise do |request, path|
|
|
73
73
|
end
|
74
74
|
```
|
75
75
|
|
76
|
-
If you are doing this to perform some kind of rewriting, it may be preferable to use the [Rewrite](../
|
76
|
+
If you are doing this to perform some kind of rewriting, it may be preferable to use the [Rewrite](../Rewrite/) controller layer.
|
@@ -65,19 +65,17 @@ module Utopia
|
|
65
65
|
"\#<#{self.class}#{details.join}>"
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
self.
|
72
|
-
self.instance_variable_get(name).freeze
|
73
|
-
end
|
74
|
-
|
75
|
-
super
|
68
|
+
def self.freeze
|
69
|
+
# This ensures that all class variables are frozen.
|
70
|
+
self.instance_variables.each do |name|
|
71
|
+
self.instance_variable_get(name).freeze
|
76
72
|
end
|
77
73
|
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.direct?(path)
|
78
|
+
path.dirname == uri_path
|
81
79
|
end
|
82
80
|
|
83
81
|
def catch_response
|
data/lib/utopia/path.rb
CHANGED
@@ -136,6 +136,10 @@ module Utopia
|
|
136
136
|
return @components.last == ''
|
137
137
|
end
|
138
138
|
|
139
|
+
def file?
|
140
|
+
return @components.last != ''
|
141
|
+
end
|
142
|
+
|
139
143
|
def to_directory
|
140
144
|
if directory?
|
141
145
|
return self
|
@@ -259,6 +263,8 @@ module Utopia
|
|
259
263
|
end
|
260
264
|
end
|
261
265
|
|
266
|
+
alias last? file?
|
267
|
+
|
262
268
|
# Pops the last path component.
|
263
269
|
def pop
|
264
270
|
# We don't want to convert an absolute path to a relative path.
|
data/lib/utopia/version.rb
CHANGED
data/setup/site/README.md
CHANGED
@@ -6,11 +6,11 @@ Welcome to Utopia, a Ruby framework for web site and application development. Fo
|
|
6
6
|
|
7
7
|
To start the development server, simply execute
|
8
8
|
|
9
|
-
>
|
9
|
+
> bake
|
10
10
|
Generating transient session key for development...
|
11
11
|
20:57:36 - INFO - Starting Falcon HTTP server on localhost:9292
|
12
12
|
20:57:36 - INFO - Guard::RSpec is running
|
13
13
|
20:57:36 - INFO - Guard is now watching at '...'
|
14
14
|
[1] guard(main)>
|
15
15
|
|
16
|
-
Then browse
|
16
|
+
Then browse https://localhost:9292 (or as specified) to see your new site.
|
data/setup/site/config.ru
CHANGED
@@ -14,6 +14,7 @@ else
|
|
14
14
|
use Rack::ShowExceptions unless UTOPIA.testing?
|
15
15
|
end
|
16
16
|
|
17
|
+
# serve static files from public/
|
17
18
|
use Utopia::Static, root: 'public'
|
18
19
|
|
19
20
|
use Utopia::Redirection::Rewrite, {
|
@@ -39,6 +40,7 @@ use Utopia::Session,
|
|
39
40
|
|
40
41
|
use Utopia::Controller
|
41
42
|
|
43
|
+
# serve static files from pages/
|
42
44
|
use Utopia::Static
|
43
45
|
|
44
46
|
# Serve dynamic content
|
data/setup/site/gems.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous" />
|
16
16
|
|
17
|
-
<link rel="icon" type="image/png" href="/_static/icon.
|
17
|
+
<link rel="icon" type="image/png" href="/_static/icon.svg" />
|
18
18
|
<link rel="stylesheet" href="/_static/site.css" type="text/css" media="screen" />
|
19
19
|
</head>
|
20
20
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" 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-linecap:square;stroke-miterlimit:1.5;">
|
3
|
+
<g transform="matrix(0.922789,0,0,0.922789,16.591,0.837867)">
|
4
|
+
<path d="M120.731,31.594L212.702,84.694L212.702,190.893L120.731,243.993L28.759,190.893L28.759,84.694L120.731,31.594Z" style="fill:none;"/>
|
5
|
+
<clipPath id="_clip1">
|
6
|
+
<path d="M120.731,31.594L212.702,84.694L212.702,190.893L120.731,243.993L28.759,190.893L28.759,84.694L120.731,31.594Z"/>
|
7
|
+
</clipPath>
|
8
|
+
<g clip-path="url(#_clip1)">
|
9
|
+
<g transform="matrix(18.3943,0,0,10.62,-1929.57,-966.601)">
|
10
|
+
<g transform="matrix(1,0,0,0.178571,106.463,93.9922)">
|
11
|
+
<rect x="0" y="0" width="10" height="56" style="fill:#f79433;"/>
|
12
|
+
</g>
|
13
|
+
<g transform="matrix(1,0,0,0.416667,106.463,80.6588)">
|
14
|
+
<rect x="0" y="56" width="10" height="24" style="fill:#4e8dd8;"/>
|
15
|
+
</g>
|
16
|
+
</g>
|
17
|
+
</g>
|
18
|
+
<path d="M120.731,31.594L212.702,84.694L212.702,190.893L120.731,243.993L28.759,190.893L28.759,84.694L120.731,31.594Z" style="fill:none;stroke:black;stroke-width:26.01px;"/>
|
19
|
+
</g>
|
20
|
+
</svg>
|
@@ -1 +1,11 @@
|
|
1
|
-
<?xml version="1.0" standalone="no"
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<svg
|
3
|
+
width="100%" height="100%"
|
4
|
+
viewBox="0 0 10 80"
|
5
|
+
preserveAspectRatio="none"
|
6
|
+
version="1.1"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
xmlns:xlink= "http://www.w3.org/1999/xlink">
|
9
|
+
<rect x="0" y="0" width="10" height="56" style="fill:#f79433;"/>
|
10
|
+
<rect x="0" y="56" width="10" height="24" style="fill:#4e8dd8;"/>
|
11
|
+
</svg>
|
@@ -1 +1,19 @@
|
|
1
|
-
<?xml version="1.0" standalone="no"
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<svg
|
3
|
+
width="100%" height="100%"
|
4
|
+
viewBox="0 0 420 80"
|
5
|
+
preserveAspectRatio="none"
|
6
|
+
version="1.1"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
xmlns:xlink= "http://www.w3.org/1999/xlink">
|
9
|
+
<rect x="0" y="0" width="420" height="56" style="fill:#f79433;"/>
|
10
|
+
<rect x="0" y="56" width="420" height="24" style="fill:#4e8dd8;"/>
|
11
|
+
<g>
|
12
|
+
<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;"/>
|
13
|
+
<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;"/>
|
14
|
+
<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;"/>
|
15
|
+
<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;"/>
|
16
|
+
<path d="M362.589,0l-29.477,80l75.888,0l-31.247,-80l-15.164,0Z" style="fill:#fff;fill-rule:nonzero;"/>
|
17
|
+
<rect x="304.879" y="0" width="17.93" height="80" style="fill:#fff;"/>
|
18
|
+
</g>
|
19
|
+
</svg>
|
@@ -34,10 +34,10 @@ RSpec.shared_context "server" do
|
|
34
34
|
require 'benchmark/http/spider'
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
reactor.async do
|
37
|
+
before do
|
38
|
+
@endpoint = Async::HTTP::Endpoint.parse("http://localhost", Async::IO::Endpoint.unix("server.ipc"))
|
39
|
+
|
40
|
+
@server_task = reactor.async do
|
41
41
|
middleware = Falcon::Server.middleware(app)
|
42
42
|
|
43
43
|
server = Falcon::Server.new(middleware, endpoint)
|
@@ -47,6 +47,8 @@ RSpec.shared_context "server" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
after do
|
50
|
-
server_task.stop
|
50
|
+
@server_task.stop
|
51
51
|
end
|
52
|
+
|
53
|
+
let(:endpoint) {@endpoint}
|
52
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: net-smtp
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rack
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -325,7 +339,7 @@ files:
|
|
325
339
|
- setup/site/pages/errors/file-not-found.xnode
|
326
340
|
- setup/site/pages/links.yaml
|
327
341
|
- setup/site/pages/welcome/index.xnode
|
328
|
-
- setup/site/public/_static/icon.
|
342
|
+
- setup/site/public/_static/icon.svg
|
329
343
|
- setup/site/public/_static/site.css
|
330
344
|
- setup/site/public/_static/utopia-background.svg
|
331
345
|
- setup/site/public/_static/utopia.svg
|
@@ -353,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
353
367
|
- !ruby/object:Gem::Version
|
354
368
|
version: '0'
|
355
369
|
requirements: []
|
356
|
-
rubygems_version: 3.
|
370
|
+
rubygems_version: 3.3.3
|
357
371
|
signing_key:
|
358
372
|
specification_version: 4
|
359
373
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
Binary file
|