jpmobile 1.0.0.pre.4 → 1.0.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/.rspec +4 -0
  2. data/Gemfile +3 -3
  3. data/VERSION.yml +2 -2
  4. data/jpmobile.gemspec +335 -0
  5. data/lib/jpmobile.rb +0 -1
  6. data/lib/jpmobile/email.rb +47 -21
  7. data/lib/jpmobile/mail.rb +33 -26
  8. data/lib/jpmobile/mailer.rb +2 -0
  9. data/lib/jpmobile/util.rb +3 -3
  10. data/spec/unit/email-fixtures/au-attached.eml +1551 -0
  11. data/spec/unit/email-fixtures/au-decomail.eml +44 -0
  12. data/spec/unit/email-fixtures/au-emoji.eml +19 -0
  13. data/spec/unit/email-fixtures/au-emoji2.eml +45 -0
  14. data/spec/unit/email-fixtures/au-emoji5.eml +24 -0
  15. data/spec/unit/email-fixtures/docomo-emoji.eml +19 -0
  16. data/spec/unit/email-fixtures/docomo-gmail-sjis.eml +45 -0
  17. data/spec/unit/email-fixtures/docomo-jis.eml +20 -0
  18. data/spec/unit/email-fixtures/pc-mail-multi.eml +77 -0
  19. data/spec/unit/email-fixtures/pc-mail-single.eml +29 -0
  20. data/spec/unit/email-fixtures/softbank-blank.eml +20 -0
  21. data/spec/unit/email-fixtures/softbank-emoji-utf8.eml +19 -0
  22. data/spec/unit/email-fixtures/softbank-emoji.eml +19 -0
  23. data/spec/unit/email-fixtures/softbank-gmail-sjis.eml +45 -0
  24. data/spec/unit/email-fixtures/softbank-gmail-utf8.eml +45 -0
  25. data/spec/unit/{detect_by_email_spec.rb → email_spec.rb} +25 -2
  26. data/spec/unit/emoticon_spec.rb +1 -1
  27. data/spec/unit/encoding_spec.rb +1 -1
  28. data/spec/unit/is_carrier_spec.rb +1 -1
  29. data/spec/unit/mail_spec.rb +1 -1
  30. data/spec/unit/receive_mail_spec.rb +26 -1
  31. data/spec/unit/util_spec.rb +1 -1
  32. data/spec/unit/valid_ip_spec.rb +1 -1
  33. data/test/rails/.gitignore +1 -0
  34. data/test/rails/overrides/.rspec +5 -0
  35. data/test/rails/overrides/Gemfile +33 -0
  36. data/test/rails/overrides/app/views/filter/index.html.erb +0 -0
  37. data/test/rails/overrides/app/views/hankaku_filter/index.html.erb +0 -0
  38. data/test/rails/overrides/app/views/hankaku_input_filter/index.html.erb +0 -0
  39. data/test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb +1 -0
  40. data/test/rails/overrides/app/views/layouts/xhtml.html.erb +12 -0
  41. data/test/rails/overrides/app/views/links/au_gps.html.erb +1 -0
  42. data/test/rails/overrides/app/views/links/au_location.html.erb +1 -0
  43. data/test/rails/overrides/app/views/links/docomo_foma_gps.html.erb +1 -0
  44. data/test/rails/overrides/app/views/links/docomo_openiarea.html.erb +1 -0
  45. data/test/rails/overrides/app/views/links/docomo_utn.html.erb +1 -0
  46. data/test/rails/overrides/app/views/links/link.html.erb +1 -0
  47. data/test/rails/overrides/app/views/links/show_all.html.erb +1 -0
  48. data/test/rails/overrides/app/views/links/softbank_location.html.erb +1 -0
  49. data/test/rails/overrides/app/views/links/willcom_location.html.erb +1 -0
  50. data/test/rails/overrides/app/views/mobile_mailer/multi_message.html.erb +11 -0
  51. data/test/rails/overrides/app/views/mobile_mailer/multi_message.text.erb +2 -0
  52. data/test/rails/overrides/app/views/mobile_mailer/view_selection.html.erb +3 -0
  53. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile.html.erb +3 -0
  54. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_au.html.erb +3 -0
  55. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_docomo.html.erb +3 -0
  56. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_emobile.html.erb +3 -0
  57. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_softbank.html.erb +3 -0
  58. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_vodafone.html.erb +3 -0
  59. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_willcom.html.erb +3 -0
  60. data/test/rails/overrides/app/views/normal_mailer/msg.text.erb +3 -0
  61. data/test/rails/overrides/app/views/template_path/_partial.html.erb +1 -0
  62. data/test/rails/overrides/app/views/template_path/_partial_mobile.html.erb +1 -0
  63. data/test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
  64. data/test/rails/overrides/app/views/template_path/_partial_smart_phone.html.erb +1 -0
  65. data/test/rails/overrides/app/views/template_path/_partial_smart_phone_iphone.html.erb +1 -0
  66. data/test/rails/overrides/app/views/template_path/index.html.erb +1 -0
  67. data/test/rails/overrides/app/views/template_path/index_mobile.html.erb +1 -0
  68. data/test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb +1 -0
  69. data/test/rails/overrides/app/views/template_path/index_smart_phone.html.erb +1 -0
  70. data/test/rails/overrides/app/views/template_path/index_smart_phone_iphone.html.erb +1 -0
  71. data/test/rails/overrides/app/views/template_path/partial.html.erb +2 -0
  72. data/test/rails/overrides/app/views/template_path/show_mobile.html.erb +1 -0
  73. data/test/rails/overrides/app/views/template_path/show_mobile_docomo.html.erb +1 -0
  74. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-attached.eml +1551 -0
  75. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-decomail.eml +44 -0
  76. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji.eml +19 -0
  77. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji2.eml +45 -0
  78. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji5.eml +24 -0
  79. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-emoji.eml +19 -0
  80. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml +45 -0
  81. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-jis.eml +20 -0
  82. data/test/rails/overrides/spec/fixtures/mobile_mailer/no-from.eml +78 -0
  83. data/test/rails/overrides/spec/fixtures/mobile_mailer/non-jp.eml +45 -0
  84. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-blank.eml +20 -0
  85. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji-utf8.eml +19 -0
  86. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji.eml +19 -0
  87. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-sjis.eml +45 -0
  88. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-utf8.eml +45 -0
  89. data/test/rails/overrides/spec/helpers/helpers_spec.rb +1 -2
  90. data/test/rails/overrides/spec/models/mobile_mailer_spec.rb +37 -1
  91. data/test/rails/overrides/spec/models/normal_mailer_spec.rb +1 -1
  92. data/test/rails/overrides/spec/rcov.opts +2 -0
  93. data/test/rails/overrides/spec/requests/docomo_guid_spec.rb +1 -2
  94. data/test/rails/overrides/spec/requests/docomo_spec.rb +1 -2
  95. data/test/rails/overrides/spec/requests/emobile_spec.rb +1 -2
  96. data/test/rails/overrides/spec/requests/filter_spec.rb +1 -1
  97. data/test/rails/overrides/spec/requests/helpers_spec.rb +1 -1
  98. data/test/rails/overrides/spec/requests/pc_spec.rb +1 -2
  99. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +1 -2
  100. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -2
  101. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +1 -2
  102. data/test/rails/overrides/spec/spec_helper.rb +1 -1
  103. metadata +229 -386
  104. data/test/rails/rails_root/app/controllers/application_controller.rb +0 -6
  105. data/test/rails/rails_root/app/controllers/docomo_guid_always_controller.rb +0 -3
  106. data/test/rails/rails_root/app/controllers/docomo_guid_base_controller.rb +0 -5
  107. data/test/rails/rails_root/app/controllers/docomo_guid_docomo_controller.rb +0 -3
  108. data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -3
  109. data/test/rails/rails_root/app/controllers/filter_controller_base.rb +0 -25
  110. data/test/rails/rails_root/app/controllers/hankaku_filter_controller.rb +0 -3
  111. data/test/rails/rails_root/app/controllers/hankaku_input_filter_controller.rb +0 -7
  112. data/test/rails/rails_root/app/controllers/links_controller.rb +0 -28
  113. data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +0 -5
  114. data/test/rails/rails_root/app/controllers/template_path_controller.rb +0 -17
  115. data/test/rails/rails_root/app/controllers/trans_sid_always_and_session_off_controller.rb +0 -4
  116. data/test/rails/rails_root/app/controllers/trans_sid_always_controller.rb +0 -3
  117. data/test/rails/rails_root/app/controllers/trans_sid_base_controller.rb +0 -40
  118. data/test/rails/rails_root/app/controllers/trans_sid_metal_controller.rb +0 -15
  119. data/test/rails/rails_root/app/controllers/trans_sid_mobile_controller.rb +0 -3
  120. data/test/rails/rails_root/app/controllers/trans_sid_none_controller.rb +0 -3
  121. data/test/rails/rails_root/app/helpers/application_helper.rb +0 -2
  122. data/test/rails/rails_root/app/models/mobile_mailer.rb +0 -19
  123. data/test/rails/rails_root/app/models/normal_mailer.rb +0 -9
  124. data/test/rails/rails_root/app/models/user.rb +0 -2
  125. data/test/rails/rails_root/autotest/discover.rb +0 -2
  126. data/test/rails/rails_root/config/application.rb +0 -42
  127. data/test/rails/rails_root/config/boot.rb +0 -6
  128. data/test/rails/rails_root/config/environment.rb +0 -5
  129. data/test/rails/rails_root/config/environments/development.rb +0 -26
  130. data/test/rails/rails_root/config/environments/production.rb +0 -49
  131. data/test/rails/rails_root/config/environments/test.rb +0 -35
  132. data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  133. data/test/rails/rails_root/config/initializers/inflections.rb +0 -10
  134. data/test/rails/rails_root/config/initializers/jpmobile_generator.rb +0 -2
  135. data/test/rails/rails_root/config/initializers/mime_types.rb +0 -5
  136. data/test/rails/rails_root/config/initializers/secret_token.rb +0 -7
  137. data/test/rails/rails_root/config/initializers/session_store.rb +0 -2
  138. data/test/rails/rails_root/config/routes.rb +0 -7
  139. data/test/rails/rails_root/db/migrate/001_add_sessions_table.rb +0 -16
  140. data/test/rails/rails_root/db/migrate/20100824062306_create_users.rb +0 -13
  141. data/test/rails/rails_root/db/schema.rb +0 -31
  142. data/test/rails/rails_root/db/seeds.rb +0 -7
  143. data/test/rails/rails_root/spec/helpers/helpers_spec.rb +0 -15
  144. data/test/rails/rails_root/spec/models/mobile_mailer_spec.rb +0 -737
  145. data/test/rails/rails_root/spec/models/normal_mailer_spec.rb +0 -34
  146. data/test/rails/rails_root/spec/requests/docomo_guid_spec.rb +0 -102
  147. data/test/rails/rails_root/spec/requests/docomo_spec.rb +0 -33
  148. data/test/rails/rails_root/spec/requests/emobile_spec.rb +0 -53
  149. data/test/rails/rails_root/spec/requests/filter_spec.rb +0 -221
  150. data/test/rails/rails_root/spec/requests/helpers_spec.rb +0 -187
  151. data/test/rails/rails_root/spec/requests/pc_spec.rb +0 -22
  152. data/test/rails/rails_root/spec/requests/softbank_emulator_spec.rb +0 -21
  153. data/test/rails/rails_root/spec/requests/template_path_spec.rb +0 -240
  154. data/test/rails/rails_root/spec/requests/trans_sid_spec.rb +0 -207
  155. data/test/rails/rails_root/spec/spec_helper.rb +0 -38
  156. data/test/rails/rails_root/test/performance/browsing_test.rb +0 -9
  157. data/test/rails/rails_root/test/test_helper.rb +0 -13
  158. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  159. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  160. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  161. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  162. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  163. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  164. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  165. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  166. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  167. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  168. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  169. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
  170. data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +0 -3
  171. data/test/rails/rails_root/vendor/plugins/jpmobile/install.rb +0 -1
  172. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +0 -59
  173. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb +0 -72
  174. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +0 -43
  175. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +0 -33
  176. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +0 -205
  177. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb +0 -1931
  178. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +0 -3909
  179. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb +0 -255
  180. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb +0 -965
  181. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +0 -36
  182. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/encoding.rb +0 -29
  183. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +0 -113
  184. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +0 -174
  185. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +0 -18
  186. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_dispatch.rb +0 -2
  187. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +0 -33
  188. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb +0 -2
  189. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb +0 -330
  190. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb +0 -41
  191. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +0 -168
  192. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/android.rb +0 -10
  193. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +0 -128
  194. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/ddipocket.rb +0 -12
  195. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +0 -149
  196. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb +0 -16
  197. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/iphone.rb +0 -26
  198. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/smart_phone.rb +0 -21
  199. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +0 -91
  200. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/vodafone.rb +0 -17
  201. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +0 -28
  202. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/windows_phone.rb +0 -10
  203. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/path_set.rb +0 -40
  204. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +0 -68
  205. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack.rb +0 -49
  206. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/filter.rb +0 -50
  207. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/mobile_carrier.rb +0 -33
  208. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb +0 -47
  209. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb +0 -50
  210. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +0 -45
  211. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/resolver.rb +0 -38
  212. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +0 -133
  213. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +0 -370
  214. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/conversion-table.rb +0 -2588
  215. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/utf8_to_image.rb +0 -1407
  216. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb +0 -47
  217. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb +0 -34
  218. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +0 -33
  219. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb +0 -107
  220. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +0 -31
  221. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb +0 -23
  222. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  223. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  224. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  225. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  226. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  227. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  228. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  229. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  230. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  231. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  232. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  233. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
@@ -1,47 +0,0 @@
1
- require 'scanf'
2
-
3
- def to_ranges(array)
4
- sorted = array.sort.uniq
5
- results = []
6
- start = nil
7
- for i in 0...sorted.size
8
- start ||= sorted[i]
9
- if i == sorted.size-1 || sorted[i+1] - sorted[i] > 1
10
- if start == sorted[i]
11
- results << start
12
- else
13
- results << (start..sorted[i])
14
- end
15
- start = nil
16
- end
17
- end
18
- results
19
- end
20
-
21
- def ranges_to_regexp(array)
22
- r = ""
23
- array.each do |x|
24
- if x.is_a? Range
25
- r << "\\x%02x-\\x%02x" % [x.first, x.last]
26
- else
27
- r << "\\x%02x" % x
28
- end
29
- end
30
- r
31
- end
32
-
33
- h = Hash.new {|h,k| h[k]=[]}
34
-
35
- ARGF.each do |l|
36
- l.chomp!
37
- sjis_bin = [[l].pack("H4")].first
38
- a = l.scanf("%02X%02X")
39
- h[a.first] << a.last
40
- end
41
-
42
- re = []
43
- h.sort.each do |k,v|
44
- re << "\\x%02x"%k + '['+ranges_to_regexp(to_ranges(v))+']'
45
- p ["\\x%02x"%k, to_ranges(v), ranges_to_regexp(to_ranges(v))]
46
- end
47
- puts re.join('|')
@@ -1,34 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # http://www.au.kddi.com/ezfactory/tec/spec/pdf/typeD.pdf から生成
4
- # - OSXのpreviewで開き、すべてを選択してコピーし、テキストファイルに落とす
5
- # - http://moriq.tdiary.net/20070212.html#p01
6
- # などの手段によって生成する。
7
-
8
- table = []
9
- open("au.txt") do |f|
10
- f.each do |l|
11
- l.chomp!
12
- l.scan( /(([0-9A-F] )+)/ ) do |s|
13
- s = s[0].gsub!(/ /, "")
14
- next if s.size < 16
15
- out = s[s.size-16,16]
16
- table << a = [0,4,8,12].map{|i| out[i,4]}
17
- end
18
- end
19
- end
20
-
21
- open(File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/au.rb","w") do |f|
22
- f.puts "Jpmobile::Emoticon::AU_SJIS_TO_UNICODE = {"
23
- table.each do |a|
24
- f.puts " 0x%s=>0x%s," % [a[0],a[1]]
25
- end
26
- f.puts "}.freeze"
27
- f.puts "Jpmobile::Emoticon::AU_UNICODE_TO_SJIS = Jpmobile::Emoticon::AU_SJIS_TO_UNICODE.invert.freeze"
28
- # EmailJIS -> UNICODE
29
- f.puts "Jpmobile::Emoticon::AU_EMAILJIS_TO_UNICODE = {"
30
- table.each do |a|
31
- f.puts " 0x%s=>0x%s," % [a[2],a[1]]
32
- end
33
- f.puts "}.freeze"
34
- end
@@ -1,33 +0,0 @@
1
- require 'rubygems'
2
- require 'hpricot'
3
- require 'open-uri'
4
- require 'cgi'
5
-
6
- $KCODE="u"
7
-
8
- def parse(html)
9
- results = []
10
- (Hpricot(html)/"//table//tr").each do |tr|
11
- tds = (tr/:td/:span)
12
- if tds && tds.size > 0
13
- results << tds.map {|td| CGI.unescapeHTML(td.inner_html)}
14
- end
15
- end
16
- results
17
- end
18
-
19
- table = []
20
- %w(basic extention).each do |x|
21
- uri = "http://www.nttdocomo.co.jp/service/imode/make/content/pictograph/#{x}/index.html"
22
- table += parse(URI(uri).read.toutf8)
23
- end
24
-
25
-
26
- open(File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/docomo.rb","w") do |f|
27
- f.puts "Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE = {"
28
- table.each do |row|
29
- f.puts " 0x%s=>0x%s, "%[row[1], row[3]]
30
- end
31
- f.puts "}.freeze"
32
- f.puts "Jpmobile::Emoticon::DOCOMO_UNICODE_TO_SJIS = Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE.invert.freeze"
33
- end
@@ -1,107 +0,0 @@
1
- #!/usr/bin/ruby -Ku
2
- require 'pp'
3
- require 'iconv'
4
- require 'scanf'
5
-
6
- # http://labs.unoh.net/2007/02/post_65.html
7
- # のテーブルから変換用テーブルを作成する。
8
-
9
- # Jpmobileのテーブルを拝借
10
- module Jpmobile
11
- module Emoticon
12
- end
13
- end
14
- for c in %w(au docomo softbank)
15
- require File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/#{c}.rb"
16
- end
17
-
18
- class Table
19
- def initialize(path)
20
- @list = []
21
- @table = {}
22
- @code = {}
23
- if path =~ /emoji_(.)2(..)/
24
- @type = $1
25
- @dest_types = $2.split(//)
26
- else
27
- raise Exception, "something is wrong"
28
- end
29
- open(path) do |f|
30
- f.gets # ヘッダを捨てる
31
- f.each do |l|
32
- a = Iconv.conv("utf-8", "cp932", l).chomp.split(/\t/)
33
- @list << a
34
- @code[a[0]] = a[1]
35
- @table[a[0]] = a[2...a.size]
36
- end
37
- end
38
- end
39
- def chars
40
- table.keys.sort_by {|x| x.gsub(/\D/,"").to_i }
41
- end
42
- def conv(src, dest_type)
43
- if dest_type == @type
44
- src
45
- else
46
- @table[src][@dest_types.index(dest_type)]
47
- end
48
- end
49
- attr_reader :list, :table, :code, :type
50
- end
51
-
52
- class Tables
53
- def initialize
54
- @chars = []
55
- @tables = {}
56
- @types = []
57
- for name in %w(i2es e2is s2ie)
58
- table = Table.new("emoji_#{name}.txt")
59
- @tables[table.type] = table
60
- @chars |= table.chars
61
- @types << table.type
62
- end
63
- end
64
- def conv(src, dest_type)
65
- src_type = src[1,1]
66
- dest = @tables[src_type].conv(src, dest_type)
67
- dest = nil if dest == "〓"
68
- dest
69
- end
70
- def id_to_unicode(src)
71
- return src if src.nil? || src !~ /^%[ies]\d+%$/
72
- case src[1,1]
73
- when "i"
74
- sjis = tables["i"].code[src]
75
- return Jpmobile::Emoticon::DOCOMO_SJIS_TO_UNICODE[sjis.to_i(16)]
76
- when "e"
77
- sjis = tables["e"].code[src]
78
- return Jpmobile::Emoticon::AU_SJIS_TO_UNICODE[sjis.to_i(16)]
79
- when "s"
80
- webcode = tables["s"].code[src]
81
- unicode = Jpmobile::Emoticon::SOFTBANK_WEBCODE_TO_UNICODE[webcode]
82
- return nil unless unicode
83
- return unicode + 0x1000
84
- end
85
- end
86
- attr_reader :chars, :tables, :types
87
- end
88
-
89
- t = Tables.new
90
- ident = {'i'=>'DOCOMO', 'e'=>'AU', 's'=>'SOFTBANK'}
91
-
92
- open(File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/conversion_table.rb","w") do |f|
93
- for dest_type in %w(i e s)
94
- f.puts "Jpmobile::Emoticon::CONVERSION_TABLE_TO_#{ident[dest_type]} = {"
95
- for src in t.chars
96
- dest = t.conv(src, dest_type)
97
- src_unicode = t.id_to_unicode(src)
98
- dest_unicode = t.id_to_unicode(dest)
99
- next if src_unicode.nil? || dest_unicode.nil?
100
- f.printf(" %s=>%s,\n",
101
- src_unicode.is_a?(Integer) ? "0x%04X"%src_unicode : "'#{src_unicode}'",
102
- dest_unicode.is_a?(Integer) ? "0x%04X"%dest_unicode : "'#{dest_unicode}'"
103
- )
104
- end
105
- f.puts "}"
106
- end
107
- end
@@ -1,31 +0,0 @@
1
- require 'rubygems'
2
- require 'hpricot'
3
- require 'cgi'
4
- require 'open-uri'
5
-
6
- # 'http://developers.softbankmobile.co.jp/dp/tool_dl/web/picword_01.php'
7
-
8
- table = []
9
- for i in 1..6
10
- uri = "http://developers.softbankmobile.co.jp/dp/tool_dl/web/picword_%02d.php" % i
11
- h = Hpricot(URI(uri).read.toutf8)
12
- (h/"//table[@width='100%']//tr").each do |tr|
13
- if tr
14
- a = (tr/"td/font[@class='j10']").map { |td| td.inner_html }
15
- unless a.empty?
16
- s = CGI.unescapeHTML(a.last)
17
- raise Exception, "something is wrong" if s[0,2] != "\x1b\x24" || s[4] != 0x0f
18
- table << [a.first, s[2,2]]
19
- end
20
- end
21
- end
22
- end
23
-
24
- open(File.dirname(__FILE__)+"/../lib/jpmobile/emoticon/softbank.rb","w") do |f|
25
- f.puts "Jpmobile::Emoticon::SOFTBANK_UNICODE_TO_WEBCODE = {"
26
- table.each do |a|
27
- f.puts %{ 0x%s => %p,} % a
28
- end
29
- f.puts "}"
30
- f.puts "Jpmobile::Emoticon::SOFTBANK_WEBCODE_TO_UNICODE = Jpmobile::Emoticon::SOFTBANK_UNICODE_TO_WEBCODE.invert"
31
- end
@@ -1,23 +0,0 @@
1
-
2
- require 'open-uri'
3
-
4
- html = URI('http://www.au.kddi.com/ezfactory/tec/spec/4_4.html').read
5
- array = html.scan %r{<td bgcolor="#f2f2f2"><div class="TableText">(.+?)</div></td>.*?<td><div class="TableText">(.+?)</div></td>}m
6
-
7
-
8
- gps_unsupported = []
9
- array.each do |pair|
10
- pair.map! {|x| x.gsub(/<br>|&nbsp;/,"")}
11
- next if pair.first.empty? || pair.last.empty?
12
- name = pair.first
13
- devids = pair.last.split(/\//)
14
-
15
- case name
16
- when /^T[DKSTP]/, /^[AC]1\d\d\d/, /^C\d\d\d[^\d]/, "B01K"
17
- gps_unsupported |= devids
18
- else
19
- gps_supported |= devids
20
- end
21
- end
22
-
23
- p gps_unsupported
@@ -1,18 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
3
- $:.include?(File.expand_path(File.dirname(__FILE__)))
4
-
5
- module Jpmobile
6
- module Mobile
7
- module IpAddresses
8
- autoload :AbstractIpAddresses, 'jpmobile/mobile/ip_addresses/abstract_ip_addresses'
9
- autoload :Docomo, 'jpmobile/mobile/ip_addresses/docomo'
10
- autoload :Au, 'jpmobile/mobile/ip_addresses/au'
11
- autoload :Softbank, 'jpmobile/mobile/ip_addresses/softbank'
12
- autoload :Vodafone, 'jpmobile/mobile/ip_addresses/softbank'
13
- autoload :Willcom, 'jpmobile/mobile/ip_addresses/willcom'
14
- autoload :Ddipocket, 'jpmobile/mobile/ip_addresses/willcom'
15
- autoload :Emobile, 'jpmobile/mobile/ip_addresses/emobile'
16
- end
17
- end
18
- end
@@ -1,23 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class AbstractIpAddresses
5
- def valid_ip?(remote_ip_str)
6
- begin
7
- remote_ip = IPAddr.new(remote_ip_str)
8
- rescue
9
- return false
10
- end
11
-
12
- self.class.ip_address_list.any? {|ip| ip.include?(remote_ip)}
13
- end
14
-
15
- class << self
16
- def ip_address_list
17
- []
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,40 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Au < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "210.230.128.224/28",
9
- "121.111.227.160/27",
10
- "61.117.1.0/28",
11
- "219.108.158.0/27",
12
- "219.125.146.0/28",
13
- "61.117.2.32/29",
14
- "61.117.2.40/29",
15
- "219.108.158.40/29",
16
- "219.125.148.0/25",
17
- "222.5.63.0/25",
18
- "222.5.63.128/25",
19
- "222.5.62.128/25",
20
- "59.135.38.128/25",
21
- "219.108.157.0/25",
22
- "219.125.145.0/25",
23
- "121.111.231.0/25",
24
- "121.111.227.0/25",
25
- "118.152.214.192/26",
26
- "118.159.131.0/25",
27
- "118.159.133.0/25",
28
- "118.159.132.160/27",
29
- "111.86.142.0/26",
30
- "111.86.141.64/26",
31
- "111.86.141.128/26",
32
- "111.86.141.192/26",
33
- "118.159.133.192/26"
34
- ].map {|ip| IPAddr.new(ip) }
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,22 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Docomo < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "210.153.84.0/24",
9
- "210.136.161.0/24",
10
- "210.153.86.0/24",
11
- "124.146.174.0/24",
12
- "124.146.175.0/24",
13
- "202.229.176.0/24",
14
- "202.229.177.0/24",
15
- "202.229.178.0/24"
16
- ].map {|ip| IPAddr.new(ip)}
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,15 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Emobile < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "117.55.1.224/27"
9
- ].map {|ip| IPAddr.new(ip) }
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Softbank < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "123.108.237.0/27",
9
- "202.253.96.224/27",
10
- "210.146.7.192/26",
11
- "210.175.1.128/25"
12
- ].map {|ip| IPAddr.new(ip) }
13
- end
14
- end
15
- end
16
- class Vodafone < Softbank
17
- end
18
- end
19
- end
20
- end
@@ -1,158 +0,0 @@
1
- module Jpmobile
2
- module Mobile
3
- module IpAddresses
4
- class Willcom < AbstractIpAddresses
5
- class << self
6
- def ip_address_list
7
- @@ip_address_list ||= [
8
- "61.198.128.0/24",
9
- "61.198.129.0/24",
10
- "61.198.130.0/24",
11
- "61.198.131.0/24",
12
- "61.198.132.0/24",
13
- "61.198.133.0/24",
14
- "61.198.134.0/24",
15
- "61.198.135.0/24",
16
- "61.198.136.0/24",
17
- "61.198.137.0/24",
18
- "61.198.138.100/32",
19
- "61.198.138.101/32",
20
- "61.198.138.102/32",
21
- "61.198.138.103/32",
22
- "61.198.139.0/29",
23
- "61.198.139.128/27",
24
- "61.198.139.160/28",
25
- "61.198.140.0/24",
26
- "61.198.141.0/24",
27
- "61.198.142.0/24",
28
- "61.198.143.0/24",
29
- "61.198.160.0/24",
30
- "61.198.161.0/24",
31
- "61.198.162.0/24",
32
- "61.198.163.0/24",
33
- "61.198.164.0/24",
34
- "61.198.165.0/24",
35
- "61.198.166.0/24",
36
- "61.198.168.0/24",
37
- "61.198.169.0/24",
38
- "61.198.170.0/24",
39
- "61.198.171.0/24",
40
- "61.198.172.0/24",
41
- "61.198.173.0/24",
42
- "61.198.174.0/24",
43
- "61.198.175.0/24",
44
- "61.198.248.0/24",
45
- "61.198.249.0/24",
46
- "61.198.250.0/24",
47
- "61.198.251.0/24",
48
- "61.198.252.0/24",
49
- "61.198.253.0/24",
50
- "61.198.254.0/24",
51
- "61.198.255.0/24",
52
- "61.204.0.0/24",
53
- "61.204.2.0/24",
54
- "61.204.3.0/25",
55
- "61.204.3.128/25",
56
- "61.204.4.0/24",
57
- "61.204.5.0/24",
58
- "61.204.6.0/25",
59
- "61.204.6.128/25",
60
- "61.204.7.0/25",
61
- "61.204.92.0/24",
62
- "61.204.93.0/24",
63
- "61.204.94.0/24",
64
- "61.204.95.0/24",
65
- "114.20.49.0/24",
66
- "114.20.50.0/24",
67
- "114.20.51.0/24",
68
- "114.20.52.0/24",
69
- "114.20.53.0/24",
70
- "114.20.54.0/24",
71
- "114.20.55.0/24",
72
- "114.20.56.0/24",
73
- "114.20.57.0/24",
74
- "114.20.58.0/24",
75
- "114.20.59.0/24",
76
- "114.20.60.0/24",
77
- "114.20.61.0/24",
78
- "114.20.62.0/24",
79
- "114.20.63.0/24",
80
- "114.20.64.0/24",
81
- "114.20.65.0/24",
82
- "114.20.66.0/24",
83
- "114.20.67.0/24",
84
- "114.21.255.0/27",
85
- "125.28.0.0/24",
86
- "125.28.1.0/24",
87
- "125.28.15.0/24",
88
- "125.28.16.0/24",
89
- "125.28.17.0/24",
90
- "125.28.2.0/24",
91
- "125.28.3.0/24",
92
- "125.28.4.0/24",
93
- "125.28.5.0/24",
94
- "125.28.8.0/24",
95
- "210.168.246.0/24",
96
- "210.168.247.0/24",
97
- "210.169.92.0/24",
98
- "210.169.93.0/24",
99
- "210.169.94.0/24",
100
- "210.169.95.0/24",
101
- "210.169.96.0/24",
102
- "210.169.97.0/24",
103
- "210.169.98.0/24",
104
- "210.169.99.0/24",
105
- "211.126.192.128/25",
106
- "211.18.232.0/24",
107
- "211.18.233.0/24",
108
- "211.18.234.0/24",
109
- "211.18.235.0/24",
110
- "211.18.236.0/24",
111
- "211.18.237.0/24",
112
- "219.108.10.0/24",
113
- "219.108.11.0/24",
114
- "219.108.12.0/24",
115
- "219.108.13.0/24",
116
- "219.108.14.0/24",
117
- "219.108.15.0/24",
118
- "219.108.7.0/24",
119
- "219.108.8.0/24",
120
- "219.108.9.0/24",
121
- "221.119.0.0/24",
122
- "221.119.1.0/24",
123
- "221.119.2.0/24",
124
- "221.119.3.0/24",
125
- "221.119.4.0/24",
126
- "221.119.6.0/24",
127
- "221.119.7.0/24",
128
- "221.119.8.0/24",
129
- "221.119.9.0/24",
130
- "114.20.49.0/24",
131
- "114.20.50.0/24",
132
- "114.20.51.0/24",
133
- "114.20.52.0/24",
134
- "114.20.53.0/24",
135
- "114.20.54.0/24",
136
- "114.20.55.0/24",
137
- "114.20.56.0/24",
138
- "114.20.57.0/24",
139
- "114.20.58.0/24",
140
- "114.20.59.0/24",
141
- "114.20.60.0/24",
142
- "114.20.61.0/24",
143
- "114.20.62.0/24",
144
- "114.20.63.0/24",
145
- "114.20.64.0/24",
146
- "114.20.65.0/24",
147
- "114.20.66.0/24",
148
- "114.20.67.0/24",
149
- "114.21.255.0/27"
150
- ].map {|ip| IPAddr.new(ip) }
151
- end
152
- end
153
- end
154
- class Ddipocket < Willcom
155
- end
156
- end
157
- end
158
- end