jpmobile 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/.gitignore +6 -0
  2. data/{test/rails/rails_root/vendor/plugins/jpmobile/MIT-LICENSE → MIT-LICENSE} +0 -0
  3. data/README.rdoc +16 -6
  4. data/Rakefile +14 -0
  5. data/VERSION.yml +4 -0
  6. data/init.rb +3 -0
  7. data/install.rb +1 -0
  8. data/jpmobile.gemspec +299 -0
  9. data/lib/jpmobile.rb +0 -2
  10. data/lib/jpmobile/emoticon.rb +16 -2
  11. data/lib/jpmobile/emoticon/z_combine.rb +17 -4
  12. data/lib/jpmobile/filter.rb +2 -3
  13. data/lib/jpmobile/mobile/abstract_mobile.rb +6 -0
  14. data/lib/jpmobile/mobile/docomo.rb +24 -1
  15. data/lib/jpmobile/mobile/z_ip_addresses_au.rb +3 -2
  16. data/lib/jpmobile/mobile/z_ip_addresses_docomo.rb +4 -1
  17. data/lib/jpmobile/request_with_mobile.rb +4 -1
  18. data/{test/rails/rails_root/vendor/plugins/jpmobile/spec → spec}/spec.opts +0 -0
  19. data/spec/spec_helper.rb +36 -0
  20. data/spec/unit/detect_by_email_spec.rb +31 -0
  21. data/{test/rails/rails_root/vendor/plugins/jpmobile/spec → spec}/unit/detect_by_ua_spec.rb +11 -13
  22. data/spec/unit/is_carrier_spec.rb +93 -0
  23. data/spec/unit/spec_helper.rb +5 -0
  24. data/spec/unit/util_spec.rb +30 -0
  25. data/spec/unit/valid_ip_spec.rb +60 -0
  26. data/{test/rails/rails_root/vendor/plugins/jpmobile/tasks → tasks}/jpmobile_tasks.rake +3 -3
  27. data/test/legacy/autoload_test.rb +2 -1
  28. data/test/legacy/docomo_test.rb +39 -0
  29. data/test/legacy/emoticon_functional_test.rb +21 -19
  30. data/test/legacy/emoticon_test.rb +12 -12
  31. data/test/legacy/filter_test.rb +10 -8
  32. data/test/legacy/helper.rb +32 -3
  33. data/test/legacy/softbank_test.rb +2 -0
  34. data/test/rails/.gitignore +1 -0
  35. data/test/rails/overrides/app/controllers/filter_controller.rb +10 -0
  36. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +2 -0
  37. data/test/rails/overrides/spec/controllers/docomo_spec.rb +2 -0
  38. data/test/rails/overrides/spec/controllers/emobile_spec.rb +2 -0
  39. data/test/rails/overrides/spec/controllers/filter_spec.rb +8 -7
  40. data/test/rails/overrides/spec/controllers/pc_spec.rb +2 -0
  41. data/test/rails/overrides/spec/controllers/softbank_emulator_spec.rb +2 -0
  42. data/test/rails/overrides/spec/controllers/template_path_spec.rb +2 -0
  43. data/test/rails/overrides/spec/controllers/trans_sid_spec.rb +1 -0
  44. data/test/rails/overrides/spec/helpers/helpers_spec.rb +2 -0
  45. data/test/rails/overrides/spec/spec_helper.rb +15 -0
  46. data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -23
  47. data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +1 -1
  48. data/test/rails/rails_root/app/controllers/template_path_controller.rb +3 -0
  49. data/test/rails/rails_root/app/helpers/application_helper.rb +0 -1
  50. data/test/rails/rails_root/config/boot.rb +13 -110
  51. data/test/rails/rails_root/config/environment.rb +4 -41
  52. data/test/rails/rails_root/config/environments/development.rb +22 -13
  53. data/test/rails/rails_root/config/environments/production.rb +41 -20
  54. data/test/rails/rails_root/config/environments/test.rb +35 -28
  55. data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +2 -2
  56. data/test/rails/rails_root/config/initializers/inflections.rb +1 -1
  57. data/test/rails/rails_root/config/initializers/session_store.rb +2 -15
  58. data/test/rails/rails_root/config/routes.rb +6 -42
  59. data/test/rails/rails_root/db/schema.rb +24 -7
  60. data/test/rails/rails_root/db/seeds.rb +2 -2
  61. data/test/rails/rails_root/spec/helpers/helpers_spec.rb +4 -2
  62. data/test/rails/rails_root/spec/spec_helper.rb +19 -35
  63. data/test/rails/rails_root/test/performance/browsing_test.rb +2 -2
  64. data/test/rails/rails_root/test/test_helper.rb +2 -27
  65. data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +1 -1
  66. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +39 -25
  67. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +2 -1
  68. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +3 -4
  69. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +24 -8
  70. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +10 -9
  71. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +17 -4
  72. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +43 -136
  73. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +5 -18
  74. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +24 -16
  75. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +42 -85
  76. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +25 -2
  77. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +28 -3
  78. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/display.rb +29 -26
  79. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +60 -11
  80. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +16 -41
  81. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +1 -10
  82. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_au.rb +3 -2
  83. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_docomo.rb +4 -1
  84. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +4 -3
  85. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +14 -13
  86. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +52 -35
  87. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +68 -0
  88. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/spec_helper.rb +3 -2
  89. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/detect_by_email_spec.rb +21 -27
  90. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/is_carrier_spec.rb +56 -84
  91. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/spec_helper.rb +1 -2
  92. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/util_spec.rb +8 -2
  93. data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/valid_ip_spec.rb +43 -52
  94. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/disabled_update_display_info_docomo.rb +0 -0
  95. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_au.rb +0 -0
  96. data/tools/emoji/genregexp.rb +47 -0
  97. metadata +348 -253
  98. data/test/rails/rails_root/README +0 -243
  99. data/test/rails/rails_root/Rakefile +0 -10
  100. data/test/rails/rails_root/app/controllers/docomo_guid_controller.rb +0 -13
  101. data/test/rails/rails_root/app/controllers/trans_sid_controller.rb +0 -28
  102. data/test/rails/rails_root/app/views/filter/index.html.erb +0 -0
  103. data/test/rails/rails_root/app/views/hankaku_filter/index.html.erb +0 -0
  104. data/test/rails/rails_root/app/views/template_path/_partial.html.erb +0 -1
  105. data/test/rails/rails_root/app/views/template_path/_partial_mobile.html.erb +0 -1
  106. data/test/rails/rails_root/app/views/template_path/_partial_mobile_docomo.html.erb +0 -1
  107. data/test/rails/rails_root/app/views/template_path/index.html.erb +0 -1
  108. data/test/rails/rails_root/app/views/template_path/index_mobile.html.erb +0 -1
  109. data/test/rails/rails_root/app/views/template_path/index_mobile_docomo.html.erb +0 -1
  110. data/test/rails/rails_root/app/views/template_path/partial.html.erb +0 -2
  111. data/test/rails/rails_root/config/database.yml +0 -22
  112. data/test/rails/rails_root/config/initializers/new_rails_defaults.rb +0 -21
  113. data/test/rails/rails_root/config/locales/en.yml +0 -5
  114. data/test/rails/rails_root/db/development.sqlite3 +0 -0
  115. data/test/rails/rails_root/db/test.sqlite3 +0 -0
  116. data/test/rails/rails_root/doc/README_FOR_APP +0 -2
  117. data/test/rails/rails_root/lib/tasks/rspec.rake +0 -165
  118. data/test/rails/rails_root/log/development.log +0 -38
  119. data/test/rails/rails_root/log/production.log +0 -0
  120. data/test/rails/rails_root/log/server.log +0 -0
  121. data/test/rails/rails_root/log/test.log +0 -451
  122. data/test/rails/rails_root/public/404.html +0 -30
  123. data/test/rails/rails_root/public/422.html +0 -30
  124. data/test/rails/rails_root/public/500.html +0 -30
  125. data/test/rails/rails_root/public/favicon.ico +0 -0
  126. data/test/rails/rails_root/public/images/rails.png +0 -0
  127. data/test/rails/rails_root/public/index.html +0 -275
  128. data/test/rails/rails_root/public/javascripts/application.js +0 -2
  129. data/test/rails/rails_root/public/javascripts/controls.js +0 -963
  130. data/test/rails/rails_root/public/javascripts/dragdrop.js +0 -973
  131. data/test/rails/rails_root/public/javascripts/effects.js +0 -1128
  132. data/test/rails/rails_root/public/javascripts/prototype.js +0 -4320
  133. data/test/rails/rails_root/public/robots.txt +0 -5
  134. data/test/rails/rails_root/script/about +0 -4
  135. data/test/rails/rails_root/script/console +0 -3
  136. data/test/rails/rails_root/script/dbconsole +0 -3
  137. data/test/rails/rails_root/script/destroy +0 -3
  138. data/test/rails/rails_root/script/generate +0 -3
  139. data/test/rails/rails_root/script/performance/benchmarker +0 -3
  140. data/test/rails/rails_root/script/performance/profiler +0 -3
  141. data/test/rails/rails_root/script/plugin +0 -3
  142. data/test/rails/rails_root/script/runner +0 -3
  143. data/test/rails/rails_root/script/server +0 -3
  144. data/test/rails/rails_root/spec/controllers/docomo_guid_spec.rb +0 -77
  145. data/test/rails/rails_root/spec/controllers/docomo_spec.rb +0 -28
  146. data/test/rails/rails_root/spec/controllers/emobile_spec.rb +0 -35
  147. data/test/rails/rails_root/spec/controllers/filter_spec.rb +0 -157
  148. data/test/rails/rails_root/spec/controllers/pc_spec.rb +0 -11
  149. data/test/rails/rails_root/spec/controllers/softbank_emulator_spec.rb +0 -40
  150. data/test/rails/rails_root/spec/controllers/template_path_spec.rb +0 -115
  151. data/test/rails/rails_root/spec/controllers/trans_sid_spec.rb +0 -99
  152. data/test/rails/rails_root/spec/rcov.opts +0 -2
  153. data/test/rails/rails_root/spec/rspec.rake +0 -165
  154. data/test/rails/rails_root/spec/spec.opts +0 -4
  155. data/test/rails/rails_root/vendor/plugins/jpmobile/CHANGELOG +0 -7
  156. data/test/rails/rails_root/vendor/plugins/jpmobile/README.rdoc +0 -239
  157. data/test/rails/rails_root/vendor/plugins/jpmobile/Rakefile +0 -116
  158. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_request.rb +0 -5
  159. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/auth.rb +0 -55
  160. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/combined_logger.rb +0 -54
  161. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/request.rb +0 -7
  162. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/trans_sid.rb +0 -14
  163. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/version.rb +0 -9
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ doc
2
+ tmp
3
+ pkg
4
+ .bundle
5
+ Gemfile
6
+ Gemfile.lock
data/README.rdoc CHANGED
@@ -16,25 +16,35 @@
16
16
 
17
17
  == インストール
18
18
  Rails の Version に応じて選択してください。
19
- === Rails 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8
19
+ === Rails 2.3.3 2.3.8
20
+ ==== pluginとしてインストールする場合
20
21
  開発版:
21
- % ./script/plugin install git://github.com/darashi/jpmobile.git
22
+ % ./script/plugin install git://github.com/jpmobile/jpmobile.git
23
+
24
+ ==== gemでインストールする場合
25
+
26
+ # gem install jpmobile -v 0.0.8
27
+ としてgemをインストールした後
28
+
29
+ RAILS_ROOT/config/environment.rb の Rails::Initializer.run do |config| 〜 end 内に
30
+ config.gem "jpmobile"
31
+ の行を追加する。
22
32
 
23
33
  === Rails 2.3.2
24
34
  ==== pluginとしてインストールする場合
25
35
 
26
36
  リリース版: (Version 0.0.6)
27
- % git clone git://github.com/darashi/jpmobile.git vendor/plugins/jpmobile
37
+ % git clone git://github.com/jpmobile/jpmobile.git vendor/plugins/jpmobile
28
38
  % cd vendor/plugins/jpmobile
29
39
  % git checkout 0.0.6
30
40
  % rm -rf .git
31
41
 
32
42
  開発版:
33
- % ./script/plugin install git://github.com/darashi/jpmobile.git
43
+ % ./script/plugin install git://github.com/jpmobile/jpmobile.git
34
44
 
35
45
  ==== gemでインストールする場合
36
46
 
37
- # gem install jpmobile
47
+ # gem install jpmobile -v 0.0.8
38
48
  としてgemをインストールした後
39
49
 
40
50
  RAILS_ROOT/config/environment.rb の Rails::Initializer.run do |config| 〜 end 内に
@@ -43,7 +53,7 @@ RAILS_ROOT/config/environment.rb の Rails::Initializer.run do |config| 〜 end
43
53
 
44
54
  === Rails 2.2.x 以前
45
55
  リリース版:
46
- % git clone git://github.com/darashi/jpmobile.git vendor/plugins/jpmobile
56
+ % git clone git://github.com/jpmobile/jpmobile.git vendor/plugins/jpmobile
47
57
  % cd vendor/plugins/jpmobile
48
58
  % git checkout 0.0.5
49
59
  % rm -rf .git
data/Rakefile CHANGED
@@ -114,3 +114,17 @@ end
114
114
 
115
115
  task :test => ['test:legacy', 'spec:unit', 'test:rails']
116
116
  load 'tasks/jpmobile_tasks.rake'
117
+
118
+ begin
119
+ require 'jeweler'
120
+ Jeweler::Tasks.new do |gemspec|
121
+ gemspec.name = "jpmobile"
122
+ gemspec.summary = %q{A Rails plugin for Japanese mobile-phones}
123
+ gemspec.description = %q{A Rails plugin for Japanese mobile-phones}
124
+ gemspec.email = %q{dara@shidara.net}
125
+ gemspec.homepage = %q{http://github.com/jpmobile/jpmobile}
126
+ gemspec.authors = ["Yoji Shidara", "Shin-ichiro OGAWA"]
127
+ end
128
+ rescue LoadError
129
+ puts "Jeweler not available. Install it with: gem install jeweler"
130
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 8
data/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ # Include hook code here
2
+
3
+ require 'jpmobile'
data/install.rb ADDED
@@ -0,0 +1 @@
1
+ # Install hook code here
data/jpmobile.gemspec ADDED
@@ -0,0 +1,299 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jpmobile}
8
+ s.version = "0.0.8"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Yoji Shidara", "Shin-ichiro OGAWA"]
12
+ s.date = %q{2010-08-31}
13
+ s.description = %q{A Rails plugin for Japanese mobile-phones}
14
+ s.email = %q{dara@shidara.net}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG",
21
+ "MIT-LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "init.rb",
26
+ "install.rb",
27
+ "jpmobile.gemspec",
28
+ "lib/jpmobile.rb",
29
+ "lib/jpmobile/datum_conv.rb",
30
+ "lib/jpmobile/docomo_guid.rb",
31
+ "lib/jpmobile/email.rb",
32
+ "lib/jpmobile/emoticon.rb",
33
+ "lib/jpmobile/emoticon/au.rb",
34
+ "lib/jpmobile/emoticon/conversion_table.rb",
35
+ "lib/jpmobile/emoticon/docomo.rb",
36
+ "lib/jpmobile/emoticon/softbank.rb",
37
+ "lib/jpmobile/emoticon/z_combine.rb",
38
+ "lib/jpmobile/filter.rb",
39
+ "lib/jpmobile/helpers.rb",
40
+ "lib/jpmobile/hook_action_controller.rb",
41
+ "lib/jpmobile/hook_action_view.rb",
42
+ "lib/jpmobile/hook_request.rb",
43
+ "lib/jpmobile/mobile/abstract_mobile.rb",
44
+ "lib/jpmobile/mobile/au.rb",
45
+ "lib/jpmobile/mobile/display.rb",
46
+ "lib/jpmobile/mobile/docomo.rb",
47
+ "lib/jpmobile/mobile/emobile.rb",
48
+ "lib/jpmobile/mobile/softbank.rb",
49
+ "lib/jpmobile/mobile/willcom.rb",
50
+ "lib/jpmobile/mobile/z_display_info_docomo.rb",
51
+ "lib/jpmobile/mobile/z_ip_addresses_au.rb",
52
+ "lib/jpmobile/mobile/z_ip_addresses_docomo.rb",
53
+ "lib/jpmobile/mobile/z_ip_addresses_emobile.rb",
54
+ "lib/jpmobile/mobile/z_ip_addresses_softbank.rb",
55
+ "lib/jpmobile/mobile/z_ip_addresses_willcom.rb",
56
+ "lib/jpmobile/position.rb",
57
+ "lib/jpmobile/rack/auth.rb",
58
+ "lib/jpmobile/rack/combined_logger.rb",
59
+ "lib/jpmobile/rack/request.rb",
60
+ "lib/jpmobile/rack/trans_sid.rb",
61
+ "lib/jpmobile/request_with_mobile.rb",
62
+ "lib/jpmobile/trans_sid.rb",
63
+ "lib/jpmobile/util.rb",
64
+ "lib/jpmobile/version.rb",
65
+ "spec/spec.opts",
66
+ "spec/spec_helper.rb",
67
+ "spec/unit/detect_by_email_spec.rb",
68
+ "spec/unit/detect_by_ua_spec.rb",
69
+ "spec/unit/is_carrier_spec.rb",
70
+ "spec/unit/spec_helper.rb",
71
+ "spec/unit/util_spec.rb",
72
+ "spec/unit/valid_ip_spec.rb",
73
+ "tasks/jpmobile_tasks.rake",
74
+ "test/legacy/au_test.rb",
75
+ "test/legacy/autoload_test.rb",
76
+ "test/legacy/docomo_test.rb",
77
+ "test/legacy/emoticon_functional_test.rb",
78
+ "test/legacy/emoticon_test.rb",
79
+ "test/legacy/filter_test.rb",
80
+ "test/legacy/helper.rb",
81
+ "test/legacy/helpers_test.rb",
82
+ "test/legacy/softbank_test.rb",
83
+ "test/legacy/willcom_test.rb",
84
+ "test/rails/.gitignore",
85
+ "test/rails/2.3.2/spec/controllers/trans_sid_spec.rb",
86
+ "test/rails/overrides/app/controllers/application_controller.rb",
87
+ "test/rails/overrides/app/controllers/docomo_guid_controller.rb",
88
+ "test/rails/overrides/app/controllers/filter_controller.rb",
89
+ "test/rails/overrides/app/controllers/mobile_spec_controller.rb",
90
+ "test/rails/overrides/app/controllers/template_path_controller.rb",
91
+ "test/rails/overrides/app/controllers/trans_sid_controller.rb",
92
+ "test/rails/overrides/app/views/filter/index.html.erb",
93
+ "test/rails/overrides/app/views/hankaku_filter/index.html.erb",
94
+ "test/rails/overrides/app/views/template_path/_partial.html.erb",
95
+ "test/rails/overrides/app/views/template_path/_partial_mobile.html.erb",
96
+ "test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb",
97
+ "test/rails/overrides/app/views/template_path/index.html.erb",
98
+ "test/rails/overrides/app/views/template_path/index_mobile.html.erb",
99
+ "test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb",
100
+ "test/rails/overrides/app/views/template_path/partial.html.erb",
101
+ "test/rails/overrides/lib/tasks/rspec.rake",
102
+ "test/rails/overrides/spec/controllers/docomo_guid_spec.rb",
103
+ "test/rails/overrides/spec/controllers/docomo_spec.rb",
104
+ "test/rails/overrides/spec/controllers/emobile_spec.rb",
105
+ "test/rails/overrides/spec/controllers/filter_spec.rb",
106
+ "test/rails/overrides/spec/controllers/pc_spec.rb",
107
+ "test/rails/overrides/spec/controllers/softbank_emulator_spec.rb",
108
+ "test/rails/overrides/spec/controllers/template_path_spec.rb",
109
+ "test/rails/overrides/spec/controllers/trans_sid_spec.rb",
110
+ "test/rails/overrides/spec/helpers/helpers_spec.rb",
111
+ "test/rails/overrides/spec/rcov.opts",
112
+ "test/rails/overrides/spec/rspec.rake",
113
+ "test/rails/overrides/spec/spec.opts",
114
+ "test/rails/overrides/spec/spec_helper.rb",
115
+ "tools/disabled_update_display_info_docomo.rb",
116
+ "tools/emoji/genregexp.rb",
117
+ "tools/generate_au_emoticon_table.rb",
118
+ "tools/generate_docomo_emoticon_table.rb",
119
+ "tools/generate_emoticon_conversion_table.rb",
120
+ "tools/generate_softbank_emoticon_table.rb",
121
+ "tools/list_gps_unsupported_au.rb",
122
+ "tools/update_ip_addresses_au.rb",
123
+ "tools/update_ip_addresses_willcom.rb"
124
+ ]
125
+ s.homepage = %q{http://github.com/jpmobile/jpmobile}
126
+ s.rdoc_options = ["--charset=UTF-8"]
127
+ s.require_paths = ["lib"]
128
+ s.rubygems_version = %q{1.3.7}
129
+ s.summary = %q{A Rails plugin for Japanese mobile-phones}
130
+ s.test_files = [
131
+ "spec/unit/detect_by_email_spec.rb",
132
+ "spec/unit/detect_by_ua_spec.rb",
133
+ "spec/unit/spec_helper.rb",
134
+ "spec/unit/valid_ip_spec.rb",
135
+ "spec/unit/util_spec.rb",
136
+ "spec/unit/is_carrier_spec.rb",
137
+ "spec/spec_helper.rb",
138
+ "test/legacy/filter_test.rb",
139
+ "test/legacy/autoload_test.rb",
140
+ "test/legacy/softbank_test.rb",
141
+ "test/legacy/au_test.rb",
142
+ "test/legacy/willcom_test.rb",
143
+ "test/legacy/emoticon_functional_test.rb",
144
+ "test/legacy/emoticon_test.rb",
145
+ "test/legacy/helpers_test.rb",
146
+ "test/legacy/docomo_test.rb",
147
+ "test/legacy/helper.rb",
148
+ "test/rails/rails_root/spec/helpers/helpers_spec.rb",
149
+ "test/rails/rails_root/spec/requests/softbank_emulator_spec.rb",
150
+ "test/rails/rails_root/spec/requests/docomo_spec.rb",
151
+ "test/rails/rails_root/spec/requests/helpers_spec.rb",
152
+ "test/rails/rails_root/spec/requests/docomo_guid_spec.rb",
153
+ "test/rails/rails_root/spec/requests/trans_sid_spec.rb",
154
+ "test/rails/rails_root/spec/requests/template_path_spec.rb",
155
+ "test/rails/rails_root/spec/requests/filter_spec.rb",
156
+ "test/rails/rails_root/spec/requests/pc_spec.rb",
157
+ "test/rails/rails_root/spec/requests/emobile_spec.rb",
158
+ "test/rails/rails_root/spec/spec_helper.rb",
159
+ "test/rails/rails_root/autotest/discover.rb",
160
+ "test/rails/rails_root/app/helpers/application_helper.rb",
161
+ "test/rails/rails_root/app/models/user.rb",
162
+ "test/rails/rails_root/app/controllers/trans_sid_always_controller.rb",
163
+ "test/rails/rails_root/app/controllers/hankaku_filter_controller.rb",
164
+ "test/rails/rails_root/app/controllers/filter_controller_base.rb",
165
+ "test/rails/rails_root/app/controllers/links_controller.rb",
166
+ "test/rails/rails_root/app/controllers/trans_sid_base_controller.rb",
167
+ "test/rails/rails_root/app/controllers/trans_sid_none_controller.rb",
168
+ "test/rails/rails_root/app/controllers/trans_sid_always_and_session_off_controller.rb",
169
+ "test/rails/rails_root/app/controllers/template_path_controller.rb",
170
+ "test/rails/rails_root/app/controllers/docomo_guid_docomo_controller.rb",
171
+ "test/rails/rails_root/app/controllers/filter_controller.rb",
172
+ "test/rails/rails_root/app/controllers/mobile_spec_controller.rb",
173
+ "test/rails/rails_root/app/controllers/trans_sid_mobile_controller.rb",
174
+ "test/rails/rails_root/app/controllers/application_controller.rb",
175
+ "test/rails/rails_root/app/controllers/docomo_guid_always_controller.rb",
176
+ "test/rails/rails_root/app/controllers/docomo_guid_base_controller.rb",
177
+ "test/rails/rails_root/vendor/plugins/jpmobile/install.rb",
178
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/emoticon_spec.rb",
179
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/au_spec.rb",
180
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/willcom_spec.rb",
181
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/params_filter_spec.rb",
182
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/docomo_spec.rb",
183
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/filter_spec.rb",
184
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/windows_phone.rb",
185
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/mobile_by_ua_spec.rb",
186
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/iphone_spec.rb",
187
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/softbank_spec.rb",
188
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack/jpmobile/android_spec.rb",
189
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/detect_by_email_spec.rb",
190
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/spec_helper.rb",
191
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/valid_ip_spec.rb",
192
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/util_spec.rb",
193
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/is_carrier_spec.rb",
194
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/spec_helper.rb",
195
+ "test/rails/rails_root/vendor/plugins/jpmobile/spec/rack_helper.rb",
196
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb",
197
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_au.rb",
198
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/disabled_update_display_info_docomo.rb",
199
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_willcom.rb",
200
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb",
201
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb",
202
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb",
203
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb",
204
+ "test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb",
205
+ "test/rails/rails_root/vendor/plugins/jpmobile/init.rb",
206
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb",
207
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb",
208
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb",
209
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb",
210
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb",
211
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb",
212
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/filter.rb",
213
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/mobile_carrier.rb",
214
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb",
215
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/encoding.rb",
216
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack.rb",
217
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb",
218
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb",
219
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_willcom.rb",
220
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb",
221
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/iphone.rb",
222
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_emobile.rb",
223
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb",
224
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_au.rb",
225
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb",
226
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/display.rb",
227
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/smart_phone.rb",
228
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_docomo.rb",
229
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_softbank.rb",
230
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb",
231
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb",
232
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_display_info_docomo.rb",
233
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/windows_phone.rb",
234
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb",
235
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/vodafone.rb",
236
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/android.rb",
237
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/ddipocket.rb",
238
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb",
239
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb",
240
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb",
241
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb",
242
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb",
243
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb",
244
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb",
245
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb",
246
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb",
247
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb",
248
+ "test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb",
249
+ "test/rails/rails_root/vendor/plugins/jpmobile/tmp/conversion-table.rb",
250
+ "test/rails/rails_root/vendor/plugins/jpmobile/tmp/utf8_to_image.rb",
251
+ "test/rails/rails_root/db/migrate/20100824062306_create_users.rb",
252
+ "test/rails/rails_root/db/migrate/001_add_sessions_table.rb",
253
+ "test/rails/rails_root/db/schema.rb",
254
+ "test/rails/rails_root/db/seeds.rb",
255
+ "test/rails/rails_root/config/environments/development.rb",
256
+ "test/rails/rails_root/config/environments/test.rb",
257
+ "test/rails/rails_root/config/environments/production.rb",
258
+ "test/rails/rails_root/config/environment.rb",
259
+ "test/rails/rails_root/config/routes.rb",
260
+ "test/rails/rails_root/config/application.rb",
261
+ "test/rails/rails_root/config/initializers/inflections.rb",
262
+ "test/rails/rails_root/config/initializers/mime_types.rb",
263
+ "test/rails/rails_root/config/initializers/backtrace_silencers.rb",
264
+ "test/rails/rails_root/config/initializers/session_store.rb",
265
+ "test/rails/rails_root/config/initializers/secret_token.rb",
266
+ "test/rails/rails_root/config/initializers/jpmobile_generator.rb",
267
+ "test/rails/rails_root/config/boot.rb",
268
+ "test/rails/rails_root/test/performance/browsing_test.rb",
269
+ "test/rails/rails_root/test/test_helper.rb",
270
+ "test/rails/overrides/spec/helpers/helpers_spec.rb",
271
+ "test/rails/overrides/spec/spec_helper.rb",
272
+ "test/rails/overrides/spec/controllers/softbank_emulator_spec.rb",
273
+ "test/rails/overrides/spec/controllers/docomo_spec.rb",
274
+ "test/rails/overrides/spec/controllers/docomo_guid_spec.rb",
275
+ "test/rails/overrides/spec/controllers/trans_sid_spec.rb",
276
+ "test/rails/overrides/spec/controllers/template_path_spec.rb",
277
+ "test/rails/overrides/spec/controllers/filter_spec.rb",
278
+ "test/rails/overrides/spec/controllers/pc_spec.rb",
279
+ "test/rails/overrides/spec/controllers/emobile_spec.rb",
280
+ "test/rails/overrides/app/controllers/trans_sid_controller.rb",
281
+ "test/rails/overrides/app/controllers/template_path_controller.rb",
282
+ "test/rails/overrides/app/controllers/filter_controller.rb",
283
+ "test/rails/overrides/app/controllers/mobile_spec_controller.rb",
284
+ "test/rails/overrides/app/controllers/docomo_guid_controller.rb",
285
+ "test/rails/overrides/app/controllers/application_controller.rb",
286
+ "test/rails/2.3.2/spec/controllers/trans_sid_spec.rb"
287
+ ]
288
+
289
+ if s.respond_to? :specification_version then
290
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
291
+ s.specification_version = 3
292
+
293
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
294
+ else
295
+ end
296
+ else
297
+ end
298
+ end
299
+
data/lib/jpmobile.rb CHANGED
@@ -1,5 +1,3 @@
1
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
2
-
3
1
  module Jpmobile
4
2
  autoload :Email , 'jpmobile/email'
5
3
  autoload :Emoticon, 'jpmobile/emoticon'
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+
3
+ require 'scanf'
2
4
  require 'nkf'
3
5
 
4
6
  module Jpmobile
@@ -88,9 +90,21 @@ module Jpmobile
88
90
  when Integer
89
91
  # 変換先がUnicodeで指定されている。つまり対応する絵文字がある。
90
92
  if sjis = UNICODE_TO_SJIS[converted]
91
- [sjis].pack('n')
93
+ if to_sjis
94
+ sjis_emotion = [sjis].pack('n')
95
+ if sjis_emotion.respond_to?(:force_encoding)
96
+ sjis_emotion.force_encoding("Shift_JIS")
97
+ end
98
+ sjis_emotion
99
+ else
100
+ [converted].pack("U")
101
+ end
92
102
  elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000]
93
- "\x1b\x24#{webcode}\x0f"
103
+ emotion = "\x1b\x24#{webcode}\x0f"
104
+ if emotion.respond_to?(:force_encoding)
105
+ emotion.force_encoding(str.encoding)
106
+ end
107
+ emotion
94
108
  else
95
109
  # キャリア変換テーブルに指定されていたUnicodeに対応する
96
110
  # 携帯側エンコーディングが見つからない(変換テーブルの不備の可能性あり)。
@@ -1,4 +1,7 @@
1
- $KCODE='u'
1
+ unless Object.const_defined?(:Encoding)
2
+ $KCODE = 'u'
3
+ end
4
+
2
5
  module Jpmobile
3
6
  module Emoticon
4
7
  SJIS_TO_UNICODE = {}
@@ -7,11 +10,21 @@ module Jpmobile
7
10
  SJIS_TO_UNICODE.freeze
8
11
  UNICODE_TO_SJIS = SJIS_TO_UNICODE.invert.freeze
9
12
 
10
- SJIS_REGEXP = Regexp.union(*SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')})
13
+ if Object.const_defined?(:Encoding)
14
+ sjis_regexp = Proc.new do |sjis|
15
+ Regexp.compile(Regexp.escape([sjis].pack('n').force_encoding("Shift_JIS")))
16
+ end
17
+ else
18
+ sjis_regexp = Proc.new do |sjis|
19
+ Regexp.compile(Regexp.escape([sjis].pack('n'),"s"),nil,'s')
20
+ end
21
+ end
22
+
23
+ SJIS_REGEXP = Regexp.union(*SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
11
24
  SOFTBANK_WEBCODE_REGEXP = Regexp.union(*([/(?!)/n]+SOFTBANK_WEBCODE_TO_UNICODE.keys.map{|x| "\x1b\x24#{x}\x0f"}))
12
25
 
13
- DOCOMO_SJIS_REGEXP = Regexp.union(*DOCOMO_SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')})
14
- AU_SJIS_REGEXP = Regexp.union(*AU_SJIS_TO_UNICODE.keys.map{|s| Regexp.compile(Regexp.escape([s].pack('n'),"s"),nil,'s')})
26
+ DOCOMO_SJIS_REGEXP = Regexp.union(*DOCOMO_SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
27
+ AU_SJIS_REGEXP = Regexp.union(*AU_SJIS_TO_UNICODE.keys.map{|s| sjis_regexp[s]})
15
28
  SOFTBANK_UNICODE_REGEXP = Regexp.union(*SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|x| [x].pack('U')}).freeze
16
29
 
17
30
  EMOTICON_UNICODES = UNICODE_TO_SJIS.keys|SOFTBANK_UNICODE_TO_WEBCODE.keys.map{|k|k+0x1000}