jpmobile 6.1.2 → 7.1.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -4
  3. data/.rubocop.yml +174 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile +11 -0
  6. data/Gemfile.lock +220 -166
  7. data/README.md +27 -21
  8. data/Rakefile +1 -1
  9. data/jpmobile.gemspec +6 -13
  10. data/lib/jpmobile/datum_conv.rb +7 -7
  11. data/lib/jpmobile/docomo_guid.rb +2 -2
  12. data/lib/jpmobile/email.rb +2 -2
  13. data/lib/jpmobile/fallback_view_selector.rb +2 -2
  14. data/lib/jpmobile/filter.rb +4 -2
  15. data/lib/jpmobile/hook_action_view.rb +3 -3
  16. data/lib/jpmobile/hook_template_details_requested.rb +12 -0
  17. data/lib/jpmobile/mail.rb +3 -3
  18. data/lib/jpmobile/mailer.rb +4 -5
  19. data/lib/jpmobile/method_less_action_support.rb +11 -0
  20. data/lib/jpmobile/mobile/abstract_mobile.rb +1 -1
  21. data/lib/jpmobile/mobile/android_tablet.rb +1 -1
  22. data/lib/jpmobile/mobile/au.rb +4 -6
  23. data/lib/jpmobile/mobile/softbank.rb +3 -1
  24. data/lib/jpmobile/path_set.rb +10 -36
  25. data/lib/jpmobile/position.rb +6 -6
  26. data/lib/jpmobile/rails.rb +8 -2
  27. data/lib/jpmobile/resolver.rb +47 -6
  28. data/lib/jpmobile/template_details.rb +38 -0
  29. data/lib/jpmobile/trans_sid.rb +2 -2
  30. data/lib/jpmobile/util.rb +1 -1
  31. data/lib/jpmobile/version.rb +1 -1
  32. data/lib/jpmobile/view_selector.rb +5 -6
  33. data/lib/jpmobile.rb +13 -0
  34. data/lib/tasks/jpmobile_tasks.rake +4 -5
  35. data/renovate.json +6 -0
  36. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -0
  37. data/spec/rack/jpmobile/params_filter_spec.rb +6 -6
  38. data/spec/unit/decorated_mail_spec.rb +1 -1
  39. data/spec/unit/email_spec.rb +1 -1
  40. data/spec/unit/mail_spec.rb +4 -4
  41. data/spec/unit/receive_mail_spec.rb +30 -30
  42. data/spec/unit/util_spec.rb +1 -1
  43. data/test/rails/overrides/Gemfile.jpmobile +4 -0
  44. data/test/rails/overrides/app/controllers/method_less_action_support_controller.rb +3 -0
  45. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
  46. data/test/rails/overrides/app/controllers/template_path_controller.rb +3 -0
  47. data/test/rails/overrides/app/mailers/decorated_mailer.rb +1 -1
  48. data/test/rails/overrides/app/views/method_less_action_support/index_smart_phone.html.erb +0 -0
  49. data/test/rails/overrides/app/views/mobile_spec/mobile_not_exist.html.erb +3 -0
  50. data/test/rails/overrides/config/routes.rb +5 -1
  51. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
  52. data/test/rails/overrides/spec/rails_helper.rb +2 -2
  53. data/test/rails/overrides/spec/requests/filter_spec.rb +106 -0
  54. data/test/rails/overrides/spec/requests/method_less_action_support_spec.rb +29 -0
  55. data/test/rails/overrides/spec/requests/pc_spec.rb +3 -2
  56. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
  57. data/test/rails/overrides/spec/{features → system}/admin/top_spec.rb +2 -2
  58. data/test/rails/overrides/spec/{features → system}/filter_spec.rb +2 -7
  59. data/test/rails/overrides/spec/system/support/cuprite_setup.rb +12 -0
  60. data/test/rails/overrides/spec/system_helper.rb +3 -0
  61. data/test/sinatra/guestbook.rb +0 -1
  62. metadata +26 -342
  63. data/test/rails/overrides/app/views/mobile_spec/no_mobile.html.erb +0 -3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jpmobile (6.1.1)
4
+ jpmobile (7.0.4)
5
5
  mail (~> 2.7.0)
6
6
  rexml
7
7
  scanf
@@ -9,228 +9,282 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.1.0)
13
- actionpack (= 6.1.0)
14
- activesupport (= 6.1.0)
12
+ actioncable (7.1.0)
13
+ actionpack (= 7.1.0)
14
+ activesupport (= 7.1.0)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (6.1.0)
18
- actionpack (= 6.1.0)
19
- activejob (= 6.1.0)
20
- activerecord (= 6.1.0)
21
- activestorage (= 6.1.0)
22
- activesupport (= 6.1.0)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (7.1.0)
19
+ actionpack (= 7.1.0)
20
+ activejob (= 7.1.0)
21
+ activerecord (= 7.1.0)
22
+ activestorage (= 7.1.0)
23
+ activesupport (= 7.1.0)
23
24
  mail (>= 2.7.1)
24
- actionmailer (6.1.0)
25
- actionpack (= 6.1.0)
26
- actionview (= 6.1.0)
27
- activejob (= 6.1.0)
28
- activesupport (= 6.1.0)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.1.0)
29
+ actionpack (= 7.1.0)
30
+ actionview (= 7.1.0)
31
+ activejob (= 7.1.0)
32
+ activesupport (= 7.1.0)
29
33
  mail (~> 2.5, >= 2.5.4)
30
- rails-dom-testing (~> 2.0)
31
- actionpack (6.1.0)
32
- actionview (= 6.1.0)
33
- activesupport (= 6.1.0)
34
- rack (~> 2.0, >= 2.0.9)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.2)
38
+ actionpack (7.1.0)
39
+ actionview (= 7.1.0)
40
+ activesupport (= 7.1.0)
41
+ nokogiri (>= 1.8.5)
42
+ rack (>= 2.2.4)
43
+ rack-session (>= 1.0.1)
35
44
  rack-test (>= 0.6.3)
36
- rails-dom-testing (~> 2.0)
37
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.1.0)
39
- actionpack (= 6.1.0)
40
- activerecord (= 6.1.0)
41
- activestorage (= 6.1.0)
42
- activesupport (= 6.1.0)
45
+ rails-dom-testing (~> 2.2)
46
+ rails-html-sanitizer (~> 1.6)
47
+ actiontext (7.1.0)
48
+ actionpack (= 7.1.0)
49
+ activerecord (= 7.1.0)
50
+ activestorage (= 7.1.0)
51
+ activesupport (= 7.1.0)
52
+ globalid (>= 0.6.0)
43
53
  nokogiri (>= 1.8.5)
44
- actionview (6.1.0)
45
- activesupport (= 6.1.0)
54
+ actionview (7.1.0)
55
+ activesupport (= 7.1.0)
46
56
  builder (~> 3.1)
47
- erubi (~> 1.4)
48
- rails-dom-testing (~> 2.0)
49
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.1.0)
51
- activesupport (= 6.1.0)
57
+ erubi (~> 1.11)
58
+ rails-dom-testing (~> 2.2)
59
+ rails-html-sanitizer (~> 1.6)
60
+ activejob (7.1.0)
61
+ activesupport (= 7.1.0)
52
62
  globalid (>= 0.3.6)
53
- activemodel (6.1.0)
54
- activesupport (= 6.1.0)
55
- activerecord (6.1.0)
56
- activemodel (= 6.1.0)
57
- activesupport (= 6.1.0)
58
- activestorage (6.1.0)
59
- actionpack (= 6.1.0)
60
- activejob (= 6.1.0)
61
- activerecord (= 6.1.0)
62
- activesupport (= 6.1.0)
63
- marcel (~> 0.3.1)
64
- mimemagic (~> 0.3.2)
65
- activesupport (6.1.0)
63
+ activemodel (7.1.0)
64
+ activesupport (= 7.1.0)
65
+ activerecord (7.1.0)
66
+ activemodel (= 7.1.0)
67
+ activesupport (= 7.1.0)
68
+ timeout (>= 0.4.0)
69
+ activestorage (7.1.0)
70
+ actionpack (= 7.1.0)
71
+ activejob (= 7.1.0)
72
+ activerecord (= 7.1.0)
73
+ activesupport (= 7.1.0)
74
+ marcel (~> 1.0)
75
+ activesupport (7.1.0)
76
+ base64
77
+ bigdecimal
66
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
79
+ connection_pool (>= 2.2.5)
80
+ drb
67
81
  i18n (>= 1.6, < 2)
68
82
  minitest (>= 5.1)
83
+ mutex_m
69
84
  tzinfo (~> 2.0)
70
- zeitwerk (~> 2.3)
71
- addressable (2.7.0)
72
- public_suffix (>= 2.0.2, < 5.0)
73
- ast (2.4.1)
85
+ addressable (2.8.1)
86
+ public_suffix (>= 2.0.2, < 6.0)
87
+ ast (2.4.2)
88
+ base64 (0.1.1)
89
+ bigdecimal (3.1.4)
74
90
  builder (3.2.4)
75
- capybara (3.34.0)
76
- addressable
77
- mini_mime (>= 0.1.3)
78
- nokogiri (~> 1.8)
79
- rack (>= 1.6.0)
80
- rack-test (>= 0.6.3)
81
- regexp_parser (~> 1.5)
82
- xpath (~> 3.2)
83
- capybara-webkit (1.15.1)
84
- capybara (>= 2.3, < 4.0)
85
- json
86
91
  coderay (1.1.3)
87
- concurrent-ruby (1.1.7)
92
+ concurrent-ruby (1.2.2)
93
+ connection_pool (2.4.1)
88
94
  crass (1.0.6)
89
- diff-lcs (1.4.4)
90
- erubi (1.10.0)
91
- geokit (1.13.1)
92
- git (1.7.0)
95
+ date (3.3.3)
96
+ diff-lcs (1.5.0)
97
+ drb (2.1.1)
98
+ ruby2_keywords
99
+ erubi (1.12.0)
100
+ geokit (1.14.0)
101
+ git (1.18.0)
102
+ addressable (~> 2.8)
93
103
  rchardet (~> 1.8)
94
- globalid (0.4.2)
95
- activesupport (>= 4.2.0)
104
+ globalid (1.2.1)
105
+ activesupport (>= 6.1)
96
106
  hpricot (0.8.6)
97
- i18n (1.8.5)
107
+ i18n (1.14.1)
98
108
  concurrent-ruby (~> 1.0)
99
- json (2.3.1)
100
- loofah (2.8.0)
109
+ io-console (0.6.0)
110
+ irb (1.8.1)
111
+ rdoc
112
+ reline (>= 0.3.8)
113
+ json (2.6.3)
114
+ language_server-protocol (3.17.0.3)
115
+ loofah (2.21.3)
101
116
  crass (~> 1.0.2)
102
- nokogiri (>= 1.5.9)
117
+ nokogiri (>= 1.12.0)
103
118
  mail (2.7.1)
104
119
  mini_mime (>= 0.1.1)
105
- marcel (0.3.3)
106
- mimemagic (~> 0.3.2)
120
+ marcel (1.0.2)
107
121
  method_source (1.0.0)
108
- mimemagic (0.3.5)
109
- mini_mime (1.0.2)
110
- mini_portile2 (2.4.0)
111
- minitest (5.14.2)
112
- nio4r (2.5.4)
113
- nokogiri (1.10.10)
114
- mini_portile2 (~> 2.4.0)
115
- parallel (1.20.1)
116
- parser (3.0.0.0)
122
+ mini_mime (1.1.5)
123
+ minitest (5.20.0)
124
+ mutex_m (0.1.2)
125
+ net-imap (0.4.0)
126
+ date
127
+ net-protocol
128
+ net-pop (0.1.2)
129
+ net-protocol
130
+ net-protocol (0.2.1)
131
+ timeout
132
+ net-smtp (0.4.0)
133
+ net-protocol
134
+ nio4r (2.5.9)
135
+ nokogiri (1.14.5-arm64-darwin)
136
+ racc (~> 1.4)
137
+ nokogiri (1.14.5-x86_64-linux)
138
+ racc (~> 1.4)
139
+ parallel (1.23.0)
140
+ parser (3.2.2.3)
117
141
  ast (~> 2.4.1)
118
- pry (0.13.1)
142
+ racc
143
+ pry (0.14.2)
119
144
  coderay (~> 1.1)
120
145
  method_source (~> 1.0)
121
- public_suffix (4.0.6)
122
- rack (2.2.3)
123
- rack-test (1.1.0)
124
- rack (>= 1.0, < 3)
125
- rails (6.1.0)
126
- actioncable (= 6.1.0)
127
- actionmailbox (= 6.1.0)
128
- actionmailer (= 6.1.0)
129
- actionpack (= 6.1.0)
130
- actiontext (= 6.1.0)
131
- actionview (= 6.1.0)
132
- activejob (= 6.1.0)
133
- activemodel (= 6.1.0)
134
- activerecord (= 6.1.0)
135
- activestorage (= 6.1.0)
136
- activesupport (= 6.1.0)
146
+ psych (5.1.0)
147
+ stringio
148
+ public_suffix (5.0.1)
149
+ racc (1.7.1)
150
+ rack (2.2.8)
151
+ rack-session (1.0.1)
152
+ rack (< 3)
153
+ rack-test (2.1.0)
154
+ rack (>= 1.3)
155
+ rackup (1.0.0)
156
+ rack (< 3)
157
+ webrick
158
+ rails (7.1.0)
159
+ actioncable (= 7.1.0)
160
+ actionmailbox (= 7.1.0)
161
+ actionmailer (= 7.1.0)
162
+ actionpack (= 7.1.0)
163
+ actiontext (= 7.1.0)
164
+ actionview (= 7.1.0)
165
+ activejob (= 7.1.0)
166
+ activemodel (= 7.1.0)
167
+ activerecord (= 7.1.0)
168
+ activestorage (= 7.1.0)
169
+ activesupport (= 7.1.0)
137
170
  bundler (>= 1.15.0)
138
- railties (= 6.1.0)
139
- sprockets-rails (>= 2.0.0)
140
- rails-dom-testing (2.0.3)
141
- activesupport (>= 4.2.0)
171
+ railties (= 7.1.0)
172
+ rails-dom-testing (2.2.0)
173
+ activesupport (>= 5.0.0)
174
+ minitest
142
175
  nokogiri (>= 1.6)
143
- rails-html-sanitizer (1.3.0)
144
- loofah (~> 2.3)
145
- railties (6.1.0)
146
- actionpack (= 6.1.0)
147
- activesupport (= 6.1.0)
148
- method_source
149
- rake (>= 0.8.7)
150
- thor (~> 1.0)
151
- rainbow (3.0.0)
152
- rake (13.0.1)
176
+ rails-html-sanitizer (1.6.0)
177
+ loofah (~> 2.21)
178
+ nokogiri (~> 1.14)
179
+ railties (7.1.0)
180
+ actionpack (= 7.1.0)
181
+ activesupport (= 7.1.0)
182
+ irb
183
+ rackup (>= 1.0.0)
184
+ rake (>= 12.2)
185
+ thor (~> 1.0, >= 1.2.2)
186
+ zeitwerk (~> 2.6)
187
+ rainbow (3.1.1)
188
+ rake (13.0.6)
153
189
  rchardet (1.8.0)
154
- regexp_parser (1.8.2)
155
- rexml (3.2.4)
156
- rspec (3.10.0)
157
- rspec-core (~> 3.10.0)
158
- rspec-expectations (~> 3.10.0)
159
- rspec-mocks (~> 3.10.0)
160
- rspec-core (3.10.0)
161
- rspec-support (~> 3.10.0)
162
- rspec-expectations (3.10.0)
190
+ rdoc (6.5.0)
191
+ psych (>= 4.0.0)
192
+ regexp_parser (2.8.1)
193
+ reline (0.3.9)
194
+ io-console (~> 0.5)
195
+ rexml (3.2.6)
196
+ rspec (3.12.0)
197
+ rspec-core (~> 3.12.0)
198
+ rspec-expectations (~> 3.12.0)
199
+ rspec-mocks (~> 3.12.0)
200
+ rspec-core (3.12.2)
201
+ rspec-support (~> 3.12.0)
202
+ rspec-expectations (3.12.3)
163
203
  diff-lcs (>= 1.2.0, < 2.0)
164
- rspec-support (~> 3.10.0)
204
+ rspec-support (~> 3.12.0)
165
205
  rspec-its (1.3.0)
166
206
  rspec-core (>= 3.0.0)
167
207
  rspec-expectations (>= 3.0.0)
168
- rspec-mocks (3.10.0)
208
+ rspec-mocks (3.12.5)
169
209
  diff-lcs (>= 1.2.0, < 2.0)
170
- rspec-support (~> 3.10.0)
171
- rspec-rails (4.0.1)
172
- actionpack (>= 4.2)
173
- activesupport (>= 4.2)
174
- railties (>= 4.2)
175
- rspec-core (~> 3.9)
176
- rspec-expectations (~> 3.9)
177
- rspec-mocks (~> 3.9)
178
- rspec-support (~> 3.9)
179
- rspec-support (3.10.0)
180
- rubocop (1.7.0)
210
+ rspec-support (~> 3.12.0)
211
+ rspec-rails (6.0.3)
212
+ actionpack (>= 6.1)
213
+ activesupport (>= 6.1)
214
+ railties (>= 6.1)
215
+ rspec-core (~> 3.12)
216
+ rspec-expectations (~> 3.12)
217
+ rspec-mocks (~> 3.12)
218
+ rspec-support (~> 3.12)
219
+ rspec-support (3.12.1)
220
+ rubocop (1.56.4)
221
+ base64 (~> 0.1.1)
222
+ json (~> 2.3)
223
+ language_server-protocol (>= 3.17.0)
181
224
  parallel (~> 1.10)
182
- parser (>= 2.7.1.5)
225
+ parser (>= 3.2.2.3)
183
226
  rainbow (>= 2.2.2, < 4.0)
184
227
  regexp_parser (>= 1.8, < 3.0)
185
- rexml
186
- rubocop-ast (>= 1.2.0, < 2.0)
228
+ rexml (>= 3.2.5, < 4.0)
229
+ rubocop-ast (>= 1.28.1, < 2.0)
187
230
  ruby-progressbar (~> 1.7)
188
- unicode-display_width (>= 1.4.0, < 2.0)
189
- rubocop-ast (1.3.0)
190
- parser (>= 2.7.1.5)
191
- rubocop-performance (1.5.2)
192
- rubocop (>= 0.71.0)
193
- ruby-progressbar (1.10.1)
231
+ unicode-display_width (>= 2.4.0, < 3.0)
232
+ rubocop-ast (1.29.0)
233
+ parser (>= 3.2.1.0)
234
+ rubocop-capybara (2.19.0)
235
+ rubocop (~> 1.41)
236
+ rubocop-factory_bot (2.24.0)
237
+ rubocop (~> 1.33)
238
+ rubocop-performance (1.19.1)
239
+ rubocop (>= 1.7.0, < 2.0)
240
+ rubocop-ast (>= 0.4.0)
241
+ rubocop-rails (2.21.2)
242
+ activesupport (>= 4.2.0)
243
+ rack (>= 1.1)
244
+ rubocop (>= 1.33.0, < 2.0)
245
+ rubocop-rspec (2.24.1)
246
+ rubocop (~> 1.33)
247
+ rubocop-capybara (~> 2.17)
248
+ rubocop-factory_bot (~> 2.22)
249
+ ruby-progressbar (1.13.0)
250
+ ruby2_keywords (0.0.5)
194
251
  scanf (1.0.0)
195
- sprockets (4.0.2)
196
- concurrent-ruby (~> 1.0)
197
- rack (> 1, < 3)
198
- sprockets-rails (3.2.2)
199
- actionpack (>= 4.0)
200
- activesupport (>= 4.0)
201
- sprockets (>= 3.0.0)
202
- sqlite3 (1.4.2)
252
+ sqlite3 (1.6.1-arm64-darwin)
253
+ sqlite3 (1.6.1-x86_64-linux)
203
254
  sqlite3-ruby (1.3.3)
204
255
  sqlite3 (>= 1.3.3)
205
- thor (1.0.1)
206
- tzinfo (2.0.3)
256
+ stringio (3.0.8)
257
+ thor (1.2.2)
258
+ timeout (0.4.0)
259
+ tzinfo (2.0.6)
207
260
  concurrent-ruby (~> 1.0)
208
- unicode-display_width (1.7.0)
209
- websocket-driver (0.7.3)
261
+ unicode-display_width (2.4.2)
262
+ webrick (1.8.1)
263
+ websocket-driver (0.7.6)
210
264
  websocket-extensions (>= 0.1.0)
211
265
  websocket-extensions (0.1.5)
212
- xpath (3.2.0)
213
- nokogiri (~> 1.8)
214
- zeitwerk (2.4.2)
266
+ zeitwerk (2.6.11)
215
267
 
216
268
  PLATFORMS
217
- ruby
218
- x86_64-darwin-19
269
+ arm64-darwin-20
270
+ arm64-darwin-21
271
+ x86_64-linux
219
272
 
220
273
  DEPENDENCIES
221
- capybara-webkit
222
274
  geokit
223
275
  git
224
276
  hpricot
225
277
  jpmobile!
226
278
  pry
227
- rails (~> 6.1.0)
279
+ rails (~> 7.1.0)
228
280
  rspec
229
281
  rspec-its
230
282
  rspec-rails
231
283
  rubocop
232
284
  rubocop-performance
285
+ rubocop-rails
286
+ rubocop-rspec
233
287
  sqlite3-ruby
234
288
 
235
289
  BUNDLED WITH
236
- 2.2.3
290
+ 2.4.19
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- [![CircleCI](https://circleci.com/gh/jpmobile/jpmobile/tree/master.svg?style=svg)](https://circleci.com/gh/jpmobile/jpmobile/tree/master)
1
+ [![CircleCI](https://circleci.com/gh/jpmobile/jpmobile/tree/main.svg?style=svg)](https://circleci.com/gh/jpmobile/jpmobile/tree/main)
2
2
  [![Code Climate](https://codeclimate.com/github/jpmobile/jpmobile/badges/gpa.svg)](https://codeclimate.com/github/jpmobile/jpmobile)
3
3
 
4
4
  # jpmobile: A Rails plugin for Japanese mobile-phones
5
5
 
6
6
  ## jpmobileとは
7
- 携帯電話特有の機能を Rails 5.0 や Rack middleware で利用するためのプラグイン。 以下の機能を備える。
7
+ 携帯電話特有の機能を Rails や Rack middleware で利用するためのプラグイン。 以下の機能を備える。
8
8
 
9
9
  * 携帯電話のキャリア判別
10
10
  * 端末位置情報の取得
@@ -38,21 +38,6 @@ Rails](https://github.com/jpmobile/jpmobile/wiki/Version-:-Jpmobile-vs-Rails)
38
38
  を参照。
39
39
 
40
40
  ## インストール
41
- ### Rails pluginとしてインストールする場合
42
- ```shell
43
- % rails plugin install git://github.com/jpmobile/jpmobile.git
44
- ```
45
-
46
- #### IPアドレス検証が必要な場合
47
- ```shell
48
- % rails plugin install git://github.com/jpmobile/jpmobile-ipaddresses.git
49
- ```
50
-
51
- #### ディスプレイ情報を取得する必要がある場合
52
- ```shell
53
- % rails plugin install git://github.com/jpmobile/jpmobile-terminfo.git
54
- ```
55
-
56
41
  ### gemでインストールする場合
57
42
  ```shell
58
43
  % gem install jpmobile
@@ -155,10 +140,9 @@ Rack::Request#mobile.position に位置情報が格納されます。
155
140
  @longuitude = request.mobile.position.lon
156
141
  ```
157
142
 
158
- #### [GeoKit](http://geokit.rubyforge.org) との連携
143
+ #### [GeoKit](https://github.com/geokit/geokit) との連携
159
144
 
160
- vendor/plugins/geokit以下にGeoKitがインストールされていると、Jpmobile::PositionにGeoKit::Mappabl
161
- eがincludeされる。したがって、
145
+ vendor/plugins/geokit以下にGeoKitがインストールされていると、Jpmobile::PositionにGeoKit::Mappableがincludeされる。したがって、
162
146
 
163
147
  ```ruby
164
148
  request.mobile.position.distance_to('札幌駅')
@@ -310,6 +294,28 @@ def index
310
294
  end
311
295
  ```
312
296
 
297
+ ### アクション定義の省略
298
+
299
+ Railsでは、アクション名に対応するテンプレートが存在する場合、アクション用のメソッド定義を省略できる。
300
+
301
+ しかし、端末向けテンプレートしか存在しないアクションの場合、jpmobileではメソッド定義を省略することを許していない。
302
+
303
+ ```ruby
304
+ class MyController < ApplicationController
305
+ # app/views/my/index_smart_phone.html.erb がある場合でも、次のメソッド定義は必須。
306
+ def index
307
+ end
308
+ end
309
+ ```
310
+
311
+ 次のように設定を加えると、これを省略できるようになる。
312
+
313
+ ```ruby
314
+ class MyController < ApplicationController
315
+ include Jpmobile::MethodLessActionSupport
316
+ end
317
+ ```
318
+
313
319
  ### 位置情報の取得用リンクの生成
314
320
 
315
321
  以下のようなコードで、端末に位置情報を要求するリンクを出力する。
@@ -396,7 +402,7 @@ end
396
402
  ## jpmobileの開発方法
397
403
 
398
404
  jpmobileの開発に関しては
399
- [こちら](https://github.com/jpmobile/jpmobile/blob/master/CONTRIBUTING.md) へ
405
+ [こちら](https://github.com/jpmobile/jpmobile/blob/main/CONTRIBUTING.md) へ
400
406
 
401
407
  ## リンク
402
408
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ namespace :test do
21
21
  'jpmobile-ipaddresses',
22
22
  'jpmobile-terminfo',
23
23
  ]
24
- github_prefix = 'git://github.com/jpmobile'
24
+ github_prefix = 'https://github.com/jpmobile'
25
25
  vendor_path = Pathname.new(Dir.pwd).join('vendor')
26
26
  FileUtils.mkdir_p(vendor_path)
27
27
 
data/jpmobile.gemspec CHANGED
@@ -9,26 +9,19 @@ Gem::Specification.new do |gem|
9
9
  gem.email = ['rust.stnard@gmail.com']
10
10
  gem.description = 'A Rails plugin for mobile devices in Japan'
11
11
  gem.summary = 'Rails plugin for mobile devices in Japan'
12
- gem.homepage = 'http://jpmobile-rails.org'
12
+ gem.homepage = 'https://jpmobile-rails.org'
13
13
  gem.license = 'MIT'
14
14
 
15
+ gem.metadata['source_code_uri'] = 'https://github.com/jpmobile/jpmobile'
16
+ gem.metadata['documentation_uri'] = gem.metadata['source_code_uri']
17
+
15
18
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
19
  gem.require_paths = ['lib']
18
20
 
19
- gem.required_ruby_version = '>= 2.5.0'
21
+ gem.required_ruby_version = '>= 2.7.0'
20
22
 
21
23
  gem.add_dependency 'mail', '~> 2.7.0'
22
24
  gem.add_dependency 'rexml'
23
25
  gem.add_dependency 'scanf'
24
- gem.add_development_dependency 'capybara-webkit'
25
- gem.add_development_dependency 'geokit'
26
- gem.add_development_dependency 'git'
27
- gem.add_development_dependency 'hpricot'
28
- gem.add_development_dependency 'pry'
29
- gem.add_development_dependency 'rails', '~> 6.1.0'
30
- gem.add_development_dependency 'rspec'
31
- gem.add_development_dependency 'rspec-its'
32
- gem.add_development_dependency 'rspec-rails'
33
- gem.add_development_dependency 'sqlite3-ruby'
26
+ gem.metadata['rubygems_mfa_required'] = 'true'
34
27
  end
@@ -19,11 +19,11 @@ module DatumConv
19
19
  l = l_deg * Deg2Rad
20
20
 
21
21
  e2 = f * (2 - f)
22
- n = a / Math.sqrt(1 - e2 * Math.sin(b)**2)
22
+ n = a / Math.sqrt(1 - (e2 * (Math.sin(b)**2)))
23
23
 
24
24
  x = (n + he) * Math.cos(b) * Math.cos(l)
25
25
  y = (n + he) * Math.cos(b) * Math.sin(l)
26
- z = (n * (1 - e2) + he) * Math.sin(b)
26
+ z = ((n * (1 - e2)) + he) * Math.sin(b)
27
27
  return x, y, z
28
28
  end
29
29
 
@@ -34,12 +34,12 @@ module DatumConv
34
34
  e2 = f * (2 - f)
35
35
  l = Math.atan2(y, x)
36
36
 
37
- p = Math.sqrt(x**2 + y**2)
38
- r = Math.sqrt(p**2 + z**2)
39
- u = Math.atan2(z * ((1 - f) + e2 * a / r), p)
40
- b = Math.atan2(z * (1 - f) + e2 * a * Math.sin(u)**3, (1 - f) * (p - e2 * a * Math.cos(u)**3))
37
+ p = Math.sqrt((x**2) + (y**2))
38
+ r = Math.sqrt((p**2) + (z**2))
39
+ u = Math.atan2(z * ((1 - f) + (e2 * a / r)), p)
40
+ b = Math.atan2((z * (1 - f)) + (e2 * a * (Math.sin(u)**3)), (1 - f) * (p - (e2 * a * (Math.cos(u)**3))))
41
41
 
42
- he = p * Math.cos(b) + z * Math.sin(b) - a * Math.sqrt(1 - e2 * Math.sin(b)**2)
42
+ he = (p * Math.cos(b)) + (z * Math.sin(b)) - (a * Math.sqrt(1 - (e2 * (Math.sin(b)**2))))
43
43
 
44
44
  b_deg = b / Deg2Rad
45
45
  l_deg = l / Deg2Rad
@@ -1,5 +1,5 @@
1
1
  # DoCoMoの時guid=onの付与
2
- class ActionController::Base #:nodoc:
2
+ class ActionController::Base # :nodoc:
3
3
  class_attribute :docomo_guid_mode
4
4
 
5
5
  class << self
@@ -10,7 +10,7 @@ class ActionController::Base #:nodoc:
10
10
  end
11
11
  end
12
12
 
13
- module Jpmobile::DocomoGuid #:nodoc:
13
+ module Jpmobile::DocomoGuid # :nodoc:
14
14
  protected
15
15
 
16
16
  def default_url_options
@@ -10,7 +10,7 @@ module Jpmobile
10
10
  def detect(email)
11
11
  Mobile.carriers.each do |const|
12
12
  c = Mobile.const_get(const)
13
- return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
13
+ return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/) # rubocop:disable Performance/ConstantRegexp
14
14
  end
15
15
  nil
16
16
  end
@@ -21,7 +21,7 @@ module Jpmobile
21
21
  c = Mobile.const_get(const)
22
22
  if c::MAIL_ADDRESS_REGEXP &&
23
23
  header.match(/(\S+@[A-Za-z0-9\-._]+)/) &&
24
- Regexp.last_match(1).match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
24
+ Regexp.last_match(1).match(/^#{c::MAIL_ADDRESS_REGEXP}$/) # rubocop:disable Performance/ConstantRegexp
25
25
  return c
26
26
  end
27
27
  end
@@ -8,10 +8,10 @@ module Jpmobile
8
8
  begin
9
9
  expected_view_file = lookup_context.find_template(options[:template], options[:prefixes])
10
10
 
11
- _candidates = lookup_context.mobile.map {|variant|
11
+ _candidates = lookup_context.mobile.filter_map do |variant|
12
12
  target_template = options[:template] + '_' + variant
13
13
  expected_view_file.virtual_path.match(target_template)
14
- }.compact
14
+ end
15
15
 
16
16
  if _candidates.empty?
17
17
  lookup_context.mobile = []