jpmobile 4.2.5 → 5.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/jpmobile.gemspec +1 -2
  4. data/lib/jpmobile.rb +17 -7
  5. data/lib/jpmobile/configuration.rb +1 -1
  6. data/lib/jpmobile/encoding.rb +13 -19
  7. data/lib/jpmobile/{hook_action_controller.rb → fallback_view_selector.rb} +4 -6
  8. data/lib/jpmobile/filter.rb +13 -10
  9. data/lib/jpmobile/mobile/abstract_mobile.rb +2 -2
  10. data/lib/jpmobile/mobile/google_emoticon.rb +2 -2
  11. data/lib/jpmobile/mobile/smart_phone.rb +2 -2
  12. data/lib/jpmobile/mobile/unicode_emoticon.rb +2 -2
  13. data/lib/jpmobile/rack/filter.rb +36 -38
  14. data/lib/jpmobile/rack/mobile_carrier.rb +8 -10
  15. data/lib/jpmobile/rack/params_filter.rb +32 -34
  16. data/lib/jpmobile/rails.rb +17 -4
  17. data/lib/jpmobile/resolver.rb +2 -3
  18. data/lib/jpmobile/trans_sid.rb +58 -78
  19. data/lib/jpmobile/util.rb +0 -17
  20. data/lib/jpmobile/version.rb +1 -1
  21. data/lib/tasks/jpmobile_tasks.rake +31 -37
  22. data/spec/rack/jpmobile/android_spec.rb +2 -2
  23. data/spec/rack/jpmobile/au_spec.rb +17 -17
  24. data/spec/rack/jpmobile/black_berry_spec.rb +2 -2
  25. data/spec/rack/jpmobile/docomo_spec.rb +15 -15
  26. data/spec/rack/jpmobile/emoticon_spec.rb +57 -57
  27. data/spec/rack/jpmobile/filter_spec.rb +25 -25
  28. data/spec/rack/jpmobile/iphone_spec.rb +3 -3
  29. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +3 -3
  30. data/spec/rack/jpmobile/params_filter_spec.rb +10 -10
  31. data/spec/rack/jpmobile/softbank_spec.rb +9 -9
  32. data/spec/rack/jpmobile/willcom_spec.rb +6 -6
  33. data/spec/rack/jpmobile/windows_phone.rb +2 -2
  34. data/spec/rack_helper.rb +0 -1
  35. data/spec/unit/mail_spec.rb +1 -10
  36. data/spec/unit/util_spec.rb +42 -56
  37. data/test/rails/overrides/Gemfile.jpmobile +5 -3
  38. data/test/rails/overrides/app/controllers/filter_controller.rb +0 -1
  39. data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -9
  40. data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +2 -2
  41. data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
  42. data/test/rails/overrides/app/views/filter/text_template.html.erb +1 -0
  43. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +3 -3
  44. data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
  45. data/test/rails/overrides/spec/features/filter_spec.rb +10 -9
  46. data/test/rails/overrides/spec/helpers/helpers_spec.rb +5 -3
  47. data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
  48. data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
  49. data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
  50. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +4 -4
  51. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -1
  52. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +7 -9
  53. metadata +12 -28
  54. data/lib/jpmobile/hook_action_dispatch.rb +0 -2
  55. data/lib/jpmobile/rack.rb +0 -14
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe "PCからのアクセスの場合", :type => :request do
3
+ describe "PCからのアクセスの場合", type: :request do
4
4
  before do
5
5
  @headers = {
6
6
  "HTTP_USER_AGENT" => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)",
@@ -8,12 +8,12 @@ describe "PCからのアクセスの場合", :type => :request do
8
8
  end
9
9
 
10
10
  it "request.mobile は nil であるべき" do
11
- get "/mobile_spec/index", {}, @headers
11
+ get "/mobile_spec/index", params: {}, env: @headers
12
12
 
13
13
  expect(request.mobile).to be_nil
14
14
  end
15
15
  it "request.mobile? は false であるべき" do
16
- get "/mobile_spec/index", {}, @headers
16
+ get "/mobile_spec/index", params: {}, env: @headers
17
17
 
18
18
  expect(request.mobile?).to be_falsey
19
19
  end
@@ -1,17 +1,17 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe "Softbank Emulator からのアクセスのとき", :type => :request do
3
+ describe "Softbank Emulator からのアクセスのとき", type: :request do
4
4
  it "request.mobile は Softbank のインスタンスであること" do
5
- get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "Semulator"}
5
+ get "/mobile_spec/index", params: {}, env: {"HTTP_USER_AGENT" => "Semulator"}
6
6
 
7
7
  expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Softbank)
8
8
  expect(request.mobile?).to be_truthy
9
9
  end
10
10
  end
11
11
 
12
- describe "Vodafone Emulator からのアクセスのとき", :type => :request do
12
+ describe "Vodafone Emulator からのアクセスのとき", type: :request do
13
13
  it "request.mobile は Vodafone のインスタンスであること" do
14
- get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "Vemulator"}
14
+ get "/mobile_spec/index", params: {}, env: {"HTTP_USER_AGENT" => "Vemulator"}
15
15
 
16
16
  expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Vodafone)
17
17
  expect(request.mobile?).to be_truthy
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe TemplatePathController, "integrated_views", :type => :request do
3
+ describe TemplatePathController, "integrated_views", type: :request do
4
4
  before do
5
5
  page.driver.header('User-Agent', user_agent)
6
6
  end
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  def get_with_session(controller, action, user_agent)
4
4
  open_session do |sess|
5
- sess.get "/#{controller}/#{action}", {}, {"HTTP_USER_AGENT" => user_agent}
5
+ sess.get "/#{controller}/#{action}", params: {}, env: {"HTTP_USER_AGENT" => user_agent}
6
6
  end
7
7
  end
8
8
 
@@ -18,9 +18,9 @@ def describe_mobile_with_ua(user_agent, charset, &block)
18
18
  end
19
19
  end
20
20
 
21
- describe "trans_sid functional", :type => :request do
21
+ describe "trans_sid functional", type: :request do
22
22
  before(:each) do
23
- @user ||= User.create(:name => "hoge")
23
+ @user ||= User.create(name: "hoge")
24
24
  end
25
25
 
26
26
  shared_examples_for "trans_sid が起動しないとき" do
@@ -105,7 +105,7 @@ describe "trans_sid functional", :type => :request do
105
105
  end
106
106
 
107
107
  it "の trans_sid_mode は nil" do
108
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
108
+ get "/#{@controller}/link", params: {}, env: {"HTTP_USER_AGENT" => @user_agent}
109
109
 
110
110
  expect(controller.trans_sid_mode).to be_nil
111
111
  end
@@ -120,7 +120,7 @@ describe "trans_sid functional", :type => :request do
120
120
  end
121
121
 
122
122
  it "の trans_sid_mode は :none" do
123
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
123
+ get "/#{@controller}/link", params: {}, env: {"HTTP_USER_AGENT" => @user_agent}
124
124
 
125
125
  expect(controller.trans_sid_mode).to eq(:none)
126
126
  end
@@ -135,7 +135,7 @@ describe "trans_sid functional", :type => :request do
135
135
  end
136
136
 
137
137
  it "の trans_sid_mode は :always" do
138
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
138
+ get "/#{@controller}/link", params: {}, env: {"HTTP_USER_AGENT" => @user_agent}
139
139
 
140
140
  expect(controller.trans_sid_mode).to eq(:always)
141
141
  end
@@ -164,7 +164,7 @@ describe "trans_sid functional", :type => :request do
164
164
  end
165
165
 
166
166
  it "の trans_sid_mode は :mobile" do
167
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
167
+ get "/#{@controller}/link", params: {}, env: {"HTTP_USER_AGENT" => @user_agent}
168
168
 
169
169
  expect(controller.trans_sid_mode).to eq(:mobile)
170
170
  end
@@ -185,12 +185,10 @@ describe "trans_sid functional", :type => :request do
185
185
  it_should_behave_like "trans_sid が起動しないとき"
186
186
  end
187
187
 
188
- # NOTE: 3.0.0RC では accept-charset は UTF-8 で埋め込まれるので保留
189
188
  describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)", "Shift_JIS" do
190
189
  it_should_behave_like "trans_sid が起動するとき"
191
190
  end
192
191
 
193
- # NOTE: 3.0.0RC では accept-charset は UTF-8 で埋め込まれるので保留
194
192
  describe_mobile_with_ua "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0", "Shift_JIS" do
195
193
  it_should_behave_like "trans_sid が起動しないとき"
196
194
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpmobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.5
4
+ version: 5.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shin-ichiro OGAWA
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-14 00:00:00.000000000 Z
12
+ date: 2016-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: '4.2'
20
+ version: 5.0.0.beta1
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: '4.2'
27
+ version: 5.0.0.beta1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rspec
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -151,20 +151,6 @@ dependencies:
151
151
  - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
- - !ruby/object:Gem::Dependency
155
- name: mail
156
- requirement: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - '='
159
- - !ruby/object:Gem::Version
160
- version: 2.5.5
161
- type: :development
162
- prerelease: false
163
- version_requirements: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - '='
166
- - !ruby/object:Gem::Version
167
- version: 2.5.5
168
154
  description: A Rails plugin for mobile devices in Japan
169
155
  email:
170
156
  - rust.stnard@gmail.com
@@ -196,10 +182,9 @@ files:
196
182
  - lib/jpmobile/emoticon/unicode.rb
197
183
  - lib/jpmobile/emoticon/z_combine.rb
198
184
  - lib/jpmobile/encoding.rb
185
+ - lib/jpmobile/fallback_view_selector.rb
199
186
  - lib/jpmobile/filter.rb
200
187
  - lib/jpmobile/helpers.rb
201
- - lib/jpmobile/hook_action_controller.rb
202
- - lib/jpmobile/hook_action_dispatch.rb
203
188
  - lib/jpmobile/hook_action_view.rb
204
189
  - lib/jpmobile/hook_test_request.rb
205
190
  - lib/jpmobile/lookup_context.rb
@@ -225,7 +210,6 @@ files:
225
210
  - lib/jpmobile/mobile/windows_phone.rb
226
211
  - lib/jpmobile/path_set.rb
227
212
  - lib/jpmobile/position.rb
228
- - lib/jpmobile/rack.rb
229
213
  - lib/jpmobile/rack/filter.rb
230
214
  - lib/jpmobile/rack/mobile_carrier.rb
231
215
  - lib/jpmobile/rack/params_filter.rb
@@ -295,7 +279,6 @@ files:
295
279
  - spec/unit/variants_spec.rb
296
280
  - test/rails/.gitignore
297
281
  - test/rails/overrides/.rspec
298
- - test/rails/overrides/Gemfile
299
282
  - test/rails/overrides/Gemfile.jpmobile
300
283
  - test/rails/overrides/app/controllers/admin/top_controller.rb
301
284
  - test/rails/overrides/app/controllers/application_controller.rb
@@ -322,6 +305,7 @@ files:
322
305
  - test/rails/overrides/app/views/decorated_mailer/deco_mail.html.erb
323
306
  - test/rails/overrides/app/views/decorated_mailer/deco_mail.text.erb
324
307
  - test/rails/overrides/app/views/filter/index.html.erb
308
+ - test/rails/overrides/app/views/filter/text_template.html.erb
325
309
  - test/rails/overrides/app/views/hankaku_filter/index.html.erb
326
310
  - test/rails/overrides/app/views/hankaku_input_filter/index.html.erb
327
311
  - test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb
@@ -444,12 +428,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
444
428
  version: '0'
445
429
  required_rubygems_version: !ruby/object:Gem::Requirement
446
430
  requirements:
447
- - - ">="
431
+ - - ">"
448
432
  - !ruby/object:Gem::Version
449
- version: '0'
433
+ version: 1.3.1
450
434
  requirements: []
451
435
  rubyforge_project:
452
- rubygems_version: 2.6.14.1
436
+ rubygems_version: 2.5.1
453
437
  signing_key:
454
438
  specification_version: 4
455
439
  summary: A Rails plugin for mobile devices in Japan
@@ -510,7 +494,6 @@ test_files:
510
494
  - spec/unit/variants_spec.rb
511
495
  - test/rails/.gitignore
512
496
  - test/rails/overrides/.rspec
513
- - test/rails/overrides/Gemfile
514
497
  - test/rails/overrides/Gemfile.jpmobile
515
498
  - test/rails/overrides/app/controllers/admin/top_controller.rb
516
499
  - test/rails/overrides/app/controllers/application_controller.rb
@@ -537,6 +520,7 @@ test_files:
537
520
  - test/rails/overrides/app/views/decorated_mailer/deco_mail.html.erb
538
521
  - test/rails/overrides/app/views/decorated_mailer/deco_mail.text.erb
539
522
  - test/rails/overrides/app/views/filter/index.html.erb
523
+ - test/rails/overrides/app/views/filter/text_template.html.erb
540
524
  - test/rails/overrides/app/views/hankaku_filter/index.html.erb
541
525
  - test/rails/overrides/app/views/hankaku_input_filter/index.html.erb
542
526
  - test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb
@@ -1,2 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- ActionDispatch::Request.send :include, Jpmobile::Encoding
data/lib/jpmobile/rack.rb DELETED
@@ -1,14 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rack/utils'
3
- require 'singleton'
4
-
5
- module Jpmobile
6
- module Rack
7
- module_function
8
- def mount_middlewares
9
- # 漢字コード・絵文字フィルター
10
- ::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::ParamsFilter)
11
- ::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::Filter)
12
- end
13
- end
14
- end