utopia 2.25.0 → 2.26.1
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/bake/utopia/environment.rb +16 -12
- data/bake/utopia/node.rb +5 -5
- data/bake/utopia/server.rb +8 -8
- data/bake/utopia/shell.rb +3 -3
- data/bake/utopia/site.rb +16 -16
- data/bake/utopia/static.rb +8 -8
- data/bake/utopia.rb +4 -4
- data/lib/utopia/content/document.rb +4 -4
- data/lib/utopia/content/link.rb +10 -10
- data/lib/utopia/content/links.rb +5 -5
- data/lib/utopia/content/markup.rb +5 -5
- data/lib/utopia/content/node.rb +8 -8
- data/lib/utopia/content/response.rb +5 -5
- data/lib/utopia/content/tags.rb +8 -8
- data/lib/utopia/content.rb +18 -18
- data/lib/utopia/controller/actions.rb +5 -5
- data/lib/utopia/controller/base.rb +2 -2
- data/lib/utopia/controller/respond.rb +6 -6
- data/lib/utopia/controller/rewrite.rb +3 -3
- data/lib/utopia/controller.rb +10 -10
- data/lib/utopia/exceptions/handler.rb +3 -3
- data/lib/utopia/exceptions/mailer.rb +31 -9
- data/lib/utopia/exceptions.rb +3 -3
- data/lib/utopia/extensions/date_comparisons.rb +2 -2
- data/lib/utopia/http.rb +36 -36
- data/lib/utopia/locale.rb +3 -3
- data/lib/utopia/localization.rb +7 -7
- data/lib/utopia/middleware.rb +5 -5
- data/lib/utopia/path/matcher.rb +2 -2
- data/lib/utopia/path.rb +21 -21
- data/lib/utopia/redirection.rb +4 -4
- data/lib/utopia/responder.rb +2 -2
- data/lib/utopia/session/serialization.rb +4 -4
- data/lib/utopia/session.rb +8 -8
- data/lib/utopia/setup.rb +7 -7
- data/lib/utopia/shell.rb +5 -5
- data/lib/utopia/static/local_file.rb +8 -8
- data/lib/utopia/static/mime_types.rb +2 -2
- data/lib/utopia/static.rb +11 -11
- data/lib/utopia/version.rb +1 -1
- data/lib/utopia.rb +7 -8
- data/license.md +1 -1
- data/readme.md +1 -1
- data/setup/server/git/hooks/post-receive +10 -9
- data/setup/site/Guardfile +3 -2
- data/setup/site/bake.rb +3 -3
- data/setup/site/config/environment.rb +3 -3
- data/setup/site/config/sus.rb +3 -3
- data/setup/site/config.ru +8 -8
- data/setup/site/fixtures/website.rb +6 -6
- data/setup/site/gems.rb +13 -13
- data/setup/site/test/website.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +3 -9
- metadata.gz.sig +0 -0
- data/lib/utopia/content_length.rb +0 -33
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "msgpack"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "time"
|
9
|
+
require "date"
|
10
10
|
|
11
11
|
module Utopia
|
12
12
|
class Session
|
data/lib/utopia/session.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2014-
|
4
|
+
# Copyright, 2014-2025, by Samuel Williams.
|
5
5
|
# Copyright, 2019, by Huba Nagy.
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
7
|
+
require "openssl"
|
8
|
+
require "digest/sha2"
|
9
|
+
require "console"
|
10
|
+
require "json"
|
11
11
|
|
12
|
-
require_relative
|
13
|
-
require_relative
|
12
|
+
require_relative "session/lazy_hash"
|
13
|
+
require_relative "session/serialization"
|
14
14
|
|
15
15
|
module Utopia
|
16
16
|
# A middleware which provides a secure client-side session storage using a private symmetric encrpytion key.
|
@@ -20,7 +20,7 @@ module Utopia
|
|
20
20
|
|
21
21
|
MAXIMUM_SIZE = 1024*32
|
22
22
|
|
23
|
-
SECRET_KEY =
|
23
|
+
SECRET_KEY = "UTOPIA_SESSION_SECRET".freeze
|
24
24
|
|
25
25
|
RACK_SESSION = "rack.session".freeze
|
26
26
|
CIPHER_ALGORITHM = "aes-256-cbc"
|
data/lib/utopia/setup.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2010-
|
4
|
+
# Copyright, 2010-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "yaml"
|
7
|
+
require "securerandom"
|
8
8
|
|
9
|
-
require
|
9
|
+
require "variant"
|
10
10
|
|
11
|
-
require
|
11
|
+
require "console"
|
12
12
|
|
13
13
|
module Utopia
|
14
14
|
# Used for setting up a Utopia web application, typically via `config/environment.rb`
|
@@ -58,11 +58,11 @@ module Utopia
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def apply!
|
61
|
-
add_load_path(
|
61
|
+
add_load_path("lib")
|
62
62
|
|
63
63
|
apply_environment
|
64
64
|
|
65
|
-
require_relative
|
65
|
+
require_relative "../utopia"
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
data/lib/utopia/shell.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require "rack/builder"
|
7
|
+
require "rack/test"
|
8
|
+
require "irb"
|
9
9
|
|
10
10
|
module Utopia
|
11
11
|
# This is designed to be used with the corresponding bake task.
|
@@ -19,7 +19,7 @@ module Utopia
|
|
19
19
|
|
20
20
|
def app
|
21
21
|
@app ||= Rack::Builder.parse_file(
|
22
|
-
File.expand_path(
|
22
|
+
File.expand_path("config.ru", @context.root)
|
23
23
|
).first
|
24
24
|
end
|
25
25
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "time"
|
7
|
+
require "digest/sha1"
|
8
8
|
|
9
9
|
module Utopia
|
10
10
|
# A middleware which serves static files from the specified root directory.
|
@@ -64,23 +64,23 @@ module Utopia
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def modified?(env)
|
67
|
-
if modified_since = env[
|
67
|
+
if modified_since = env["HTTP_IF_MODIFIED_SINCE"]
|
68
68
|
return false if File.mtime(full_path) <= Time.parse(modified_since)
|
69
69
|
end
|
70
70
|
|
71
|
-
if etags = env[
|
71
|
+
if etags = env["HTTP_IF_NONE_MATCH"]
|
72
72
|
etags = etags.split(/\s*,\s*/)
|
73
|
-
return false if etags.include?(etag) || etags.include?(
|
73
|
+
return false if etags.include?(etag) || etags.include?("*")
|
74
74
|
end
|
75
75
|
|
76
76
|
return true
|
77
77
|
end
|
78
78
|
|
79
79
|
CONTENT_LENGTH = Rack::CONTENT_LENGTH
|
80
|
-
CONTENT_RANGE =
|
80
|
+
CONTENT_RANGE = "Content-Range".freeze
|
81
81
|
|
82
82
|
def serve(env, response_headers)
|
83
|
-
ranges = Rack::Utils.get_byte_ranges(env[
|
83
|
+
ranges = Rack::Utils.get_byte_ranges(env["HTTP_RANGE"], size)
|
84
84
|
response = [200, response_headers, self]
|
85
85
|
|
86
86
|
# puts "Requesting ranges: #{ranges.inspect} (#{size})"
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "mime/types"
|
7
7
|
|
8
8
|
module Utopia
|
9
9
|
# A middleware which serves static files from the specified root directory.
|
data/lib/utopia/static.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2009-
|
4
|
+
# Copyright, 2009-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "middleware"
|
7
|
+
require_relative "localization"
|
8
8
|
|
9
|
-
require_relative
|
10
|
-
require_relative
|
9
|
+
require_relative "static/local_file"
|
10
|
+
require_relative "static/mime_types"
|
11
11
|
|
12
|
-
require
|
12
|
+
require "traces/provider"
|
13
13
|
|
14
14
|
module Utopia
|
15
15
|
# A middleware which serves static files from the specified root directory.
|
16
16
|
class Static
|
17
|
-
DEFAULT_CACHE_CONTROL =
|
17
|
+
DEFAULT_CACHE_CONTROL = "public, max-age=3600".freeze
|
18
18
|
|
19
19
|
# @param root [String] The root directory to serve files from.
|
20
20
|
# @param types [Array] The mime-types (and file extensions) to recognize/serve.
|
@@ -51,17 +51,17 @@ module Utopia
|
|
51
51
|
|
52
52
|
attr :extensions
|
53
53
|
|
54
|
-
LAST_MODIFIED =
|
54
|
+
LAST_MODIFIED = "Last-Modified".freeze
|
55
55
|
CONTENT_TYPE = HTTP::CONTENT_TYPE
|
56
56
|
CACHE_CONTROL = HTTP::CACHE_CONTROL
|
57
|
-
ETAG =
|
58
|
-
ACCEPT_RANGES =
|
57
|
+
ETAG = "ETag".freeze
|
58
|
+
ACCEPT_RANGES = "Accept-Ranges".freeze
|
59
59
|
|
60
60
|
def respond(env, path_info, extension)
|
61
61
|
path = Path[path_info].simplify
|
62
62
|
|
63
63
|
if locale = env[Localization::CURRENT_LOCALE_KEY]
|
64
|
-
path.last.insert(path.last.rindex(
|
64
|
+
path.last.insert(path.last.rindex(".") || -1, ".#{locale}")
|
65
65
|
end
|
66
66
|
|
67
67
|
if file = fetch_file(path)
|
data/lib/utopia/version.rb
CHANGED
data/lib/utopia.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2009-
|
4
|
+
# Copyright, 2009-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "utopia/version"
|
7
7
|
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative 'utopia/content_length'
|
8
|
+
require_relative "utopia/content"
|
9
|
+
require_relative "utopia/controller"
|
10
|
+
require_relative "utopia/exceptions"
|
11
|
+
require_relative "utopia/redirection"
|
12
|
+
require_relative "utopia/static"
|
14
13
|
|
15
14
|
# Utopia is a web application framework built on top of Rack.
|
16
15
|
module Utopia
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.
|
4
4
|
|
5
|
-
[![Development Status](https://github.com/
|
5
|
+
[![Development Status](https://github.com/ioquatix/utopia/workflows/Test/badge.svg)](https://github.com/ioquatix/utopia/actions?workflow=Test)
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
5
|
#
|
@@ -20,7 +21,7 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
22
|
# THE SOFTWARE.
|
22
23
|
|
23
|
-
require
|
24
|
+
require "etc"
|
24
25
|
|
25
26
|
# Add the following into sudoers for this to work correctly:
|
26
27
|
# Users in group wheel can execute all commands as user http with no password.
|
@@ -29,25 +30,25 @@ require 'etc'
|
|
29
30
|
GIT_WORK_TREE = `git config core.worktree`.chomp
|
30
31
|
|
31
32
|
# We convert GIT_DIR to an absolute path:
|
32
|
-
ENV[
|
33
|
+
ENV["GIT_DIR"] = File.join(Dir.pwd, ENV["GIT_DIR"])
|
33
34
|
|
34
35
|
# We deploy the site as the user and group of the directory for the working tree:
|
35
36
|
File.stat(GIT_WORK_TREE).tap do |stat|
|
36
|
-
ENV[
|
37
|
-
ENV[
|
37
|
+
ENV["DEPLOY_USER"] = DEPLOY_USER = Etc.getpwuid(stat.uid).name
|
38
|
+
ENV["DEPLOY_GROUP"] = DEPLOY_GROUP = Etc.getgrgid(stat.gid).name
|
38
39
|
end
|
39
40
|
|
40
41
|
WHOAMI = `whoami`.chomp!
|
41
42
|
|
42
43
|
# We should find out if we need to use sudo or not:
|
43
44
|
SUDO = if WHOAMI != DEPLOY_USER
|
44
|
-
[
|
45
|
+
["sudo", "-u", DEPLOY_USER]
|
45
46
|
end
|
46
47
|
|
47
48
|
CommandFailure = Class.new(StandardError)
|
48
49
|
|
49
50
|
def sh(command)
|
50
|
-
puts command.join(
|
51
|
+
puts command.join(" ")
|
51
52
|
unless system(*command)
|
52
53
|
raise CommandFailure.new("#{command.join(' ')} failed with #{$?}!")
|
53
54
|
end
|
@@ -62,13 +63,13 @@ Dir.chdir(GIT_WORK_TREE) do
|
|
62
63
|
sudo %W{git checkout -f}
|
63
64
|
sudo %W{git submodule update -i}
|
64
65
|
|
65
|
-
if File.exist?
|
66
|
+
if File.exist? "gems.rb"
|
66
67
|
sudo %W{bundle install}
|
67
68
|
end
|
68
69
|
|
69
|
-
if File.exist?
|
70
|
+
if File.exist? "bake.rb"
|
70
71
|
sudo %W{bundle exec bake deploy restart}
|
71
|
-
elsif File.exist?
|
72
|
+
elsif File.exist? "Rakefile"
|
72
73
|
sudo %W{bundle exec rake deploy restart}
|
73
74
|
end
|
74
75
|
end
|
data/setup/site/Guardfile
CHANGED
data/setup/site/bake.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2025, by Samuel Williams.
|
5
5
|
|
6
6
|
def deploy
|
7
7
|
# This task is typiclly run after the site is updated but before the server is restarted.
|
@@ -9,10 +9,10 @@ end
|
|
9
9
|
|
10
10
|
# Restart the application server.
|
11
11
|
def restart
|
12
|
-
call
|
12
|
+
call "falcon:supervisor:restart"
|
13
13
|
end
|
14
14
|
|
15
15
|
# Start the development server.
|
16
16
|
def default
|
17
|
-
call
|
17
|
+
call "utopia:development"
|
18
18
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-
|
4
|
+
# Copyright, 2016-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "bundler/setup"
|
7
7
|
Bundler.setup
|
8
8
|
|
9
|
-
require
|
9
|
+
require "utopia/setup"
|
10
10
|
UTOPIA ||= Utopia.setup
|
data/setup/site/config/sus.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-
|
4
|
+
# Copyright, 2017-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "variant"
|
7
7
|
Variant.force!(:testing)
|
8
8
|
|
9
|
-
require
|
9
|
+
require "covered/sus"
|
10
10
|
include Covered::Sus
|
data/setup/site/config.ru
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rackup
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative
|
4
|
+
require_relative "config/environment"
|
5
5
|
|
6
6
|
self.freeze_app
|
7
7
|
|
@@ -15,24 +15,24 @@ else
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Serve static files from "public" directory:
|
18
|
-
use Utopia::Static, root:
|
18
|
+
use Utopia::Static, root: "public"
|
19
19
|
|
20
20
|
use Utopia::Redirection::Rewrite, {
|
21
|
-
|
21
|
+
"/" => "/welcome/index"
|
22
22
|
}
|
23
23
|
|
24
24
|
use Utopia::Redirection::DirectoryIndex
|
25
25
|
|
26
26
|
use Utopia::Redirection::Errors, {
|
27
|
-
404 =>
|
27
|
+
404 => "/errors/file-not-found"
|
28
28
|
}
|
29
29
|
|
30
|
-
require
|
30
|
+
require "utopia/localization"
|
31
31
|
use Utopia::Localization,
|
32
|
-
default_locale:
|
33
|
-
locales: [
|
32
|
+
default_locale: "en",
|
33
|
+
locales: ["en", "de", "ja", "zh"]
|
34
34
|
|
35
|
-
require
|
35
|
+
require "utopia/session"
|
36
36
|
use Utopia::Session,
|
37
37
|
expires_after: 3600 * 24,
|
38
38
|
secret: UTOPIA.secret_for(:session),
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-
|
4
|
+
# Copyright, 2016-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require "rack/test"
|
7
|
+
require "sus/fixtures/async/http"
|
8
|
+
require "protocol/rack"
|
9
9
|
|
10
10
|
AWebsite = Sus::Shared("a website") do
|
11
11
|
include Rack::Test::Methods
|
12
12
|
|
13
|
-
let(:rackup_path) {File.expand_path(
|
13
|
+
let(:rackup_path) {File.expand_path("../config.ru", __dir__)}
|
14
14
|
let(:rackup_directory) {File.dirname(rackup_path)}
|
15
15
|
|
16
16
|
let(:app) {Rack::Builder.parse_file(rackup_path)}
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
AServer = Sus::Shared("a server") do
|
32
32
|
include Sus::Fixtures::Async::HTTP::ServerContext
|
33
33
|
|
34
|
-
let(:rackup_path) {File.expand_path(
|
34
|
+
let(:rackup_path) {File.expand_path("../config.ru", __dir__)}
|
35
35
|
let(:rackup_directory) {File.dirname(rackup_path)}
|
36
36
|
|
37
37
|
let(:rack_app) {Rack::Builder.parse_file(rackup_path)}
|
data/setup/site/gems.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2012-
|
4
|
+
# Copyright, 2012-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
source
|
6
|
+
source "https://rubygems.org"
|
7
7
|
|
8
8
|
group :preload do
|
9
|
-
gem
|
9
|
+
gem "utopia", "~> $UTOPIA_VERSION"
|
10
10
|
# gem 'utopia-gallery'
|
11
11
|
# gem 'utopia-analytics'
|
12
12
|
|
13
|
-
gem
|
13
|
+
gem "variant"
|
14
14
|
end
|
15
15
|
|
16
|
-
gem
|
16
|
+
gem "net-smtp"
|
17
17
|
|
18
18
|
group :development do
|
19
|
-
gem
|
20
|
-
gem
|
21
|
-
gem
|
19
|
+
gem "bake-test"
|
20
|
+
gem "rack-test"
|
21
|
+
gem "guard-falcon", require: false
|
22
22
|
|
23
|
-
gem
|
24
|
-
gem
|
23
|
+
gem "sus"
|
24
|
+
gem "sus-fixtures-async-http"
|
25
25
|
|
26
|
-
gem
|
26
|
+
gem "covered"
|
27
27
|
|
28
|
-
gem
|
28
|
+
gem "benchmark-http"
|
29
29
|
end
|
30
30
|
|
31
31
|
group :production do
|
32
|
-
gem
|
32
|
+
gem "falcon"
|
33
33
|
end
|
data/setup/site/test/website.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-
|
4
|
+
# Copyright, 2016-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "website"
|
7
|
+
require "benchmark/http"
|
8
8
|
|
9
9
|
describe "website" do
|
10
10
|
include_context AServer
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.26.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -9,7 +9,6 @@ authors:
|
|
9
9
|
- Michael Adams
|
10
10
|
- Olle Jonsson
|
11
11
|
- Pierre Montelle
|
12
|
-
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain:
|
15
14
|
- |
|
@@ -41,7 +40,7 @@ cert_chain:
|
|
41
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
42
|
-----END CERTIFICATE-----
|
44
|
-
date:
|
43
|
+
date: 2025-01-28 00:00:00.000000000 Z
|
45
44
|
dependencies:
|
46
45
|
- !ruby/object:Gem::Dependency
|
47
46
|
name: bake
|
@@ -225,8 +224,6 @@ dependencies:
|
|
225
224
|
- - "~>"
|
226
225
|
- !ruby/object:Gem::Version
|
227
226
|
version: '0.4'
|
228
|
-
description:
|
229
|
-
email:
|
230
227
|
executables: []
|
231
228
|
extensions: []
|
232
229
|
extra_rdoc_files: []
|
@@ -248,7 +245,6 @@ files:
|
|
248
245
|
- lib/utopia/content/node.rb
|
249
246
|
- lib/utopia/content/response.rb
|
250
247
|
- lib/utopia/content/tags.rb
|
251
|
-
- lib/utopia/content_length.rb
|
252
248
|
- lib/utopia/controller.rb
|
253
249
|
- lib/utopia/controller/actions.md
|
254
250
|
- lib/utopia/controller/actions.rb
|
@@ -312,7 +308,6 @@ licenses:
|
|
312
308
|
metadata:
|
313
309
|
funding_uri: https://github.com/sponsors/ioquatix/
|
314
310
|
source_code_uri: https://github.com/ioquatix/utopia.git
|
315
|
-
post_install_message:
|
316
311
|
rdoc_options: []
|
317
312
|
require_paths:
|
318
313
|
- lib
|
@@ -327,8 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
327
322
|
- !ruby/object:Gem::Version
|
328
323
|
version: '0'
|
329
324
|
requirements: []
|
330
|
-
rubygems_version: 3.
|
331
|
-
signing_key:
|
325
|
+
rubygems_version: 3.6.2
|
332
326
|
specification_version: 4
|
333
327
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
334
328
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative 'middleware'
|
7
|
-
|
8
|
-
module Utopia
|
9
|
-
# A faster implementation of Rack::ContentLength which doesn't rewrite body, but does expect it to either be an Array or an object that responds to #bytesize.
|
10
|
-
class ContentLength
|
11
|
-
def initialize(app)
|
12
|
-
@app = app
|
13
|
-
end
|
14
|
-
|
15
|
-
def content_length_of(body)
|
16
|
-
if body.respond_to?(:map)
|
17
|
-
return body.map(&:bytesize).reduce(0, :+)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def call(env)
|
22
|
-
response = @app.call(env)
|
23
|
-
|
24
|
-
unless response[2]&.empty? or response[1].include?(Rack::CONTENT_LENGTH)
|
25
|
-
if content_length = self.content_length_of(response[2])
|
26
|
-
response[1][Rack::CONTENT_LENGTH] = content_length
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
return response
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|