jpmobile 2.0.1 → 2.0.2

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.
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = jpmobile: A Rails plugin for Japanese mobile-phones
2
2
 
3
3
  == jpmobileとは
4
- 携帯電話特有の機能を Rails 3.0 や Rack middleware で利用するためのプラグイン。
4
+ 携帯電話特有の機能を Rails 3.1 や Rack middleware で利用するためのプラグイン。
5
5
  以下の機能を備える。
6
6
 
7
7
  * 携帯電話のキャリア判別
@@ -18,7 +18,7 @@
18
18
  * メールの受信(experimental)
19
19
  * 絵文字と漢字コードの変換
20
20
 
21
- また Rails 3.0 に以下の機能を追加する
21
+ また Rails 3.1 に以下の機能を追加する
22
22
  * ビューへの自動振分け
23
23
  * 位置情報取得などのリンクヘルパーの追加
24
24
  * セッションIDをフォーム/リンクに付与(Trans SID)
@@ -223,7 +223,7 @@ Androidの場合はindex_smart_phone_android.html.erb、Windows Phoneの場合
223
223
  === 位置情報の取得用リンクの生成
224
224
 
225
225
  以下のようなコードで、端末に位置情報を要求するリンクを出力する。
226
- <%= get_position_link_to(:action=>:gps) %>
226
+ <%= get_position_link_to("位置情報を取得する", :action=>:gps) %>
227
227
 
228
228
  === セッションIDの付与(Trans SID)
229
229
  ==== Cookie非対応携帯だけに付与する
@@ -237,7 +237,7 @@ Androidの場合はindex_smart_phone_android.html.erb、Windows Phoneの場合
237
237
  end
238
238
 
239
239
  trans_sid 機能を使う場合には cookie session store を使用することができません。
240
- また Rails 3.0 では Cookie が使える場合にはそちらが優先されてしまうため、:always を指定した場合に問題になる場合があります。
240
+ また Rails 3.1 では Cookie が使える場合にはそちらが優先されてしまうため、:always を指定した場合に問題になる場合があります。
241
241
  trans_sid を使用する際には、例えば config/initializers/session_store.rb で
242
242
  Rails.application.config.session_store :active_record_store
243
243
  Rails.application.config.session_options = {:cookie_only => false}
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 0
4
- :patch: 1
4
+ :patch: 2
5
5
  :build: !!null
@@ -153,7 +153,7 @@ module Jpmobile
153
153
  def self.unicodecr_to_au_email(in_str)
154
154
  str = Jpmobile::Util.ascii_8bit(in_str)
155
155
  regexp = Regexp.compile(Jpmobile::Util.ascii_8bit("&#x([0-9a-f]{4});"), Regexp::IGNORECASE)
156
- str.gsub(regexp) do |match|
156
+ str = str.gsub(regexp) do |match|
157
157
  unicode = $1.scanf("%x").first
158
158
  converted = CONVERSION_TABLE_TO_AU[unicode]
159
159
 
@@ -176,6 +176,8 @@ module Jpmobile
176
176
  match
177
177
  end
178
178
  end
179
+ regexp = Regexp.compile(Regexp.escape(Jpmobile::Util.ascii_8bit("\x1b\x28\x42\x1b\x24\x42")), Regexp::IGNORECASE)
180
+ str.gsub(regexp, '')
179
181
  end
180
182
 
181
183
  # +str+ のなかでUnicode数値文字参照で表記された絵文字をメール送信用JISコードに変換する
@@ -40,6 +40,9 @@ module Jpmobile
40
40
  # 内部コードから外部コードに変換
41
41
  def after(controller, options = {})
42
42
  if apply_outgoing?(controller) and controller.response.body.is_a?(String)
43
+ if controller.request.mobile?
44
+ options.merge!(:charset => controller.request.mobile.default_charset)
45
+ end
43
46
  controller.response.body = to_external(controller.response.body, options)
44
47
  end
45
48
  end
@@ -64,7 +67,9 @@ module Jpmobile
64
67
 
65
68
  doc = convert_text_content(doc)
66
69
 
67
- doc.to_html.gsub("\xc2\xa0","&nbsp;")
70
+ html = doc.to_html.gsub("\xc2\xa0","&nbsp;")
71
+ html = html.gsub(/charset=[a-z0-9\-]+/i, "charset=#{options[:charset]}") if options[:charset]
72
+ html
68
73
  end
69
74
  end
70
75
 
@@ -58,6 +58,16 @@ module Jpmobile::Mobile
58
58
  false
59
59
  end
60
60
 
61
+ # Jpmobile::Rack::Filter を適用するかどうか
62
+ def apply_filter?
63
+ true
64
+ end
65
+
66
+ # Jpmobile::Rack::ParamsFilter を適用するかどうか
67
+ def apply_params_filter?
68
+ true
69
+ end
70
+
61
71
  # エンコーディング変換用
62
72
  def to_internal(str)
63
73
  str
@@ -7,6 +7,16 @@ module Jpmobile::Mobile
7
7
  # 対応するUser-Agentの正規表現
8
8
  USER_AGENT_REGEXP = /iPhone/
9
9
 
10
+ # Jpmobile::Rack::Filter を適用する
11
+ def apply_filter?
12
+ true
13
+ end
14
+
15
+ # Jpmobile::Rack::ParamsFilter を適用する
16
+ def apply_params_filter?
17
+ true
18
+ end
19
+
10
20
  # 文字コード変換
11
21
  def to_internal(str)
12
22
  # 絵文字を数値参照に変換
@@ -17,5 +17,15 @@ module Jpmobile::Mobile
17
17
  def smart_phone?
18
18
  true
19
19
  end
20
+
21
+ # Jpmobile::Rack::Filter は適用しない
22
+ def apply_filter?
23
+ false
24
+ end
25
+
26
+ # Jpmobile::Rack::ParamsFilter は適用しない
27
+ def apply_params_filter?
28
+ false
29
+ end
20
30
  end
21
31
  end
@@ -1,5 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # 出力変換
3
+ require 'scanf'
4
+
3
5
  module Jpmobile
4
6
  module Rack
5
7
  class Filter
@@ -13,7 +15,7 @@ module Jpmobile
13
15
 
14
16
  status, env, response = @app.call(env)
15
17
 
16
- if mobile and env['Content-Type'] =~ %r!text/html|application/xhtml\+xml!
18
+ if mobile and mobile.apply_filter? and env['Content-Type'] =~ %r!text/html|application/xhtml\+xml!
17
19
  type, charset = env['Content-Type'].split(/;\s*charset=/)
18
20
 
19
21
  body = response_to_body(response)
@@ -25,6 +27,17 @@ module Jpmobile
25
27
  if type and charset
26
28
  env['Content-Type'] = "#{type}; charset=#{charset}"
27
29
  end
30
+ elsif pc_emoticon?
31
+ body = response_to_body(response)
32
+
33
+ response = body.gsub(/&#x([0-9a-f]{4});/i) do |match|
34
+ img = @pc_emoticon_hash[$1.upcase] || (@pc_emoticon_hash[("%x" % ($1.scanf("%x").first - 0x1000)).upcase] rescue nil)
35
+ if img
36
+ "<img src=\"#{@@pc_emoticon_image_path}/#{img}.gif\" alt=\"#{img}\" />"
37
+ else
38
+ ""
39
+ end
40
+ end
28
41
  end
29
42
 
30
43
  new_response = ::Rack::Response.new(response, status, env)
@@ -32,6 +45,25 @@ module Jpmobile
32
45
  end
33
46
 
34
47
  private
48
+ def pc_emoticon?
49
+ if @@pc_emoticon_yaml and File.exist?(@@pc_emoticon_yaml) and
50
+ @@pc_emoticon_image_path and FileTest.directory?(@@pc_emoticon_image_path)
51
+
52
+ unless @pc_emoticon_hash
53
+ begin
54
+ yaml_hash = YAML.load_file(@@pc_emoticon_yaml)
55
+ @pc_emoticon_hash = Hash[*(yaml_hash.values.inject([]){ |r, v| r += v.to_a.flatten; r})]
56
+ @@pc_emoticon_image_path.chop if @@pc_emoticon_image_path.match(/\/$/)
57
+
58
+ return true
59
+ rescue => ex
60
+ end
61
+ end
62
+ end
63
+
64
+ return false
65
+ end
66
+
35
67
  def response_to_body(response)
36
68
  if response.respond_to?(:to_str)
37
69
  response.to_str
@@ -45,6 +77,18 @@ module Jpmobile
45
77
  body
46
78
  end
47
79
  end
80
+
81
+ @@pc_emoticon_image_path = nil
82
+ @@pc_emoticon_yaml = nil
83
+ class << self
84
+ def pc_emoticon_image_path=(path)
85
+ @@pc_emoticon_image_path = path
86
+ end
87
+
88
+ def pc_emoticon_yaml=(file)
89
+ @@pc_emoticon_yaml = file
90
+ end
91
+ end
48
92
  end
49
93
  end
50
94
  end
@@ -9,7 +9,7 @@ module Jpmobile
9
9
 
10
10
  def call(env)
11
11
  # 入力
12
- if @mobile = env['rack.jpmobile']
12
+ if @mobile = env['rack.jpmobile'] and @mobile.apply_params_filter?
13
13
  # パラメータをkey, valueに分解
14
14
  # form_params
15
15
  if env['REQUEST_METHOD'] == 'POST'
@@ -0,0 +1,16 @@
1
+ module Jpmobile
2
+ module Sinatra
3
+ class Base < ::Sinatra::Base
4
+ # Calls the given block for every possible template file in views,
5
+ # named name.ext, where ext is registered on engine.
6
+ def find_template(views, name, engine)
7
+ if env['rack.jpmobile'] and !env['rack.jpmobile'].variants.empty?
8
+ env['rack.jpmobile'].variants.each do |variant|
9
+ yield ::File.join(views, "#{name}_#{variant}.#{@preferred_extension}")
10
+ end
11
+ end
12
+ super
13
+ end
14
+ end
15
+ end
16
+ end
@@ -27,7 +27,7 @@ module Jpmobile
27
27
  module SessionID
28
28
  module_function
29
29
 
30
- include ActionDispatch::Session::Compatibility
30
+ extend ActionDispatch::Session::Compatibility
31
31
  end
32
32
  end
33
33
 
@@ -16,6 +16,9 @@ describe "絵文字が" do
16
16
 
17
17
  @softbank_cr = "&#xF04A;"
18
18
  @softbank_utf8 = [0xf04a].pack("U")
19
+
20
+ @emoticon_yaml = File.join(File.expand_path(File.dirname(__FILE__)), "../../../tmp/emoticon.yml")
21
+ @emoticon_images = File.join(File.expand_path(File.dirname(__FILE__)), "../../../tmp/emoticons")
19
22
  end
20
23
 
21
24
  context "PC のとき" do
@@ -45,6 +48,55 @@ describe "絵文字が" do
45
48
  end
46
49
  end
47
50
 
51
+ context "PC で絵文字を変換するとき" do
52
+ before(:each) do
53
+ unless FileTest.exist?(File.join(File.expand_path(File.dirname(__FILE__)), '../../../tmp/emoticon.yaml')) and
54
+ FileTest.directory?(File.join(File.expand_path(File.dirname(__FILE__)), '../../../tmp/emoticons'))
55
+ pending "emoticon.yaml and emoticons directory don't exists"
56
+ end
57
+
58
+ @res = Rack::MockRequest.env_for("/", 'Content-Type' => 'text/html; charset=utf-8')
59
+
60
+ Jpmobile::Rack::Filter.pc_emoticon_yaml = "tmp/emoticon.yaml"
61
+ Jpmobile::Rack::Filter.pc_emoticon_image_path = @path = "tmp/emoticons"
62
+ end
63
+
64
+ after(:each) do
65
+ Jpmobile::Rack::Filter.pc_emoticon_yaml = nil
66
+ Jpmobile::Rack::Filter.pc_emoticon_image_path = nil
67
+ end
68
+
69
+ it "docomo 絵文字が画像に変換されること" do
70
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@docomo_cr))).call(@res)[2]
71
+ response_body(response).should == "<img src=\"#{@path}/sun.gif\" alt=\"sun\" />"
72
+ end
73
+
74
+ it "docomo 絵文字コードの埋込みは変換されないこと" do
75
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@docomo_utf8))).call(@res)[2]
76
+ response_body(response).should == @docomo_utf8
77
+ end
78
+
79
+ it "au 絵文字が画像に変換されること" do
80
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@au_cr))).call(@res)[2]
81
+ response_body(response).should == "<img src=\"#{@path}/sun.gif\" alt=\"sun\" />"
82
+ end
83
+
84
+ it "au 絵文字コードの埋込みは変換されないこと" do
85
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@au_utf8))).call(@res)[2]
86
+ response_body(response).should == @au_utf8
87
+ end
88
+
89
+ it "softbank 絵文字が画像に変換されること" do
90
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@softbank_cr))).call(@res)[2]
91
+ response_body(response).should == "<img src=\"#{@path}/sun.gif\" alt=\"sun\" />"
92
+ end
93
+
94
+ it "softbank 絵文字コードの埋込みは変換されないこと" do
95
+ response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@softbank_utf8))).call(@res)[2]
96
+ response_body(response).should == @softbank_utf8
97
+ end
98
+ end
99
+
48
100
  context "docomo のとき" do
49
101
  before(:each) do
50
102
  @res = Rack::MockRequest.env_for(
@@ -85,6 +85,10 @@ describe Jpmobile::Emoticon do
85
85
  it "should not convert ascii string to unicodecr" do
86
86
  Jpmobile::Emoticon.external_to_unicodecr_au_mail(utf8_to_jis("-------=_NextPart_15793_72254_63179")).should_not match(/e5c2/i)
87
87
  end
88
+
89
+ it "should not include extra JIS escape sequence between Kanji-code and emoticon" do
90
+ Jpmobile::Emoticon.unicodecr_to_au_email(utf8_to_jis("&#xe481;掲示板")).should == Jpmobile::Util.ascii_8bit("\x1b\x24\x42\x75\x3a\x37\x47\x3C\x28\x48\x44\x1b\x28\x42")
91
+ end
88
92
  end
89
93
  end
90
94
  end
@@ -59,7 +59,7 @@ describe "Jpmobile::Mobile" do
59
59
  end
60
60
 
61
61
  it "should convert emoticon &#xe63e; to \x75\x41 in B-Encoding" do
62
- @mobile.to_mail_subject("ほげ&#xe63e;").should == "=?ISO-2022-JP?B?GyRCJFskMhsoQhskQnVBGyhC?="
62
+ @mobile.to_mail_subject("ほげ&#xe63e;").should == "=?ISO-2022-JP?B?GyRCJFskMnVBGyhC?="
63
63
  end
64
64
  end
65
65
 
@@ -69,7 +69,7 @@ describe "Jpmobile::Mobile" do
69
69
  end
70
70
 
71
71
  it "should convert emoticon &#xe63e; to \x75\x41" do
72
- ascii_8bit(@mobile.to_mail_body("ほげ&#xe63e;")).should == ascii_8bit(utf8_to_jis("ほげ") + jis("\x1b\x24\x42\x75\x41\x1b\x28\x42"))
72
+ ascii_8bit(@mobile.to_mail_body("ほげ&#xe63e;")).should == ascii_8bit(jis("\e\x24\x42\x24\x5B\x24\x32\x75\x41\x1b\x28\x42"))
73
73
  end
74
74
  end
75
75
  end
@@ -111,8 +111,8 @@ describe "Jpmobile::Mail" do
111
111
  @mail.subject += "&#xe63e;"
112
112
  @mail.body = "#{@mail.body}&#xe63e;"
113
113
 
114
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQhskQnVBGyhC?=")))
115
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x75\x41\x1b\x28\x42"))))
114
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVXVBGyhC?=")))
115
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\e\x24\x42\x24\x5B\x24\x32\x75\x41\e\x28\x42"))))
116
116
  end
117
117
  end
118
118
  end
@@ -105,7 +105,7 @@ describe "Jpmobile::Mail#receive" do
105
105
  end
106
106
 
107
107
  it "should encode correctly" do
108
- ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCJUYlOSVIGyhCGyRCdk8bKEI="))
108
+ ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCJUYlOSVIdk8bKEI="))
109
109
  end
110
110
  end
111
111
 
@@ -201,23 +201,23 @@ describe "Jpmobile::Mail#receive" do
201
201
 
202
202
  context "to_s" do
203
203
  it "should have subject which is same as original" do
204
- ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCQmpMPhsoQhskQnZeGyhC"))
204
+ ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCQmpMPnZeGyhC"))
205
205
  end
206
206
 
207
207
  it "should have body which is same as original" do
208
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
208
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\e\x24\x42\x4B\x5C\x4A\x38\x76\x7D\e\x28\x42"))))
209
209
  end
210
210
  end
211
211
 
212
212
  context "modify and to_s" do
213
213
  it "should encode subject correctly" do
214
214
  @mail.subject = "大江戸&#xe63e;"
215
- ascii_8bit(@mail.to_s).should match("GyRCQmc5PjhNGyhCGyRCdUEbKEI=")
215
+ ascii_8bit(@mail.to_s).should match(/\?GyRCQmc5PjhNdUEbKEI=/)
216
216
  end
217
217
 
218
218
  it "should encode body correctly" do
219
219
  @mail.body = "会議が開催&#xe646;"
220
- ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x32\x71\x35\x44\x24\x2C\x33\x2B\x3A\x45\x1b\x28\x42\x1b\x24\x42\x75\x48\x1b\x28\x42"))))
220
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x32\x71\x35\x44\x24\x2C\x33\x2B\x3A\x45\x75\x48\x1b\x28\x42"))))
221
221
  end
222
222
  end
223
223
  end
@@ -4,4 +4,7 @@ class HankakuInputFilterController < FilterControllerBase
4
4
  def index_xhtml
5
5
  render "index_xhtml", :layout => "xhtml"
6
6
  end
7
+
8
+ def with_charset
9
+ end
7
10
  end
@@ -0,0 +1 @@
1
+ <%= link_to 'リンク', '#' -%>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsRoot</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
+ <%= csrf_meta_tag %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
@@ -163,7 +163,7 @@ describe MobileMailer do
163
163
 
164
164
  raw_mail = ascii_8bit(email.to_s)
165
165
  raw_mail.should match(/For au/)
166
- raw_mail.should match(Regexp.escape("GyRCRnxLXDhsQmpMPhsoQhskQnZeGyhC"))
166
+ raw_mail.should match(Regexp.escape("GyRCRnxLXDhsQmpMPnZeGyhC"))
167
167
  raw_mail.should match(Regexp.compile(ascii_8bit("\x76\x21")))
168
168
  end
169
169
 
@@ -215,6 +215,11 @@ describe "jpmobile integration spec" do
215
215
  end
216
216
  it_should_behave_like "Shift_JISで通信する端末との通信(半角変換付き)"
217
217
  it_should_behave_like "hankaku_filter :input => true のとき"
218
+
219
+ it "Content-Type が Shift_JIS であること" do
220
+ get "/#{@controller}/with_charset", {}, {"HTTP_USER_AGENT" => @user_agent}
221
+ body.should match(/Shift_JIS/)
222
+ end
218
223
  end
219
224
 
220
225
  describe HankakuInputFilterController, "SoftBank 910T からのアクセス" do
@@ -225,5 +230,10 @@ describe "jpmobile integration spec" do
225
230
  end
226
231
  it_should_behave_like "UTF-8で通信する端末との通信(半角変換付き)"
227
232
  it_should_behave_like "hankaku_filter :input => true のとき"
233
+
234
+ it "Content-Type が UTF-8 であること" do
235
+ get "/#{@controller}/with_charset", {}, {"HTTP_USER_AGENT" => @user_agent}
236
+ body.should match(/UTF-8/)
237
+ end
228
238
  end
229
239
  end
@@ -0,0 +1,2 @@
1
+ require './guestbook'
2
+ run Guestbook
@@ -1,26 +1,25 @@
1
1
  require 'rubygems'
2
2
  require 'sinatra'
3
- require 'jpmobile'
3
+ require File.join(File.dirname(__FILE__), '../../lib/jpmobile')
4
4
  require 'jpmobile/rack'
5
5
  require 'singleton'
6
6
  require 'pp'
7
7
 
8
- require 'jpmobile'
9
- require 'jpmobile/rack'
8
+ require 'jpmobile/sinatra'
10
9
 
11
10
  class SinatraTestHelper
12
11
  include Singleton
13
12
  attr_accessor :last_app
14
13
  end
15
14
 
16
- class Guestbook < Sinatra::Base
15
+ class Guestbook < Jpmobile::Sinatra::Base
17
16
  use Jpmobile::Rack::MobileCarrier
18
17
  use Jpmobile::Rack::ParamsFilter
19
18
  use Jpmobile::Rack::Filter
20
19
 
21
20
  def call(env)
22
21
  _dup = dup
23
- SinatraTestHelper.instance.last_app = _dup
22
+ ::SinatraTestHelper.instance.last_app = _dup
24
23
  _dup.call!(env)
25
24
  end
26
25
 
@@ -35,6 +34,8 @@ class Guestbook < Sinatra::Base
35
34
  post '/' do
36
35
  @p = params[:p]
37
36
  end
38
- end
39
37
 
40
- Guestbook.run
38
+ get '/top' do
39
+ erb :index
40
+ end
41
+ end
@@ -36,4 +36,14 @@ class SinatraOnJpmobile < Test::Unit::TestCase
36
36
  assert_equal last_app.assigns(:p), "けーたい"
37
37
  assert_equal last_response.body, utf8_to_sjis("けーたい")
38
38
  end
39
+
40
+ # def test_view_selector_pc
41
+ # get '/top', {}, {"HTTP_USER_AGENT" => "Mozilla"}
42
+ # assert_equal last_response.body, 'PC'
43
+ # end
44
+
45
+ # def test_view_selector_mobile
46
+ # get '/top', {}, {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
47
+ # assert_equal last_response.body, 'MOBILE'
48
+ # end
39
49
  end
@@ -0,0 +1 @@
1
+ PC
@@ -0,0 +1 @@
1
+ MOBILE
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: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-05 00:00:00.000000000Z
13
+ date: 2011-09-26 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jeweler
17
- requirement: &23576180 !ruby/object:Gem::Requirement
17
+ requirement: &20415560 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *23576180
25
+ version_requirements: *20415560
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rails
28
- requirement: &23575080 !ruby/object:Gem::Requirement
28
+ requirement: &20415080 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.1.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *23575080
36
+ version_requirements: *20415080
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &23574220 !ruby/object:Gem::Requirement
39
+ requirement: &20393360 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *23574220
47
+ version_requirements: *20393360
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec-rails
50
- requirement: &23573240 !ruby/object:Gem::Requirement
50
+ requirement: &20392880 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *23573240
58
+ version_requirements: *20392880
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: webrat
61
- requirement: &23572300 !ruby/object:Gem::Requirement
61
+ requirement: &20392400 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *23572300
69
+ version_requirements: *20392400
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: geokit
72
- requirement: &23571660 !ruby/object:Gem::Requirement
72
+ requirement: &20391920 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *23571660
80
+ version_requirements: *20391920
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: sqlite3-ruby
83
- requirement: &23570480 !ruby/object:Gem::Requirement
83
+ requirement: &20391440 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *23570480
91
+ version_requirements: *20391440
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: hpricot
94
- requirement: &23569620 !ruby/object:Gem::Requirement
94
+ requirement: &20390860 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *23569620
102
+ version_requirements: *20390860
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rails
105
- requirement: &23568620 !ruby/object:Gem::Requirement
105
+ requirement: &20390380 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 3.1.0
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *23568620
113
+ version_requirements: *20390380
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: jeweler
116
- requirement: &23565280 !ruby/object:Gem::Requirement
116
+ requirement: &20389820 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 1.5.1
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *23565280
124
+ version_requirements: *20389820
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
- requirement: &23564200 !ruby/object:Gem::Requirement
127
+ requirement: &20389320 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: 2.6.0
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *23564200
135
+ version_requirements: *20389320
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec-rails
138
- requirement: &23561920 !ruby/object:Gem::Requirement
138
+ requirement: &20388840 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: 2.6.0
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *23561920
146
+ version_requirements: *20388840
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: webrat
149
- requirement: &23561000 !ruby/object:Gem::Requirement
149
+ requirement: &20388340 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: 0.7.2
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *23561000
157
+ version_requirements: *20388340
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: geokit
160
- requirement: &23559820 !ruby/object:Gem::Requirement
160
+ requirement: &20387800 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ! '>='
@@ -165,10 +165,10 @@ dependencies:
165
165
  version: 1.5.0
166
166
  type: :development
167
167
  prerelease: false
168
- version_requirements: *23559820
168
+ version_requirements: *20387800
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: sqlite3-ruby
171
- requirement: &23559020 !ruby/object:Gem::Requirement
171
+ requirement: &20387280 !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements:
174
174
  - - ! '>='
@@ -176,10 +176,10 @@ dependencies:
176
176
  version: 1.3.2
177
177
  type: :development
178
178
  prerelease: false
179
- version_requirements: *23559020
179
+ version_requirements: *20387280
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: hpricot
182
- requirement: &23557960 !ruby/object:Gem::Requirement
182
+ requirement: &20386760 !ruby/object:Gem::Requirement
183
183
  none: false
184
184
  requirements:
185
185
  - - ! '>='
@@ -187,10 +187,10 @@ dependencies:
187
187
  version: 0.8.3
188
188
  type: :development
189
189
  prerelease: false
190
- version_requirements: *23557960
190
+ version_requirements: *20386760
191
191
  - !ruby/object:Gem::Dependency
192
192
  name: git
193
- requirement: &23487920 !ruby/object:Gem::Requirement
193
+ requirement: &20386260 !ruby/object:Gem::Requirement
194
194
  none: false
195
195
  requirements:
196
196
  - - ! '>='
@@ -198,7 +198,7 @@ dependencies:
198
198
  version: 1.2.5
199
199
  type: :development
200
200
  prerelease: false
201
- version_requirements: *23487920
201
+ version_requirements: *20386260
202
202
  description: A Rails plugin for Japanese mobile-phones
203
203
  email: dara@shidara.net
204
204
  executables: []
@@ -259,6 +259,7 @@ files:
259
259
  - lib/jpmobile/rails.rb
260
260
  - lib/jpmobile/request_with_mobile.rb
261
261
  - lib/jpmobile/resolver.rb
262
+ - lib/jpmobile/sinatra.rb
262
263
  - lib/jpmobile/trans_sid.rb
263
264
  - lib/jpmobile/util.rb
264
265
  - lib/tasks/jpmobile_tasks.rake
@@ -326,7 +327,9 @@ files:
326
327
  - test/rails/overrides/app/views/hankaku_filter/index.html.erb
327
328
  - test/rails/overrides/app/views/hankaku_input_filter/index.html.erb
328
329
  - test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb
330
+ - test/rails/overrides/app/views/hankaku_input_filter/with_charset.html.erb
329
331
  - test/rails/overrides/app/views/layouts/application_mobile.html.erb
332
+ - test/rails/overrides/app/views/layouts/with_charset.html.erb
330
333
  - test/rails/overrides/app/views/layouts/xhtml.html.erb
331
334
  - test/rails/overrides/app/views/links/au_gps.html.erb
332
335
  - test/rails/overrides/app/views/links/au_location.html.erb
@@ -398,8 +401,11 @@ files:
398
401
  - test/rails/overrides/spec/requests/template_path_spec.rb
399
402
  - test/rails/overrides/spec/requests/trans_sid_spec.rb
400
403
  - test/rails/overrides/spec/spec_helper.rb
404
+ - test/sinatra/config.ru
401
405
  - test/sinatra/guestbook.rb
402
406
  - test/sinatra/test/filter_test.rb
407
+ - test/sinatra/views/index.erb
408
+ - test/sinatra/views/index_mobile.erb
403
409
  - tools/emoji/genregexp.rb
404
410
  - tools/generate_au_emoticon_table.rb
405
411
  - tools/generate_docomo_emoticon_table.rb