utopia 2.18.4 → 2.19.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bake/utopia/node.rb +22 -2
- data/lib/utopia/content/link.rb +6 -0
- 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/static/mime_types.rb +1 -1
- data/lib/utopia/version.rb +1 -1
- data/setup/site/gems.rb +1 -0
- data/setup/site/spec/website_context.rb +7 -5
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afe16033d2147ab12f15fc57a7f22662691ef24fa5f9c2281ae661449e6cbef8
|
4
|
+
data.tar.gz: f1120652e3576dd04a33ee41c72532154566bfd257328bf324592c0e0dd3400a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c10bac71475edee0ec72765c4f313a3ad3b78decd3b141c4b3dca90b137eba79982a894dda1961d83f9b747d1bdca62bf46161e877577e2aa01ebff984da271
|
7
|
+
data.tar.gz: e253761fc895fd0d4086a7febcdfeb50b060067df76f8f067b273f18ed0984511687745e0f408e76ea2a481683a3e0662944e0d71d09243d3aaa54b082ac24e6
|
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/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
|
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/gems.rb
CHANGED
@@ -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.2
|
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-27 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
|
@@ -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.4.0.dev
|
357
371
|
signing_key:
|
358
372
|
specification_version: 4
|
359
373
|
summary: Utopia is a framework for building dynamic content-driven websites.
|