dragonruby-rack 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4eb445a0e6d8d213740fb5604c1dbd3794d92732a540d5157837fee9f22a4314
4
- data.tar.gz: 4957d3f7413f65f43ee11f236cb8bfe892a4b7aac958493837eb8985b79219c0
3
+ metadata.gz: a3261527e317b140e481bdcfabd773275842eedb826dd0e8205de98461772155
4
+ data.tar.gz: beb636c9b92b17f539282a6e844ac5e1ba7e618f3a182f7a6b227f85e1cbcb4d
5
5
  SHA512:
6
- metadata.gz: fd9e975ed8ef7a749e9f67a8f14db04b4c8fe7ff621097977471197a40fc848d5317ee76656ad677f3f7c3362fd31975529189d4ad410fc76211b2d9e63d4534
7
- data.tar.gz: b0763b9f6ac8f1ffe3bc16d015a8a113dcb1160d88df5d62903351d05cd3faa5ab9fb77492ba5298ce1fc233bddc7fb69ac5ad75352030a1af281ed9537a85c9
6
+ metadata.gz: b2439d5258a16a3d16ad1420314c3479f78e486d6fb219c22af8a01645c16a850393643efc272dfb75e1e96f61063df9cb0d3f48bdbff48c81371771d9a7bf59
7
+ data.tar.gz: d229658ebfd4a5de6585d48e4f8439c4e44cc809ac7b0bbe1394d1b16ba6cee13d8e375f3c051b6c0270593c0f06ee5b9937c034afae61245de8f6d9323b0de7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 — 2026-08-02
4
+
5
+ **Breaking: Rack 3 only, Ruby 3.2 or newer.** 0.1.0 declared `rack >= 2.2` and
6
+ did not work on Rack 2.
7
+
8
+ Rack 3 requires response header keys to be lowercase. Rack 2 left the case
9
+ alone, and its file server returns `Content-Type`. This endpoint reads that
10
+ header to decide whether to inject the `<base>` tag, so on Rack 2 the injection
11
+ never fired: the game mounted, served its `index.html`, and then loaded none of
12
+ its assets. The fix is the version bound rather than a case-insensitive lookup —
13
+ on Rack 3 the lowercase key is a guarantee, so the failure mode stops existing
14
+ instead of being defended against.
15
+
16
+ The floor is `3.0.3`, not `3.0`: `Rack::URLMap` up to 3.0.2 calls `Regexp.new`
17
+ with the third argument Ruby 3.2 removed, and URLMap is what backs both
18
+ `Rack::Builder#map` and Rails' `mount`.
19
+
20
+ - Added CI (GitHub Actions): the suite on Ruby 3.2/3.3/3.4, plus a run pinned to
21
+ the oldest Rack the gemspec claims, so the lower bound is tested and not
22
+ guessed. Separate jobs lint, and build-install-require the packaged gem.
23
+ - Added [Standard](https://github.com/standardrb/standard); the existing code was
24
+ reformatted to it. No behaviour changed. `standardrb --fix` also rewrote
25
+ `Dir.children(dir).empty?` to `Dir.empty?(dir)` and dropped the redundant
26
+ class from a bare `rescue StandardError`, both of which mean the same thing.
27
+ - `required_ruby_version` is now `>= 3.2`. It said 3.1, but the development
28
+ dependencies have needed 3.2 since they were written.
29
+
3
30
  ## 0.1.0 — 2026-08-02
4
31
 
5
32
  Extracted from https://stammer.dev website, where it had been serving
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # dragonruby-rack
2
2
 
3
+ [![CI](https://github.com/rstammer/dragonruby-rack/actions/workflows/ci.yml/badge.svg)](https://github.com/rstammer/dragonruby-rack/actions/workflows/ci.yml)
4
+
3
5
  Serve a [DragonRuby GTK](https://dragonruby.org) HTML5 export from a Rack or
4
6
  Rails app, on your own domain, without an iframe and without itch.io.
5
7
 
8
+ Needs **Ruby 3.2+** and **Rack 3** (Rails 7.1 and up). Rails is optional — see
9
+ [Without Rails](#without-rails).
10
+
6
11
  ```ruby
7
12
  # Gemfile
8
13
  gem "dragonruby-rack"
@@ -97,7 +102,15 @@ on the web correctly.
97
102
 
98
103
  ```sh
99
104
  bundle install
100
- bundle exec rspec
105
+ bundle exec rake # spec + standardrb
106
+ ```
107
+
108
+ CI runs the suite on Ruby 3.2, 3.3 and 3.4, and once more pinned to the oldest
109
+ Rack the gemspec claims to support — 0.1.0 shipped a lower bound nothing had
110
+ ever run against, and it was wrong. To reproduce that run locally:
111
+
112
+ ```sh
113
+ RACK_VERSION=3.0.3 bundle install && RACK_VERSION=3.0.3 bundle exec rspec
101
114
  ```
102
115
 
103
116
  ## Licence
@@ -50,7 +50,7 @@ module DragonRuby
50
50
  end
51
51
 
52
52
  return if File.exist?(File.join(into, MARKER))
53
- return if Dir.children(into).empty?
53
+ return if Dir.empty?(into)
54
54
 
55
55
  raise Error, <<~MESSAGE.strip
56
56
  #{into} is not empty and holds no #{MARKER}, so it does not look like
@@ -25,10 +25,10 @@ module DragonRuby
25
25
  # require-corp without a per-file Cross-Origin-Resource-Policy header.
26
26
  ISOLATION_HEADERS = {
27
27
  "cross-origin-opener-policy" => "same-origin",
28
- "cross-origin-embedder-policy" => "require-corp",
28
+ "cross-origin-embedder-policy" => "require-corp"
29
29
  }.freeze
30
30
 
31
- NOT_FOUND = ->(_env) { [404, { "content-type" => "text/plain" }, ["Not found"]] }
31
+ NOT_FOUND = ->(_env) { [404, {"content-type" => "text/plain"}, ["Not found"]] }
32
32
 
33
33
  attr_reader :root
34
34
 
@@ -42,7 +42,7 @@ module DragonRuby
42
42
  NOT_FOUND,
43
43
  root: @root,
44
44
  urls: [""], # serve every path under this mount from the bundle
45
- index: index, # directory requests ("/") resolve to index.html
45
+ index: index # directory requests ("/") resolve to index.html
46
46
  )
47
47
  end
48
48
 
@@ -84,7 +84,7 @@ module DragonRuby
84
84
  body.close if body.respond_to?(:close)
85
85
  return [html] if html.empty? # HEAD carries no body — leave headers as-is
86
86
 
87
- base = "#{env['SCRIPT_NAME']}/"
87
+ base = "#{env["SCRIPT_NAME"]}/"
88
88
  html = html.sub(/<head>/i, %(<head><base href="#{base}">))
89
89
  headers["content-length"] = html.bytesize.to_s
90
90
  [html]
@@ -1,5 +1,5 @@
1
1
  module DragonRuby
2
2
  module Rack
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -15,12 +15,12 @@ module DragonRuby
15
15
  namespace "dragonruby:mount"
16
16
 
17
17
  argument :name, type: :string,
18
- desc: "Name of the game — becomes both the directory and the URL path"
18
+ desc: "Name of the game — becomes both the directory and the URL path"
19
19
 
20
20
  class_option :path, type: :string, default: nil,
21
- desc: "Directory holding the bundle (default: <games_root>/<name>)"
21
+ desc: "Directory holding the bundle (default: <games_root>/<name>)"
22
22
  class_option :at, type: :string, default: nil,
23
- desc: "URL path to mount at (default: /<name>)"
23
+ desc: "URL path to mount at (default: /<name>)"
24
24
 
25
25
  def create_bundle_directory
26
26
  empty_directory bundle_path
@@ -40,7 +40,7 @@ module DragonRuby
40
40
  end
41
41
 
42
42
  inject_into_file "config/routes.rb", comment + mount_line + "\n",
43
- after: /Rails\.application\.routes\.draw do\n/
43
+ after: /Rails\.application\.routes\.draw do\n/
44
44
  end
45
45
 
46
46
  def tell_them_what_is_missing
@@ -57,7 +57,7 @@ module DragonRuby
57
57
 
58
58
  def games_root
59
59
  ::Rails.application.config.dragonruby.games_root
60
- rescue StandardError
60
+ rescue
61
61
  "games"
62
62
  end
63
63
 
@@ -71,10 +71,10 @@ module DragonRuby
71
71
 
72
72
  def comment
73
73
  <<~RUBY
74
- # #{name} — a DragonRuby HTML5 export, served cross-origin isolated so its
75
- # WASM runtime can use SharedArrayBuffer. The bundle lives outside public/
76
- # on purpose: Rails' static file server runs before the router and would
77
- # serve it without those headers. Link to it as #{url_path}/
74
+ # #{name} — a DragonRuby HTML5 export, served cross-origin isolated so its
75
+ # WASM runtime can use SharedArrayBuffer. The bundle lives outside public/
76
+ # on purpose: Rails' static file server runs before the router and would
77
+ # serve it without those headers. Link to it as #{url_path}/
78
78
  RUBY
79
79
  end
80
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonruby-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Stammer
@@ -15,7 +15,7 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '2.2'
18
+ version: 3.0.3
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '4'
@@ -25,7 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '2.2'
28
+ version: 3.0.3
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: '4'
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.1'
68
+ version: '3.2'
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - ">="