simple_workflow 2.1.0 → 2.2.1
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 +4 -4
- data/Gemfile.lock +189 -139
- data/README.md +1 -1
- data/Rakefile +6 -28
- data/lib/simple_workflow/controller.rb +1 -1
- data/lib/simple_workflow/detour.rb +1 -1
- data/lib/simple_workflow/helper.rb +1 -1
- data/lib/simple_workflow/middleware.rb +10 -10
- data/lib/simple_workflow/version.rb +1 -1
- data/simple_workflow.gemspec +4 -6
- data/test/controller_test.rb +1 -1
- data/test/helper_test.rb +6 -5
- data/test/middleware_test.rb +14 -18
- data/test/test_helper.rb +2 -4
- metadata +11 -28
- data/simple_workflow-2.0.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b48b1e1e4e2c025d51b43bcd8800688bd5b34701e614477e59b31db2be525653
|
4
|
+
data.tar.gz: 102dd804824b1deac4b309b0150cd9149524be5926ff048c21479ec9c7ed2d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a99be761b12d1fe90b73b108fea8f4fb611dcf458c350c10158e70f05d4e2bfbc2c857069272c8cee498445b6d41e53cab73a4ea483f42c7f7f099a086ac072e
|
7
|
+
data.tar.gz: 7015168be5b0f6c000fa98415155f3e4dd6be1f2561e450c25b75c3b78835abec87a8bfae2bcb84d332fae4a645911a34fbf47c8b2cf72e8662a66d947830b71
|
data/Gemfile.lock
CHANGED
@@ -1,186 +1,236 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_workflow (2.1
|
5
|
-
rails (>=
|
4
|
+
simple_workflow (2.2.1)
|
5
|
+
rails (>= 6.1, < 8)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (
|
11
|
-
actionpack (=
|
12
|
-
activesupport (=
|
10
|
+
actioncable (7.1.3.4)
|
11
|
+
actionpack (= 7.1.3.4)
|
12
|
+
activesupport (= 7.1.3.4)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (7.1.3.4)
|
17
|
+
actionpack (= 7.1.3.4)
|
18
|
+
activejob (= 7.1.3.4)
|
19
|
+
activerecord (= 7.1.3.4)
|
20
|
+
activestorage (= 7.1.3.4)
|
21
|
+
activesupport (= 7.1.3.4)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.1.3.4)
|
27
|
+
actionpack (= 7.1.3.4)
|
28
|
+
actionview (= 7.1.3.4)
|
29
|
+
activejob (= 7.1.3.4)
|
30
|
+
activesupport (= 7.1.3.4)
|
27
31
|
mail (~> 2.5, >= 2.5.4)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.2)
|
36
|
+
actionpack (7.1.3.4)
|
37
|
+
actionview (= 7.1.3.4)
|
38
|
+
activesupport (= 7.1.3.4)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
racc
|
41
|
+
rack (>= 2.2.4)
|
42
|
+
rack-session (>= 1.0.1)
|
33
43
|
rack-test (>= 0.6.3)
|
34
|
-
rails-dom-testing (~> 2.
|
35
|
-
rails-html-sanitizer (~> 1.
|
36
|
-
actiontext (
|
37
|
-
actionpack (=
|
38
|
-
activerecord (=
|
39
|
-
activestorage (=
|
40
|
-
activesupport (=
|
44
|
+
rails-dom-testing (~> 2.2)
|
45
|
+
rails-html-sanitizer (~> 1.6)
|
46
|
+
actiontext (7.1.3.4)
|
47
|
+
actionpack (= 7.1.3.4)
|
48
|
+
activerecord (= 7.1.3.4)
|
49
|
+
activestorage (= 7.1.3.4)
|
50
|
+
activesupport (= 7.1.3.4)
|
51
|
+
globalid (>= 0.6.0)
|
41
52
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (
|
43
|
-
activesupport (=
|
53
|
+
actionview (7.1.3.4)
|
54
|
+
activesupport (= 7.1.3.4)
|
44
55
|
builder (~> 3.1)
|
45
|
-
erubi (~> 1.
|
46
|
-
rails-dom-testing (~> 2.
|
47
|
-
rails-html-sanitizer (~> 1.
|
48
|
-
activejob (
|
49
|
-
activesupport (=
|
56
|
+
erubi (~> 1.11)
|
57
|
+
rails-dom-testing (~> 2.2)
|
58
|
+
rails-html-sanitizer (~> 1.6)
|
59
|
+
activejob (7.1.3.4)
|
60
|
+
activesupport (= 7.1.3.4)
|
50
61
|
globalid (>= 0.3.6)
|
51
|
-
activemodel (
|
52
|
-
activesupport (=
|
53
|
-
activerecord (
|
54
|
-
activemodel (=
|
55
|
-
activesupport (=
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
activesupport (
|
62
|
+
activemodel (7.1.3.4)
|
63
|
+
activesupport (= 7.1.3.4)
|
64
|
+
activerecord (7.1.3.4)
|
65
|
+
activemodel (= 7.1.3.4)
|
66
|
+
activesupport (= 7.1.3.4)
|
67
|
+
timeout (>= 0.4.0)
|
68
|
+
activestorage (7.1.3.4)
|
69
|
+
actionpack (= 7.1.3.4)
|
70
|
+
activejob (= 7.1.3.4)
|
71
|
+
activerecord (= 7.1.3.4)
|
72
|
+
activesupport (= 7.1.3.4)
|
73
|
+
marcel (~> 1.0)
|
74
|
+
activesupport (7.1.3.4)
|
75
|
+
base64
|
76
|
+
bigdecimal
|
64
77
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
78
|
+
connection_pool (>= 2.2.5)
|
79
|
+
drb
|
65
80
|
i18n (>= 1.6, < 2)
|
66
81
|
minitest (>= 5.1)
|
82
|
+
mutex_m
|
67
83
|
tzinfo (~> 2.0)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
builder (3.
|
72
|
-
concurrent-ruby (1.
|
84
|
+
ast (2.4.2)
|
85
|
+
base64 (0.2.0)
|
86
|
+
bigdecimal (3.1.8)
|
87
|
+
builder (3.3.0)
|
88
|
+
concurrent-ruby (1.3.2)
|
89
|
+
connection_pool (2.4.1)
|
73
90
|
crass (1.0.6)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
91
|
+
date (3.3.4)
|
92
|
+
docile (1.4.0)
|
93
|
+
drb (2.2.1)
|
94
|
+
erubi (1.12.0)
|
95
|
+
globalid (1.2.1)
|
96
|
+
activesupport (>= 6.1)
|
97
|
+
i18n (1.14.5)
|
79
98
|
concurrent-ruby (~> 1.0)
|
80
|
-
|
99
|
+
io-console (0.7.2)
|
100
|
+
irb (1.13.1)
|
101
|
+
rdoc (>= 4.0.0)
|
102
|
+
reline (>= 0.4.2)
|
103
|
+
json (2.7.2)
|
104
|
+
language_server-protocol (3.17.0.3)
|
105
|
+
loofah (2.22.0)
|
81
106
|
crass (~> 1.0.2)
|
82
|
-
nokogiri (>= 1.
|
83
|
-
mail (2.
|
107
|
+
nokogiri (>= 1.12.0)
|
108
|
+
mail (2.8.1)
|
84
109
|
mini_mime (>= 0.1.1)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
mini_mime (1.
|
90
|
-
mini_portile2 (2.
|
91
|
-
minitest (5.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
110
|
+
net-imap
|
111
|
+
net-pop
|
112
|
+
net-smtp
|
113
|
+
marcel (1.0.4)
|
114
|
+
mini_mime (1.1.5)
|
115
|
+
mini_portile2 (2.8.7)
|
116
|
+
minitest (5.23.1)
|
117
|
+
mutex_m (0.2.0)
|
118
|
+
net-imap (0.4.12)
|
119
|
+
date
|
120
|
+
net-protocol
|
121
|
+
net-pop (0.1.2)
|
122
|
+
net-protocol
|
123
|
+
net-protocol (0.2.2)
|
124
|
+
timeout
|
125
|
+
net-smtp (0.5.0)
|
126
|
+
net-protocol
|
127
|
+
nio4r (2.7.3)
|
128
|
+
nokogiri (1.16.5)
|
129
|
+
mini_portile2 (~> 2.8.2)
|
130
|
+
racc (~> 1.4)
|
131
|
+
parallel (1.25.1)
|
132
|
+
parser (3.3.2.0)
|
102
133
|
ast (~> 2.4.1)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
134
|
+
racc
|
135
|
+
psych (5.1.2)
|
136
|
+
stringio
|
137
|
+
racc (1.8.0)
|
138
|
+
rack (3.0.11)
|
139
|
+
rack-session (2.0.0)
|
140
|
+
rack (>= 3.0.0)
|
141
|
+
rack-test (2.1.0)
|
142
|
+
rack (>= 1.3)
|
143
|
+
rackup (2.1.0)
|
144
|
+
rack (>= 3)
|
145
|
+
webrick (~> 1.8)
|
146
|
+
rails (7.1.3.4)
|
147
|
+
actioncable (= 7.1.3.4)
|
148
|
+
actionmailbox (= 7.1.3.4)
|
149
|
+
actionmailer (= 7.1.3.4)
|
150
|
+
actionpack (= 7.1.3.4)
|
151
|
+
actiontext (= 7.1.3.4)
|
152
|
+
actionview (= 7.1.3.4)
|
153
|
+
activejob (= 7.1.3.4)
|
154
|
+
activemodel (= 7.1.3.4)
|
155
|
+
activerecord (= 7.1.3.4)
|
156
|
+
activestorage (= 7.1.3.4)
|
157
|
+
activesupport (= 7.1.3.4)
|
118
158
|
bundler (>= 1.15.0)
|
119
|
-
railties (=
|
120
|
-
|
121
|
-
|
122
|
-
|
159
|
+
railties (= 7.1.3.4)
|
160
|
+
rails-dom-testing (2.2.0)
|
161
|
+
activesupport (>= 5.0.0)
|
162
|
+
minitest
|
123
163
|
nokogiri (>= 1.6)
|
124
|
-
rails-html-sanitizer (1.
|
125
|
-
loofah (~> 2.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
164
|
+
rails-html-sanitizer (1.6.0)
|
165
|
+
loofah (~> 2.21)
|
166
|
+
nokogiri (~> 1.14)
|
167
|
+
railties (7.1.3.4)
|
168
|
+
actionpack (= 7.1.3.4)
|
169
|
+
activesupport (= 7.1.3.4)
|
170
|
+
irb
|
171
|
+
rackup (>= 1.0.0)
|
172
|
+
rake (>= 12.2)
|
173
|
+
thor (~> 1.0, >= 1.2.2)
|
174
|
+
zeitwerk (~> 2.6)
|
175
|
+
rainbow (3.1.1)
|
176
|
+
rake (13.2.1)
|
177
|
+
rdoc (6.7.0)
|
178
|
+
psych (>= 4.0.0)
|
179
|
+
regexp_parser (2.9.2)
|
180
|
+
reline (0.5.8)
|
181
|
+
io-console (~> 0.5)
|
182
|
+
rexml (3.2.9)
|
183
|
+
strscan
|
184
|
+
rubocop (1.64.1)
|
185
|
+
json (~> 2.3)
|
186
|
+
language_server-protocol (>= 3.17.0)
|
137
187
|
parallel (~> 1.10)
|
138
|
-
parser (>=
|
188
|
+
parser (>= 3.3.0.2)
|
139
189
|
rainbow (>= 2.2.2, < 4.0)
|
140
|
-
regexp_parser (>= 1.8)
|
141
|
-
rexml
|
142
|
-
rubocop-ast (>=
|
190
|
+
regexp_parser (>= 1.8, < 3.0)
|
191
|
+
rexml (>= 3.2.5, < 4.0)
|
192
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
143
193
|
ruby-progressbar (~> 1.7)
|
144
|
-
unicode-display_width (>=
|
145
|
-
rubocop-ast (1.3
|
146
|
-
parser (>=
|
147
|
-
rubocop-performance (1.
|
148
|
-
rubocop (>=
|
149
|
-
rubocop-ast (>=
|
150
|
-
rubocop-rails (2.
|
194
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
195
|
+
rubocop-ast (1.31.3)
|
196
|
+
parser (>= 3.3.1.0)
|
197
|
+
rubocop-performance (1.21.0)
|
198
|
+
rubocop (>= 1.48.1, < 2.0)
|
199
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
200
|
+
rubocop-rails (2.25.0)
|
151
201
|
activesupport (>= 4.2.0)
|
152
202
|
rack (>= 1.1)
|
153
|
-
rubocop (>=
|
154
|
-
|
155
|
-
|
203
|
+
rubocop (>= 1.33.0, < 2.0)
|
204
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
205
|
+
ruby-progressbar (1.13.0)
|
206
|
+
simplecov (0.22.0)
|
156
207
|
docile (~> 1.1)
|
157
208
|
simplecov-html (~> 0.11)
|
158
209
|
simplecov_json_formatter (~> 0.1)
|
159
210
|
simplecov-html (0.12.3)
|
160
|
-
simplecov_json_formatter (0.1.
|
161
|
-
|
211
|
+
simplecov_json_formatter (0.1.4)
|
212
|
+
stringio (3.1.0)
|
213
|
+
strscan (3.1.0)
|
214
|
+
thor (1.3.1)
|
215
|
+
timeout (0.4.1)
|
216
|
+
tzinfo (2.0.6)
|
162
217
|
concurrent-ruby (~> 1.0)
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
activesupport (>= 4.0)
|
167
|
-
sprockets (>= 3.0.0)
|
168
|
-
thor (1.0.1)
|
169
|
-
tzinfo (2.0.4)
|
170
|
-
concurrent-ruby (~> 1.0)
|
171
|
-
unicode-display_width (1.7.0)
|
172
|
-
websocket-driver (0.7.3)
|
218
|
+
unicode-display_width (2.5.0)
|
219
|
+
webrick (1.8.1)
|
220
|
+
websocket-driver (0.7.6)
|
173
221
|
websocket-extensions (>= 0.1.0)
|
174
222
|
websocket-extensions (0.1.5)
|
175
|
-
zeitwerk (2.
|
223
|
+
zeitwerk (2.6.15)
|
176
224
|
|
177
225
|
PLATFORMS
|
178
226
|
ruby
|
179
227
|
|
180
228
|
DEPENDENCIES
|
181
|
-
|
182
|
-
rubocop (~> 0.49)
|
229
|
+
rubocop (~> 1.0)
|
183
230
|
rubocop-performance (~> 1.5)
|
184
231
|
rubocop-rails (~> 2.4)
|
185
232
|
simple_workflow!
|
186
233
|
simplecov (~> 0.9)
|
234
|
+
|
235
|
+
BUNDLED WITH
|
236
|
+
2.3.8
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ simple_workflow
|
|
2
2
|
===============
|
3
3
|
|
4
4
|
[](https://badge.fury.io/rb/simple_workflow)
|
5
|
-
[](https://github.com/donv/simple_workflow/actions/workflows/test.yml)
|
6
6
|
|
7
7
|
* http://github.com/donv/simple_workflow
|
8
8
|
* http://rubydoc.info/gems/simple_workflow
|
data/Rakefile
CHANGED
@@ -1,35 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'rake/clean'
|
5
|
-
require 'rake/testtask'
|
6
|
-
require "#{File.dirname(__FILE__)}/lib/simple_workflow/version"
|
7
|
-
|
8
|
-
GEM_FILE = "simple_workflow-#{SimpleWorkflow::VERSION}.gem"
|
9
|
-
GEM_SPEC_FILE = 'simple_workflow.gemspec'
|
10
|
-
|
11
|
-
CLEAN.include('simple_workflow-*.gem', 'tmp')
|
3
|
+
require 'bundler/gem_tasks'
|
12
4
|
|
13
5
|
task default: :test
|
14
6
|
|
15
|
-
|
16
|
-
task gem: GEM_FILE
|
17
|
-
|
18
|
-
file(GEM_FILE => GEM_SPEC_FILE) do
|
19
|
-
puts "Generating #{GEM_FILE}"
|
20
|
-
`gem build #{GEM_SPEC_FILE}`
|
21
|
-
end
|
22
|
-
|
23
|
-
desc 'Push the gem to RubyGems'
|
24
|
-
task release: :gem do
|
25
|
-
output = `git status --porcelain`
|
26
|
-
raise "Workspace not clean!\n#{output}" unless output.empty?
|
27
|
-
|
28
|
-
sh "git tag #{SimpleWorkflow::VERSION}"
|
29
|
-
sh 'git push --tags'
|
30
|
-
sh "gem push #{GEM_FILE}"
|
31
|
-
end
|
32
|
-
|
7
|
+
require 'rake/testtask'
|
33
8
|
Rake::TestTask.new do |t|
|
34
9
|
t.libs << 'test'
|
35
10
|
t.test_files = FileList['test/*_test.rb']
|
@@ -38,4 +13,7 @@ end
|
|
38
13
|
|
39
14
|
require 'rubocop/rake_task'
|
40
15
|
RuboCop::RakeTask.new
|
41
|
-
|
16
|
+
|
17
|
+
namespace :test do
|
18
|
+
task full: ['rubocop:autocorrect_all', :test]
|
19
|
+
end
|
@@ -66,7 +66,7 @@ module SimpleWorkflow::Controller
|
|
66
66
|
|
67
67
|
def redirect_to_post(options)
|
68
68
|
url = url_for options
|
69
|
-
render text: <<~HTML
|
69
|
+
render text: <<~HTML, layout: false
|
70
70
|
<html>
|
71
71
|
<body onload="document.getElementById('form').submit()">
|
72
72
|
<form id="form" action="#{url}" method="POST">
|
@@ -23,7 +23,7 @@ module SimpleWorkflow::Detour
|
|
23
23
|
return nil unless detours
|
24
24
|
|
25
25
|
detour = detours.delete(origin_options) || detours.pop
|
26
|
-
Rails.logger.debug "popped detour: #{detour.inspect} #{session[:detours].size} more"
|
26
|
+
Rails.logger.debug { "popped detour: #{detour.inspect} #{session[:detours].size} more" }
|
27
27
|
reset_workflow(session) if detours.empty?
|
28
28
|
detour
|
29
29
|
end
|
@@ -44,7 +44,7 @@ module SimpleWorkflow::Helper
|
|
44
44
|
end
|
45
45
|
origin.update(origin_options) if origin.keys == [:anchor]
|
46
46
|
url = url_for(options)
|
47
|
-
url + (
|
47
|
+
url + (url.include?('?') ? '&' : '?') + origin.to_h.to_param('detour')
|
48
48
|
end
|
49
49
|
|
50
50
|
def origin_options
|
@@ -14,9 +14,9 @@ class SimpleWorkflow::Middleware
|
|
14
14
|
|
15
15
|
def call(env)
|
16
16
|
store_detour_from_params(env)
|
17
|
-
status, headers,
|
17
|
+
status, headers, body = @app.call(env)
|
18
18
|
remove_old_detours(env)
|
19
|
-
[status, headers,
|
19
|
+
[status, headers, body]
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -42,7 +42,7 @@ class SimpleWorkflow::Middleware
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def remove_old_detours(env)
|
45
|
-
return unless session(env).instance_variable_get(
|
45
|
+
return unless session(env).instance_variable_get(:@by).is_a?(ActionDispatch::Session::CookieStore)
|
46
46
|
|
47
47
|
session_size = workflow_size = nil
|
48
48
|
session = session(env)
|
@@ -60,12 +60,12 @@ class SimpleWorkflow::Middleware
|
|
60
60
|
session[:detours].shift
|
61
61
|
reset_workflow(session) if session[:detours].empty?
|
62
62
|
end
|
63
|
-
Rails.logger.debug
|
63
|
+
Rails.logger.debug { <<~MSG }
|
64
64
|
session: #{session_size} bytes, workflow(#{session[:detours].try(:size) || 0}): #{workflow_size} bytes
|
65
65
|
MSG
|
66
66
|
return unless session_size > 4096
|
67
67
|
|
68
|
-
Rails.logger.warn
|
68
|
+
Rails.logger.warn <<~MSG
|
69
69
|
simple_workflow: session exceeds cookie size limit: #{session_size} bytes. Workflow empty! Not My Fault!
|
70
70
|
MSG
|
71
71
|
Rails.logger.warn "simple_workflow: session: #{session.to_hash}"
|
@@ -75,20 +75,20 @@ class SimpleWorkflow::Middleware
|
|
75
75
|
def remove_discarded_flashes(session)
|
76
76
|
return unless (old_flashes = session[:flash] && session[:flash]['discard'])
|
77
77
|
|
78
|
-
Rails.logger.warn
|
78
|
+
Rails.logger.warn <<~MSG
|
79
79
|
simple_workflow: found discarded flash entries: #{old_flashes}. Deleting them.
|
80
80
|
MSG
|
81
81
|
session[:flash]['flashes'] = session[:flash]['flashes'].except(*old_flashes)
|
82
82
|
Rails.logger.warn "simple_workflow: session: #{session.to_hash}"
|
83
83
|
end
|
84
84
|
|
85
|
-
if ActionPack::VERSION::MAJOR >=
|
85
|
+
if ActionPack::VERSION::MAJOR >= 7
|
86
86
|
def serialize_session(cookie_jar, session)
|
87
|
-
cookie_jar.send(:
|
87
|
+
cookie_jar.send(:serializer).send(:dump, session)
|
88
88
|
end
|
89
|
-
else # Rails
|
89
|
+
else # Rails 6
|
90
90
|
def serialize_session(cookie_jar, session)
|
91
|
-
cookie_jar.send(:serialize,
|
91
|
+
cookie_jar.send(:serialize, session)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
data/simple_workflow.gemspec
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'rake'
|
4
3
|
require './lib/simple_workflow/version'
|
5
4
|
require 'date'
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = 'simple_workflow'
|
9
8
|
s.version = SimpleWorkflow::VERSION
|
10
|
-
s.date = Date.today.strftime '%Y-%m-%d' # rubocop:disable Rails/Date
|
11
9
|
s.authors = ['Uwe Kubosch']
|
12
10
|
s.email = 'uwe@kubosch.no'
|
13
11
|
s.summary = 'Add simple breadcrumbs "detour" workflow to Ruby On Rails.'
|
14
12
|
s.homepage = 'https://github.com/donv/simple_workflow'
|
15
13
|
s.description = 'Expands Ruby on Rails to allow simple breadcrumb detour workflows.'
|
16
|
-
s.required_ruby_version = '
|
14
|
+
s.required_ruby_version = '~> 3.1'
|
17
15
|
s.licenses = %w[MIT]
|
18
|
-
s.files =
|
16
|
+
s.files = Dir['[A-Z]*', 'lib/**/*', 'test/**/*']
|
19
17
|
|
20
|
-
s.add_runtime_dependency('rails', '>=
|
18
|
+
s.add_runtime_dependency('rails', '>=6.1', '<8')
|
21
19
|
|
22
|
-
s.add_development_dependency('minitest-reporters', '~>1.0')
|
23
20
|
s.add_development_dependency('rubocop', '~>1.0')
|
24
21
|
s.add_development_dependency('rubocop-performance', '~>1.5')
|
25
22
|
s.add_development_dependency('rubocop-rails', '~>2.4')
|
26
23
|
s.add_development_dependency('simplecov', '~>0.9')
|
24
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
27
25
|
end
|
data/test/controller_test.rb
CHANGED
data/test/helper_test.rb
CHANGED
@@ -4,12 +4,12 @@ require_relative 'test_helper'
|
|
4
4
|
require 'action_controller/metal/exceptions'
|
5
5
|
require 'test_app'
|
6
6
|
|
7
|
-
class HelperTest <
|
7
|
+
class HelperTest < Minitest::Test
|
8
8
|
include SimpleWorkflow::Helper
|
9
9
|
|
10
10
|
def test_with_detour
|
11
11
|
assert_equal '?detour%5Baction%5D=myaction&detour%5Bcontroller%5D=mycontroller&detour%5Bid%5D=42' \
|
12
|
-
|
12
|
+
'&detour%5Bquery%5D%5Bnested%5D=criterium',
|
13
13
|
with_detour('')
|
14
14
|
end
|
15
15
|
|
@@ -20,7 +20,8 @@ class HelperTest < MiniTest::Test
|
|
20
20
|
|
21
21
|
def test_with_detour_with_only_anchor_as_origin
|
22
22
|
assert_equal '?detour%5Baction%5D=myaction&detour%5Banchor%5D=tab_2' \
|
23
|
-
|
23
|
+
'&detour%5Bcontroller%5D=mycontroller&detour%5Bid%5D=42' \
|
24
|
+
'&detour%5Bquery%5D%5Bnested%5D=criterium',
|
24
25
|
with_detour('', anchor: :tab_2)
|
25
26
|
end
|
26
27
|
|
@@ -38,7 +39,7 @@ class HelperTest < MiniTest::Test
|
|
38
39
|
end
|
39
40
|
|
40
41
|
assert_equal '?detour%5Baction%5D=index&detour%5Banchor%5D=tab_2' \
|
41
|
-
|
42
|
+
'&detour%5Bcontroller%5D=simple_workflow%2F&detour%5Bhullo%5D=1',
|
42
43
|
with_detour('', '/dashboard/index?hullo=1#tab_2')
|
43
44
|
ensure
|
44
45
|
Rails.application = nil
|
@@ -48,7 +49,7 @@ class HelperTest < MiniTest::Test
|
|
48
49
|
assert_equal [
|
49
50
|
'Link Text',
|
50
51
|
'Link target?detour%5Baction%5D=myaction&detour%5Bcontroller%5D=mycontroller&detour%5Bid%5D=42' \
|
51
|
-
|
52
|
+
'&detour%5Bquery%5D%5Bnested%5D=criterium',
|
52
53
|
{ id: 'link_tag_id', title: 'Link title' },
|
53
54
|
],
|
54
55
|
detour_to('Link Text', 'Link target', id: 'link_tag_id', title: 'Link title')
|
data/test/middleware_test.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative 'test_helper'
|
|
4
4
|
require 'simple_workflow/middleware'
|
5
5
|
require_relative 'test_app'
|
6
6
|
|
7
|
-
class MiddlewareTest <
|
7
|
+
class MiddlewareTest < Minitest::Test
|
8
8
|
def setup
|
9
9
|
@app = TestApp.instance
|
10
10
|
# @app = ->(env) { [200, env, 'app response'] }
|
@@ -20,11 +20,10 @@ class MiddlewareTest < MiniTest::Test
|
|
20
20
|
def test_get_without_detour
|
21
21
|
env = env_for('/')
|
22
22
|
|
23
|
-
status, headers,
|
23
|
+
status, headers, body = @stack.call env
|
24
24
|
|
25
25
|
assert_equal 200, status
|
26
|
-
assert_equal
|
27
|
-
assert_equal 'app response', response
|
26
|
+
assert_equal ['app response'], [*body]
|
28
27
|
assert_equal [], headers['rack.session'].to_hash.keys
|
29
28
|
assert_nil headers['rack.session'].to_hash['detours']
|
30
29
|
end
|
@@ -32,11 +31,10 @@ class MiddlewareTest < MiniTest::Test
|
|
32
31
|
def test_detour
|
33
32
|
env = env_for('/?detour[controller]=test')
|
34
33
|
|
35
|
-
status, headers,
|
34
|
+
status, headers, body = @stack.call(env)
|
36
35
|
|
37
36
|
assert_equal 200, status
|
38
|
-
assert_equal
|
39
|
-
assert_equal 'app response', response
|
37
|
+
assert_equal ['app response'], [*body]
|
40
38
|
assert_equal(%w[session_id detours], headers['rack.session'].to_hash.keys)
|
41
39
|
assert_equal([{ 'controller' => 'test' }], headers['rack.session'].to_hash['detours'])
|
42
40
|
end
|
@@ -52,10 +50,10 @@ class MiddlewareTest < MiniTest::Test
|
|
52
50
|
last_env = env_for('/?detour[controller]=test_last',
|
53
51
|
'rack.session' => env['rack.session'],
|
54
52
|
'rack.session.options' => env['rack.session.options'])
|
55
|
-
status, env,
|
53
|
+
status, env, body = @stack.call last_env
|
56
54
|
|
57
55
|
assert_equal 200, status
|
58
|
-
assert_equal 'app response',
|
56
|
+
assert_equal ['app response'], [*body]
|
59
57
|
assert_equal(%w[session_id detours], env['rack.session'].to_hash.keys)
|
60
58
|
|
61
59
|
assert_equal(((57..99).to_a + [:last]).map { |i| { 'controller' => "test_#{i}" } },
|
@@ -63,16 +61,15 @@ class MiddlewareTest < MiniTest::Test
|
|
63
61
|
end
|
64
62
|
|
65
63
|
def test_huge_detour_over_4k
|
66
|
-
# rubocop:disable
|
64
|
+
# rubocop:disable Layout/LineLength
|
67
65
|
query = "/orders/TeYphD2wcYyBDFaKTnmAog/edit?detour%5Baction%5D=index&detour%5Bcommit%5D=Search&detour%5Bcontroller%5D=order_drilldown&detour%5Bdrilldown_search%5D%5Bdimensions%5D%5B%5D=arrival&detour%5Bdrilldown_search%5D%5Bdimensions%5D%5B%5D=delay&detour%5Bdrilldown_search%5D%5Bdisplay_type%5D=NONE&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bactual_time%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bcomments%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdelay%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdescription%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdirection%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdrop_off_stand%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bestimated%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bfirst_vehicle%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bofb%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bonb%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Boperation%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bpick_up%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bpick_up_stand%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bplanned%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bprobable%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bscheduled%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bsta%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Btime%5D=0&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Barrival%5D%5B%5D=Arrival&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Barrival%5D%5B%5D=Departure&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Bcalendar_date%5D%5B%5D=2016-03-01&detour%5Bdrilldown_search%5D%5Blist%5D=1&detour%5Bdrilldown_search%5D%5Blist_change_times%5D=0&detour%5Bdrilldown_search%5D%5Border_by_value%5D=0&detour%5Bdrilldown_search%5D%5Bpercent%5D=1&detour%5Bdrilldown_search%5D%5Bselect_value%5D=COUNT&detour%5Bdrilldown_search%5D%5Btitle%5D=OSL+Daily+Delay+Report+2016-04-16#{'+etc' * 200}&detour%5Butf8%5D=%E2%9C%93"
|
68
|
-
# rubocop:enable
|
66
|
+
# rubocop:enable Layout/LineLength
|
69
67
|
env = env_for(query)
|
70
68
|
|
71
69
|
status, headers, response = @stack.call env
|
72
70
|
|
73
71
|
assert_equal 200, status
|
74
|
-
assert_equal
|
75
|
-
assert_equal 'app response', response
|
72
|
+
assert_equal ['app response'], [*response]
|
76
73
|
assert_equal(%w[session_id], headers['rack.session'].to_hash.keys)
|
77
74
|
end
|
78
75
|
|
@@ -84,8 +81,10 @@ class MiddlewareTest < MiniTest::Test
|
|
84
81
|
status, headers, response = @stack.call env
|
85
82
|
|
86
83
|
assert_equal 200, status
|
87
|
-
|
88
|
-
|
84
|
+
if headers['set-cookie']
|
85
|
+
assert_match(%r{_session_id=\w+--\w+; path=/; httponly}, headers['set-cookie'])
|
86
|
+
end
|
87
|
+
assert_equal ['app response'], [*response]
|
89
88
|
assert_equal ['session_id'], headers['rack.session'].to_hash.keys
|
90
89
|
assert_nil headers['rack.session'].to_hash['detours']
|
91
90
|
end
|
@@ -101,9 +100,6 @@ class MiddlewareTest < MiniTest::Test
|
|
101
100
|
ActionDispatch::Cookies::GENERATOR_KEY => ActiveSupport::KeyGenerator.new('secret'),
|
102
101
|
ActionDispatch::Cookies::SECRET_KEY_BASE => 'secret',
|
103
102
|
}
|
104
|
-
if /^5\.2\./.match?(Rails.version)
|
105
|
-
default_opts[ActionDispatch::Cookies::COOKIES_ROTATIONS] = Struct.new(:encrypted).new([])
|
106
|
-
end
|
107
103
|
Rack::MockRequest.env_for(url, default_opts.update(opts))
|
108
104
|
end
|
109
105
|
end
|
data/test/test_helper.rb
CHANGED
@@ -5,18 +5,16 @@ require 'bundler/setup'
|
|
5
5
|
require 'simplecov'
|
6
6
|
SimpleCov.start do
|
7
7
|
coverage_dir File.expand_path('../coverage', File.dirname(__FILE__))
|
8
|
-
minimum_coverage
|
8
|
+
minimum_coverage 75
|
9
9
|
end
|
10
10
|
require 'minitest/autorun'
|
11
|
-
require 'minitest/reporters'
|
12
|
-
MiniTest::Reporters.use!
|
13
11
|
require 'rails'
|
14
12
|
require 'simple_workflow'
|
15
13
|
|
16
14
|
FileUtils.mkdir_p File.expand_path '../log', __dir__
|
17
15
|
|
18
16
|
module SimpleWorkflow::Controller
|
19
|
-
def self.action_encoding_template(
|
17
|
+
def self.action_encoding_template(_action)
|
20
18
|
false
|
21
19
|
end
|
22
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,34 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: minitest-reporters
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.0'
|
40
|
-
type: :development
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '1.0'
|
32
|
+
version: '8'
|
47
33
|
- !ruby/object:Gem::Dependency
|
48
34
|
name: rubocop
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +105,6 @@ files:
|
|
119
105
|
- lib/simple_workflow/railtie.rb
|
120
106
|
- lib/simple_workflow/test_helper.rb
|
121
107
|
- lib/simple_workflow/version.rb
|
122
|
-
- simple_workflow-2.0.0.gem
|
123
108
|
- simple_workflow.gemspec
|
124
109
|
- test/controller_test.rb
|
125
110
|
- test/helper_test.rb
|
@@ -129,26 +114,24 @@ files:
|
|
129
114
|
homepage: https://github.com/donv/simple_workflow
|
130
115
|
licenses:
|
131
116
|
- MIT
|
132
|
-
metadata:
|
117
|
+
metadata:
|
118
|
+
rubygems_mfa_required: 'true'
|
133
119
|
post_install_message:
|
134
120
|
rdoc_options: []
|
135
121
|
require_paths:
|
136
122
|
- lib
|
137
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
138
124
|
requirements:
|
139
|
-
- - "
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '2.5'
|
142
|
-
- - "<"
|
125
|
+
- - "~>"
|
143
126
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
127
|
+
version: '3.1'
|
145
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
129
|
requirements:
|
147
130
|
- - ">="
|
148
131
|
- !ruby/object:Gem::Version
|
149
132
|
version: '0'
|
150
133
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.5.9
|
152
135
|
signing_key:
|
153
136
|
specification_version: 4
|
154
137
|
summary: Add simple breadcrumbs "detour" workflow to Ruby On Rails.
|
data/simple_workflow-2.0.0.gem
DELETED
Binary file
|