diff --git a/CHANGELOG.md b/CHANGELOG.md index 87bfd21..5f282ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.3.0] - 2024-01-27 + +- use sinatra >= 4.0.0 + ## [0.2.0] - 2023-07-30 - use ruby.wasm 2.0.0 diff --git a/gem/Gemfile.lock b/gem/Gemfile.lock index 91fe911..dca18a5 100644 --- a/gem/Gemfile.lock +++ b/gem/Gemfile.lock @@ -1,11 +1,11 @@ PATH remote: . specs: - bormashino (0.2.0) + bormashino (0.3.0) json_pure (~> 2.6, >= 2.6.1) os (~> 1.1, >= 1.1.4) ruby2_keywords (= 0.0.4) - sinatra (~> 2.2) + sinatra (>= 4.0.0) GEM remote: https://rubygems.org/ @@ -16,6 +16,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) ast (2.4.2) + base64 (0.2.0) coderay (1.1.3) concurrent-ruby (1.2.2) diff-lcs (1.5.0) @@ -52,7 +53,7 @@ GEM lumberjack (1.2.8) method_source (1.0.0) minitest (5.19.0) - mustermann (2.0.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) nenv (0.3.0) notiffany (0.1.3) @@ -65,9 +66,12 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - rack (2.2.7) - rack-protection (2.2.4) - rack + rack (3.0.8) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.2) @@ -117,13 +121,14 @@ GEM ruby-progressbar (1.13.0) ruby2_keywords (0.0.4) shellany (0.0.1) - sinatra (2.2.4) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.4) + sinatra (4.0.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) thor (1.2.2) - tilt (2.1.0) + tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) diff --git a/gem/bormashino.gemspec b/gem/bormashino.gemspec index 63f8833..3240a99 100644 --- a/gem/bormashino.gemspec +++ b/gem/bormashino.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| # Uncomment to register a new dependency of your gem # spec.add_dependency "example-gem", "~> 1.0" spec.add_dependency 'json_pure', '~> 2.6', '>= 2.6.1' - spec.add_dependency 'sinatra', '~> 2.2' + spec.add_dependency 'sinatra', '>= 4.0.0' spec.add_dependency 'ruby2_keywords', '0.0.4' spec.add_dependency 'os', '~> 1.1', '>= 1.1.4' diff --git a/gem/lib/bormashino/version.rb b/gem/lib/bormashino/version.rb index 3c2d64f..7000648 100644 --- a/gem/lib/bormashino/version.rb +++ b/gem/lib/bormashino/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Bormashino - VERSION = '0.2.0' + VERSION = '0.3.0' end diff --git a/gem/spec/bormashino/server_spec.rb b/gem/spec/bormashino/server_spec.rb index dbaf475..d4f39e7 100644 --- a/gem/spec/bormashino/server_spec.rb +++ b/gem/spec/bormashino/server_spec.rb @@ -171,7 +171,7 @@ class MockApp < Sinatra::Base it 'sends referer' do expect(subject.first).to eq 302 - expect(subject[1]['Location']).to eq 'http://example.com:0/referer' + expect(subject[1]['location']).to eq 'http://example.com:0/referer' end end end diff --git a/npm/package-lock.json b/npm/package-lock.json index 1b7d222..f4178ba 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "bormashino", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bormashino", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "dependencies": { "@wasmer/wasi": "0.12.0", diff --git a/npm/package.json b/npm/package.json index 75c29ac..1633692 100644 --- a/npm/package.json +++ b/npm/package.json @@ -2,7 +2,7 @@ "name": "bormashino", "description": "The package to build SPAs with Ruby", "homepage": "https://github.com/keyasuda/bormashino", - "version": "0.2.0", + "version": "0.3.0", "main": "src/index.js", "scripts": { "test": "jest --notify src/", diff --git a/npm/src/applyServerResult.js b/npm/src/applyServerResult.js index 09e58cb..e1dd460 100644 --- a/npm/src/applyServerResult.js +++ b/npm/src/applyServerResult.js @@ -41,13 +41,13 @@ export const applyServerResult = (src, target, router) => { return true case 302: - const loc = new URL(src[1]['Location']) + const loc = new URL(src[1]['location']) if (loc.host == 'example.com:0') { const path = loc.pathname + loc.search router.pushState(path) } else { - location.href = src[1]['Location'] + location.href = src[1]['location'] } return false diff --git a/npm/src/applyServerResult.test.js b/npm/src/applyServerResult.test.js index b2d9d9e..f84ecde 100644 --- a/npm/src/applyServerResult.test.js +++ b/npm/src/applyServerResult.test.js @@ -110,7 +110,7 @@ describe('applyServerResult', () => { describe('302 relative location', () => { beforeEach(() => { - content = [302, { Location: 'http://example.com:0/location' }, []] + content = [302, { location: 'http://example.com:0/location' }, []] ret = applyServerResult(content, target, router) }) @@ -132,13 +132,13 @@ describe('applyServerResult', () => { delete window.location window.location = { assign: jest.fn() } - content = [302, { Location: 'http://absolute.example.com/location' }, []] + content = [302, { location: 'http://absolute.example.com/location' }, []] ret = applyServerResult(content, target, router) }) it('navigates to the location', () => { - expect(location.href).toEqual(content[1]['Location']) + expect(location.href).toEqual(content[1]['location']) }) it('returns true', () => { diff --git a/test-app/Gemfile.lock b/test-app/Gemfile.lock index 958716a..001ac9f 100644 --- a/test-app/Gemfile.lock +++ b/test-app/Gemfile.lock @@ -11,11 +11,11 @@ GIT PATH remote: ../gem specs: - bormashino (0.2.0) + bormashino (0.3.0) json_pure (~> 2.6, >= 2.6.1) os (~> 1.1, >= 1.1.4) ruby2_keywords (= 0.0.4) - sinatra (~> 2.2) + sinatra (>= 4.0.0) GEM remote: https://rubygems.org/ @@ -28,6 +28,7 @@ GEM addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) + base64 (0.2.0) capybara (3.39.1) addressable matrix @@ -92,7 +93,7 @@ GEM method_source (1.0.0) mini_mime (1.1.2) minitest (5.19.0) - mustermann (2.0.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) nenv (0.3.0) nokogiri (1.15.1-x86_64-linux) @@ -109,9 +110,12 @@ GEM method_source (~> 1.0) public_suffix (5.0.1) racc (1.6.2) - rack (2.2.7) - rack-protection (2.2.4) - rack + rack (3.0.8) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) rainbow (3.1.1) @@ -163,13 +167,14 @@ GEM ruby-progressbar (1.13.0) ruby2_keywords (0.0.4) shellany (0.0.1) - sinatra (2.2.4) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.4) + sinatra (4.0.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) thor (1.2.2) - tilt (2.1.0) + tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) diff --git a/test-app/package-lock.json b/test-app/package-lock.json index 2c0d7a7..4354d29 100644 --- a/test-app/package-lock.json +++ b/test-app/package-lock.json @@ -1,5 +1,5 @@ { - "name": "npm-proj-1706207272237-0.5249562090028224nqODAi", + "name": "test-app", "lockfileVersion": 2, "requires": true, "packages": { @@ -15,18 +15,18 @@ }, "../npm": { "name": "bormashino", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "dependencies": { "@wasmer/wasi": "0.12.0", "@wasmer/wasmfs": "^0.12.0", "html5-history-router": "^1.1.0", - "ruby-3_2-wasm-wasi": "2.0.0" + "ruby-3_2-wasm-wasi": "2.3.0" }, "devDependencies": { - "@babel/core": "^7.21.8", - "@babel/preset-env": "^7.21.5", - "jest": "^28.1.3", + "@babel/core": "^7.23.6", + "@babel/preset-env": "^7.23.6", + "jest": "^29.7.0", "jest-environment-jsdom": "^28.1.3", "node-notifier": "^10.0.1" } @@ -5011,15 +5011,15 @@ "bormashino": { "version": "file:../npm", "requires": { - "@babel/core": "^7.21.8", - "@babel/preset-env": "^7.21.5", + "@babel/core": "^7.23.6", + "@babel/preset-env": "^7.23.6", "@wasmer/wasi": "0.12.0", "@wasmer/wasmfs": "^0.12.0", "html5-history-router": "^1.1.0", - "jest": "^28.1.3", + "jest": "^29.7.0", "jest-environment-jsdom": "^28.1.3", "node-notifier": "^10.0.1", - "ruby-3_2-wasm-wasi": "2.0.0" + "ruby-3_2-wasm-wasi": "2.3.0" } }, "braces": { diff --git a/test-app/spec/spec_helper.rb b/test-app/spec/spec_helper.rb index a870fd1..ce9df6c 100644 --- a/test-app/spec/spec_helper.rb +++ b/test-app/spec/spec_helper.rb @@ -9,7 +9,7 @@ class JSConsoleLogger def puts(log) src = log.strip.sub(/\A.+[ 0-9.▶◀]+\{/, '{') src = JSON.parse(src) - $stdout.puts src['params']['args'].map { |a| a['value'] } if src['method'] == 'Runtime.consoleAPICalled' + $stdout.puts src['params']['args'].pluck('value') if src['method'] == 'Runtime.consoleAPICalled' rescue StandardError # do nothing end diff --git a/test-app/spec/test_app_spec.rb b/test-app/spec/test_app_spec.rb index 6eab862..3da3bc8 100644 --- a/test-app/spec/test_app_spec.rb +++ b/test-app/spec/test_app_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe 'test_app', type: :feature, retry: 10 do +RSpec.describe 'test_app', retry: 10, type: :feature do subject { page } before do diff --git a/test-app/src/Gemfile.lock b/test-app/src/Gemfile.lock index 755b6c3..222605a 100644 --- a/test-app/src/Gemfile.lock +++ b/test-app/src/Gemfile.lock @@ -1,19 +1,24 @@ GEM remote: https://rubygems.org/ specs: + base64 (0.2.0) json_pure (2.6.3) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - rack (2.2.7) - rack-protection (3.0.6) - rack + rack (3.0.8) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) ruby2_keywords (0.0.4) - sinatra (3.0.6) + sinatra (4.0.0) mustermann (~> 3.0) - rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.6) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) - tilt (2.1.0) + tilt (2.3.0) PLATFORMS ruby