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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 677174ac49d8e0a2194ce704a4ef9913ea441f0870e15240e544d7ffa96543cb
4
- data.tar.gz: c0344d7c6a00eea78414fce663ed9c6a6d03d37d36fc47e6c5f7f422de4b7cb2
3
+ metadata.gz: 56923a2e74dc8c0c9741d25e21e871b8e1aabb2085c47b6f5880af60befa72fa
4
+ data.tar.gz: 0f7e1423b063dad1c370c700dfeb541a8c3b149b29418086fe2952574b216bfc
5
5
  SHA512:
6
- metadata.gz: cf487dfd07bcf584a0aca8a9d8f6b4c97151941155a98a1d506c5c8d80bbe26e13f253f347e09d04f556ca3182380b8fd01363ebb37582cd15bd0b88e5a1690f
7
- data.tar.gz: '069036ceb3bf30f8d04d7523126434043123d17f657d3ebc84225d5213ca43ac0935058a26feec316a744576d46084042ca97e44f54c68150d7c634324b18b33'
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
@@ -43,10 +43,12 @@ module Utopia
43
43
  end
44
44
 
45
45
  def key
46
- if locale
47
- "#{@path.last}.#{@locale}"
48
- else
49
- @path.last
46
+ if @path
47
+ if locale
48
+ "#{@path.last}.#{@locale}"
49
+ else
50
+ @path.last
51
+ end
50
52
  end
51
53
  end
52
54
 
@@ -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) && data = YAML.load_file(yaml_path)
146
- return symbolize_keys(data)
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
@@ -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 node = resolve_link(link)
128
- attributes = request.env.fetch(VARIABLES_KEY, {}).to_hash
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
@@ -219,6 +219,8 @@ module Utopia
219
219
  response = @app.call(localized_env)
220
220
 
221
221
  break unless response[0] >= 400
222
+
223
+ response[2].close if response[2].respond_to?(:close)
222
224
  end
223
225
 
224
226
  return vary(env, response)
@@ -52,7 +52,7 @@ module Utopia
52
52
  ["torrent", "application/x-bittorrent"]
53
53
  ],
54
54
  :images => [
55
- "png", "gif", "jpeg", "tiff", "svg"
55
+ "png", "gif", "jpeg", "tiff", "svg", "webp"
56
56
  ],
57
57
  :default => [
58
58
  :media, :text, :archive, :images, :fonts
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? extension.downcase
80
- path = Path[path_info].simplify
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
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Utopia
24
- VERSION = "2.19.0"
24
+ VERSION = "2.20.0"
25
25
  end
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
- Async.logger.error{"#{method} #{uri} -> #{response.status}"}
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
@@ -0,0 +1,3 @@
1
+ d���sT͡Jĭ�z:�ѡ�Eؗ�u�A\��+U<t�<$\&�ݗ��*�m�h�h)�������}��j?���&�v�Τ�X�|4�
2
+ �#V����� j�6��H�h?�֘l}L����Uo�N98O'7��Cz�����+��R��];ɩ�lcLW�U��sP�J�!DJ
3
+ �b�y��敗��C� �/�?[� DuYLJJ�kn�•��6���U�S�8�5T�Z�f�Z�Pi��T=7q�߈ f�f
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.19.0
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
- date: 2021-12-25 00:00:00.000000000 Z
15
+ cert_chain:
16
+ - |
17
+ -----BEGIN CERTIFICATE-----
18
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
19
+ ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
20
+ MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
21
+ aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
22
+ AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
23
+ xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
24
+ eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
25
+ L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlr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hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+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.2
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
@@ -0,0 +1,3 @@
1
+ h�+��5�0��#�1EG�4�ۛĉ�k��d�XHx�ĉ��n��"S �n�&Q������^_�&�K�iq�j�1v�
2
+ )U_�煉$!T80�<��BoZK� %=�\�35�!��I�P]�`�Ri�
3
+ ���2l�݄n��