Skip to content

Commit f8d5ebb

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 81661db + e5fc6b2 commit f8d5ebb

File tree

8 files changed

+40
-19
lines changed

8 files changed

+40
-19
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
ruby: [ '3.1', '3.2', '3.3', 'head' ]
9+
ruby: [ '3.1', '3.2', 'head' ]
1010
rails: [ '7.1', 'edge' ]
11+
rubyopt: [""]
1112
include:
12-
- ruby: '2.7'
13-
rails: '6.1'
14-
- ruby: '3.0'
15-
rails: '6.1'
13+
- ruby: '3.3'
14+
rails: '7.1'
15+
rubyopt: "--enable-frozen-string-literal"
16+
exclude:
1617
- ruby: '3.1'
17-
rails: '7.0'
18+
rails: 'edge'
19+
rubyopt: ''
1820

1921
env:
2022
RAILS_VERSION: ${{ matrix.rails }}
23+
RUBYOPT: ${{ matrix.rubyopt }}
2124

2225
steps:
23-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2427

2528
- name: Set up Ruby
2629
uses: ruby/setup-ruby@v1
@@ -29,10 +32,10 @@ jobs:
2932
bundler-cache: true
3033

3134
- name: Run unit tests
32-
run: bundle exec rake test:unit
35+
run: bundle exec rake test:unit RUBYOPT="${{ matrix.rubyopt }}"
3336
timeout-minutes: 3
3437

3538
- name: Run acceptance tests
36-
run: bundle exec rake test:acceptance
39+
run: bundle exec rake test:acceptance RUBYOPT="${{ matrix.rubyopt }}"
3740
timeout-minutes: 10
3841
if: ${{ matrix.rails != 'edge' && matrix.ruby != 'head' }} # Acceptance tests use `gem install rails && rails new`

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Next Release
22

3+
## 4.3.0
4+
5+
* Fix reloading issue in Ruby 3.3.
6+
* Fixed compatibility with `--enable-frozen-string-literal`.
7+
* Add embeded engines to default reload matcher.
8+
39
## 4.2.1
410

511
* Added `Spring.connect_timeout` and `Spring.boot_timeout` to allow to increase timeout for larger apps.

lib/spring/application_manager.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def start_wait_thread(pid, child)
126126
# as if it does we're no longer interested in the child
127127
loop do
128128
IO.select([child])
129-
break if child.recv(1, Socket::MSG_PEEK).empty?
129+
peek = child.recv(1, Socket::MSG_PEEK)
130+
break if peek.nil? || peek.empty?
130131
sleep 0.01
131132
end
132133

lib/spring/json.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# encoding: UTF-8
1+
# frozen_string_literal: true
22

33
# ### WHY SPRING VENDORS A JSON LIBRARY ###
44
#
@@ -13,7 +13,6 @@
1313
module Spring
1414
module JSON
1515
def self.load(string)
16-
string.force_encoding("utf-8")
1716
OkJson.decode(string)
1817
end
1918

@@ -364,7 +363,7 @@ def unquote(q)
364363
end
365364
end
366365
if rubydoesenc?
367-
a[w] = '' << uchar
366+
a[w] = +'' << uchar
368367
w += 1
369368
else
370369
w += ucharenc(a, w, uchar)

lib/spring/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Spring
2-
VERSION = "4.2.1"
2+
VERSION = "4.3.0"
33
end

test/support/acceptance_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class AcceptanceTest < ActiveSupport::TestCase
1212

1313
def rails_version
1414
if ENV['RAILS_VERSION'] == "edge"
15-
">= 7.1.0.alpha"
15+
">= 8.0.0.alpha"
1616
else
17-
"~> #{ENV['RAILS_VERSION'] || "6.1"}.0"
17+
"~> #{ENV['RAILS_VERSION'] || "7.1"}.0"
1818
end
1919
end
2020

@@ -189,7 +189,7 @@ def self.omg
189189
app.insert_into_test "Foo.omg"
190190

191191
app.await_reload
192-
assert_failure app.spring_test_command, stdout: "RuntimeError: omg"
192+
assert_failure app.spring_test_command, stdout: "RuntimeError: omg", log: /child \d+ shutdown/
193193
end
194194

195195
test "app gets reloaded even with a ton of boot output" do

test/support/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ def read_streams
168168
end
169169

170170
def read_stream(stream)
171-
output = ""
171+
output = +""
172172
while IO.select([stream], [], [], 0.5) && !stream.eof?
173173
output << stream.readpartial(10240)
174174
end
175175
output
176176
end
177177

178178
def dump_streams(command, streams)
179-
output = "$ #{command}\n"
179+
output = +"$ #{command}\n"
180180

181181
streams.each do |name, stream|
182182
unless stream.chomp.empty?

test/unit/json_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require_relative "../helper"
2+
require 'spring/json'
3+
4+
class JsonTest < ActiveSupport::TestCase
5+
test 'can decode unicode characters' do
6+
assert_equal({"unicode_example"=>"©"}, Spring::JSON.load('{"unicode_example": "\u00A9"}'))
7+
end
8+
9+
test 'can encode' do
10+
assert_equal('{}', Spring::JSON.dump({}))
11+
end
12+
end

0 commit comments

Comments
 (0)