copy_tuner_client 0.10.0 → 0.11.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bccd14def1ebe5752df2720935cff2474e749adc498cdcd310e4c8eeb3144245
4
- data.tar.gz: f1acb0047c41797eb773eb852379d1921e040a1e5688eea89a7becce3f4540c4
3
+ metadata.gz: 8db12b6e0610b91e1722080f0c2fea2c12c5b90430cc2266974bf63822db6c94
4
+ data.tar.gz: 7d6c1c2b8877738c02d6072e315311ab19c258686159534d26a421e599d1c46a
5
5
  SHA512:
6
- metadata.gz: 669c8e6bc71974318d16f4277f498a8933869486a23a9fcbbd67375cfd9d8325e65a700645b01454d062d986763a32a264f33d3b01f2ec41cc7e4d5d5fe7035d
7
- data.tar.gz: b201841f91363ec9f725bd071f2ddb8f341412ba0ce58edcd9e39b530ff092356592d33a57366fed95070d64e0226b428144b4fc315ffc6b121ac062f6d2848f
6
+ metadata.gz: 37d33371c0bb6f22939a895e66a34f2986a51cb22d84206f75e727ba40d18ab78e8e4ca9cf2aef62509a47928494420311d9b359c4479445fc32bbe8b4cafcf0
7
+ data.tar.gz: 02d24f9b53dcdc5ba933789b40a5e422e04912fafa9a17122dec816893eeac77d35046a3a8fbc152b35d551e3f4b320ab4e5f38a9fe548bc10e45cc7cdb59a32
@@ -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,8 @@
1
+ ## 0.11.0
2
+
3
+ - Remove deprecated rescue_format option
4
+ - Fix ruby@2.7 keyword warning
5
+
1
6
  ## 0.10.0
2
7
 
3
8
  - Add copy_tuner:detect_html_incompatible_keys task
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,20 +1,19 @@
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.10.0)
16
+ copy_tuner_client (0.11.0)
18
17
  i18n (>= 0.5.0)
19
18
  json
20
19
  nokogiri
@@ -22,207 +21,230 @@ PATH
22
21
  GEM
23
22
  remote: http://rubygems.org/
24
23
  specs:
25
- actioncable (5.2.4.2)
26
- actionpack (= 5.2.4.2)
24
+ actioncable (6.1.4.1)
25
+ actionpack (= 6.1.4.1)
26
+ activesupport (= 6.1.4.1)
27
27
  nio4r (~> 2.0)
28
28
  websocket-driver (>= 0.6.1)
29
- actionmailer (5.2.4.2)
30
- actionpack (= 5.2.4.2)
31
- actionview (= 5.2.4.2)
32
- 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)
33
41
  mail (~> 2.5, >= 2.5.4)
34
42
  rails-dom-testing (~> 2.0)
35
- actionpack (5.2.4.2)
36
- actionview (= 5.2.4.2)
37
- activesupport (= 5.2.4.2)
38
- 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)
39
47
  rack-test (>= 0.6.3)
40
48
  rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
42
- actionview (5.2.4.2)
43
- 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)
44
58
  builder (~> 3.1)
45
59
  erubi (~> 1.4)
46
60
  rails-dom-testing (~> 2.0)
47
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
48
- activejob (5.2.4.2)
49
- 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)
50
64
  globalid (>= 0.3.6)
51
- activemodel (5.2.4.2)
52
- activesupport (= 5.2.4.2)
53
- activerecord (5.2.4.2)
54
- activemodel (= 5.2.4.2)
55
- activesupport (= 5.2.4.2)
56
- arel (>= 9.0)
57
- activestorage (5.2.4.2)
58
- actionpack (= 5.2.4.2)
59
- activerecord (= 5.2.4.2)
60
- marcel (~> 0.3.1)
61
- 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)
62
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
- i18n (>= 0.7, < 2)
64
- minitest (~> 5.1)
65
- tzinfo (~> 1.1)
66
- 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)
67
84
  public_suffix (>= 2.0.2, < 5.0)
68
- arel (9.0.0)
69
- ast (2.4.0)
70
- brakeman (4.8.1)
71
- brakeman_translate_checkstyle_format (0.0.1)
72
- thor
85
+ ast (2.4.2)
73
86
  builder (3.2.4)
74
- concurrent-ruby (1.1.6)
75
- crack (0.4.3)
76
- safe_yaml (~> 1.0.0)
87
+ concurrent-ruby (1.1.9)
88
+ crack (0.4.5)
89
+ rexml
77
90
  crass (1.0.6)
78
- daemons (1.3.1)
79
- diff-lcs (1.3)
80
- erubi (1.9.0)
91
+ daemons (1.4.1)
92
+ diff-lcs (1.4.4)
93
+ erubi (1.10.0)
81
94
  eventmachine (1.2.7)
82
- globalid (0.4.2)
83
- activesupport (>= 4.2.0)
84
- haml (5.1.2)
95
+ globalid (0.5.2)
96
+ activesupport (>= 5.0)
97
+ haml (5.2.2)
85
98
  temple (>= 0.8.0)
86
99
  tilt
87
- haml_lint (0.34.2)
88
- haml (>= 4.0, < 5.2)
100
+ haml_lint (0.37.1)
101
+ haml (>= 4.0, < 5.3)
102
+ parallel (~> 1.10)
89
103
  rainbow
90
104
  rubocop (>= 0.50.0)
91
105
  sysexits (~> 1.1)
92
106
  hashdiff (1.0.1)
93
- i18n (1.8.2)
107
+ i18n (1.8.10)
94
108
  concurrent-ruby (~> 1.0)
95
- jaro_winkler (1.5.4)
96
109
  json (2.5.1)
97
- loofah (2.5.0)
110
+ loofah (2.12.0)
98
111
  crass (~> 1.0.2)
99
112
  nokogiri (>= 1.5.9)
100
113
  mail (2.7.1)
101
114
  mini_mime (>= 0.1.1)
102
- marcel (0.3.3)
103
- mimemagic (~> 0.3.2)
115
+ marcel (1.0.1)
104
116
  method_source (1.0.0)
105
- mimemagic (0.3.4)
106
- mini_mime (1.0.2)
107
- mini_portile2 (2.4.0)
108
- minitest (5.14.0)
117
+ mini_mime (1.1.1)
118
+ mini_portile2 (2.6.1)
119
+ minitest (5.14.4)
109
120
  mustermann (1.1.1)
110
121
  ruby2_keywords (~> 0.0.1)
111
- nio4r (2.5.2)
112
- nokogiri (1.10.9)
113
- mini_portile2 (~> 2.4.0)
114
- parallel (1.19.1)
115
- parser (2.7.1.2)
116
- ast (~> 2.4.0)
117
- public_suffix (4.0.4)
118
- rack (2.2.2)
119
- 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)
120
133
  rack
121
134
  rack-test (1.1.0)
122
135
  rack (>= 1.0, < 3)
123
- rails (5.2.4.2)
124
- actioncable (= 5.2.4.2)
125
- actionmailer (= 5.2.4.2)
126
- actionpack (= 5.2.4.2)
127
- actionview (= 5.2.4.2)
128
- activejob (= 5.2.4.2)
129
- activemodel (= 5.2.4.2)
130
- activerecord (= 5.2.4.2)
131
- activestorage (= 5.2.4.2)
132
- activesupport (= 5.2.4.2)
133
- bundler (>= 1.3.0)
134
- 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)
135
150
  sprockets-rails (>= 2.0.0)
136
151
  rails-dom-testing (2.0.3)
137
152
  activesupport (>= 4.2.0)
138
153
  nokogiri (>= 1.6)
139
- rails-html-sanitizer (1.3.0)
154
+ rails-html-sanitizer (1.4.2)
140
155
  loofah (~> 2.3)
141
- railties (5.2.4.2)
142
- actionpack (= 5.2.4.2)
143
- activesupport (= 5.2.4.2)
156
+ railties (6.1.4.1)
157
+ actionpack (= 6.1.4.1)
158
+ activesupport (= 6.1.4.1)
144
159
  method_source
145
- rake (>= 0.8.7)
146
- thor (>= 0.19.0, < 2.0)
160
+ rake (>= 0.13)
161
+ thor (~> 1.0)
147
162
  rainbow (3.0.0)
148
- rake (13.0.1)
149
- rexml (3.2.4)
150
- rspec (3.8.0)
151
- rspec-core (~> 3.8.0)
152
- rspec-expectations (~> 3.8.0)
153
- rspec-mocks (~> 3.8.0)
154
- rspec-core (3.8.2)
155
- rspec-support (~> 3.8.0)
156
- 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)
157
173
  diff-lcs (>= 1.2.0, < 2.0)
158
- rspec-support (~> 3.8.0)
159
- rspec-mocks (3.8.2)
174
+ rspec-support (~> 3.10.0)
175
+ rspec-mocks (3.10.2)
160
176
  diff-lcs (>= 1.2.0, < 2.0)
161
- rspec-support (~> 3.8.0)
162
- rspec-support (3.8.3)
163
- rubocop (0.81.0)
164
- jaro_winkler (~> 1.5.1)
177
+ rspec-support (~> 3.10.0)
178
+ rspec-support (3.10.2)
179
+ rubocop (1.21.0)
165
180
  parallel (~> 1.10)
166
- parser (>= 2.7.0.1)
181
+ parser (>= 3.0.0.0)
167
182
  rainbow (>= 2.2.2, < 4.0)
183
+ regexp_parser (>= 1.8, < 3.0)
168
184
  rexml
185
+ rubocop-ast (>= 1.9.1, < 2.0)
169
186
  ruby-progressbar (~> 1.7)
170
- unicode-display_width (>= 1.4.0, < 2.0)
171
- rubocop-performance (1.5.2)
172
- rubocop (>= 0.71.0)
173
- rubocop-rails (2.5.2)
174
- 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)
175
195
  rack (>= 1.1)
176
- rubocop (>= 0.72.0)
177
- rubocop-rspec (1.38.1)
178
- rubocop (>= 0.68.1)
179
- ruby-progressbar (1.10.1)
180
- ruby2_keywords (0.0.2)
181
- 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)
182
204
  sham_rack (1.4.1)
183
205
  rack
184
- sinatra (2.0.8.1)
206
+ sinatra (2.1.0)
185
207
  mustermann (~> 1.0)
186
- rack (~> 2.0)
187
- rack-protection (= 2.0.8.1)
208
+ rack (~> 2.2)
209
+ rack-protection (= 2.1.0)
188
210
  tilt (~> 2.0)
189
- sprockets (4.0.0)
211
+ sprockets (4.0.2)
190
212
  concurrent-ruby (~> 1.0)
191
213
  rack (> 1, < 3)
192
- sprockets-rails (3.2.1)
214
+ sprockets-rails (3.2.2)
193
215
  actionpack (>= 4.0)
194
216
  activesupport (>= 4.0)
195
217
  sprockets (>= 3.0.0)
196
218
  sqlite3 (1.4.2)
197
219
  sysexits (1.2.0)
198
220
  temple (0.8.2)
199
- thin (1.7.2)
221
+ thin (1.8.1)
200
222
  daemons (~> 1.0, >= 1.0.9)
201
223
  eventmachine (~> 1.0, >= 1.0.4)
202
224
  rack (>= 1, < 3)
203
- thor (1.0.1)
204
- thread_safe (0.3.6)
225
+ thor (1.1.0)
205
226
  tilt (2.0.10)
206
- tzinfo (1.2.7)
207
- thread_safe (~> 0.1)
208
- unicode-display_width (1.7.0)
209
- webmock (3.8.3)
210
- 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)
211
232
  crack (>= 0.3.2)
212
233
  hashdiff (>= 0.4.0, < 2.0.0)
213
- websocket-driver (0.7.1)
234
+ websocket-driver (0.7.5)
214
235
  websocket-extensions (>= 0.1.0)
215
- websocket-extensions (0.1.4)
216
- yard (0.9.24)
236
+ websocket-extensions (0.1.5)
237
+ yard (0.9.26)
238
+ zeitwerk (2.4.2)
217
239
 
218
240
  PLATFORMS
219
241
  ruby
220
242
 
221
243
  DEPENDENCIES
222
244
  copy_tuner_client!
223
- rails (~> 5.2.4.2)
245
+ rails (~> 6.1)
224
246
  rake
225
- rspec (= 3.8.0)
247
+ rspec
226
248
  sgcop!
227
249
  sham_rack
228
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
 
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
7
7
  s.add_dependency 'i18n', '>= 0.5.0'
8
8
  s.add_dependency 'json'
9
9
  s.add_dependency 'nokogiri'
10
- s.add_development_dependency 'rails', '~> 5.2.4.2'
10
+ s.add_development_dependency 'rails', '~> 6.1'
11
11
  s.add_development_dependency 'rake'
12
- s.add_development_dependency 'rspec', '3.8.0' # NOTE: 3.9.0だとundefined method `synchronize'でコケるテストがある
12
+ s.add_development_dependency 'rspec'
13
13
  s.add_development_dependency 'sham_rack'
14
14
  s.add_development_dependency 'sinatra'
15
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 => "../"
@@ -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?
@@ -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
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.10.0'.freeze
3
+ VERSION = '0.11.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -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
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.10.0
4
+ version: 0.11.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-09-03 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.2.4.2
61
+ version: '6.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.2.4.2
68
+ version: '6.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.8.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.8.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sham_rack
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +202,8 @@ files:
202
202
  - copy_tuner_client.gemspec
203
203
  - gemfiles/5.2.gemfile
204
204
  - gemfiles/6.0.gemfile
205
+ - gemfiles/6.1.gemfile
206
+ - gemfiles/main.gemfile
205
207
  - lib/copy_tuner_client.rb
206
208
  - lib/copy_tuner_client/cache.rb
207
209
  - lib/copy_tuner_client/client.rb
@@ -211,6 +213,7 @@ files:
211
213
  - lib/copy_tuner_client/dotted_hash.rb
212
214
  - lib/copy_tuner_client/engine.rb
213
215
  - lib/copy_tuner_client/errors.rb
216
+ - lib/copy_tuner_client/helper_extension.rb
214
217
  - lib/copy_tuner_client/i18n_backend.rb
215
218
  - lib/copy_tuner_client/i18n_compat.rb
216
219
  - lib/copy_tuner_client/poller.rb
@@ -231,6 +234,7 @@ files:
231
234
  - spec/copy_tuner_client/configuration_spec.rb
232
235
  - spec/copy_tuner_client/copyray_spec.rb
233
236
  - spec/copy_tuner_client/dotted_hash_spec.rb
237
+ - spec/copy_tuner_client/helper_extension_spec.rb
234
238
  - spec/copy_tuner_client/i18n_backend_spec.rb
235
239
  - spec/copy_tuner_client/poller_spec.rb
236
240
  - spec/copy_tuner_client/prefixed_logger_spec.rb
@@ -254,6 +258,7 @@ files:
254
258
  - src/main.js
255
259
  - src/specimen.js
256
260
  - src/util.js
261
+ - test.sh
257
262
  - ui/views/copytuner/index.html.erb
258
263
  - ui/views/layouts/copytuner_default.html.erb
259
264
  homepage: https://github.com/SonicGarden/copy-tuner-ruby-client
@@ -274,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
279
  - !ruby/object:Gem::Version
275
280
  version: '0'
276
281
  requirements: []
277
- rubygems_version: 3.1.2
282
+ rubygems_version: 3.1.6
278
283
  signing_key:
279
284
  specification_version: 4
280
285
  summary: Client for the CopyTuner copy management service
@@ -284,6 +289,7 @@ test_files:
284
289
  - spec/copy_tuner_client/configuration_spec.rb
285
290
  - spec/copy_tuner_client/copyray_spec.rb
286
291
  - spec/copy_tuner_client/dotted_hash_spec.rb
292
+ - spec/copy_tuner_client/helper_extension_spec.rb
287
293
  - spec/copy_tuner_client/i18n_backend_spec.rb
288
294
  - spec/copy_tuner_client/poller_spec.rb
289
295
  - spec/copy_tuner_client/prefixed_logger_spec.rb