copy_tuner_client 0.8.1 → 0.12.0

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: 757532de573065d4b93a08c8bd5061a17c8fbef293d5f14a8ff24bb3815f3323
4
- data.tar.gz: 5d6ceefe8fcb9b2d21ad9592e07d8e0ac68c9ef8684824e57e2a24d5f22afeb1
3
+ metadata.gz: 02e158d00caa261a1c3cf73b38648bde2307f5160708fcf39e7e84b542c2ecc6
4
+ data.tar.gz: ca6f9c714f15afbace17d89d3ef67a71546d5b414be83ff09e59c6b9b1974958
5
5
  SHA512:
6
- metadata.gz: e1effa31089ac5b0b480196ff1fb9700b92b80a2137393467923c84150a252688c2bc4b33f5a1a63c84a58af9128866a22a784111dcd16842a24b0a00437e11f
7
- data.tar.gz: 8e987b21c4b30714b056f2685f57b9b4157f505fb4ef6857b853ab1dd82b3bbaffd442f8add04c8ffed8d0c80d1f52e2eb00d2a452be6859cd42aa048c5ef602
6
+ metadata.gz: ffb1ebc5fb6f78326f820527646f32eb6fcbf09c622f90d299d61a96778c27ad0954d0c8db784d96a4c93534a5eee0acb01eed824ddd1cbcee0aa5fae5cd35cc
7
+ data.tar.gz: 1ebe88eb8278fee882c0129908c562157b0ca16e6b7ac0181ae9774f53df84e5df3fcd63a843586302ab6010d369bf19d78bae8453cdc28fbf463977b8d7ede7
@@ -9,7 +9,7 @@ name: Ruby
9
9
 
10
10
  on:
11
11
  push:
12
- branches: [ master ]
12
+ branches: [master]
13
13
  pull_request:
14
14
 
15
15
  jobs:
@@ -18,36 +18,32 @@ jobs:
18
18
  env:
19
19
  BUNDLE_JOBS: 4
20
20
  BUNDLE_RETRY: 3
21
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21
22
  strategy:
22
23
  fail-fast: false
23
24
  matrix:
24
- ruby: [2.6, 2.7]
25
- gemfile: [
26
- "gemfiles/5.2.gemfile",
27
- "gemfiles/6.0.gemfile",
28
- ]
25
+ ruby: [2.6, 2.7, 3.0]
26
+ gemfile: ["5.2", "6.0", "6.1", "main"]
27
+ exclude:
28
+ - ruby: 2.6
29
+ gemfile: main
30
+ - ruby: 3.0
31
+ gemfile: 5.2
32
+ - ruby: 3.0
33
+ gemfile: "6.0"
29
34
  steps:
30
- - name: Install packages
31
- run: |
32
- sudo apt update -y
33
- sudo apt install -y libsqlite3-dev
34
- - uses: actions/checkout@v2
35
- - uses: actions/cache@v1
36
- with:
37
- path: /home/runner/bundle
38
- key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
39
- restore-keys: |
40
- bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
41
- - name: Set up Ruby
42
- uses: ruby/setup-ruby@v1
43
- with:
44
- ruby-version: ${{ matrix.ruby }}
45
- - name: Install dependencies
46
- run: |
47
- bundle config path /home/runner/bundle
48
- bundle config --global gemfile ${{ matrix.gemfile }}
49
- bundle install
50
- bundle update
51
- bundle clean
52
- - name: Run rspec
53
- run: bundle exec rspec
35
+ - name: Install packages
36
+ run: |
37
+ sudo apt update -y
38
+ sudo apt install -y libsqlite3-dev
39
+
40
+ - uses: actions/checkout@v2
41
+
42
+ - name: Set up Ruby
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby }}
46
+ bundler-cache: true
47
+
48
+ - name: Run rspec
49
+ run: bundle exec rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.12.0
2
+
3
+ - Add `config.ignored_keys` and `config.ignored_key_handler`
4
+
5
+ ## 0.11.0
6
+
7
+ - Remove deprecated rescue_format option
8
+ - Fix ruby@2.7 keyword warning
9
+
10
+ ## 0.10.0
11
+
12
+ - Add copy_tuner:detect_html_incompatible_keys task
13
+
14
+ ## 0.9.0
15
+
16
+ - Do not upload invalid type keys
17
+
1
18
  ## 0.8.1
2
19
 
3
20
  - Fix bug in `CopyrayMiddleware`
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'sgcop', git: 'git://github.com/SonicGarden/sgcop.git'
5
+ gem 'sgcop', github: 'SonicGarden/sgcop'
data/Gemfile.lock CHANGED
@@ -1,227 +1,250 @@
1
1
  GIT
2
- remote: git://github.com/SonicGarden/sgcop.git
3
- revision: cbe7f18b9e81e9e3cda2e4bc5f64735fa014dc9b
2
+ remote: https://github.com/SonicGarden/sgcop.git
3
+ revision: e708293619ea29e2a7a326db3dfaa3be63939c69
4
4
  specs:
5
- sgcop (0.0.36)
6
- brakeman
7
- brakeman_translate_checkstyle_format
8
- haml_lint (~> 0.34.0)
9
- rubocop (~> 0.81.0)
10
- rubocop-performance (~> 1.5.2)
11
- rubocop-rails (~> 2.5.2)
12
- rubocop-rspec (~> 1.38.1)
5
+ sgcop (0.4.14)
6
+ haml_lint (~> 0.37.0)
7
+ rubocop (~> 1.21.0)
8
+ rubocop-performance (~> 1.11.5)
9
+ rubocop-rails (~> 2.12.2)
10
+ rubocop-rake (~> 0.6.0)
11
+ rubocop-rspec (~> 2.4.0)
13
12
 
14
13
  PATH
15
14
  remote: .
16
15
  specs:
17
- copy_tuner_client (0.8.1)
16
+ copy_tuner_client (0.12.0)
18
17
  i18n (>= 0.5.0)
19
18
  json
19
+ nokogiri
20
20
 
21
21
  GEM
22
22
  remote: http://rubygems.org/
23
23
  specs:
24
- actioncable (5.2.4.2)
25
- actionpack (= 5.2.4.2)
24
+ actioncable (6.1.4.1)
25
+ actionpack (= 6.1.4.1)
26
+ activesupport (= 6.1.4.1)
26
27
  nio4r (~> 2.0)
27
28
  websocket-driver (>= 0.6.1)
28
- actionmailer (5.2.4.2)
29
- actionpack (= 5.2.4.2)
30
- actionview (= 5.2.4.2)
31
- activejob (= 5.2.4.2)
29
+ actionmailbox (6.1.4.1)
30
+ actionpack (= 6.1.4.1)
31
+ activejob (= 6.1.4.1)
32
+ activerecord (= 6.1.4.1)
33
+ activestorage (= 6.1.4.1)
34
+ activesupport (= 6.1.4.1)
35
+ mail (>= 2.7.1)
36
+ actionmailer (6.1.4.1)
37
+ actionpack (= 6.1.4.1)
38
+ actionview (= 6.1.4.1)
39
+ activejob (= 6.1.4.1)
40
+ activesupport (= 6.1.4.1)
32
41
  mail (~> 2.5, >= 2.5.4)
33
42
  rails-dom-testing (~> 2.0)
34
- actionpack (5.2.4.2)
35
- actionview (= 5.2.4.2)
36
- activesupport (= 5.2.4.2)
37
- rack (~> 2.0, >= 2.0.8)
43
+ actionpack (6.1.4.1)
44
+ actionview (= 6.1.4.1)
45
+ activesupport (= 6.1.4.1)
46
+ rack (~> 2.0, >= 2.0.9)
38
47
  rack-test (>= 0.6.3)
39
48
  rails-dom-testing (~> 2.0)
40
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
41
- actionview (5.2.4.2)
42
- activesupport (= 5.2.4.2)
49
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
50
+ actiontext (6.1.4.1)
51
+ actionpack (= 6.1.4.1)
52
+ activerecord (= 6.1.4.1)
53
+ activestorage (= 6.1.4.1)
54
+ activesupport (= 6.1.4.1)
55
+ nokogiri (>= 1.8.5)
56
+ actionview (6.1.4.1)
57
+ activesupport (= 6.1.4.1)
43
58
  builder (~> 3.1)
44
59
  erubi (~> 1.4)
45
60
  rails-dom-testing (~> 2.0)
46
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
47
- activejob (5.2.4.2)
48
- activesupport (= 5.2.4.2)
61
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
62
+ activejob (6.1.4.1)
63
+ activesupport (= 6.1.4.1)
49
64
  globalid (>= 0.3.6)
50
- activemodel (5.2.4.2)
51
- activesupport (= 5.2.4.2)
52
- activerecord (5.2.4.2)
53
- activemodel (= 5.2.4.2)
54
- activesupport (= 5.2.4.2)
55
- arel (>= 9.0)
56
- activestorage (5.2.4.2)
57
- actionpack (= 5.2.4.2)
58
- activerecord (= 5.2.4.2)
59
- marcel (~> 0.3.1)
60
- activesupport (5.2.4.2)
65
+ activemodel (6.1.4.1)
66
+ activesupport (= 6.1.4.1)
67
+ activerecord (6.1.4.1)
68
+ activemodel (= 6.1.4.1)
69
+ activesupport (= 6.1.4.1)
70
+ activestorage (6.1.4.1)
71
+ actionpack (= 6.1.4.1)
72
+ activejob (= 6.1.4.1)
73
+ activerecord (= 6.1.4.1)
74
+ activesupport (= 6.1.4.1)
75
+ marcel (~> 1.0.0)
76
+ mini_mime (>= 1.1.0)
77
+ activesupport (6.1.4.1)
61
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
- i18n (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- addressable (2.7.0)
79
+ i18n (>= 1.6, < 2)
80
+ minitest (>= 5.1)
81
+ tzinfo (~> 2.0)
82
+ zeitwerk (~> 2.3)
83
+ addressable (2.8.0)
66
84
  public_suffix (>= 2.0.2, < 5.0)
67
- arel (9.0.0)
68
- ast (2.4.0)
69
- brakeman (4.8.1)
70
- brakeman_translate_checkstyle_format (0.0.1)
71
- thor
85
+ ast (2.4.2)
72
86
  builder (3.2.4)
73
- concurrent-ruby (1.1.6)
74
- crack (0.4.3)
75
- safe_yaml (~> 1.0.0)
87
+ concurrent-ruby (1.1.9)
88
+ crack (0.4.5)
89
+ rexml
76
90
  crass (1.0.6)
77
- daemons (1.3.1)
78
- diff-lcs (1.3)
79
- erubi (1.9.0)
91
+ daemons (1.4.1)
92
+ diff-lcs (1.4.4)
93
+ erubi (1.10.0)
80
94
  eventmachine (1.2.7)
81
- globalid (0.4.2)
82
- activesupport (>= 4.2.0)
83
- haml (5.1.2)
95
+ globalid (0.5.2)
96
+ activesupport (>= 5.0)
97
+ haml (5.2.2)
84
98
  temple (>= 0.8.0)
85
99
  tilt
86
- haml_lint (0.34.2)
87
- haml (>= 4.0, < 5.2)
100
+ haml_lint (0.37.1)
101
+ haml (>= 4.0, < 5.3)
102
+ parallel (~> 1.10)
88
103
  rainbow
89
104
  rubocop (>= 0.50.0)
90
105
  sysexits (~> 1.1)
91
106
  hashdiff (1.0.1)
92
- i18n (1.8.2)
107
+ i18n (1.8.10)
93
108
  concurrent-ruby (~> 1.0)
94
- jaro_winkler (1.5.4)
95
109
  json (2.5.1)
96
- loofah (2.5.0)
110
+ loofah (2.12.0)
97
111
  crass (~> 1.0.2)
98
112
  nokogiri (>= 1.5.9)
99
113
  mail (2.7.1)
100
114
  mini_mime (>= 0.1.1)
101
- marcel (0.3.3)
102
- mimemagic (~> 0.3.2)
115
+ marcel (1.0.1)
103
116
  method_source (1.0.0)
104
- mimemagic (0.3.4)
105
- mini_mime (1.0.2)
106
- mini_portile2 (2.4.0)
107
- minitest (5.14.0)
117
+ mini_mime (1.1.1)
118
+ mini_portile2 (2.6.1)
119
+ minitest (5.14.4)
108
120
  mustermann (1.1.1)
109
121
  ruby2_keywords (~> 0.0.1)
110
- nio4r (2.5.2)
111
- nokogiri (1.10.9)
112
- mini_portile2 (~> 2.4.0)
113
- parallel (1.19.1)
114
- parser (2.7.1.2)
115
- ast (~> 2.4.0)
116
- public_suffix (4.0.4)
117
- rack (2.2.2)
118
- rack-protection (2.0.8.1)
122
+ nio4r (2.5.8)
123
+ nokogiri (1.12.4)
124
+ mini_portile2 (~> 2.6.1)
125
+ racc (~> 1.4)
126
+ parallel (1.21.0)
127
+ parser (3.0.2.0)
128
+ ast (~> 2.4.1)
129
+ public_suffix (4.0.6)
130
+ racc (1.5.2)
131
+ rack (2.2.3)
132
+ rack-protection (2.1.0)
119
133
  rack
120
134
  rack-test (1.1.0)
121
135
  rack (>= 1.0, < 3)
122
- rails (5.2.4.2)
123
- actioncable (= 5.2.4.2)
124
- actionmailer (= 5.2.4.2)
125
- actionpack (= 5.2.4.2)
126
- actionview (= 5.2.4.2)
127
- activejob (= 5.2.4.2)
128
- activemodel (= 5.2.4.2)
129
- activerecord (= 5.2.4.2)
130
- activestorage (= 5.2.4.2)
131
- activesupport (= 5.2.4.2)
132
- bundler (>= 1.3.0)
133
- railties (= 5.2.4.2)
136
+ rails (6.1.4.1)
137
+ actioncable (= 6.1.4.1)
138
+ actionmailbox (= 6.1.4.1)
139
+ actionmailer (= 6.1.4.1)
140
+ actionpack (= 6.1.4.1)
141
+ actiontext (= 6.1.4.1)
142
+ actionview (= 6.1.4.1)
143
+ activejob (= 6.1.4.1)
144
+ activemodel (= 6.1.4.1)
145
+ activerecord (= 6.1.4.1)
146
+ activestorage (= 6.1.4.1)
147
+ activesupport (= 6.1.4.1)
148
+ bundler (>= 1.15.0)
149
+ railties (= 6.1.4.1)
134
150
  sprockets-rails (>= 2.0.0)
135
151
  rails-dom-testing (2.0.3)
136
152
  activesupport (>= 4.2.0)
137
153
  nokogiri (>= 1.6)
138
- rails-html-sanitizer (1.3.0)
154
+ rails-html-sanitizer (1.4.2)
139
155
  loofah (~> 2.3)
140
- railties (5.2.4.2)
141
- actionpack (= 5.2.4.2)
142
- activesupport (= 5.2.4.2)
156
+ railties (6.1.4.1)
157
+ actionpack (= 6.1.4.1)
158
+ activesupport (= 6.1.4.1)
143
159
  method_source
144
- rake (>= 0.8.7)
145
- thor (>= 0.19.0, < 2.0)
160
+ rake (>= 0.13)
161
+ thor (~> 1.0)
146
162
  rainbow (3.0.0)
147
- rake (13.0.1)
148
- rexml (3.2.4)
149
- rspec (3.8.0)
150
- rspec-core (~> 3.8.0)
151
- rspec-expectations (~> 3.8.0)
152
- rspec-mocks (~> 3.8.0)
153
- rspec-core (3.8.2)
154
- rspec-support (~> 3.8.0)
155
- rspec-expectations (3.8.6)
163
+ rake (13.0.6)
164
+ regexp_parser (2.1.1)
165
+ rexml (3.2.5)
166
+ rspec (3.10.0)
167
+ rspec-core (~> 3.10.0)
168
+ rspec-expectations (~> 3.10.0)
169
+ rspec-mocks (~> 3.10.0)
170
+ rspec-core (3.10.1)
171
+ rspec-support (~> 3.10.0)
172
+ rspec-expectations (3.10.1)
156
173
  diff-lcs (>= 1.2.0, < 2.0)
157
- rspec-support (~> 3.8.0)
158
- rspec-mocks (3.8.2)
174
+ rspec-support (~> 3.10.0)
175
+ rspec-mocks (3.10.2)
159
176
  diff-lcs (>= 1.2.0, < 2.0)
160
- rspec-support (~> 3.8.0)
161
- rspec-support (3.8.3)
162
- rubocop (0.81.0)
163
- jaro_winkler (~> 1.5.1)
177
+ rspec-support (~> 3.10.0)
178
+ rspec-support (3.10.2)
179
+ rubocop (1.21.0)
164
180
  parallel (~> 1.10)
165
- parser (>= 2.7.0.1)
181
+ parser (>= 3.0.0.0)
166
182
  rainbow (>= 2.2.2, < 4.0)
183
+ regexp_parser (>= 1.8, < 3.0)
167
184
  rexml
185
+ rubocop-ast (>= 1.9.1, < 2.0)
168
186
  ruby-progressbar (~> 1.7)
169
- unicode-display_width (>= 1.4.0, < 2.0)
170
- rubocop-performance (1.5.2)
171
- rubocop (>= 0.71.0)
172
- rubocop-rails (2.5.2)
173
- activesupport
187
+ unicode-display_width (>= 1.4.0, < 3.0)
188
+ rubocop-ast (1.11.0)
189
+ parser (>= 3.0.1.1)
190
+ rubocop-performance (1.11.5)
191
+ rubocop (>= 1.7.0, < 2.0)
192
+ rubocop-ast (>= 0.4.0)
193
+ rubocop-rails (2.12.2)
194
+ activesupport (>= 4.2.0)
174
195
  rack (>= 1.1)
175
- rubocop (>= 0.72.0)
176
- rubocop-rspec (1.38.1)
177
- rubocop (>= 0.68.1)
178
- ruby-progressbar (1.10.1)
179
- ruby2_keywords (0.0.2)
180
- safe_yaml (1.0.5)
196
+ rubocop (>= 1.7.0, < 2.0)
197
+ rubocop-rake (0.6.0)
198
+ rubocop (~> 1.0)
199
+ rubocop-rspec (2.4.0)
200
+ rubocop (~> 1.0)
201
+ rubocop-ast (>= 1.1.0)
202
+ ruby-progressbar (1.11.0)
203
+ ruby2_keywords (0.0.5)
181
204
  sham_rack (1.4.1)
182
205
  rack
183
- sinatra (2.0.8.1)
206
+ sinatra (2.1.0)
184
207
  mustermann (~> 1.0)
185
- rack (~> 2.0)
186
- rack-protection (= 2.0.8.1)
208
+ rack (~> 2.2)
209
+ rack-protection (= 2.1.0)
187
210
  tilt (~> 2.0)
188
- sprockets (4.0.0)
211
+ sprockets (4.0.2)
189
212
  concurrent-ruby (~> 1.0)
190
213
  rack (> 1, < 3)
191
- sprockets-rails (3.2.1)
214
+ sprockets-rails (3.2.2)
192
215
  actionpack (>= 4.0)
193
216
  activesupport (>= 4.0)
194
217
  sprockets (>= 3.0.0)
195
218
  sqlite3 (1.4.2)
196
219
  sysexits (1.2.0)
197
220
  temple (0.8.2)
198
- thin (1.7.2)
221
+ thin (1.8.1)
199
222
  daemons (~> 1.0, >= 1.0.9)
200
223
  eventmachine (~> 1.0, >= 1.0.4)
201
224
  rack (>= 1, < 3)
202
- thor (1.0.1)
203
- thread_safe (0.3.6)
225
+ thor (1.1.0)
204
226
  tilt (2.0.10)
205
- tzinfo (1.2.7)
206
- thread_safe (~> 0.1)
207
- unicode-display_width (1.7.0)
208
- webmock (3.8.3)
209
- addressable (>= 2.3.6)
227
+ tzinfo (2.0.4)
228
+ concurrent-ruby (~> 1.0)
229
+ unicode-display_width (2.1.0)
230
+ webmock (3.14.0)
231
+ addressable (>= 2.8.0)
210
232
  crack (>= 0.3.2)
211
233
  hashdiff (>= 0.4.0, < 2.0.0)
212
- websocket-driver (0.7.1)
234
+ websocket-driver (0.7.5)
213
235
  websocket-extensions (>= 0.1.0)
214
- websocket-extensions (0.1.4)
215
- yard (0.9.24)
236
+ websocket-extensions (0.1.5)
237
+ yard (0.9.26)
238
+ zeitwerk (2.4.2)
216
239
 
217
240
  PLATFORMS
218
241
  ruby
219
242
 
220
243
  DEPENDENCIES
221
244
  copy_tuner_client!
222
- rails (~> 5.2.4.2)
245
+ rails (~> 6.1)
223
246
  rake
224
- rspec (= 3.8.0)
247
+ rspec
225
248
  sgcop!
226
249
  sham_rack
227
250
  sinatra
data/README.md CHANGED
@@ -61,12 +61,15 @@ $ npm run build # Compile to a <script> containing a self-executing function
61
61
 
62
62
  ### default spec
63
63
 
64
- $ bundle exec rake
64
+ ```
65
+ $ bundle exec rspec
66
+ ```
65
67
 
66
- ### Appraisal for Multi Version Rails spec
68
+ ### testing against all target rails versions
67
69
 
68
- $ bundle exec appraisal install
69
- $ bundle exec rake appraisal
70
+ ```
71
+ $ ./test.sh
72
+ ```
70
73
 
71
74
  ## release gem
72
75
 
@@ -6,9 +6,10 @@ Gem::Specification.new do |s|
6
6
  s.required_ruby_version = '>= 2.5.0'
7
7
  s.add_dependency 'i18n', '>= 0.5.0'
8
8
  s.add_dependency 'json'
9
- s.add_development_dependency 'rails', '~> 5.2.4.2'
9
+ s.add_dependency 'nokogiri'
10
+ s.add_development_dependency 'rails', '~> 6.1'
10
11
  s.add_development_dependency 'rake'
11
- s.add_development_dependency 'rspec', '3.8.0' # NOTE: 3.9.0だとundefined method `synchronize'でコケるテストがある
12
+ s.add_development_dependency 'rspec'
12
13
  s.add_development_dependency 'sham_rack'
13
14
  s.add_development_dependency 'sinatra'
14
15
  s.add_development_dependency 'sqlite3'
data/gemfiles/5.2.gemfile CHANGED
@@ -1,7 +1,5 @@
1
- # This file was generated by Appraisal
2
-
3
1
  source "http://rubygems.org"
4
2
 
5
- gem "rails", "5.2.4.2"
3
+ gem "rails", "~> 5.2"
6
4
 
7
5
  gemspec :path => "../"
data/gemfiles/6.0.gemfile CHANGED
@@ -1,7 +1,5 @@
1
- # This file was generated by Appraisal
2
-
3
1
  source "http://rubygems.org"
4
2
 
5
- gem "rails", "6.0.2.2"
3
+ gem "rails", "~> 6.0"
6
4
 
7
5
  gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 6.1"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", github: "rails/rails", branch: "main"
4
+
5
+ gemspec :path => "../"
@@ -19,7 +19,7 @@ module CopyTunerClient
19
19
  :proxy_port, :proxy_user, :secure, :polling_delay, :sync_interval,
20
20
  :sync_interval_staging, :sync_ignore_path_regex, :logger,
21
21
  :framework, :middleware, :disable_middleware, :disable_test_translation,
22
- :ca_file, :exclude_key_regexp, :s3_host, :locales].freeze
22
+ :ca_file, :exclude_key_regexp, :s3_host, :locales, :ignored_keys, :ignored_key_handler].freeze
23
23
 
24
24
  # @return [String] The API key for your project, found on the project edit form.
25
25
  attr_accessor :api_key
@@ -131,6 +131,12 @@ module CopyTunerClient
131
131
  # @return [Boolean] Html escape
132
132
  attr_accessor :html_escape
133
133
 
134
+ # @return [Array<String>] A list of ignored keys
135
+ attr_accessor :ignored_keys
136
+
137
+ # @return [Proc]
138
+ attr_accessor :ignored_key_handler
139
+
134
140
  alias_method :secure?, :secure
135
141
 
136
142
  # Instantiated from {CopyTunerClient.configure}. Sets defaults.
@@ -152,6 +158,8 @@ module CopyTunerClient
152
158
  self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com'
153
159
  self.disable_copyray_comment_injection = false
154
160
  self.html_escape = false
161
+ self.ignored_keys = []
162
+ self.ignored_key_handler = -> (e) { raise e }
155
163
 
156
164
  @applied = false
157
165
  end
@@ -1,5 +1,6 @@
1
1
  require 'copy_tuner_client/copyray'
2
2
  require 'copy_tuner_client/translation_log'
3
+ require 'copy_tuner_client/helper_extension'
3
4
 
4
5
  module CopyTunerClient
5
6
  # Connects to integration points for Rails 3 applications
@@ -10,36 +11,10 @@ module CopyTunerClient
10
11
 
11
12
  initializer :initialize_copy_tuner_hook_methods, :after => :load_config_initializers do |app|
12
13
  ActiveSupport.on_load(:action_view) do
13
- ActionView::Helpers::TranslationHelper.class_eval do
14
- def translate_with_copyray_comment(key, options = {})
15
- source = translate_without_copyray_comment(key, options)
16
- # TODO: 0.6.0以降で options[:rescue_format] == text を消す
17
- if CopyTunerClient.configuration.disable_copyray_comment_injection || options[:rescue_format] == :text
18
- if options[:rescue_format] == :text
19
- ActiveSupport::Deprecation.warn('rescue_format option is deprecated in copy_tuner_client@0.6.0')
20
- end
21
- source
22
- else
23
- separator = options[:separator] || I18n.default_separator
24
- scope = options[:scope]
25
- normalized_key =
26
- if key.to_s.first == '.'
27
- scope_key_by_partial(key)
28
- else
29
- I18n.normalize_keys(nil, key, scope, separator).join(separator)
30
- end
31
- CopyTunerClient::Copyray.augment_template(source, normalized_key)
32
- end
33
- end
34
- if CopyTunerClient.configuration.enable_middleware?
35
- alias_method :translate_without_copyray_comment, :translate
36
- alias_method :translate, :translate_with_copyray_comment
37
- alias :t :translate
38
- alias :tt :translate_without_copyray_comment
39
- else
40
- alias :tt :translate
41
- end
42
- end
14
+ CopyTunerClient::HelperExtension.hook_translation_helper(
15
+ ActionView::Helpers::TranslationHelper,
16
+ middleware_enabled: CopyTunerClient.configuration.enable_middleware?
17
+ )
43
18
  end
44
19
 
45
20
  if CopyTunerClient.configuration.enable_middleware?
@@ -9,4 +9,7 @@ module CopyTunerClient
9
9
  # server does not recognize. Polling is aborted when this error is raised.
10
10
  class InvalidApiKey < StandardError
11
11
  end
12
+
13
+ class IgnoredKey < StandardError
14
+ end
12
15
  end
@@ -0,0 +1,34 @@
1
+ module CopyTunerClient
2
+ module HelperExtension
3
+ class << self
4
+ def hook_translation_helper(mod, middleware_enabled:)
5
+ mod.class_eval do
6
+ def translate_with_copyray_comment(key, **options)
7
+ source = translate_without_copyray_comment(key, **options)
8
+ if CopyTunerClient.configuration.disable_copyray_comment_injection
9
+ source
10
+ else
11
+ separator = options[:separator] || I18n.default_separator
12
+ scope = options[:scope]
13
+ normalized_key =
14
+ if key.to_s.first == '.'
15
+ scope_key_by_partial(key)
16
+ else
17
+ I18n.normalize_keys(nil, key, scope, separator).join(separator)
18
+ end
19
+ CopyTunerClient::Copyray.augment_template(source, normalized_key)
20
+ end
21
+ end
22
+ if middleware_enabled
23
+ alias_method :translate_without_copyray_comment, :translate
24
+ alias_method :translate, :translate_with_copyray_comment
25
+ alias :t :translate
26
+ alias :tt :translate_without_copyray_comment
27
+ else
28
+ alias :tt :translate
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -61,8 +61,16 @@ module CopyTunerClient
61
61
  private
62
62
 
63
63
  def lookup(locale, key, scope = [], options = {})
64
+ return nil if !key.is_a?(String) && !key.is_a?(Symbol)
65
+
64
66
  parts = I18n.normalize_keys(locale, key, scope, options[:separator])
65
67
  key_with_locale = parts.join('.')
68
+ key_without_locale = parts[1..].join('.')
69
+
70
+ if CopyTunerClient::configuration.ignored_keys.include?(key_without_locale)
71
+ CopyTunerClient::configuration.ignored_key_handler.call(IgnoredKey.new("Ignored key: #{key_without_locale}"))
72
+ end
73
+
66
74
  content = cache[key_with_locale] || super
67
75
  cache[key_with_locale] = nil if content.nil?
68
76
  content
@@ -86,6 +94,8 @@ module CopyTunerClient
86
94
 
87
95
  def default(locale, object, subject, options = {})
88
96
  content = super(locale, object, subject, options)
97
+ return content if !object.is_a?(String) && !object.is_a?(Symbol)
98
+
89
99
  if content.respond_to?(:to_str)
90
100
  parts = I18n.normalize_keys(locale, object, options[:scope], options[:separator])
91
101
  # NOTE: ActionView::Helpers::TranslationHelper#translate wraps default String in an Array
@@ -0,0 +1,14 @@
1
+ require 'nokogiri'
2
+
3
+ module CopyTunerClient
4
+ module I18nCompat
5
+ def select_html_incompatible_blurbs(blurbs)
6
+ non_html_key_blurbs = blurbs.reject { |key| key.ends_with?('.html') || key.ends_with?('_html') }
7
+ html_blurbs = non_html_key_blurbs.select do |key, content|
8
+ Nokogiri::HTML.fragment(content).children.any? { |node| node.name != 'text' }
9
+ end
10
+ end
11
+
12
+ module_function :select_html_incompatible_blurbs
13
+ end
14
+ end
@@ -19,7 +19,7 @@ module CopyTunerClient
19
19
  def self.install_hook
20
20
  I18n.class_eval do
21
21
  class << self
22
- def translate_with_copy_tuner_hook(key, **options)
22
+ def translate_with_copy_tuner_hook(key = nil, **options)
23
23
  scope = options[:scope]
24
24
  scope = scope.dup if scope.is_a?(Array) || scope.is_a?(String)
25
25
  result = translate_without_copy_tuner_hook(key, **options)
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.8.1'.freeze
3
+ VERSION = '0.12.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -25,8 +25,21 @@ namespace :copy_tuner do
25
25
  if conflict_keys.empty?
26
26
  puts 'All success'
27
27
  else
28
- pp conflict_keys
29
- raise 'Exists invalid keys'
28
+ puts conflict_keys.sort.join("\n")
29
+ exit 1
30
+ end
31
+ end
32
+
33
+ desc "Detect html incompatible keys."
34
+ task :detect_html_incompatible_keys => :environment do
35
+ require 'copy_tuner_client/i18n_compat'
36
+ html_incompatible_blurbs = CopyTunerClient::I18nCompat.select_html_incompatible_blurbs(CopyTunerClient.cache.blurbs)
37
+
38
+ if html_incompatible_blurbs.empty?
39
+ puts 'All success'
40
+ else
41
+ puts html_incompatible_blurbs.keys.sort.join("\n")
42
+ exit 1
30
43
  end
31
44
  end
32
45
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require 'copy_tuner_client/helper_extension'
3
+ require 'copy_tuner_client/copyray'
4
+
5
+ describe CopyTunerClient::HelperExtension do
6
+ # rails <= 6.0.x
7
+ module HashArgumentHelper
8
+ def translate(key, options = {})
9
+ "Hello, #{options[:name]}"
10
+ end
11
+ end
12
+
13
+ # rails >= 6.1.x
14
+ module KeywordArgumentsHelper
15
+ def translate(key, **options)
16
+ "Hello, #{options[:name]}"
17
+ end
18
+ end
19
+
20
+ class HashArgumentView
21
+ include HashArgumentHelper
22
+ end
23
+
24
+ class KeywordArgumentsView
25
+ include KeywordArgumentsHelper
26
+ end
27
+
28
+ CopyTunerClient::HelperExtension.hook_translation_helper(HashArgumentHelper, middleware_enabled: true)
29
+ CopyTunerClient::HelperExtension.hook_translation_helper(KeywordArgumentsHelper, middleware_enabled: true)
30
+
31
+ it 'works with hash argument method' do
32
+ view = HashArgumentView.new
33
+ expect(view.translate('some.key', name: 'World')).to eq '<!--COPYRAY some.key-->Hello, World'
34
+ end
35
+
36
+ it 'works with keyword argument method' do
37
+ view = KeywordArgumentsView.new
38
+ expect(view.translate('some.key', name: 'World')).to eq '<!--COPYRAY some.key-->Hello, World'
39
+ end
40
+ end
@@ -139,6 +139,13 @@ describe CopyTunerClient::I18nBackend do
139
139
  end
140
140
  end
141
141
 
142
+ context 'non-string key' do
143
+ it 'Not to be registered in the cache' do
144
+ expect { subject.translate('en', {}) }.to throw_symbol(:exception)
145
+ expect(cache).not_to have_key 'en.{}'
146
+ end
147
+ end
148
+
142
149
  describe "with stored translations" do
143
150
  subject { build_backend }
144
151
 
data/test.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ BUNDLE_GEMFILE=gemfiles/5.2.gemfile bundle install && BUNDLE_GEMFILE=gemfiles/5.2.gemfile bundle exec rspec spec
4
+ BUNDLE_GEMFILE=gemfiles/6.0.gemfile bundle install && BUNDLE_GEMFILE=gemfiles/6.0.gemfile bundle exec rspec spec
5
+ BUNDLE_GEMFILE=gemfiles/6.1.gemfile bundle install && BUNDLE_GEMFILE=gemfiles/6.1.gemfile bundle exec rspec spec
6
+ BUNDLE_GEMFILE=gemfiles/main.gemfile bundle install && BUNDLE_GEMFILE=gemfiles/main.gemfile bundle exec rspec spec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -38,20 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 5.2.4.2
61
+ version: '6.1'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 5.2.4.2
68
+ version: '6.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +84,16 @@ dependencies:
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '='
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: 3.8.0
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: 3.8.0
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: sham_rack
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +202,8 @@ files:
188
202
  - copy_tuner_client.gemspec
189
203
  - gemfiles/5.2.gemfile
190
204
  - gemfiles/6.0.gemfile
205
+ - gemfiles/6.1.gemfile
206
+ - gemfiles/main.gemfile
191
207
  - lib/copy_tuner_client.rb
192
208
  - lib/copy_tuner_client/cache.rb
193
209
  - lib/copy_tuner_client/client.rb
@@ -197,7 +213,9 @@ files:
197
213
  - lib/copy_tuner_client/dotted_hash.rb
198
214
  - lib/copy_tuner_client/engine.rb
199
215
  - lib/copy_tuner_client/errors.rb
216
+ - lib/copy_tuner_client/helper_extension.rb
200
217
  - lib/copy_tuner_client/i18n_backend.rb
218
+ - lib/copy_tuner_client/i18n_compat.rb
201
219
  - lib/copy_tuner_client/poller.rb
202
220
  - lib/copy_tuner_client/prefixed_logger.rb
203
221
  - lib/copy_tuner_client/process_guard.rb
@@ -216,6 +234,7 @@ files:
216
234
  - spec/copy_tuner_client/configuration_spec.rb
217
235
  - spec/copy_tuner_client/copyray_spec.rb
218
236
  - spec/copy_tuner_client/dotted_hash_spec.rb
237
+ - spec/copy_tuner_client/helper_extension_spec.rb
219
238
  - spec/copy_tuner_client/i18n_backend_spec.rb
220
239
  - spec/copy_tuner_client/poller_spec.rb
221
240
  - spec/copy_tuner_client/prefixed_logger_spec.rb
@@ -239,6 +258,7 @@ files:
239
258
  - src/main.js
240
259
  - src/specimen.js
241
260
  - src/util.js
261
+ - test.sh
242
262
  - ui/views/copytuner/index.html.erb
243
263
  - ui/views/layouts/copytuner_default.html.erb
244
264
  homepage: https://github.com/SonicGarden/copy-tuner-ruby-client
@@ -259,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
279
  - !ruby/object:Gem::Version
260
280
  version: '0'
261
281
  requirements: []
262
- rubygems_version: 3.1.2
282
+ rubygems_version: 3.1.6
263
283
  signing_key:
264
284
  specification_version: 4
265
285
  summary: Client for the CopyTuner copy management service
@@ -269,6 +289,7 @@ test_files:
269
289
  - spec/copy_tuner_client/configuration_spec.rb
270
290
  - spec/copy_tuner_client/copyray_spec.rb
271
291
  - spec/copy_tuner_client/dotted_hash_spec.rb
292
+ - spec/copy_tuner_client/helper_extension_spec.rb
272
293
  - spec/copy_tuner_client/i18n_backend_spec.rb
273
294
  - spec/copy_tuner_client/poller_spec.rb
274
295
  - spec/copy_tuner_client/prefixed_logger_spec.rb