jpmobile 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README.rdoc +29 -15
- data/Rakefile +3 -3
- data/lib/jpmobile/emoticon/conversion_table.rb +10 -9
- data/lib/jpmobile/emoticon.rb +14 -6
- data/lib/jpmobile/filter.rb +2 -9
- data/lib/jpmobile/helpers.rb +2 -0
- data/lib/jpmobile/hook_action_view.rb +5 -5
- data/lib/jpmobile/mobile/softbank.rb +2 -2
- data/lib/jpmobile/mobile/z_display_info_docomo.rb +577 -528
- data/lib/jpmobile/mobile/z_ip_addresses_au.rb +5 -1
- data/lib/jpmobile/mobile/z_ip_addresses_softbank.rb +2 -2
- data/lib/jpmobile/mobile/z_ip_addresses_willcom.rb +53 -13
- data/lib/jpmobile/trans_sid.rb +28 -14
- data/lib/jpmobile/version.rb +1 -1
- data/test/legacy/emoticon_test.rb +6 -0
- data/test/legacy/helpers_test.rb +6 -5
- data/test/rails/2.3.2/spec/controllers/trans_sid_spec.rb +99 -0
- data/test/rails/overrides/app/controllers/{application.rb → application_controller.rb} +0 -0
- data/test/rails/overrides/app/controllers/filter_controller.rb +1 -0
- data/test/rails/overrides/spec/controllers/filter_spec.rb +1 -0
- data/test/rails/overrides/spec/controllers/trans_sid_spec.rb +20 -2
- data/test/rails/rails_root/README +6 -19
- data/test/rails/rails_root/app/controllers/{application.rb → application_controller.rb} +0 -0
- data/test/rails/rails_root/app/controllers/trans_sid_controller.rb +4 -2
- data/test/rails/rails_root/app/views/filter/index.html.erb +0 -0
- data/test/rails/rails_root/app/views/hankaku_filter/index.html.erb +0 -0
- data/test/rails/rails_root/app/views/template_path/_partial.html.erb +1 -0
- data/test/rails/rails_root/app/views/template_path/_partial_mobile.html.erb +1 -0
- data/test/rails/rails_root/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
- data/test/rails/rails_root/app/views/template_path/partial.html.erb +2 -0
- data/test/rails/rails_root/config/boot.rb +2 -1
- data/test/rails/rails_root/config/environment.rb +15 -48
- data/test/rails/rails_root/config/environments/production.rb +11 -7
- data/test/rails/rails_root/config/environments/test.rb +6 -0
- data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails/rails_root/config/initializers/new_rails_defaults.rb +4 -0
- data/test/rails/rails_root/config/initializers/session_store.rb +15 -0
- data/test/rails/rails_root/config/routes.rb +1 -1
- data/test/rails/rails_root/db/development.sqlite3 +0 -0
- data/test/rails/rails_root/db/seeds.rb +7 -0
- data/test/rails/rails_root/db/test.sqlite3 +0 -0
- data/test/rails/rails_root/doc/README_FOR_APP +2 -5
- data/test/rails/rails_root/log/development.log +9 -9
- data/test/rails/rails_root/log/test.log +198 -148
- data/test/rails/rails_root/public/500.html +0 -3
- data/test/rails/rails_root/public/index.html +1 -0
- data/test/rails/rails_root/script/about +2 -2
- data/test/rails/rails_root/script/console +1 -1
- data/test/rails/rails_root/script/dbconsole +1 -1
- data/test/rails/rails_root/script/destroy +1 -1
- data/test/rails/rails_root/script/generate +1 -1
- data/test/rails/rails_root/script/performance/benchmarker +1 -1
- data/test/rails/rails_root/script/performance/profiler +1 -1
- data/test/rails/rails_root/script/plugin +1 -1
- data/test/rails/rails_root/script/runner +1 -1
- data/test/rails/rails_root/script/server +1 -1
- data/test/rails/rails_root/spec/controllers/template_path_spec.rb +49 -19
- data/test/rails/rails_root/spec/controllers/trans_sid_spec.rb +11 -8
- data/test/rails/rails_root/test/test_helper.rb +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/MIT-LICENSE +2 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/README.rdoc +31 -15
- data/test/rails/rails_root/vendor/plugins/jpmobile/Rakefile +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +3 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +3 -10
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +2 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +12 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +79 -91
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_request.rb +2 -10
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +9 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +2 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_display_info_docomo.rb +577 -528
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_au.rb +5 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_softbank.rb +2 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_willcom.rb +53 -13
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/auth.rb +55 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/combined_logger.rb +54 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/request.rb +7 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/trans_sid.rb +14 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +76 -65
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/version.rb +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/tasks/jpmobile_tasks.rake +26 -6
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/{update_display_info_docomo.rb → disabled_update_display_info_docomo.rb} +11 -6
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +0 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +0 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_au.rb +4 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_willcom.rb +2 -2
- data/tools/{update_display_info_docomo.rb → disabled_update_display_info_docomo.rb} +11 -6
- data/tools/generate_docomo_emoticon_table.rb +0 -1
- data/tools/generate_softbank_emoticon_table.rb +0 -1
- data/tools/update_ip_addresses_au.rb +4 -3
- data/tools/update_ip_addresses_willcom.rb +2 -2
- metadata +65 -35
- data/test/rails/rails_root/public/dispatch.cgi +0 -10
- data/test/rails/rails_root/public/dispatch.fcgi +0 -24
- data/test/rails/rails_root/public/dispatch.rb +0 -10
- data/test/rails/rails_root/script/performance/request +0 -3
- data/test/rails/rails_root/script/process/inspector +0 -3
- data/test/rails/rails_root/script/process/reaper +0 -3
- data/test/rails/rails_root/script/process/spawner +0 -3
@@ -19,4 +19,8 @@ Jpmobile::Mobile::Au::IP_ADDRESSES =
|
|
19
19
|
"118.152.214.192/26",
|
20
20
|
"118.159.131.0/25",
|
21
21
|
"118.159.133.0/25",
|
22
|
-
"118.159.132.160/27"
|
22
|
+
"118.159.132.160/27",
|
23
|
+
"111.86.142.0/26",
|
24
|
+
"111.86.141.64/26",
|
25
|
+
"111.86.141.128/26",
|
26
|
+
"111.86.141.192/26"].map {|ip| IPAddr.new(ip) }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# = IPアドレス帯域テーブル(手動更新分)
|
2
3
|
# == SoftBank
|
3
4
|
# http://developers.softbankmobile.co.jp/dp/tech_svc/web/ip.php
|
@@ -10,8 +11,7 @@ Jpmobile::Mobile::Softbank::IP_ADDRESSES = %w(
|
|
10
11
|
210.146.7.192/26
|
11
12
|
210.146.60.192/26
|
12
13
|
210.151.9.128/26
|
13
|
-
210.169.130.112/28
|
14
14
|
210.175.1.128/25
|
15
|
-
210.228.189.0/24
|
16
15
|
211.8.159.128/25
|
16
|
+
210.175.1.128/25
|
17
17
|
).map {|ip| IPAddr.new(ip) }
|
@@ -56,12 +56,28 @@ Jpmobile::Mobile::Willcom::IP_ADDRESSES =
|
|
56
56
|
"61.204.93.0/24",
|
57
57
|
"61.204.94.0/24",
|
58
58
|
"61.204.95.0/24",
|
59
|
+
"114.20.49.0/24",
|
60
|
+
"114.20.50.0/24",
|
61
|
+
"114.20.51.0/24",
|
62
|
+
"114.20.52.0/24",
|
63
|
+
"114.20.53.0/24",
|
64
|
+
"114.20.54.0/24",
|
65
|
+
"114.20.55.0/24",
|
66
|
+
"114.20.56.0/24",
|
67
|
+
"114.20.57.0/24",
|
68
|
+
"114.20.58.0/24",
|
69
|
+
"114.20.59.0/24",
|
70
|
+
"114.20.60.0/24",
|
71
|
+
"114.20.61.0/24",
|
72
|
+
"114.20.62.0/24",
|
73
|
+
"114.20.63.0/24",
|
74
|
+
"114.20.64.0/24",
|
75
|
+
"114.20.65.0/24",
|
76
|
+
"114.20.66.0/24",
|
77
|
+
"114.20.67.0/24",
|
78
|
+
"114.21.255.0/27",
|
59
79
|
"125.28.0.0/24",
|
60
80
|
"125.28.1.0/24",
|
61
|
-
"125.28.11.0/24",
|
62
|
-
"125.28.12.0/24",
|
63
|
-
"125.28.13.0/24",
|
64
|
-
"125.28.14.0/24",
|
65
81
|
"125.28.15.0/24",
|
66
82
|
"125.28.16.0/24",
|
67
83
|
"125.28.17.0/24",
|
@@ -69,8 +85,6 @@ Jpmobile::Mobile::Willcom::IP_ADDRESSES =
|
|
69
85
|
"125.28.3.0/24",
|
70
86
|
"125.28.4.0/24",
|
71
87
|
"125.28.5.0/24",
|
72
|
-
"125.28.6.0/24",
|
73
|
-
"125.28.7.0/24",
|
74
88
|
"125.28.8.0/24",
|
75
89
|
"210.168.246.0/24",
|
76
90
|
"210.168.247.0/24",
|
@@ -89,17 +103,12 @@ Jpmobile::Mobile::Willcom::IP_ADDRESSES =
|
|
89
103
|
"211.18.235.0/24",
|
90
104
|
"211.18.236.0/24",
|
91
105
|
"211.18.237.0/24",
|
92
|
-
"211.18.238.0/24",
|
93
|
-
"211.18.239.0/24",
|
94
106
|
"219.108.10.0/24",
|
95
107
|
"219.108.11.0/24",
|
96
108
|
"219.108.12.0/24",
|
97
109
|
"219.108.13.0/24",
|
98
110
|
"219.108.14.0/24",
|
99
111
|
"219.108.15.0/24",
|
100
|
-
"219.108.4.0/24",
|
101
|
-
"219.108.5.0/24",
|
102
|
-
"219.108.6.0/24",
|
103
112
|
"219.108.7.0/24",
|
104
113
|
"219.108.8.0/24",
|
105
114
|
"219.108.9.0/24",
|
@@ -108,10 +117,41 @@ Jpmobile::Mobile::Willcom::IP_ADDRESSES =
|
|
108
117
|
"221.119.2.0/24",
|
109
118
|
"221.119.3.0/24",
|
110
119
|
"221.119.4.0/24",
|
111
|
-
"221.119.5.0/24",
|
112
120
|
"221.119.6.0/24",
|
113
121
|
"221.119.7.0/24",
|
114
122
|
"221.119.8.0/24",
|
115
123
|
"221.119.9.0/24",
|
124
|
+
"114.20.49.0/24",
|
125
|
+
"114.20.50.0/24",
|
126
|
+
"114.20.51.0/24",
|
127
|
+
"114.20.52.0/24",
|
128
|
+
"114.20.53.0/24",
|
129
|
+
"114.20.54.0/24",
|
130
|
+
"114.20.55.0/24",
|
131
|
+
"114.20.56.0/24",
|
132
|
+
"114.20.57.0/24",
|
133
|
+
"114.20.58.0/24",
|
134
|
+
"114.20.59.0/24",
|
135
|
+
"114.20.60.0/24",
|
136
|
+
"114.20.61.0/24",
|
137
|
+
"114.20.62.0/24",
|
138
|
+
"114.20.63.0/24",
|
139
|
+
"114.20.64.0/24",
|
140
|
+
"114.20.65.0/24",
|
141
|
+
"114.20.66.0/24",
|
142
|
+
"114.20.67.0/24",
|
143
|
+
"114.21.255.0/27",
|
116
144
|
"219.108.2.0/24",
|
117
|
-
"219.108.3.0/24"
|
145
|
+
"219.108.3.0/24",
|
146
|
+
"125.28.6.0/24",
|
147
|
+
"125.28.7.0/24",
|
148
|
+
"125.28.11.0/24",
|
149
|
+
"125.28.12.0/24",
|
150
|
+
"125.28.13.0/24",
|
151
|
+
"125.28.14.0/24",
|
152
|
+
"211.18.238.0/24",
|
153
|
+
"211.18.239.0/24",
|
154
|
+
"219.108.4.0/24",
|
155
|
+
"219.108.5.0/24",
|
156
|
+
"219.108.6.0/24",
|
157
|
+
"221.119.5.0/24"].map {|ip| IPAddr.new(ip) }
|
data/lib/jpmobile/trans_sid.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# = セッションIDの付与
|
3
|
+
require 'active_support/version'
|
2
4
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def
|
5
|
+
module ParamsOverCookie
|
6
|
+
def self.included(base)
|
7
|
+
base.class_eval do
|
8
|
+
# cookie よりも params を先に見るパッチ
|
9
|
+
def load_session_with_jpmobile(env)
|
8
10
|
request = Rack::Request.new(env)
|
9
11
|
unless @cookie_only
|
10
12
|
sid = request.params[@key]
|
@@ -14,8 +16,14 @@ module ActionController
|
|
14
16
|
sid, session = get_session(env, sid)
|
15
17
|
[sid, session]
|
16
18
|
end
|
19
|
+
alias_method_chain :load_session, :jpmobile
|
17
20
|
end
|
18
21
|
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module ActionController
|
25
|
+
# cookie よりも params を先に見るパッチ
|
26
|
+
Session::AbstractStore.send :include, ParamsOverCookie
|
19
27
|
|
20
28
|
class Base #:nodoc:
|
21
29
|
class_inheritable_accessor :trans_sid_mode
|
@@ -27,7 +35,7 @@ module ActionController
|
|
27
35
|
end
|
28
36
|
|
29
37
|
def redirect_to_full_url(url, status)
|
30
|
-
if apply_trans_sid? and !url.match(/#{session_key}/)
|
38
|
+
if apply_trans_sid? and !url.match(/#{session_key}/) and jpmobile_session_id
|
31
39
|
uri = URI.parse(url)
|
32
40
|
if uri.query
|
33
41
|
uri.query += "&#{session_key}=#{jpmobile_session_id}"
|
@@ -56,15 +64,20 @@ module ActionController
|
|
56
64
|
private
|
57
65
|
# trans_sidを適用すべきかを返す。
|
58
66
|
def apply_trans_sid?
|
59
|
-
|
60
|
-
return
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
# session_id が blank の場合は適用しない
|
68
|
+
return false if trans_sid_mode and jpmobile_session_id.blank?
|
69
|
+
|
70
|
+
case trans_sid_mode
|
71
|
+
when :always
|
72
|
+
session.inspect
|
73
|
+
return true
|
74
|
+
when :mobile
|
75
|
+
if request.mobile? and !request.mobile.supports_cookie?
|
76
|
+
session.inspect
|
77
|
+
return true
|
66
78
|
end
|
67
79
|
end
|
80
|
+
|
68
81
|
return false
|
69
82
|
end
|
70
83
|
end
|
@@ -87,7 +100,7 @@ module Jpmobile::TransSid #:nodoc:
|
|
87
100
|
private
|
88
101
|
# session_keyを返す。
|
89
102
|
def session_key
|
90
|
-
(request.session_options ||
|
103
|
+
ActionController::Base.session_options.merge(request.session_options || {})[:key]
|
91
104
|
end
|
92
105
|
# session_idを返す
|
93
106
|
def jpmobile_session_id
|
@@ -101,6 +114,7 @@ module Jpmobile::TransSid #:nodoc:
|
|
101
114
|
def append_session_id_parameter
|
102
115
|
return unless request # for test process
|
103
116
|
return unless apply_trans_sid?
|
117
|
+
return unless jpmobile_session_id
|
104
118
|
response.body.gsub!(%r{(</form>)}i, sid_hidden_field_tag+'\1')
|
105
119
|
end
|
106
120
|
end
|
data/lib/jpmobile/version.rb
CHANGED
@@ -7,6 +7,9 @@ class DocomoEmoticonTest < Test::Unit::TestCase
|
|
7
7
|
def test_unicodecr_external_docomo
|
8
8
|
assert_equal "\xf8\x9f", Jpmobile::Emoticon::unicodecr_to_external("")
|
9
9
|
end
|
10
|
+
def test_unicodecr_external_docomo_for_string
|
11
|
+
assert_equal "\xf8\x9f\xf8\xa0", Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO, true)
|
12
|
+
end
|
10
13
|
def test_unicodecr_utf8_docomo
|
11
14
|
assert_equal "\356\230\276", Jpmobile::Emoticon::unicodecr_to_utf8("")
|
12
15
|
end
|
@@ -49,6 +52,9 @@ class SoftbankEmoticonTest < Test::Unit::TestCase
|
|
49
52
|
def test_softbank_utf8_cr
|
50
53
|
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr("\xef\x80\x81")
|
51
54
|
end
|
55
|
+
def test_unicodecr_external_softbank_for_string
|
56
|
+
assert_equal "\x1b$Gj\x0f\x1b$Gi\x0f", Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, true)
|
57
|
+
end
|
52
58
|
end
|
53
59
|
|
54
60
|
class KoukaiEmoticonTest < Test::Unit::TestCase
|
data/test/legacy/helpers_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require File.dirname(__FILE__)+'/helper'
|
2
3
|
require 'hpricot'
|
3
4
|
|
@@ -32,7 +33,7 @@ class HelpersTest < Test::Unit::TestCase
|
|
32
33
|
text,attrs,path,params = links.first
|
33
34
|
assert_equal("STRING", text)
|
34
35
|
assert_equal("http://example.jp", path)
|
35
|
-
assert(attrs.include?("lcs"))
|
36
|
+
assert(attrs.to_hash.include?("lcs"))
|
36
37
|
end
|
37
38
|
|
38
39
|
# get_position_link_to(自動判別), TUKA
|
@@ -77,7 +78,7 @@ class HelpersTest < Test::Unit::TestCase
|
|
77
78
|
text,attrs,path,params = links.first
|
78
79
|
assert_equal("STRING", text)
|
79
80
|
assert_equal("http://example.jp", path)
|
80
|
-
assert(attrs.include?("z"))
|
81
|
+
assert(attrs.to_hash.include?("z"))
|
81
82
|
end
|
82
83
|
|
83
84
|
# get_position_link_to(自動判別), Vodafone
|
@@ -119,7 +120,7 @@ class HelpersTest < Test::Unit::TestCase
|
|
119
120
|
text,attrs,path,params = links.first
|
120
121
|
assert_equal("STRING", text)
|
121
122
|
assert_equal("http://example.jp", path)
|
122
|
-
assert(attrs.include?("utn"))
|
123
|
+
assert(attrs.to_hash.include?("utn"))
|
123
124
|
end
|
124
125
|
|
125
126
|
# DoCoMo オープンiエリア取得用のリンクが正しく出力されるか。
|
@@ -142,7 +143,7 @@ class HelpersTest < Test::Unit::TestCase
|
|
142
143
|
text,attrs,path,params = links.first
|
143
144
|
assert_equal("STRING", text)
|
144
145
|
assert_equal("http://example.jp", path)
|
145
|
-
assert(attrs.include?("lcs"))
|
146
|
+
assert(attrs.to_hash.include?("lcs"))
|
146
147
|
end
|
147
148
|
|
148
149
|
# au簡易位置情報取得用のリンクが正しく出力されるか。
|
@@ -177,7 +178,7 @@ class HelpersTest < Test::Unit::TestCase
|
|
177
178
|
text,attrs,path,params = links.first
|
178
179
|
assert_equal("STRING", text)
|
179
180
|
assert_equal("http://example.jp", path)
|
180
|
-
assert(attrs.include?("z"))
|
181
|
+
assert(attrs.to_hash.include?("z"))
|
181
182
|
end
|
182
183
|
|
183
184
|
# Softbank 3G 位置情報取得用のリンクが正しく出力されるか。
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe "trans_sid が起動しないとき", :shared => true do
|
5
|
+
it "で link_to の自動書き換えが行われない" do
|
6
|
+
get :link
|
7
|
+
response.body.should =~ %r{^<a href="/.+?/link">linkto</a>$}
|
8
|
+
end
|
9
|
+
it "で form の自動書き換えが行われない" do
|
10
|
+
get :form
|
11
|
+
response.body.should =~ %r{^<form action="/.+?/form" method="post">Hello</form>$}
|
12
|
+
end
|
13
|
+
it "で redirect の自動書き換えが行われない" do
|
14
|
+
get :redirect
|
15
|
+
response.should redirect_to('/')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "trans_sid が起動するとき", :shared => true do
|
20
|
+
before :each do
|
21
|
+
request.session.session_id = "mysessionid"
|
22
|
+
end
|
23
|
+
it "で link_to の自動書き換えが行われる" do
|
24
|
+
get :link
|
25
|
+
response.body.should =~ %r{^<a href="/.+?/link\?_session_id=mysessionid">linkto</a>$}
|
26
|
+
end
|
27
|
+
it "で form の自動書き換えが行われる" do
|
28
|
+
get :form
|
29
|
+
response.body.should =~ %r{^<form action="/.+?/form\?_session_id=mysessionid" method="post">Hello<input type="hidden" name="_session_id" value="mysessionid" /></form>$}
|
30
|
+
end
|
31
|
+
it "で redirect の自動書き換えが行われる" do
|
32
|
+
get :redirect
|
33
|
+
response.should redirect_to('/?_session_id=mysessionid')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe TransSidBaseController, "という trans_sid が有効になっていないコントローラ" do
|
38
|
+
controller_name :trans_sid_base
|
39
|
+
it "の trans_sid_mode は nil" do
|
40
|
+
controller.trans_sid_mode.should be_nil
|
41
|
+
end
|
42
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
43
|
+
end
|
44
|
+
|
45
|
+
describe TransSidNoneController, "という trans_sid :none が指定されているコントローラ" do
|
46
|
+
controller_name :trans_sid_none
|
47
|
+
it "の trans_sid_mode は :none" do
|
48
|
+
controller.trans_sid_mode.should == :none
|
49
|
+
end
|
50
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
51
|
+
end
|
52
|
+
|
53
|
+
describe TransSidAlwaysController, "という trans_sid :always が指定されているコントローラ" do
|
54
|
+
controller_name :trans_sid_always
|
55
|
+
before :each do
|
56
|
+
request.session.session_id = "mysessionid"
|
57
|
+
end
|
58
|
+
it "の trans_sid_mode は :always" do
|
59
|
+
controller.trans_sid_mode.should == :always
|
60
|
+
end
|
61
|
+
it_should_behave_like "trans_sid が起動するとき"
|
62
|
+
end
|
63
|
+
|
64
|
+
describe TransSidMobileController, "という trans_sid :mobile が指定されているコントローラ" do
|
65
|
+
controller_name :trans_sid_mobile
|
66
|
+
it "の trans_sid_mode は :mobile" do
|
67
|
+
controller.trans_sid_mode.should == :mobile
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def describe_mobile_with_ua(user_agent, &block)
|
72
|
+
describe("trans_sid :mobile が指定されているコントローラに #{user_agent} からアクセスしたとき") do
|
73
|
+
controller_name :trans_sid_mobile
|
74
|
+
before do
|
75
|
+
request.user_agent = user_agent
|
76
|
+
end
|
77
|
+
instance_eval(&block)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)" do
|
82
|
+
it_should_behave_like "trans_sid が起動するとき"
|
83
|
+
end
|
84
|
+
|
85
|
+
describe_mobile_with_ua "J-PHONE/3.0/V301D" do
|
86
|
+
it_should_behave_like "trans_sid が起動するとき"
|
87
|
+
end
|
88
|
+
|
89
|
+
describe_mobile_with_ua "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0" do
|
90
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
91
|
+
end
|
92
|
+
|
93
|
+
describe_mobile_with_ua "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1" do
|
94
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
95
|
+
end
|
96
|
+
|
97
|
+
describe_mobile_with_ua "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0" do
|
98
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
99
|
+
end
|
File without changes
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
3
|
|
3
4
|
describe "trans_sid が起動しないとき", :shared => true do
|
@@ -17,7 +18,7 @@ end
|
|
17
18
|
|
18
19
|
describe "trans_sid が起動するとき", :shared => true do
|
19
20
|
before :each do
|
20
|
-
request.
|
21
|
+
request.session_options[:id] = "mysessionid"
|
21
22
|
end
|
22
23
|
it "で link_to の自動書き換えが行われる" do
|
23
24
|
get :link
|
@@ -31,6 +32,11 @@ describe "trans_sid が起動するとき", :shared => true do
|
|
31
32
|
get :redirect
|
32
33
|
response.should redirect_to('/?_session_id=mysessionid')
|
33
34
|
end
|
35
|
+
it "でセッションIDが空のときには有効にならない" do
|
36
|
+
request.session_options[:id] = ""
|
37
|
+
get :link
|
38
|
+
response.body.should =~ %r{^<a href="/.+?/link">linkto</a>$}
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
describe TransSidBaseController, "という trans_sid が有効になっていないコントローラ" do
|
@@ -52,7 +58,7 @@ end
|
|
52
58
|
describe TransSidAlwaysController, "という trans_sid :always が指定されているコントローラ" do
|
53
59
|
controller_name :trans_sid_always
|
54
60
|
before :each do
|
55
|
-
request.
|
61
|
+
request.session_options[:id] = "mysessionid"
|
56
62
|
end
|
57
63
|
it "の trans_sid_mode は :always" do
|
58
64
|
controller.trans_sid_mode.should == :always
|
@@ -77,6 +83,18 @@ def describe_mobile_with_ua(user_agent, &block)
|
|
77
83
|
end
|
78
84
|
end
|
79
85
|
|
86
|
+
describe TransSidAlwaysController, "という trans_sid :always が指定されているコントローラで reset_session したとき" do
|
87
|
+
controller_name :trans_sid_always
|
88
|
+
before :each do
|
89
|
+
# 擬似的 reset_session
|
90
|
+
request.session_options[:id] = nil
|
91
|
+
end
|
92
|
+
it "の trans_sid_mode は :always" do
|
93
|
+
controller.trans_sid_mode.should == :always
|
94
|
+
end
|
95
|
+
it_should_behave_like "trans_sid が起動しないとき"
|
96
|
+
end
|
97
|
+
|
80
98
|
describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)" do
|
81
99
|
it_should_behave_like "trans_sid が起動するとき"
|
82
100
|
end
|
@@ -36,32 +36,19 @@ link:files/vendor/rails/actionpack/README.html.
|
|
36
36
|
|
37
37
|
== Web Servers
|
38
38
|
|
39
|
-
By default, Rails will try to use Mongrel
|
40
|
-
|
41
|
-
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
|
42
|
-
that you can always get up and running quickly.
|
39
|
+
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
40
|
+
with a variety of other web servers.
|
43
41
|
|
44
42
|
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
45
43
|
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
46
44
|
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
47
45
|
More info at: http://mongrel.rubyforge.org
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
|
53
|
-
http://www.lighttpd.net.
|
47
|
+
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
48
|
+
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
49
|
+
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
54
50
|
|
55
|
-
|
56
|
-
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
|
57
|
-
for production.
|
58
|
-
|
59
|
-
But of course its also possible to run Rails on any platform that supports FCGI.
|
60
|
-
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
|
61
|
-
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
62
|
-
|
63
|
-
|
64
|
-
== Apache .htaccess example
|
51
|
+
== Apache .htaccess example for FCGI/CGI
|
65
52
|
|
66
53
|
# General Apache options
|
67
54
|
AddHandler fastcgi-script .fcgi
|
File without changes
|
@@ -1,11 +1,14 @@
|
|
1
1
|
class TransSidBaseController < ApplicationController
|
2
|
-
|
2
|
+
ActionController::Base.session_options[:key] = '_session_id'
|
3
3
|
def form
|
4
4
|
render :inline=>%{<% form_tag do %>Hello<% end %>}
|
5
5
|
end
|
6
6
|
def link
|
7
7
|
render :inline=>%{<%= link_to "linkto" %>}
|
8
8
|
end
|
9
|
+
def redirect
|
10
|
+
redirect_to('/')
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
class TransSidAlwaysController < TransSidBaseController
|
@@ -22,5 +25,4 @@ end
|
|
22
25
|
|
23
26
|
class TransSidAlwaysAndSessionOffController < TransSidBaseController
|
24
27
|
trans_sid :always
|
25
|
-
session :off
|
26
28
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>_partial.html.erb</h2>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>_partial_mobile.html.erb</h2>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2>_partial_mobile_docomo.html.erb</h2>
|
@@ -44,6 +44,7 @@ module Rails
|
|
44
44
|
def load_initializer
|
45
45
|
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
46
|
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
@@ -81,8 +82,8 @@ module Rails
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def load_rubygems
|
85
|
+
min_version = '1.3.2'
|
84
86
|
require 'rubygems'
|
85
|
-
min_version = '1.3.1'
|
86
87
|
unless rubygems_version >= min_version
|
87
88
|
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
89
|
exit 1
|
@@ -1,11 +1,7 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file
|
2
2
|
|
3
|
-
# Uncomment below to force Rails into production mode when
|
4
|
-
# you don't control web/app server and can't set it the proper way
|
5
|
-
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
-
|
7
3
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '2.
|
4
|
+
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
9
5
|
|
10
6
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
7
|
require File.join(File.dirname(__FILE__), 'boot')
|
@@ -14,62 +10,33 @@ Rails::Initializer.run do |config|
|
|
14
10
|
# Settings in config/environments/* take precedence over those specified here.
|
15
11
|
# Application configuration should go into files in config/initializers
|
16
12
|
# -- all .rb files in that directory are automatically loaded.
|
17
|
-
# See Rails::Configuration for more options.
|
18
13
|
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
22
16
|
|
23
|
-
# Specify gems that this application depends on
|
24
|
-
# They can then be installed with "rake gems:install" on new installations.
|
25
|
-
# You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
|
17
|
+
# Specify gems that this application depends on and have them installed with rake gems:install
|
26
18
|
# config.gem "bj"
|
27
19
|
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
28
20
|
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
29
21
|
# config.gem "aws-s3", :lib => "aws/s3"
|
30
22
|
|
31
|
-
# Only load the plugins named here, in the order given
|
32
|
-
# in vendor/plugins are loaded in alphabetical order.
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
33
24
|
# :all can be used as a placeholder for all plugins not explicitly named
|
34
25
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
35
26
|
|
36
|
-
#
|
37
|
-
#
|
27
|
+
# Skip frameworks you're not going to use. To use Rails without a database,
|
28
|
+
# you must remove the Active Record framework.
|
29
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
38
30
|
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# config.log_level = :debug
|
31
|
+
# Activate observers that should always be running
|
32
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
42
33
|
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
|
34
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
35
|
+
# Run "rake -D time" for a list of tasks for finding time zone names.
|
46
36
|
config.time_zone = 'UTC'
|
47
37
|
|
48
|
-
# The
|
49
|
-
#
|
50
|
-
# config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
|
38
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
39
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
51
40
|
# config.i18n.default_locale = :de
|
52
|
-
|
53
|
-
# Your secret key for verifying cookie session data integrity.
|
54
|
-
# If you change this key, all old sessions will become invalid!
|
55
|
-
# Make sure the secret is at least 30 characters and all random,
|
56
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
57
|
-
config.action_controller.session = {
|
58
|
-
:session_key => '_rails_root_session',
|
59
|
-
:secret => '15aff507586a8efbe016f95e62060ea3bea4abedee54b79b1173484080764854dfec4304d872c01d493184dfd6831bcf355d69e94ce1b6547ae64952589f1dbc'
|
60
|
-
}
|
61
|
-
|
62
|
-
# Use the database for sessions instead of the cookie-based default,
|
63
|
-
# which shouldn't be used to store highly confidential information
|
64
|
-
# (create the session table with "rake db:sessions:create")
|
65
|
-
# config.action_controller.session_store = :active_record_store
|
66
|
-
|
67
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
68
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
69
|
-
# like if you have constraints or database-specific column types
|
70
|
-
# config.active_record.schema_format = :sql
|
71
|
-
|
72
|
-
# Activate observers that should always be running
|
73
|
-
# Please note that observers generated using script/generate observer need to have an _observer suffix
|
74
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
75
41
|
end
|
42
|
+
ActionController::Base.session = {:key => "_session_id", :cookie_only => false}
|