sbsm 1.6.0 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b93d9bf6799d6d4acbc8d4b7da58620c38d3f25778ebc6b56362b8c122d563de
4
- data.tar.gz: 9a31b8e5479f81901bbe32ddc555984343750be0cbab2fab46ec26f0713bbc89
3
+ metadata.gz: 0c0b16442273f02641861ab2af2df40bdedf7adcf57a5da81e7f2f643c8cb40f
4
+ data.tar.gz: 52cbff715b9e7c64a476a1c8daca37aa684103b9a88e05451fb1ab6f1b8190e9
5
5
  SHA512:
6
- metadata.gz: 8787656db28102c2e04512f319007348d5fa2ee39988f2a111718a6c94650b2d1637d5914a87f69ef558a5e167dee190e71985df8c27b97dd16a1708201751a4
7
- data.tar.gz: f6d74035ec0fd830acbd2c599a20434fc674963093d955a220df0a7cbe942dd82dc091f7d71b2e3c62bc283821e3437e8c7d08009513f723baca9a7844230a41
6
+ metadata.gz: 45cc5410d706b22306be01727bfd9db0364df776402592cfcaa1de71850774bbb961107411b8eb35225a05dae23fc944a3047289f761d64d3743cf7fc236b67d
7
+ data.tar.gz: 3056680481b6b5d3a24d04637713497f41d6b4e7394a0d81023f6da3880eacaf8b94649eb487c50ff28f54fa8e3847fd135572d34bfd293953d9abfd0f7178d3
data/.envrc ADDED
@@ -0,0 +1,3 @@
1
+ source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
2
+
3
+ use devenv
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ # Using a matrix fails, because /setup-ruby always invokes bundle install without any additional args
20
+ # Fixed by adding not defining the debugger group in the Gemfile
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ ubuntu]
25
+ ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, head]
26
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+
34
+ - name: Run tests via test/suite.rb
35
+ run: bundle exec test/suite.rb
data/.gitignore CHANGED
@@ -1,4 +1,3 @@
1
- .ruby-version
2
1
  Gemfile.lock
3
2
  etc/
4
3
  .bundle/
@@ -7,3 +6,14 @@ vendor/
7
6
  pkg/
8
7
  coverage/
9
8
  *.log
9
+
10
+ # Devenv
11
+ .devenv*
12
+ devenv.local.nix
13
+
14
+ # direnv
15
+ .direnv
16
+
17
+ # pre-commit
18
+ .pre-commit-config.yaml
19
+
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source "https://rubygems.org"
2
+ gem 'net-smtp', require: false
2
3
 
3
4
  gemspec
data/History.txt CHANGED
@@ -1,3 +1,14 @@
1
+ === 1.6.2 / 25.01.2024
2
+
3
+ * Add devenv environment for Ruby 3.3 (see https://devenv.sh/)
4
+ * Replace Chronologger with Logger as https://github.com/ma2gedev/chrono_logger
5
+ is no longer maintained and leads to test errors under Ruby 3.3
6
+ * Run all tests also under Ruby 3.3
7
+
8
+ === 1.6.1 / 09.12.2022
9
+
10
+ * Fix Mime-Bug for Davaz.com
11
+
1
12
  === 1.6.0 / 13.06.2020
2
13
 
3
14
  * Remove calls to obsolete taint/untaint methods
data/devenv.lock ADDED
@@ -0,0 +1,228 @@
1
+ {
2
+ "nodes": {
3
+ "devenv": {
4
+ "locked": {
5
+ "dir": "src/modules",
6
+ "lastModified": 1705399223,
7
+ "narHash": "sha256-2nhAJ/9LMlwaEZDnoDIhnhQ0pEC/YIIt09WD7FmTp6g=",
8
+ "owner": "cachix",
9
+ "repo": "devenv",
10
+ "rev": "ff37923d4ba9e220b9826594e83fc29e1a4f4338",
11
+ "type": "github"
12
+ },
13
+ "original": {
14
+ "dir": "src/modules",
15
+ "owner": "cachix",
16
+ "repo": "devenv",
17
+ "type": "github"
18
+ }
19
+ },
20
+ "flake-compat": {
21
+ "flake": false,
22
+ "locked": {
23
+ "lastModified": 1696426674,
24
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
25
+ "owner": "edolstra",
26
+ "repo": "flake-compat",
27
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
28
+ "type": "github"
29
+ },
30
+ "original": {
31
+ "owner": "edolstra",
32
+ "repo": "flake-compat",
33
+ "type": "github"
34
+ }
35
+ },
36
+ "flake-compat_2": {
37
+ "flake": false,
38
+ "locked": {
39
+ "lastModified": 1696426674,
40
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
41
+ "owner": "edolstra",
42
+ "repo": "flake-compat",
43
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
44
+ "type": "github"
45
+ },
46
+ "original": {
47
+ "owner": "edolstra",
48
+ "repo": "flake-compat",
49
+ "type": "github"
50
+ }
51
+ },
52
+ "flake-utils": {
53
+ "inputs": {
54
+ "systems": "systems"
55
+ },
56
+ "locked": {
57
+ "lastModified": 1694529238,
58
+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
59
+ "owner": "numtide",
60
+ "repo": "flake-utils",
61
+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
62
+ "type": "github"
63
+ },
64
+ "original": {
65
+ "owner": "numtide",
66
+ "repo": "flake-utils",
67
+ "type": "github"
68
+ }
69
+ },
70
+ "flake-utils_2": {
71
+ "inputs": {
72
+ "systems": "systems_2"
73
+ },
74
+ "locked": {
75
+ "lastModified": 1701680307,
76
+ "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
77
+ "owner": "numtide",
78
+ "repo": "flake-utils",
79
+ "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
80
+ "type": "github"
81
+ },
82
+ "original": {
83
+ "owner": "numtide",
84
+ "repo": "flake-utils",
85
+ "type": "github"
86
+ }
87
+ },
88
+ "gitignore": {
89
+ "inputs": {
90
+ "nixpkgs": [
91
+ "pre-commit-hooks",
92
+ "nixpkgs"
93
+ ]
94
+ },
95
+ "locked": {
96
+ "lastModified": 1703887061,
97
+ "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
98
+ "owner": "hercules-ci",
99
+ "repo": "gitignore.nix",
100
+ "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
101
+ "type": "github"
102
+ },
103
+ "original": {
104
+ "owner": "hercules-ci",
105
+ "repo": "gitignore.nix",
106
+ "type": "github"
107
+ }
108
+ },
109
+ "nixpkgs": {
110
+ "locked": {
111
+ "lastModified": 1705331948,
112
+ "narHash": "sha256-qjQXfvrAT1/RKDFAMdl8Hw3m4tLVvMCc8fMqzJv0pP4=",
113
+ "owner": "NixOS",
114
+ "repo": "nixpkgs",
115
+ "rev": "b8dd8be3c790215716e7c12b247f45ca525867e2",
116
+ "type": "github"
117
+ },
118
+ "original": {
119
+ "owner": "NixOS",
120
+ "ref": "nixos-23.11",
121
+ "repo": "nixpkgs",
122
+ "type": "github"
123
+ }
124
+ },
125
+ "nixpkgs-ruby": {
126
+ "inputs": {
127
+ "flake-compat": "flake-compat",
128
+ "flake-utils": "flake-utils",
129
+ "nixpkgs": [
130
+ "nixpkgs"
131
+ ]
132
+ },
133
+ "locked": {
134
+ "lastModified": 1705118282,
135
+ "narHash": "sha256-9FUnVSPjF+xV2a7tfai8fxi9Ek538mdkEjaFJnWRk9Y=",
136
+ "owner": "bobvanderlinden",
137
+ "repo": "nixpkgs-ruby",
138
+ "rev": "1a4b0055af39b2d0756d5a117589b8ccddbce4f8",
139
+ "type": "github"
140
+ },
141
+ "original": {
142
+ "owner": "bobvanderlinden",
143
+ "repo": "nixpkgs-ruby",
144
+ "type": "github"
145
+ }
146
+ },
147
+ "nixpkgs-stable": {
148
+ "locked": {
149
+ "lastModified": 1704874635,
150
+ "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
151
+ "owner": "NixOS",
152
+ "repo": "nixpkgs",
153
+ "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
154
+ "type": "github"
155
+ },
156
+ "original": {
157
+ "owner": "NixOS",
158
+ "ref": "nixos-23.11",
159
+ "repo": "nixpkgs",
160
+ "type": "github"
161
+ }
162
+ },
163
+ "pre-commit-hooks": {
164
+ "inputs": {
165
+ "flake-compat": "flake-compat_2",
166
+ "flake-utils": "flake-utils_2",
167
+ "gitignore": "gitignore",
168
+ "nixpkgs": [
169
+ "nixpkgs"
170
+ ],
171
+ "nixpkgs-stable": "nixpkgs-stable"
172
+ },
173
+ "locked": {
174
+ "lastModified": 1705229514,
175
+ "narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=",
176
+ "owner": "cachix",
177
+ "repo": "pre-commit-hooks.nix",
178
+ "rev": "ffa9a5b90b0acfaa03b1533b83eaf5dead819a05",
179
+ "type": "github"
180
+ },
181
+ "original": {
182
+ "owner": "cachix",
183
+ "repo": "pre-commit-hooks.nix",
184
+ "type": "github"
185
+ }
186
+ },
187
+ "root": {
188
+ "inputs": {
189
+ "devenv": "devenv",
190
+ "nixpkgs": "nixpkgs",
191
+ "nixpkgs-ruby": "nixpkgs-ruby",
192
+ "pre-commit-hooks": "pre-commit-hooks"
193
+ }
194
+ },
195
+ "systems": {
196
+ "locked": {
197
+ "lastModified": 1681028828,
198
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
199
+ "owner": "nix-systems",
200
+ "repo": "default",
201
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
202
+ "type": "github"
203
+ },
204
+ "original": {
205
+ "owner": "nix-systems",
206
+ "repo": "default",
207
+ "type": "github"
208
+ }
209
+ },
210
+ "systems_2": {
211
+ "locked": {
212
+ "lastModified": 1681028828,
213
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
214
+ "owner": "nix-systems",
215
+ "repo": "default",
216
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
217
+ "type": "github"
218
+ },
219
+ "original": {
220
+ "owner": "nix-systems",
221
+ "repo": "default",
222
+ "type": "github"
223
+ }
224
+ }
225
+ },
226
+ "root": "root",
227
+ "version": 7
228
+ }
data/devenv.nix ADDED
@@ -0,0 +1,30 @@
1
+ { pkgs, ... }:
2
+
3
+ {
4
+ # https://devenv.sh/basics/
5
+ env.GREET = "devenv";
6
+
7
+ # https://devenv.sh/packages/
8
+ packages = [ pkgs.git pkgs.libyaml ];
9
+
10
+ enterShell = ''
11
+ echo This is the devenv shell for oddb2xml
12
+ git --version
13
+ ruby --version
14
+ '';
15
+
16
+ env.FREEDESKTOP_MIME_TYPES_PATH = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml";
17
+
18
+ # https://devenv.sh/languages/
19
+ # languages.nix.enable = true;
20
+
21
+ languages.ruby.enable = true;
22
+ languages.ruby.versionFile = ./.ruby-version;
23
+ # https://devenv.sh/pre-commit-hooks/
24
+ # pre-commit.hooks.shellcheck.enable = true;
25
+
26
+ # https://devenv.sh/processes/
27
+ # processes.ping.exec = "ping example.com";
28
+
29
+ # See full reference at https://devenv.sh/reference/options/
30
+ }
data/devenv.yaml ADDED
@@ -0,0 +1,8 @@
1
+ inputs:
2
+ nixpkgs:
3
+ url: github:NixOS/nixpkgs/nixos-23.11
4
+ nixpkgs-ruby:
5
+ url: github:bobvanderlinden/nixpkgs-ruby
6
+ inputs:
7
+ nixpkgs:
8
+ follows: nixpkgs
data/lib/sbsm/app.rb CHANGED
@@ -93,6 +93,14 @@ module SBSM
93
93
  @@last_session
94
94
  end
95
95
 
96
+ def fix_html_content_type(content_type)
97
+ # davaz.com#50
98
+ if content_type == 'application/xhtml+xml'
99
+ return 'text/html; charset=utf-8'
100
+ end
101
+ return content_type
102
+ end
103
+
96
104
  def call(env) ## mimick sbsm/lib/app.rb
97
105
  request = Rack::Request.new(env)
98
106
  response = Rack::Response.new
@@ -113,6 +121,7 @@ module SBSM
113
121
  mime_type = MimeMagic.by_path(file_name)
114
122
  end
115
123
  mime_type ||= 'text/plain'
124
+ mime_type = fix_html_content_type(mime_type)
116
125
  SBSM.debug "file_name is #{file_name} checkin base #{File.basename(file_name)} MIME #{mime_type}"
117
126
  response.set_header('Content-Type', mime_type)
118
127
  response.write(File.open(file_name, File::RDONLY){|file| file.read})
@@ -129,7 +138,7 @@ module SBSM
129
138
  begin
130
139
  file_name = thru.first
131
140
  raise Errno::ENOENT unless File.exist?(file_name)
132
- response.set_header('Content-Type', MimeMagic.by_extension(File.extname(file_name)).type)
141
+ response.set_header('Content-Type', fix_html_content_type(MimeMagic.by_extension(File.extname(file_name)).type))
133
142
  response.headers['Content-Disposition'] = "#{thru.last}; filename=#{File.basename(file_name)}"
134
143
  response.headers['Content-Length'] = File.size(file_name).to_s
135
144
  response.write(File.open(file_name, File::RDONLY){|file| file.read})
data/lib/sbsm/logger.rb CHANGED
@@ -22,7 +22,7 @@
22
22
  # ngiger@ywesee.com
23
23
  #++
24
24
 
25
- require 'chrono_logger'
25
+ require 'logger'
26
26
  require 'sbsm/version'
27
27
  module SBSM
28
28
  @@logger = Logger.new(STDERR)
@@ -153,8 +153,8 @@ module SBSM
153
153
  oldpath = File.expand_path("_" << File.basename(grammar_path),
154
154
  File.dirname(grammar_path))
155
155
  src = File.read(grammar_path)
156
- unless(File.exists?(oldpath) && File.read(oldpath)==src)
157
- File.delete(oldpath) if File.exists?(oldpath)
156
+ unless(File.exist?(oldpath) && File.read(oldpath)==src)
157
+ File.delete(oldpath) if File.exist?(oldpath)
158
158
  Parse.generate_parser_from_file_to_file(grammar_path,
159
159
  parser_path, @parser_method, 'SBSM')
160
160
  File.open(oldpath, 'w') { |f| f << src }
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.2'
3
3
  end
data/sbsm.gemspec CHANGED
@@ -21,17 +21,16 @@ Gem::Specification.new do |spec|
21
21
  # hoping that these version fix only security/severe bugs
22
22
  # Consulted the Gemfile.lock to get
23
23
  spec.add_dependency 'rack'
24
- spec.add_dependency 'mail'
24
+ spec.add_dependency 'mail', '< 2.8.0'
25
25
  spec.add_dependency 'hpricot'
26
26
  spec.add_dependency 'mimemagic'
27
- spec.add_dependency 'chrono_logger'
28
27
 
29
28
  spec.add_development_dependency "bundler"
30
29
  spec.add_development_dependency "rake"
31
30
  spec.add_development_dependency "rspec"
32
31
  spec.add_development_dependency "flexmock"
33
32
  spec.add_development_dependency "minitest"
34
- spec.add_development_dependency "rdoc"
33
+ spec.add_development_dependency "rdoc", '< 6.0.0'
35
34
  spec.add_development_dependency "simplecov"
36
35
  spec.add_development_dependency "watir"
37
36
  spec.add_development_dependency "watir-webdriver"
data/test/simple_sbsm.rb CHANGED
@@ -5,7 +5,7 @@ require 'sbsm/logger'
5
5
  require 'sbsm/app'
6
6
 
7
7
  root_dir = File.expand_path(File.join(__FILE__, '..', '..'))
8
- TEST_LOGGER = ChronoLogger.new(File.join(root_dir, 'test.log'))
8
+ TEST_LOGGER = Logger.new(File.join(root_dir, 'test.log'))
9
9
  SBSM.logger=TEST_LOGGER
10
10
 
11
11
  TEST_APP_URI = 'druby://localhost:9876'
data/test/suite.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # TestSuite -- ydim -- 27.01.2005 -- hwyss@ywesee.com
3
3
  require 'simplecov'
4
+ puts "Running under ruby #{RUBY_VERSION}"
4
5
 
5
6
  $: << File.dirname(File.expand_path(__FILE__))
6
7
  SimpleCov.start do
@@ -54,7 +54,7 @@ class AppVariantTest < Minitest::Test
54
54
  head '/fr/page/about'
55
55
  assert last_response.ok?
56
56
  assert last_response.body.empty?
57
- assert last_response.headers.keys.index('Content-Type')
57
+ assert last_response.headers.keys.index('content-type')
58
58
  end
59
59
  def test_request_file
60
60
  session_id_mock = '1234'
@@ -72,8 +72,8 @@ class AppVariantTest < Minitest::Test
72
72
  assert_equal(false, last_response.ok?)
73
73
  assert_equal(404, last_response.status)
74
74
  assert (last_response.body.to_s.index(invalid_path))
75
- assert last_response.headers.keys.index('Content-Type')
76
- assert_equal('text/html', last_response.headers['Content-Type'])
75
+ assert last_response.headers.keys.index('content-type')
76
+ assert_equal('text/html', last_response.headers['content-type'])
77
77
  end
78
78
  def test_request_file_with_no_mime_info
79
79
  session_id_mock = '1234'
@@ -92,8 +92,8 @@ class AppVariantTest < Minitest::Test
92
92
  result = get invalid_path, {}, env
93
93
 
94
94
  assert_equal(true, last_response.ok?)
95
- assert last_response.headers.keys.index('Content-Type')
96
- assert_equal('text/plain', last_response.headers['Content-Type'])
95
+ assert last_response.headers.keys.index('content-type')
96
+ assert_equal('text/plain', last_response.headers['content-type'])
97
97
  FileUtils.rm(file_name)
98
98
  end
99
99
  def test_request_file_with_mime_info
@@ -113,8 +113,8 @@ class AppVariantTest < Minitest::Test
113
113
  result = get invalid_path, {}, env
114
114
 
115
115
  assert_equal(true, last_response.ok?)
116
- assert last_response.headers.keys.index('Content-Type')
117
- assert_equal('image/png', last_response.headers['Content-Type'])
116
+ assert last_response.headers.keys.index('content-type')
117
+ assert_equal('image/png', last_response.headers['content-type'])
118
118
  FileUtils.rm(file_name)
119
119
  end
120
120
  end
@@ -72,12 +72,12 @@ module Demo
72
72
  PERSISTENT_COOKIE_NAME = 'CustomizedSession-cookie'
73
73
  LOOKANDFEEL = CustomLookandfeel
74
74
 
75
- def initialize(args)
75
+ def initialize(*args, **keyword_args)
76
76
  SBSM.debug "session args #{args}"
77
77
  @@active_stated_visited = false
78
78
  @@login_visited = false
79
79
  @@visited_init = true
80
- super(args)
80
+ super(*args, **keyword_args)
81
81
  end
82
82
 
83
83
  def flavor
@@ -231,7 +231,7 @@ class CustomizedAppSessionValidatorLnf < Minitest::Test
231
231
  end
232
232
  assert last_response.ok?
233
233
  # TEST_COOKIE_NAME set via param to app
234
- cookie = last_response.get_header('Set-Cookie').split("\n").find_all{|x| x.index(my_cookey_name)}
234
+ cookie = last_response.get_header('Set-Cookie')[0].split("\n").find_all{|x| x.index(my_cookey_name)}
235
235
  skip ('TODO: We should test test_customized_cookie_name')
236
236
  assert_equal 1, cookie.size
237
237
  assert_match my_cookey_name, cookie.first
@@ -249,7 +249,7 @@ class CustomizedAppCookieName < Minitest::Test
249
249
  get '/' do
250
250
  end
251
251
  assert last_response.ok?
252
- cookie = last_response.get_header('Set-Cookie').split("\n").find_all{|x| x.index(Demo::DEMO_PERSISTENT_COOKIE_NAME)}
252
+ cookie = last_response.get_header('Set-Cookie')[0].split("\n").find_all{|x| x.index(Demo::DEMO_PERSISTENT_COOKIE_NAME)}
253
253
  skip ('TODO: We should test test_customized_cookie_name')
254
254
  assert_equal 1, cookie.size
255
255
  assert_match Demo::DEMO_PERSISTENT_COOKIE_NAME, cookie.first
@@ -115,10 +115,10 @@ class StubSessionWithView < SBSM::Session
115
115
  attr_writer :lookandfeel, :persistent_user_input
116
116
  attr_writer :active_state
117
117
  public :active_state
118
- def initialize(args)
119
- args[:app] ||= StubSessionApp.new
120
- args[:validator] ||= StubSessionValidator.new
121
- super(args)
118
+ def initialize(*args, **kwargs)
119
+ kwargs[:app] ||= StubSessionApp.new
120
+ kwargs[:validator] ||= StubSessionValidator.new
121
+ super(*args, **kwargs)
122
122
  persistent_user_input = {}
123
123
  end
124
124
  end
data/test/test_session.rb CHANGED
@@ -121,7 +121,7 @@ class StubSessionWithView < SBSM::Session
121
121
  def initialize(args)
122
122
  args[:app] ||= StubSessionApp.new
123
123
  args[:validator] ||= StubSessionValidator.new
124
- super(args)
124
+ super(:app => args[:app], :validator => args[:validator])
125
125
  persistent_user_input = {}
126
126
  end
127
127
  end
@@ -163,7 +163,7 @@ class TestSession < Minitest::Test
163
163
  include Rack::Test::Methods
164
164
  def setup
165
165
  @app = StubSessionApp.new(validator: StubSessionValidator.new)
166
- @session = StubSessionWithView.new(app: @app,
166
+ @session = StubSessionWithView.new(# app: @app,
167
167
  validator: StubSessionValidator.new)
168
168
  @request = StubSessionRequest.new
169
169
  @state = StubSessionState.new(@session, nil)
@@ -174,8 +174,8 @@ class TestSession < Minitest::Test
174
174
  assert_equal('example.com', @session.server_name)
175
175
  end
176
176
  def test_user_input
177
- @request["foo"] = "bar"
178
- @request["baz"] = "zuv"
177
+ @request.params["foo"] = "bar"
178
+ @request.params["baz"] = "zuv"
179
179
  # next line checks whether we did setup correctly the session
180
180
  assert_equal(@session.validator.class, StubSessionValidator)
181
181
  @session.process_rack(rack_request: @request)
@@ -190,18 +190,18 @@ class TestSession < Minitest::Test
190
190
  assert_equal(expected, result)
191
191
  end
192
192
  def test_persistent_user_input
193
- @request["baz"] = "zuv"
193
+ @request.params["baz"] = "zuv"
194
194
  @session.process_rack(rack_request: @request)
195
195
  assert_equal("zuv", @session.persistent_user_input(:baz))
196
196
  @session.process_rack(StubSessionRequest.new)
197
197
  assert_equal("zuv", @session.persistent_user_input(:baz))
198
- @request["baz"] = "bla"
198
+ @request.params["baz"] = "bla"
199
199
  @session.process_rack(rack_request: @request)
200
200
  assert_equal("bla", @session.persistent_user_input(:baz))
201
201
  end
202
202
  def test_user_input_hash
203
- @request["hash[1]"] = "4"
204
- @request["hash[2]"] = "5"
203
+ @request.params["hash[1]"] = "4"
204
+ @request.params["hash[2]"] = "5"
205
205
  @request.params["hash[3]"] = "6"
206
206
  @request.params['real_hash'] = {'1' => 'a', '2' => 'b'}
207
207
  @session.process_rack(rack_request: @request)
@@ -231,12 +231,12 @@ class TestSession < Minitest::Test
231
231
  @session.process_rack(:rack_request =>req1)
232
232
  state1 = @session.state
233
233
  req2 = StubSessionRequest.new
234
- req2["event"] = "foo"
234
+ req2.params["event"] = "foo"
235
235
  @session.process_rack(:rack_request =>req2)
236
236
  state2 = @session.state
237
237
  refute_equal(state1, state2)
238
238
  req3 = StubSessionRequest.new
239
- req3["event"] = :bar
239
+ req3.params["event"] = :bar
240
240
  @session.process_rack(:rack_request =>req3)
241
241
  state3 = @session.state
242
242
  refute_equal(state1, state3)
@@ -248,7 +248,7 @@ class TestSession < Minitest::Test
248
248
  }
249
249
  assert_equal(attended, @session.attended_states)
250
250
  req4 = StubSessionRequest.new
251
- req4["event"] = :foobar
251
+ req4.params["event"] = :foobar
252
252
  @session.process_rack(:rack_request =>req4)
253
253
  @session.cap_max_states
254
254
  state4 = @session.state
@@ -338,8 +338,8 @@ class TestSession < Minitest::Test
338
338
  assert_nil(@session.user_input(:no_input))
339
339
  end
340
340
  def test_user_input
341
- @request["foo"] = "bar"
342
- @request["baz"] = "zuv"
341
+ @request.params["foo"] = "bar"
342
+ @request.params["baz"] = "zuv"
343
343
  @session.process_rack(rack_request: @request)
344
344
  assert_equal("bar", @session.user_input(:foo))
345
345
  assert_equal("zuv", @session.user_input(:baz))
@@ -352,9 +352,9 @@ class TestSession < Minitest::Test
352
352
  assert_equal(expected, result)
353
353
  end
354
354
  def test_user_input_hash
355
- @request["hash[1]"] = "4"
356
- @request["hash[2]"] = "5"
357
- @request["hash[3]"] = "6"
355
+ @request.params["hash[1]"] = "4"
356
+ @request.params["hash[2]"] = "5"
357
+ @request.params["hash[3]"] = "6"
358
358
  @session.process_rack(rack_request: @request)
359
359
  hash = @session.user_input(:hash)
360
360
  assert_equal(Hash, hash.class)
@@ -379,12 +379,12 @@ class TestSession < Minitest::Test
379
379
  assert_equal([], @session.valid_values('oof'))
380
380
  end
381
381
  def test_persistent_user_input
382
- @request["baz"] = "zuv"
382
+ @request.params["baz"] = "zuv"
383
383
  @session.process_rack(rack_request: @request)
384
384
  assert_equal("zuv", @session.persistent_user_input(:baz))
385
385
  @session.process_rack(rack_request: StubSessionRequest.new)
386
386
  assert_equal("zuv", @session.persistent_user_input(:baz))
387
- @request["baz"] = "bla"
387
+ @request.params["baz"] = "bla"
388
388
  @session.process_rack(rack_request: @request)
389
389
  assert_equal("bla", @session.persistent_user_input(:baz))
390
390
  end
@@ -117,7 +117,7 @@ EOS
117
117
  request = fake_request_for_path '/shortcut'
118
118
  # run in safe-mode
119
119
  Thread.new {
120
- $SAFE = 1
120
+ # $SAFE = 1
121
121
  TransHandler.instance.translate_uri(request)
122
122
  }.join
123
123
  assert_equal({'shortcut' => 'variables'}, request.params)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: mail
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hpricot
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: chrono_logger
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +140,16 @@ dependencies:
154
140
  name: rdoc
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
- - - ">="
143
+ - - "<"
158
144
  - !ruby/object:Gem::Version
159
- version: '0'
145
+ version: 6.0.0
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
- - - ">="
150
+ - - "<"
165
151
  - !ruby/object:Gem::Version
166
- version: '0'
152
+ version: 6.0.0
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: simplecov
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -254,8 +240,10 @@ executables: []
254
240
  extensions: []
255
241
  extra_rdoc_files: []
256
242
  files:
243
+ - ".envrc"
244
+ - ".github/workflows/ruby.yml"
257
245
  - ".gitignore"
258
- - ".travis.yml"
246
+ - ".ruby-version"
259
247
  - Gemfile
260
248
  - History.txt
261
249
  - LICENCE.txt
@@ -268,6 +256,9 @@ files:
268
256
  - data/flavored_uri.grammar
269
257
  - data/uri.grammar
270
258
  - data/zone_uri.grammar
259
+ - devenv.lock
260
+ - devenv.nix
261
+ - devenv.yaml
271
262
  - install.rb
272
263
  - lib/sbsm.rb
273
264
  - lib/sbsm/admin_server.rb
@@ -331,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
322
  - !ruby/object:Gem::Version
332
323
  version: '0'
333
324
  requirements: []
334
- rubygems_version: 3.1.2
325
+ rubygems_version: 3.5.3
335
326
  signing_key:
336
327
  specification_version: 4
337
328
  summary: Application framework for state based session management from ywesee
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- ---
2
- language: ruby
3
-
4
- notifications:
5
- email:
6
- - ngiger@ywesee.com
7
-
8
- cache: bundler
9
-
10
- before_install:
11
- - gem --version
12
- - bundle config set without 'debugger'
13
-
14
- rvm:
15
- - 2.7.1
16
- - 2.5.0
17
- - ruby-head
18
- matrix:
19
- allow_failures:
20
- - rvm: ruby-head
21
- - rvm: 2.5.0 # Test for LogLevel does not work