Skip to content

Commit d5e09e3

Browse files
authored
Merge pull request #804 from casperisfine/3.x-fix-erb-version-checking
Various compatibility fixes for the 3.x branch
2 parents f4d3dae + 45886ab commit d5e09e3

37 files changed

+115
-80
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
continue-on-error: ${{ matrix.experimental }}
7+
name: ${{ matrix.ruby }}
8+
strategy:
9+
matrix:
10+
experimental: [false]
11+
ruby:
12+
- "2.5"
13+
- "2.6"
14+
- "2.7"
15+
- "3.0"
16+
- "3.1"
17+
- "3.2"
18+
- "3.3"
19+
rubyopt: [""]
20+
include:
21+
- { ruby: "3.3", rubyopt: "--enable-frozen-string-literal --debug-frozen-string-literal", experimental: false }
22+
- { ruby: head, experimental: true }
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Ruby
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: ${{ matrix.ruby }}
30+
bundler-cache: true
31+
32+
- name: Run tests ${{ matrix.rubyopt }}
33+
timeout-minutes: 10
34+
run: bundle exec rake RUBYOPT="${{ matrix.rubyopt }}"

.github/workflows/isolated.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI isolated tests
2+
on: [push, pull_request]
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
ruby: [2.7]
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Set up Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: ${{ matrix.ruby }}
17+
bundler-cache: true
18+
19+
- name: Run tests
20+
run: bundle exec rake test_isolated

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/sprockets.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module Sprockets
105105
register_bundle_processor 'application/javascript', Bundle
106106
register_bundle_processor 'text/css', Bundle
107107

108-
register_bundle_metadata_reducer '*/*', :data, proc { "" }, :concat
108+
register_bundle_metadata_reducer '*/*', :data, proc { "" }, :+
109109
register_bundle_metadata_reducer 'application/javascript', :data, proc { "" }, Utils.method(:concat_javascript_sources)
110110
register_bundle_metadata_reducer '*/*', :links, :+
111111

lib/sprockets/directive_processor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: false
2+
13
require 'set'
24
require 'shellwords'
35

lib/sprockets/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ def cache_headers(env, etag)
251251
# If the request url contains a fingerprint, set a long
252252
# expires on the response
253253
if path_fingerprint(env["PATH_INFO"])
254-
headers["Cache-Control"] << ", max-age=31536000"
254+
headers["Cache-Control"] += ", max-age=31536000"
255255

256256
# Otherwise set `must-revalidate` since the asset could be modified.
257257
else
258-
headers["Cache-Control"] << ", must-revalidate"
258+
headers["Cache-Control"] += ", must-revalidate"
259259
headers["Vary"] = "Accept-Encoding"
260260
end
261261

lib/sprockets/uri_utils.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def split_file_uri(uri)
5050
# Hack for parsing Windows "file:///C:/Users/IEUser" paths
5151
path.gsub!(/^\/([a-zA-Z]:)/, '\1'.freeze)
5252

53+
host = nil if host && host.empty?
54+
query = nil if query && query.empty?
55+
5356
[scheme, host, path, query]
5457
end
5558

lib/sprockets/utils.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def string_end_with_semicolon?(str)
102102
#
103103
# Returns buf String.
104104
def concat_javascript_sources(buf, source)
105+
buf = +buf
105106
if source.bytesize > 0
106107
buf << source
107108

sprockets.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
1111
s.files = Dir["README.md", "CHANGELOG.md", "LICENSE", "lib/**/*.rb"]
1212
s.executables = ["sprockets"]
1313

14+
s.add_dependency "base64"
1415
s.add_dependency "rack", "> 1", "< 3"
1516
s.add_dependency "concurrent-ruby", "~> 1.0"
1617

@@ -23,7 +24,7 @@ Gem::Specification.new do |s|
2324
s.add_development_dependency "minitest", "~> 5.0"
2425
s.add_development_dependency "nokogiri", "~> 1.3"
2526
s.add_development_dependency "rack-test", "~> 0.6"
26-
s.add_development_dependency "rake", "~> 10.0"
27+
s.add_development_dependency "rake"
2728
s.add_development_dependency "sass", "~> 3.1"
2829
s.add_development_dependency "uglifier", "~> 2.3"
2930
s.add_development_dependency "yui-compressor", "~> 0.12"

test/sprockets_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def silence_warnings
125125
Sprockets.register_transformer 'text/css', 'application/css-sourcemap+json', SourceMapTransformer
126126

127127

128-
class Sprockets::TestCase < MiniTest::Test
128+
class Sprockets::TestCase < Minitest::Test
129129
FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
130130

131131
def self.test(name, &block)

0 commit comments

Comments
 (0)