jpmobile 1.0.12 → 2.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -3
- data/README.rdoc +2 -14
- data/Rakefile +0 -1
- data/VERSION.yml +4 -4
- data/jpmobile.gemspec +2 -1
- data/lib/jpmobile.rb +1 -15
- data/lib/jpmobile/docomo_guid.rb +1 -1
- data/lib/jpmobile/emoticon.rb +3 -119
- data/lib/jpmobile/emoticon/z_combine.rb +1 -17
- data/lib/jpmobile/filter.rb +1 -6
- data/lib/jpmobile/helpers.rb +1 -1
- data/lib/jpmobile/mail.rb +27 -196
- data/lib/jpmobile/mailer.rb +1 -7
- data/lib/jpmobile/mobile/abstract_mobile.rb +36 -94
- data/lib/jpmobile/mobile/android.rb +0 -2
- data/lib/jpmobile/mobile/au.rb +0 -4
- data/lib/jpmobile/mobile/docomo.rb +0 -8
- data/lib/jpmobile/mobile/iphone.rb +15 -1
- data/lib/jpmobile/mobile/smart_phone.rb +0 -10
- data/lib/jpmobile/mobile/softbank.rb +0 -8
- data/lib/jpmobile/rack.rb +1 -6
- data/lib/jpmobile/rack/filter.rb +1 -7
- data/lib/jpmobile/rack/params_filter.rb +2 -2
- data/lib/jpmobile/rails.rb +1 -1
- data/lib/jpmobile/resolver.rb +2 -5
- data/lib/jpmobile/trans_sid.rb +1 -26
- data/lib/jpmobile/util.rb +11 -82
- data/lib/tasks/jpmobile_tasks.rake +1 -1
- data/spec/rack/jpmobile/emoticon_spec.rb +0 -223
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -5
- data/spec/rack/jpmobile/softbank_spec.rb +1 -1
- data/spec/unit/emoticon_spec.rb +0 -64
- data/spec/unit/encoding_spec.rb +2 -2
- data/spec/unit/mail_spec.rb +2 -159
- data/spec/unit/receive_mail_spec.rb +5 -51
- data/spec/unit/spec_helper.rb +1 -1
- data/spec/unit/util_spec.rb +3 -62
- data/test/rails/overrides/Gemfile +1 -1
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +0 -3
- data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +0 -3
- data/test/rails/overrides/app/controllers/template_path_controller.rb +0 -12
- data/test/rails/overrides/app/{mailers → models}/mobile_mailer.rb +1 -7
- data/test/rails/overrides/app/{mailers → models}/normal_mailer.rb +0 -0
- data/test/rails/overrides/spec/{mailers → models}/mobile_mailer_spec.rb +1 -18
- data/test/rails/overrides/spec/{mailers → models}/normal_mailer_spec.rb +0 -0
- data/test/rails/overrides/spec/requests/filter_spec.rb +0 -18
- data/test/rails/overrides/spec/requests/template_path_spec.rb +0 -72
- data/test/rails/overrides/spec/spec_helper.rb +1 -1
- data/test/sinatra/guestbook.rb +7 -8
- data/test/sinatra/test/filter_test.rb +0 -10
- metadata +169 -296
- data/lib/jpmobile/emoticon/google.rb +0 -2421
- data/lib/jpmobile/emoticon/unicode.rb +0 -2253
- data/lib/jpmobile/mobile/android_tablet.rb +0 -12
- data/lib/jpmobile/mobile/black_berry.rb +0 -10
- data/lib/jpmobile/mobile/google_emoticon.rb +0 -29
- data/lib/jpmobile/mobile/ipad.rb +0 -12
- data/lib/jpmobile/mobile/tablet.rb +0 -16
- data/lib/jpmobile/mobile/unicode_emoticon.rb +0 -43
- data/lib/jpmobile/sinatra.rb +0 -16
- data/spec/rack/jpmobile/black_berry_spec.rb +0 -20
- data/spec/unit/decorated_mail_spec.rb +0 -76
- data/spec/unit/email-fixtures/bounce_with_utf8_part.eml +0 -42
- data/spec/unit/email-fixtures/iphone-mail3.eml +0 -56
- data/spec/unit/email-fixtures/iphone-message.eml +0 -27
- data/spec/unit/email-fixtures/photo.jpg +0 -0
- data/spec/unit/mobile/iphone_spec.rb +0 -34
- data/test/rails/overrides/app/mailers/decorated_mailer.rb +0 -11
- data/test/rails/overrides/app/views/decorated_mailer/deco_mail.html.erb +0 -10
- data/test/rails/overrides/app/views/decorated_mailer/deco_mail.text.erb +0 -1
- data/test/rails/overrides/app/views/hankaku_input_filter/with_charset.html.erb +0 -1
- data/test/rails/overrides/app/views/layouts/with_charset.html.erb +0 -13
- data/test/rails/overrides/app/views/template_path/smart_phone_only.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/smart_phone_only_smart_phone.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_ipd.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_ipd_tablet_ipad.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_tblt.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_tblt_tablet.html.erb +0 -1
- data/test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml +0 -72
- data/test/rails/overrides/spec/fixtures/mobile_mailer/photo.jpg +0 -0
- data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +0 -44
- data/test/sinatra/config.ru +0 -2
- data/test/sinatra/views/index.erb +0 -1
- data/test/sinatra/views/index_mobile.erb +0 -1
- data/tools/e4u_conv.rb +0 -122
data/lib/jpmobile/mailer.rb
CHANGED
@@ -11,8 +11,7 @@ module Jpmobile
|
|
11
11
|
self.view_paths.unshift(Jpmobile::Resolver.new(File.join(::Rails.root, "app/views")))
|
12
12
|
|
13
13
|
def mail(headers={}, &block)
|
14
|
-
tos = headers[:to]
|
15
|
-
tos = tos.split(/,/)
|
14
|
+
tos = headers[:to].split(/,/)
|
16
15
|
|
17
16
|
@mobile = if tos.size == 1
|
18
17
|
# for mobile
|
@@ -23,16 +22,11 @@ module Jpmobile
|
|
23
22
|
end
|
24
23
|
self.lookup_context.mobile = @mobile.variants
|
25
24
|
|
26
|
-
@mobile.decorated = headers.delete(:decorated)
|
27
|
-
|
28
25
|
m = super(headers, &block)
|
29
26
|
|
30
27
|
m.mobile = @mobile
|
31
28
|
m.charset = @mobile.mail_charset
|
32
29
|
|
33
|
-
# for decorated-mail manipulation
|
34
|
-
m.rearrange! if @mobile.decorated?
|
35
|
-
|
36
30
|
m
|
37
31
|
end
|
38
32
|
|
@@ -16,8 +16,6 @@ module Jpmobile::Mobile
|
|
16
16
|
USER_AGENT_REGEXP = nil
|
17
17
|
# 対応するメールアドレスの正規表現
|
18
18
|
MAIL_ADDRESS_REGEXP = nil
|
19
|
-
# テキスト部分の content-transfer-encoding
|
20
|
-
MAIL_CONTENT_TRANSFER_ENCODING = '7bit'
|
21
19
|
|
22
20
|
# 緯度経度があれば Position のインスタンスを返す。
|
23
21
|
def position; return nil; end
|
@@ -29,6 +27,16 @@ module Jpmobile::Mobile
|
|
29
27
|
# 端末を識別する文字列があれば返す。
|
30
28
|
def ident_device; nil; end
|
31
29
|
|
30
|
+
# 当該キャリアのIPアドレス帯域からのアクセスであれば +true+ を返す。
|
31
|
+
# そうでなければ +false+ を返す。
|
32
|
+
# IP空間が定義されていない場合は +nil+ を返す。
|
33
|
+
def self.valid_ip? remote_addr
|
34
|
+
@ip_list ||= ip_address_class
|
35
|
+
return false unless @ip_list
|
36
|
+
|
37
|
+
@ip_list.valid_ip?(remote_addr)
|
38
|
+
end
|
39
|
+
|
32
40
|
def valid_ip?
|
33
41
|
@__valid_ip ||= self.class.valid_ip? @request.ip
|
34
42
|
end
|
@@ -50,21 +58,6 @@ module Jpmobile::Mobile
|
|
50
58
|
false
|
51
59
|
end
|
52
60
|
|
53
|
-
# tablet かどうか
|
54
|
-
def tablet?
|
55
|
-
false
|
56
|
-
end
|
57
|
-
|
58
|
-
# Jpmobile::Rack::Filter を適用するかどうか
|
59
|
-
def apply_filter?
|
60
|
-
true
|
61
|
-
end
|
62
|
-
|
63
|
-
# Jpmobile::Rack::ParamsFilter を適用するかどうか
|
64
|
-
def apply_params_filter?
|
65
|
-
true
|
66
|
-
end
|
67
|
-
|
68
61
|
# エンコーディング変換用
|
69
62
|
def to_internal(str)
|
70
63
|
str
|
@@ -80,12 +73,11 @@ module Jpmobile::Mobile
|
|
80
73
|
def variants
|
81
74
|
return @_variants if @_variants
|
82
75
|
|
83
|
-
@_variants = self.class.ancestors.select {|c| c.to_s =~ /^Jpmobile/
|
76
|
+
@_variants = self.class.ancestors.select {|c| c.to_s =~ /^Jpmobile/}.map do |klass|
|
84
77
|
klass = klass.to_s.
|
85
78
|
gsub(/Jpmobile::/, '').
|
86
79
|
gsub(/AbstractMobile::/, '').
|
87
80
|
gsub(/Mobile::SmartPhone/, 'smart_phone').
|
88
|
-
gsub(/Mobile::Tablet/, 'tablet').
|
89
81
|
gsub(/::/, '_').
|
90
82
|
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
91
83
|
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
@@ -93,10 +85,8 @@ module Jpmobile::Mobile
|
|
93
85
|
klass =~ /abstract/ ? "mobile" : klass
|
94
86
|
end
|
95
87
|
|
96
|
-
if @_variants.include?(
|
97
|
-
@_variants = @_variants.reject{|v| v == "mobile"}.map{|v| v.gsub(/
|
98
|
-
elsif @_variants.include?("smart_phone")
|
99
|
-
@_variants = @_variants.reject{|v| v == "mobile"}.map{|v| v.gsub(/mobile_/, "smart_phone_")}
|
88
|
+
if @_variants.include?("smart_phone")
|
89
|
+
@_variants = @_variants.reject{|v| v == "mobile"}.map{|v| v.gsub(/mobile/, "smart_phone")}
|
100
90
|
end
|
101
91
|
|
102
92
|
@_variants
|
@@ -105,7 +95,7 @@ module Jpmobile::Mobile
|
|
105
95
|
# メール送信用
|
106
96
|
def to_mail_subject(str)
|
107
97
|
Jpmobile::Util.fold_text(Jpmobile::Emoticon.unicodecr_to_utf8(str)).
|
108
|
-
map{|text| "=?#{mail_charset}?B?" + [to_mail_encoding(text)].pack('m').
|
98
|
+
map{|text| "=?#{mail_charset}?B?" + [to_mail_encoding(text)].pack('m').strip + "?=" }.
|
109
99
|
join("\n\s")
|
110
100
|
end
|
111
101
|
def to_mail_body(str)
|
@@ -113,23 +103,7 @@ module Jpmobile::Mobile
|
|
113
103
|
end
|
114
104
|
def mail_charset(charset = nil)
|
115
105
|
# (charset.nil? or charset == "") ? self.class::MAIL_CHARSET : charset
|
116
|
-
|
117
|
-
charset.nil? || charset == '' || charset =~ /US-ASCII/i ? self.class::MAIL_CHARSET : charset
|
118
|
-
end
|
119
|
-
def content_transfer_encoding(headers)
|
120
|
-
transfer_encoding = headers['Content-Transfer-Encoding']
|
121
|
-
case headers['Content-Type'].to_s
|
122
|
-
when /text\/plain/
|
123
|
-
transfer_encoding.to_s == MAIL_CONTENT_TRANSFER_ENCODING ? transfer_encoding : MAIL_CONTENT_TRANSFER_ENCODING
|
124
|
-
when /text\/html/
|
125
|
-
if self.decorated?
|
126
|
-
'quoted-printable'
|
127
|
-
else
|
128
|
-
transfer_encoding.to_s == MAIL_CONTENT_TRANSFER_ENCODING ? transfer_encoding : MAIL_CONTENT_TRANSFER_ENCODING
|
129
|
-
end
|
130
|
-
else
|
131
|
-
transfer_encoding
|
132
|
-
end
|
106
|
+
self.class::MAIL_CHARSET
|
133
107
|
end
|
134
108
|
def to_mail_encoding(str)
|
135
109
|
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
|
@@ -160,60 +134,11 @@ module Jpmobile::Mobile
|
|
160
134
|
body = to_mail_internal(body, nil)
|
161
135
|
Jpmobile::Util.force_encode(body, charset, Jpmobile::Util::UTF8)
|
162
136
|
end
|
163
|
-
def decoratable?
|
164
|
-
false
|
165
|
-
end
|
166
|
-
def require_related_part?
|
167
|
-
false
|
168
|
-
end
|
169
|
-
def decorated=(boolean)
|
170
|
-
@decorated = boolean
|
171
|
-
end
|
172
|
-
def decorated?
|
173
|
-
@decorated
|
174
|
-
end
|
175
|
-
|
176
|
-
class << self
|
177
|
-
# 当該キャリアのIPアドレス帯域からのアクセスであれば +true+ を返す。
|
178
|
-
# そうでなければ +false+ を返す。
|
179
|
-
# IP空間が定義されていない場合は +nil+ を返す。
|
180
|
-
def valid_ip? remote_addr
|
181
|
-
@ip_list ||= ip_address_class
|
182
|
-
return false unless @ip_list
|
183
137
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
# メソッド名に関して非常に不安
|
189
|
-
def check_carrier(env)
|
190
|
-
user_agent_regexp && user_agent_regexp.match(env['HTTP_USER_AGENT'])
|
191
|
-
end
|
192
|
-
|
193
|
-
def user_agent_regexp
|
194
|
-
@_user_agent_regexp ||= self::USER_AGENT_REGEXP
|
195
|
-
end
|
196
|
-
|
197
|
-
def add_user_agent_regexp(regexp)
|
198
|
-
@_user_agent_regexp = Regexp.union(user_agent_regexp, regexp)
|
199
|
-
end
|
200
|
-
|
201
|
-
def carrier(env)
|
202
|
-
::Jpmobile::Mobile.carriers.each do |const|
|
203
|
-
c = ::Jpmobile::Mobile.const_get(const)
|
204
|
-
if c.check_carrier(env)
|
205
|
-
res = ::Rack::Request.new(env)
|
206
|
-
return c.new(env, res)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
nil
|
211
|
-
end
|
212
|
-
|
213
|
-
#
|
214
|
-
def ip_address_class
|
215
|
-
eval("::Jpmobile::Mobile::IpAddresses::#{self.to_s.split(/::/).last}").new rescue nil
|
216
|
-
end
|
138
|
+
# リクエストがこのクラスに属するか調べる
|
139
|
+
# メソッド名に関して非常に不安
|
140
|
+
def self.check_carrier(env)
|
141
|
+
self::USER_AGENT_REGEXP && env['HTTP_USER_AGENT'] =~ self::USER_AGENT_REGEXP
|
217
142
|
end
|
218
143
|
|
219
144
|
#XXX: lib/jpmobile.rbのautoloadで先に各キャリアの定数を定義しているから動くのです
|
@@ -226,6 +151,18 @@ module Jpmobile::Mobile
|
|
226
151
|
end
|
227
152
|
end
|
228
153
|
|
154
|
+
def self.carrier(env)
|
155
|
+
::Jpmobile::Mobile.carriers.each do |const|
|
156
|
+
c = ::Jpmobile::Mobile.const_get(const)
|
157
|
+
if c.check_carrier(env)
|
158
|
+
res = ::Rack::Request.new(env)
|
159
|
+
return c.new(env, res)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
nil
|
164
|
+
end
|
165
|
+
|
229
166
|
private
|
230
167
|
# リクエストのパラメータ。
|
231
168
|
def params
|
@@ -235,5 +172,10 @@ module Jpmobile::Mobile
|
|
235
172
|
@request.params
|
236
173
|
end
|
237
174
|
end
|
175
|
+
|
176
|
+
#
|
177
|
+
def self.ip_address_class
|
178
|
+
eval("::Jpmobile::Mobile::IpAddresses::#{self.to_s.split(/::/).last}").new rescue nil
|
179
|
+
end
|
238
180
|
end
|
239
181
|
end
|
data/lib/jpmobile/mobile/au.rb
CHANGED
@@ -10,8 +10,6 @@ module Jpmobile::Mobile
|
|
10
10
|
MAIL_ADDRESS_REGEXP = /.+@docomo\.ne\.jp/
|
11
11
|
# メールのデフォルトのcharset
|
12
12
|
MAIL_CHARSET = "Shift_JIS"
|
13
|
-
# テキスト部分の content-transfer-encoding
|
14
|
-
MAIL_CONTENT_TRANSFER_ENCODING = '8bit'
|
15
13
|
|
16
14
|
# オープンiエリアがあればエリアコードを +String+ で返す。無ければ +nil+ を返す。
|
17
15
|
def areacode
|
@@ -116,12 +114,6 @@ module Jpmobile::Mobile
|
|
116
114
|
def to_mail_body_encoded?(str)
|
117
115
|
Jpmobile::Util.shift_jis?(str)
|
118
116
|
end
|
119
|
-
def decoratable?
|
120
|
-
true
|
121
|
-
end
|
122
|
-
def require_related_part?
|
123
|
-
true
|
124
|
-
end
|
125
117
|
|
126
118
|
# i-mode ブラウザのバージョンを返す。
|
127
119
|
# http://labs.unoh.net/2009/07/i_20.html
|
@@ -7,6 +7,20 @@ module Jpmobile::Mobile
|
|
7
7
|
# 対応するUser-Agentの正規表現
|
8
8
|
USER_AGENT_REGEXP = /iPhone/
|
9
9
|
|
10
|
-
|
10
|
+
# 文字コード変換
|
11
|
+
def to_internal(str)
|
12
|
+
# 絵文字を数値参照に変換
|
13
|
+
str = Jpmobile::Emoticon.external_to_unicodecr_softbank(Jpmobile::Util.utf8(str))
|
14
|
+
# 数値参照を UTF-8 に変換
|
15
|
+
Jpmobile::Emoticon.unicodecr_to_utf8(str)
|
16
|
+
end
|
17
|
+
def to_external(str, content_type, charset)
|
18
|
+
# UTF-8を数値参照に
|
19
|
+
str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
|
20
|
+
# 数値参照を絵文字コードに変換
|
21
|
+
str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, false)
|
22
|
+
|
23
|
+
[str, charset]
|
24
|
+
end
|
11
25
|
end
|
12
26
|
end
|
@@ -11,8 +11,6 @@ module Jpmobile::Mobile
|
|
11
11
|
MAIL_ADDRESS_REGEXP = /.+@(?:softbank\.ne\.jp|disney\.ne\.jp)/
|
12
12
|
# メールのデフォルトのcharset
|
13
13
|
MAIL_CHARSET = "Shift_JIS"
|
14
|
-
# テキスト部分の content-transfer-encoding
|
15
|
-
MAIL_CONTENT_TRANSFER_ENCODING = '8bit'
|
16
14
|
|
17
15
|
# 製造番号を返す。無ければ +nil+ を返す。
|
18
16
|
def serial_number
|
@@ -82,12 +80,6 @@ module Jpmobile::Mobile
|
|
82
80
|
def to_mail_body_encoded?(str)
|
83
81
|
Jpmobile::Util.shift_jis?(str)
|
84
82
|
end
|
85
|
-
def decoratable?
|
86
|
-
true
|
87
|
-
end
|
88
|
-
def require_related_part?
|
89
|
-
true
|
90
|
-
end
|
91
83
|
|
92
84
|
private
|
93
85
|
def to_mail_encoding(str)
|
data/lib/jpmobile/rack.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'rack/utils'
|
3
|
-
require 'singleton'
|
4
3
|
|
5
4
|
module Jpmobile
|
6
5
|
module Rack
|
@@ -13,14 +12,10 @@ module Jpmobile
|
|
13
12
|
end
|
14
13
|
|
15
14
|
class Configuration
|
16
|
-
include Singleton
|
17
|
-
|
18
15
|
attr_accessor :form_accept_charset_conversion
|
19
|
-
attr_accessor :smart_phone_emoticon_compatibility
|
20
16
|
|
21
17
|
def initialize
|
22
|
-
@form_accept_charset_conversion
|
23
|
-
@smart_phone_emoticon_compatibility = false
|
18
|
+
@form_accept_charset_conversion = false
|
24
19
|
end
|
25
20
|
|
26
21
|
def mobile_filter
|
data/lib/jpmobile/rack/filter.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# 出力変換
|
3
|
-
require 'scanf'
|
4
|
-
|
5
3
|
module Jpmobile
|
6
4
|
module Rack
|
7
5
|
class Filter
|
@@ -15,7 +13,7 @@ module Jpmobile
|
|
15
13
|
|
16
14
|
status, env, response = @app.call(env)
|
17
15
|
|
18
|
-
if mobile and
|
16
|
+
if mobile and env['Content-Type'] =~ %r!text/html|application/xhtml\+xml!
|
19
17
|
type, charset = env['Content-Type'].split(/;\s*charset=/)
|
20
18
|
|
21
19
|
body = response_to_body(response)
|
@@ -27,10 +25,6 @@ module Jpmobile
|
|
27
25
|
if type and charset
|
28
26
|
env['Content-Type'] = "#{type}; charset=#{charset}"
|
29
27
|
end
|
30
|
-
elsif Jpmobile::Emoticon.pc_emoticon?
|
31
|
-
body = response_to_body(response)
|
32
|
-
|
33
|
-
response = Jpmobile::Emoticon.emoticons_to_image(body)
|
34
28
|
end
|
35
29
|
|
36
30
|
new_response = ::Rack::Response.new(response, status, env)
|
@@ -9,10 +9,10 @@ module Jpmobile
|
|
9
9
|
|
10
10
|
def call(env)
|
11
11
|
# 入力
|
12
|
-
if @mobile = env['rack.jpmobile']
|
12
|
+
if @mobile = env['rack.jpmobile']
|
13
13
|
# パラメータをkey, valueに分解
|
14
14
|
# form_params
|
15
|
-
if env['REQUEST_METHOD'] == 'POST'
|
15
|
+
if env['REQUEST_METHOD'] == 'POST'
|
16
16
|
env['rack.input'] = StringIO.new(parse_query(env['rack.input'].read))
|
17
17
|
end
|
18
18
|
|
data/lib/jpmobile/rails.rb
CHANGED
data/lib/jpmobile/resolver.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
module Jpmobile
|
2
2
|
class Resolver < ActionView::FileSystemResolver
|
3
|
-
# EXTENSION_ORDER = [:variants, :locale, :formats, :handlers]
|
4
|
-
|
5
3
|
def find_templates(name, prefix, partial, details)
|
6
4
|
path = build_path(name, prefix, partial, details)
|
7
|
-
query(path,
|
5
|
+
query(path, EXTENSIONS.map { |ext| details[ext] }, details[:formats], details[:mobile])
|
8
6
|
end
|
9
7
|
|
10
8
|
def build_path(name, prefix, partial, details)
|
@@ -17,7 +15,6 @@ module Jpmobile
|
|
17
15
|
def query(path, exts, formats, mobile)
|
18
16
|
query = File.join(@path, path)
|
19
17
|
query << '{' << mobile.map {|v| "_#{v}"}.join(',') << ',}' if mobile and mobile.respond_to?(:map)
|
20
|
-
|
21
18
|
exts.each do |ext|
|
22
19
|
query << '{' << ext.map {|e| e && ".#{e}" }.join(',') << ',}'
|
23
20
|
end
|
@@ -29,7 +26,7 @@ module Jpmobile
|
|
29
26
|
handler, format = extract_handler_and_format(p, formats)
|
30
27
|
|
31
28
|
contents = File.open(p, "rb") {|io| io.read }
|
32
|
-
variant = p.match(/.+#{path}(.+)\.#{format}.*$/) ? $1 : ''
|
29
|
+
variant = p.match(/.+#{path}(.+)\.#{format.to_sym.to_s}.*$/) ? $1 : ''
|
33
30
|
|
34
31
|
ActionView::Template.new(contents, File.expand_path(p), handler,
|
35
32
|
:virtual_path => path + variant, :format => format)
|
data/lib/jpmobile/trans_sid.rb
CHANGED
@@ -23,35 +23,10 @@ module ActionDispatch
|
|
23
23
|
module Session
|
24
24
|
class AbstractStore
|
25
25
|
include ParamsOverCookie
|
26
|
-
|
27
|
-
class SessionHash
|
28
|
-
def destroy_with_jpmobile
|
29
|
-
destroy_without_jpmobile
|
30
|
-
|
31
|
-
# for TestSession
|
32
|
-
begin
|
33
|
-
@env[ENV_SESSION_OPTIONS_KEY][:id] = ActiveSupport::SecureRandom.hex(16)
|
34
|
-
rescue
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
alias_method_chain :destroy, :jpmobile
|
39
|
-
end
|
40
26
|
end
|
41
27
|
end
|
42
28
|
end
|
43
29
|
|
44
|
-
module ActiveRecord
|
45
|
-
class SessionStore
|
46
|
-
def destroy_with_jpmobile(env)
|
47
|
-
destroy_without_jpmobile(env)
|
48
|
-
env[SESSION_RECORD_KEY] = nil
|
49
|
-
end
|
50
|
-
|
51
|
-
alias_method_chain :destroy, :jpmobile
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
30
|
module ActionController
|
56
31
|
module Redirecting
|
57
32
|
def redirect_to_with_jpmobile(options = {}, response_status = {})
|
@@ -87,7 +62,7 @@ module ActionController
|
|
87
62
|
end
|
88
63
|
|
89
64
|
class Metal #:nodoc:
|
90
|
-
|
65
|
+
class_attribute :trans_sid_mode
|
91
66
|
|
92
67
|
class << self
|
93
68
|
def trans_sid(mode = :mobile)
|