utopia 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/utopia/.DS_Store +0 -0
- data/lib/utopia/content/.DS_Store +0 -0
- data/lib/utopia/content/link.rb +6 -4
- data/lib/utopia/content/links.rb +4 -2
- data/lib/utopia/content.rb +25 -6
- data/lib/utopia/controller/.DS_Store +0 -0
- data/lib/utopia/localization.rb +2 -0
- data/lib/utopia/static/mime_types.rb +1 -1
- data/lib/utopia/static.rb +41 -23
- data/lib/utopia/version.rb +1 -1
- data/setup/.DS_Store +0 -0
- data/setup/server/.DS_Store +0 -0
- data/setup/site/.DS_Store +0 -0
- data/setup/site/pages/.DS_Store +0 -0
- data/setup/site/public/.DS_Store +0 -0
- data/setup/site/spec/website_spec.rb +1 -2
- data/setup/site/tmp/Gemfile +20 -0
- data.tar.gz.sig +3 -0
- metadata +61 -4
- metadata.gz.sig +3 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56923a2e74dc8c0c9741d25e21e871b8e1aabb2085c47b6f5880af60befa72fa
|
4
|
+
data.tar.gz: 0f7e1423b063dad1c370c700dfeb541a8c3b149b29418086fe2952574b216bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 263fb770d5ea32a76b1c2ce42802194dfd6fb2386304a2b18ee5f71f2d2a3560ce97203a48e8e9a6c6e5eb120236abefc490d6b45df9e032fd4d4d44cb4477fd
|
7
|
+
data.tar.gz: ad207a65dfc5e0cbc270b33769c1113f84f670395e4d4a8a5059a17de7d06e2e69be1d90073f55384a3f9e16b4cbe8918c563ec6696f5270785f8000831c609e
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
data/lib/utopia/content/link.rb
CHANGED
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
@@ -32,6 +32,8 @@ require 'trenni/template'
|
|
32
32
|
|
33
33
|
require 'concurrent/map'
|
34
34
|
|
35
|
+
require 'traces/provider'
|
36
|
+
|
35
37
|
module Utopia
|
36
38
|
# A middleware which serves dynamically generated content based on markup files.
|
37
39
|
class Content
|
@@ -107,6 +109,16 @@ module Utopia
|
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
112
|
+
def respond(link, request)
|
113
|
+
if node = resolve_link(link)
|
114
|
+
attributes = request.env.fetch(VARIABLES_KEY, {}).to_hash
|
115
|
+
|
116
|
+
return node.process!(request, attributes)
|
117
|
+
elsif redirect_uri = link[:uri]
|
118
|
+
return [307, {HTTP::LOCATION => redirect_uri}, []]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
110
122
|
def call(env)
|
111
123
|
request = Rack::Request.new(env)
|
112
124
|
path = Path.create(request.path_info)
|
@@ -124,12 +136,8 @@ module Utopia
|
|
124
136
|
|
125
137
|
locale = env[Localization::CURRENT_LOCALE_KEY]
|
126
138
|
if link = @links.for(path, locale)
|
127
|
-
if
|
128
|
-
|
129
|
-
|
130
|
-
return node.process!(request, attributes)
|
131
|
-
elsif redirect_uri = link[:uri]
|
132
|
-
return [307, {HTTP::LOCATION => redirect_uri}, []]
|
139
|
+
if response = self.respond(link, request)
|
140
|
+
return response
|
133
141
|
end
|
134
142
|
end
|
135
143
|
|
@@ -191,4 +199,15 @@ module Utopia
|
|
191
199
|
end
|
192
200
|
end
|
193
201
|
end
|
202
|
+
|
203
|
+
Traces::Provider(Content) do
|
204
|
+
def respond(link, request)
|
205
|
+
attributes = {
|
206
|
+
'link.key' => link.key,
|
207
|
+
'link.href' => link.href
|
208
|
+
}
|
209
|
+
|
210
|
+
trace("utopia.content.respond", attributes: attributes) {super}
|
211
|
+
end
|
212
|
+
end
|
194
213
|
end
|
Binary file
|
data/lib/utopia/localization.rb
CHANGED
data/lib/utopia/static.rb
CHANGED
@@ -26,6 +26,8 @@ require_relative 'localization'
|
|
26
26
|
require_relative 'static/local_file'
|
27
27
|
require_relative 'static/mime_types'
|
28
28
|
|
29
|
+
require 'traces/provider'
|
30
|
+
|
29
31
|
module Utopia
|
30
32
|
# A middleware which serves static files from the specified root directory.
|
31
33
|
class Static
|
@@ -72,36 +74,52 @@ module Utopia
|
|
72
74
|
ETAG = 'ETag'.freeze
|
73
75
|
ACCEPT_RANGES = 'Accept-Ranges'.freeze
|
74
76
|
|
77
|
+
def respond(env, path_info, extension)
|
78
|
+
path = Path[path_info].simplify
|
79
|
+
|
80
|
+
if locale = env[Localization::CURRENT_LOCALE_KEY]
|
81
|
+
path.last.insert(path.last.rindex('.') || -1, ".#{locale}")
|
82
|
+
end
|
83
|
+
|
84
|
+
if file = fetch_file(path)
|
85
|
+
response_headers = {
|
86
|
+
LAST_MODIFIED => file.mtime_date,
|
87
|
+
CONTENT_TYPE => @extensions[extension],
|
88
|
+
CACHE_CONTROL => @cache_control,
|
89
|
+
ETAG => file.etag,
|
90
|
+
ACCEPT_RANGES => "bytes"
|
91
|
+
}
|
92
|
+
|
93
|
+
if file.modified?(env)
|
94
|
+
return file.serve(env, response_headers)
|
95
|
+
else
|
96
|
+
return [304, response_headers, []]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
75
101
|
def call(env)
|
76
102
|
path_info = env[Rack::PATH_INFO]
|
77
103
|
extension = File.extname(path_info)
|
78
|
-
|
79
|
-
if @extensions.key?
|
80
|
-
|
81
|
-
|
82
|
-
if locale = env[Localization::CURRENT_LOCALE_KEY]
|
83
|
-
path.last.insert(path.last.rindex('.') || -1, ".#{locale}")
|
84
|
-
end
|
85
|
-
|
86
|
-
if file = fetch_file(path)
|
87
|
-
response_headers = {
|
88
|
-
LAST_MODIFIED => file.mtime_date,
|
89
|
-
CONTENT_TYPE => @extensions[extension],
|
90
|
-
CACHE_CONTROL => @cache_control,
|
91
|
-
ETAG => file.etag,
|
92
|
-
ACCEPT_RANGES => "bytes"
|
93
|
-
}
|
94
|
-
|
95
|
-
if file.modified?(env)
|
96
|
-
return file.serve(env, response_headers)
|
97
|
-
else
|
98
|
-
return [304, response_headers, []]
|
99
|
-
end
|
104
|
+
|
105
|
+
if @extensions.key?(extension.downcase)
|
106
|
+
if response = self.respond(env, path_info, extension)
|
107
|
+
return response
|
100
108
|
end
|
101
109
|
end
|
102
|
-
|
110
|
+
|
103
111
|
# else if no file was found:
|
104
112
|
return @app.call(env)
|
105
113
|
end
|
106
114
|
end
|
115
|
+
|
116
|
+
Traces::Provider(Static) do
|
117
|
+
def respond(env, path_info, extension)
|
118
|
+
attributes = {
|
119
|
+
path_info: path_info,
|
120
|
+
}
|
121
|
+
|
122
|
+
trace("utopia.static.respond", attributes: attributes) {super}
|
123
|
+
end
|
124
|
+
end
|
107
125
|
end
|
data/lib/utopia/version.rb
CHANGED
data/setup/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative 'website_context'
|
4
4
|
|
5
|
-
# Learn about best practice specs from http://betterspecs.org
|
6
5
|
RSpec.describe "website", timeout: 120 do
|
7
6
|
include_context "server"
|
8
7
|
|
@@ -13,7 +12,7 @@ RSpec.describe "website", timeout: 120 do
|
|
13
12
|
Async::HTTP::Client.open(endpoint, connection_limit: 8) do |client|
|
14
13
|
spider.fetch(statistics, client, endpoint.url) do |method, uri, response|
|
15
14
|
if response.failure?
|
16
|
-
|
15
|
+
Console.logger.error(endpoint) {"#{method} #{uri} -> #{response.status}"}
|
17
16
|
end
|
18
17
|
end.wait
|
19
18
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
source "https://rubygems.org"
|
3
|
+
|
4
|
+
gem "utopia", "~> 1.8.0"
|
5
|
+
# gem "utopia-tags-gallery"
|
6
|
+
# gem "utopia-tags-google-analytics"
|
7
|
+
|
8
|
+
gem "rake"
|
9
|
+
gem "bundler"
|
10
|
+
|
11
|
+
gem "kramdown"
|
12
|
+
|
13
|
+
group :development do
|
14
|
+
# For `rake server`:
|
15
|
+
gem "puma"
|
16
|
+
|
17
|
+
# For `rake console`:
|
18
|
+
gem "pry"
|
19
|
+
gem "rack-test"
|
20
|
+
end
|
data.tar.gz.sig
ADDED
metadata
CHANGED
@@ -1,14 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- Huba Nagy
|
9
|
+
- Michael Adams
|
10
|
+
- Olle Jonsson
|
11
|
+
- System Administrator
|
12
|
+
- k1tsu
|
8
13
|
autorequire:
|
9
14
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
15
|
+
cert_chain:
|
16
|
+
- |
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
|
19
|
+
ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
|
20
|
+
MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
|
21
|
+
aWFtcy9EQ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SUc6aK
|
36
|
+
vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
|
37
|
+
x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
|
38
|
+
bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
|
39
|
+
Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
|
40
|
+
y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
|
41
|
+
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
42
|
+
HiLJ8VOFx6w=
|
43
|
+
-----END CERTIFICATE-----
|
44
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
12
45
|
dependencies:
|
13
46
|
- !ruby/object:Gem::Dependency
|
14
47
|
name: concurrent-ruby
|
@@ -136,6 +169,20 @@ dependencies:
|
|
136
169
|
- - "~>"
|
137
170
|
- !ruby/object:Gem::Version
|
138
171
|
version: '2.1'
|
172
|
+
- !ruby/object:Gem::Dependency
|
173
|
+
name: traces
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
type: :runtime
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
139
186
|
- !ruby/object:Gem::Dependency
|
140
187
|
name: trenni
|
141
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,12 +322,15 @@ files:
|
|
275
322
|
- bake/utopia/static.rb
|
276
323
|
- bake/utopia/test.rb
|
277
324
|
- bin/utopia
|
325
|
+
- lib/.DS_Store
|
278
326
|
- lib/utopia.rb
|
327
|
+
- lib/utopia/.DS_Store
|
279
328
|
- lib/utopia/command.rb
|
280
329
|
- lib/utopia/command/environment.rb
|
281
330
|
- lib/utopia/command/server.rb
|
282
331
|
- lib/utopia/command/site.rb
|
283
332
|
- lib/utopia/content.rb
|
333
|
+
- lib/utopia/content/.DS_Store
|
284
334
|
- lib/utopia/content/document.rb
|
285
335
|
- lib/utopia/content/link.rb
|
286
336
|
- lib/utopia/content/links.rb
|
@@ -291,6 +341,7 @@ files:
|
|
291
341
|
- lib/utopia/content/tags.rb
|
292
342
|
- lib/utopia/content_length.rb
|
293
343
|
- lib/utopia/controller.rb
|
344
|
+
- lib/utopia/controller/.DS_Store
|
294
345
|
- lib/utopia/controller/actions.md
|
295
346
|
- lib/utopia/controller/actions.rb
|
296
347
|
- lib/utopia/controller/base.rb
|
@@ -321,7 +372,10 @@ files:
|
|
321
372
|
- lib/utopia/static/local_file.rb
|
322
373
|
- lib/utopia/static/mime_types.rb
|
323
374
|
- lib/utopia/version.rb
|
375
|
+
- setup/.DS_Store
|
376
|
+
- setup/server/.DS_Store
|
324
377
|
- setup/server/git/hooks/post-receive
|
378
|
+
- setup/site/.DS_Store
|
325
379
|
- setup/site/.gitignore
|
326
380
|
- setup/site/.rspec
|
327
381
|
- setup/site/Guardfile
|
@@ -333,12 +387,14 @@ files:
|
|
333
387
|
- setup/site/falcon.rb
|
334
388
|
- setup/site/gems.rb
|
335
389
|
- setup/site/lib/readme.txt
|
390
|
+
- setup/site/pages/.DS_Store
|
336
391
|
- setup/site/pages/_heading.xnode
|
337
392
|
- setup/site/pages/_page.xnode
|
338
393
|
- setup/site/pages/errors/exception.xnode
|
339
394
|
- setup/site/pages/errors/file-not-found.xnode
|
340
395
|
- setup/site/pages/links.yaml
|
341
396
|
- setup/site/pages/welcome/index.xnode
|
397
|
+
- setup/site/public/.DS_Store
|
342
398
|
- setup/site/public/_static/icon.svg
|
343
399
|
- setup/site/public/_static/site.css
|
344
400
|
- setup/site/public/_static/utopia-background.svg
|
@@ -347,6 +403,7 @@ files:
|
|
347
403
|
- setup/site/spec/spec_helper.rb
|
348
404
|
- setup/site/spec/website_context.rb
|
349
405
|
- setup/site/spec/website_spec.rb
|
406
|
+
- setup/site/tmp/Gemfile
|
350
407
|
homepage: https://github.com/ioquatix/utopia
|
351
408
|
licenses:
|
352
409
|
- MIT
|
@@ -367,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
367
424
|
- !ruby/object:Gem::Version
|
368
425
|
version: '0'
|
369
426
|
requirements: []
|
370
|
-
rubygems_version: 3.3.
|
427
|
+
rubygems_version: 3.3.7
|
371
428
|
signing_key:
|
372
429
|
specification_version: 4
|
373
430
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
metadata.gz.sig
ADDED