utopia 2.24.4 → 2.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/bake/utopia/environment.rb +16 -12
  4. data/bake/utopia/node.rb +5 -5
  5. data/bake/utopia/server.rb +8 -8
  6. data/bake/utopia/shell.rb +3 -3
  7. data/bake/utopia/site.rb +16 -16
  8. data/bake/utopia/static.rb +8 -8
  9. data/bake/utopia.rb +4 -4
  10. data/lib/utopia/content/document.rb +4 -4
  11. data/lib/utopia/content/link.rb +10 -10
  12. data/lib/utopia/content/links.rb +5 -5
  13. data/lib/utopia/content/markup.rb +6 -6
  14. data/lib/utopia/content/node.rb +8 -8
  15. data/lib/utopia/content/response.rb +5 -5
  16. data/lib/utopia/content/tags.rb +8 -8
  17. data/lib/utopia/content.rb +18 -18
  18. data/lib/utopia/controller/actions.rb +5 -5
  19. data/lib/utopia/controller/base.rb +2 -2
  20. data/lib/utopia/controller/respond.rb +6 -6
  21. data/lib/utopia/controller/rewrite.rb +3 -3
  22. data/lib/utopia/controller.rb +10 -10
  23. data/lib/utopia/exceptions/handler.rb +3 -3
  24. data/lib/utopia/exceptions/mailer.rb +9 -9
  25. data/lib/utopia/exceptions.rb +3 -3
  26. data/lib/utopia/extensions/date_comparisons.rb +2 -2
  27. data/lib/utopia/http.rb +36 -36
  28. data/lib/utopia/locale.rb +3 -3
  29. data/lib/utopia/localization.rb +7 -7
  30. data/lib/utopia/middleware.rb +5 -5
  31. data/lib/utopia/path/matcher.rb +2 -2
  32. data/lib/utopia/path.rb +21 -21
  33. data/lib/utopia/redirection.rb +4 -4
  34. data/lib/utopia/responder.rb +2 -2
  35. data/lib/utopia/session/serialization.rb +4 -4
  36. data/lib/utopia/session.rb +8 -8
  37. data/lib/utopia/setup.rb +7 -7
  38. data/lib/utopia/shell.rb +5 -5
  39. data/lib/utopia/static/local_file.rb +8 -8
  40. data/lib/utopia/static/mime_types.rb +2 -2
  41. data/lib/utopia/static.rb +11 -11
  42. data/lib/utopia/version.rb +1 -1
  43. data/lib/utopia.rb +7 -8
  44. data/license.md +1 -1
  45. data/readme.md +1 -1
  46. data/setup/server/git/hooks/post-receive +10 -9
  47. data/setup/site/Guardfile +3 -2
  48. data/setup/site/bake.rb +3 -3
  49. data/setup/site/config/environment.rb +3 -3
  50. data/setup/site/config/sus.rb +3 -3
  51. data/setup/site/config.ru +8 -8
  52. data/setup/site/fixtures/website.rb +6 -6
  53. data/setup/site/gems.rb +13 -13
  54. data/setup/site/test/website.rb +3 -3
  55. data.tar.gz.sig +0 -0
  56. metadata +3 -9
  57. metadata.gz.sig +0 -0
  58. data/lib/utopia/content_length.rb +0 -33
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2014-2024, by Samuel Williams.
4
+ # Copyright, 2014-2025, by Samuel Williams.
5
5
  # Copyright, 2019, by Huba Nagy.
6
6
 
7
- require 'openssl'
8
- require 'digest/sha2'
9
- require 'console'
10
- require 'json'
7
+ require "openssl"
8
+ require "digest/sha2"
9
+ require "console"
10
+ require "json"
11
11
 
12
- require_relative 'session/lazy_hash'
13
- require_relative 'session/serialization'
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 = 'UTOPIA_SESSION_SECRET'.freeze
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-2024, by Samuel Williams.
4
+ # Copyright, 2010-2025, by Samuel Williams.
5
5
 
6
- require 'yaml'
7
- require 'securerandom'
6
+ require "yaml"
7
+ require "securerandom"
8
8
 
9
- require 'variant'
9
+ require "variant"
10
10
 
11
- require 'console'
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('lib')
61
+ add_load_path("lib")
62
62
 
63
63
  apply_environment
64
64
 
65
- require_relative '../utopia'
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-2022, by Samuel Williams.
4
+ # Copyright, 2020-2025, by Samuel Williams.
5
5
 
6
- require 'rack/builder'
7
- require 'rack/test'
8
- require 'irb'
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('config.ru', @context.root)
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-2022, by Samuel Williams.
4
+ # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
- require 'time'
7
- require 'digest/sha1'
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['HTTP_IF_MODIFIED_SINCE']
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['HTTP_IF_NONE_MATCH']
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 = 'Content-Range'.freeze
80
+ CONTENT_RANGE = "Content-Range".freeze
81
81
 
82
82
  def serve(env, response_headers)
83
- ranges = Rack::Utils.get_byte_ranges(env['HTTP_RANGE'], size)
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-2022, by Samuel Williams.
4
+ # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
- require 'mime/types'
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-2023, by Samuel Williams.
4
+ # Copyright, 2009-2025, by Samuel Williams.
5
5
 
6
- require_relative 'middleware'
7
- require_relative 'localization'
6
+ require_relative "middleware"
7
+ require_relative "localization"
8
8
 
9
- require_relative 'static/local_file'
10
- require_relative 'static/mime_types'
9
+ require_relative "static/local_file"
10
+ require_relative "static/mime_types"
11
11
 
12
- require 'traces/provider'
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 = 'public, max-age=3600'.freeze
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 = 'Last-Modified'.freeze
54
+ LAST_MODIFIED = "Last-Modified".freeze
55
55
  CONTENT_TYPE = HTTP::CONTENT_TYPE
56
56
  CACHE_CONTROL = HTTP::CACHE_CONTROL
57
- ETAG = 'ETag'.freeze
58
- ACCEPT_RANGES = 'Accept-Ranges'.freeze
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('.') || -1, ".#{locale}")
64
+ path.last.insert(path.last.rindex(".") || -1, ".#{locale}")
65
65
  end
66
66
 
67
67
  if file = fetch_file(path)
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2009-2024, by Samuel Williams.
5
5
 
6
6
  module Utopia
7
- VERSION = "2.24.4"
7
+ VERSION = "2.26.0"
8
8
  end
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-2022, by Samuel Williams.
4
+ # Copyright, 2009-2025, by Samuel Williams.
5
5
 
6
- require_relative 'utopia/version'
6
+ require_relative "utopia/version"
7
7
 
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'
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
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2009-2024, by Samuel Williams.
3
+ Copyright, 2009-2025, by Samuel Williams.
4
4
  Copyright, 2015-2019, by Huba Nagy.
5
5
  Copyright, 2020, by Olle Jonsson.
6
6
  Copyright, 2020, by Pierre Montelle.
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/socketry/utopia/workflows/Test/badge.svg)](https://github.com/socketry/utopia/actions?workflow=Test)
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 'etc'
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['GIT_DIR'] = File.join(Dir.pwd, ENV['GIT_DIR'])
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['DEPLOY_USER'] = DEPLOY_USER = Etc.getpwuid(stat.uid).name
37
- ENV['DEPLOY_GROUP'] = DEPLOY_GROUP = Etc.getgrgid(stat.gid).name
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
- ['sudo', '-u', DEPLOY_USER]
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? 'gems.rb'
66
+ if File.exist? "gems.rb"
66
67
  sudo %W{bundle install}
67
68
  end
68
69
 
69
- if File.exist? 'bake.rb'
70
+ if File.exist? "bake.rb"
70
71
  sudo %W{bundle exec bake deploy restart}
71
- elsif File.exist? 'Rakefile'
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
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  group :development do
3
4
  guard :falcon, port: 9292 do
4
- watch('Gemfile.lock')
5
- watch('config.ru')
5
+ watch("Gemfile.lock")
6
+ watch("config.ru")
6
7
  watch(%r{^config|lib|pages/.*})
7
8
 
8
9
  notification :off
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-2022, by Samuel Williams.
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 'falcon:supervisor:restart'
12
+ call "falcon:supervisor:restart"
13
13
  end
14
14
 
15
15
  # Start the development server.
16
16
  def default
17
- call 'utopia:development'
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-2022, by Samuel Williams.
4
+ # Copyright, 2016-2025, by Samuel Williams.
5
5
 
6
- require 'bundler/setup'
6
+ require "bundler/setup"
7
7
  Bundler.setup
8
8
 
9
- require 'utopia/setup'
9
+ require "utopia/setup"
10
10
  UTOPIA ||= Utopia.setup
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2023, by Samuel Williams.
4
+ # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
- require 'variant'
6
+ require "variant"
7
7
  Variant.force!(:testing)
8
8
 
9
- require 'covered/sus'
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 'config/environment'
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: 'public'
18
+ use Utopia::Static, root: "public"
19
19
 
20
20
  use Utopia::Redirection::Rewrite, {
21
- '/' => '/welcome/index'
21
+ "/" => "/welcome/index"
22
22
  }
23
23
 
24
24
  use Utopia::Redirection::DirectoryIndex
25
25
 
26
26
  use Utopia::Redirection::Errors, {
27
- 404 => '/errors/file-not-found'
27
+ 404 => "/errors/file-not-found"
28
28
  }
29
29
 
30
- require 'utopia/localization'
30
+ require "utopia/localization"
31
31
  use Utopia::Localization,
32
- default_locale: 'en',
33
- locales: ['en', 'de', 'ja', 'zh']
32
+ default_locale: "en",
33
+ locales: ["en", "de", "ja", "zh"]
34
34
 
35
- require 'utopia/session'
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-2023, by Samuel Williams.
4
+ # Copyright, 2016-2025, by Samuel Williams.
5
5
 
6
- require 'rack/test'
7
- require 'sus/fixtures/async/http'
8
- require 'protocol/rack'
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('../config.ru', __dir__)}
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('../config.ru', __dir__)}
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-2023, by Samuel Williams.
4
+ # Copyright, 2012-2025, by Samuel Williams.
5
5
 
6
- source 'https://rubygems.org'
6
+ source "https://rubygems.org"
7
7
 
8
8
  group :preload do
9
- gem 'utopia', '~> $UTOPIA_VERSION'
9
+ gem "utopia", "~> $UTOPIA_VERSION"
10
10
  # gem 'utopia-gallery'
11
11
  # gem 'utopia-analytics'
12
12
 
13
- gem 'variant'
13
+ gem "variant"
14
14
  end
15
15
 
16
- gem 'net-smtp'
16
+ gem "net-smtp"
17
17
 
18
18
  group :development do
19
- gem 'bake-test'
20
- gem 'rack-test'
21
- gem 'guard-falcon', require: false
19
+ gem "bake-test"
20
+ gem "rack-test"
21
+ gem "guard-falcon", require: false
22
22
 
23
- gem 'sus'
24
- gem 'sus-fixtures-async-http'
23
+ gem "sus"
24
+ gem "sus-fixtures-async-http"
25
25
 
26
- gem 'covered'
26
+ gem "covered"
27
27
 
28
- gem 'benchmark-http'
28
+ gem "benchmark-http"
29
29
  end
30
30
 
31
31
  group :production do
32
- gem 'falcon'
32
+ gem "falcon"
33
33
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2016-2024, by Samuel Williams.
4
+ # Copyright, 2016-2025, by Samuel Williams.
5
5
 
6
- require 'website'
7
- require 'benchmark/http'
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.24.4
4
+ version: 2.26.0
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: 2024-06-30 00:00:00.000000000 Z
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.5.11
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