jpmobile 2.0.0.pre.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
2
2
 
3
3
  group :development, :test do
4
4
  gem 'jeweler'
5
- gem 'rails', '3.1.0.rc5'
5
+ gem 'rails', '>= 3.1.0'
6
6
  gem 'rspec'
7
7
  gem 'rspec-rails'
8
8
  gem 'webrat'
data/Rakefile CHANGED
@@ -20,7 +20,9 @@ begin
20
20
 
21
21
  gem.files.exclude 'test'
22
22
  gem.files.exclude 'spec'
23
+ gem.files.exclude 'vendor'
23
24
 
25
+ gem.add_development_dependency('rails', '>=3.1.0')
24
26
  gem.add_development_dependency('jeweler', '>=1.5.1')
25
27
  gem.add_development_dependency('rspec', '>=2.6.0')
26
28
  gem.add_development_dependency('rspec-rails', '>=2.6.0')
@@ -29,7 +31,6 @@ begin
29
31
  gem.add_development_dependency('sqlite3-ruby', '>=1.3.2')
30
32
  gem.add_development_dependency('hpricot', '>=0.8.3')
31
33
  gem.add_development_dependency('git', '>=1.2.5')
32
- gem.add_development_dependency('rails', '>=3.1.0.rc5')
33
34
  end
34
35
  rescue LoadError
35
36
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 2
3
3
  :minor: 0
4
4
  :patch: 0
5
- :build: pre.2
5
+ :build: !!null
@@ -64,7 +64,7 @@ module Jpmobile
64
64
 
65
65
  doc = convert_text_content(doc)
66
66
 
67
- doc.to_html
67
+ doc.to_html.gsub("\xc2\xa0"," ")
68
68
  end
69
69
  end
70
70
 
data/lib/jpmobile/mail.rb CHANGED
@@ -406,6 +406,48 @@ module Mail
406
406
  alias_method :encoded, :encoded_with_jpmobile
407
407
  end
408
408
 
409
+ class ContentTypeElement # :nodoc:
410
+ def initialize_with_jpmobile(string)
411
+ if m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/) and
412
+ m[4].each_byte.detect { |b| (b == 0 || b > 127)}
413
+ name = [m[4]].pack('m').strip
414
+ string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
415
+ end
416
+
417
+ initialize_without_jpmobile(string)
418
+ end
419
+ alias_method :initialize_without_jpmobile, :initialize
420
+ alias_method :initialize, :initialize_with_jpmobile
421
+ end
422
+
423
+ class ContentDispositionElement # :nodoc:
424
+ def initialize_with_jpmobile(string)
425
+ if m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/) and
426
+ m[4].each_byte.detect { |b| (b == 0 || b > 127)}
427
+ name = [m[4]].pack('m').strip
428
+ string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
429
+ end
430
+
431
+ initialize_without_jpmobile(string)
432
+ end
433
+ alias_method :initialize_without_jpmobile, :initialize
434
+ alias_method :initialize, :initialize_with_jpmobile
435
+ end
436
+
437
+ class ContentLocationElement # :nodoc:
438
+ def initialize_with_jpmobile(string)
439
+ if m = string.match(/\A(.*?)(name|filename)=("|')(.+)("|')(.*?)\z/) and
440
+ m[4].each_byte.detect { |b| (b == 0 || b > 127)}
441
+ name = [m[4]].pack('m').strip
442
+ string = "#{m[1]}#{m[2]}=#{m[3]}#{name}#{m[5]}#{m[6]}"
443
+ end
444
+
445
+ initialize_without_jpmobile(string)
446
+ end
447
+ alias_method :initialize_without_jpmobile, :initialize
448
+ alias_method :initialize, :initialize_with_jpmobile
449
+ end
450
+
409
451
  class Sendmail
410
452
  def Sendmail.call(path, arguments, destinations, mail)
411
453
  encoded_mail = mail.encoded
@@ -2,27 +2,50 @@
2
2
  # = セッションIDの付与
3
3
  require 'active_support/version'
4
4
 
5
- module ParamsOverCookie
6
- def self.included(base)
7
- base.class_eval do
8
- # cookie よりも params を先に見るパッチ
9
- def extract_session_id_with_jpmobile(env)
10
- request = ActionDispatch::Request.new(env.dup)
11
- if request.params[@key] and !@cookie_only
12
- sid = request.params[@key]
5
+ module Jpmobile
6
+ module TransSid
7
+ module ParamsOverCookie
8
+ def self.included(base)
9
+ base.class_eval do
10
+ # cookie よりも params を先に見るパッチ
11
+ def extract_session_id_with_jpmobile(env)
12
+ request = ::Rack::Request.new(env)
13
+ if request.params[@key] and !@cookie_only
14
+ sid = request.params[@key]
15
+ end
16
+ sid ||= request.cookies[@key]
17
+ sid
18
+ end
19
+ alias_method_chain :extract_session_id, :jpmobile
13
20
  end
14
- sid ||= request.cookies[@key]
15
- sid
16
21
  end
17
- alias_method_chain :extract_session_id, :jpmobile
18
22
  end
23
+
24
+ ActionDispatch::Session::AbstractStore.send :include, ParamsOverCookie
25
+ end
26
+
27
+ module SessionID
28
+ module_function
29
+
30
+ include ActionDispatch::Session::Compatibility
19
31
  end
20
32
  end
21
33
 
22
- module ActionDispatch
34
+
35
+ module Rack
23
36
  module Session
24
- class AbstractStore
25
- include ParamsOverCookie
37
+ module Abstract
38
+ class SessionHash
39
+ def destroy_with_jpmobile
40
+ destroy_without_jpmobile
41
+
42
+ options = @env[::Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY] if @env
43
+ options ||= {}
44
+ options[:id] = Jpmobile::SessionID.generate_sid
45
+ end
46
+
47
+ alias_method_chain :destroy, :jpmobile
48
+ end
26
49
  end
27
50
  end
28
51
  end
@@ -47,7 +47,7 @@ namespace :test do
47
47
  # setup jpmobile
48
48
  plugin_path = File.join(rails_root, 'vendor', 'plugins', 'jpmobile')
49
49
  FileUtils.mkdir_p(plugin_path)
50
- FileList["*"].exclude("test").exclude("spec").each do |file|
50
+ FileList["*"].exclude("test").exclude("spec").exclude('vendor').each do |file|
51
51
  FileUtils.cp_r(file, plugin_path)
52
52
  end
53
53
 
@@ -22,4 +22,7 @@ class FilterControllerBase < ApplicationController
22
22
  def input_tag
23
23
  render :text => '<input hoge="fuu" value="アブラカダブラ" />'
24
24
  end
25
+ def nbsp_char
26
+ render :text => '<a>アブラ&nbsp;カダブラ</a>'
27
+ end
25
28
  end
@@ -13,6 +13,10 @@ describe "jpmobile integration spec" do
13
13
  get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
14
14
  body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ">')
15
15
  end
16
+ it "は&nbsp;変換されない" do
17
+ get "/#{@controller}/nbsp_char", {}, {"HTTP_USER_AGENT" => @user_agent}
18
+ body.should == send(@conversion_method, '<a>アブラ&nbsp;カダブラ</a>')
19
+ end
16
20
  end
17
21
 
18
22
  shared_examples_for "hankaku_filter :input => false のとき" do
@@ -24,6 +28,10 @@ describe "jpmobile integration spec" do
24
28
  get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
25
29
  body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ" />')
26
30
  end
31
+ it "は&nbsp;変換されない" do
32
+ get "/#{@controller}/nbsp_char", {}, {"HTTP_USER_AGENT" => @user_agent}
33
+ body.should == send(@conversion_method, '<a>アブラ&nbsp;カダブラ</a>')
34
+ end
27
35
  end
28
36
 
29
37
  shared_examples_for "文字コードフィルタが動作しているとき" do
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpmobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.2
5
- prerelease: 6
4
+ version: 2.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yoji Shidara
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-27 00:00:00.000000000Z
13
+ date: 2011-09-01 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jeweler
17
- requirement: &17709120 !ruby/object:Gem::Requirement
17
+ requirement: &13235520 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,21 +22,21 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *17709120
25
+ version_requirements: *13235520
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rails
28
- requirement: &28200840 !ruby/object:Gem::Requirement
28
+ requirement: &13235040 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
- - - =
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.0.rc5
33
+ version: 3.1.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *28200840
36
+ version_requirements: *13235040
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &28200360 !ruby/object:Gem::Requirement
39
+ requirement: &13234560 !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: *28200360
47
+ version_requirements: *13234560
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec-rails
50
- requirement: &28199880 !ruby/object:Gem::Requirement
50
+ requirement: &13097940 !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: *28199880
58
+ version_requirements: *13097940
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: webrat
61
- requirement: &28199400 !ruby/object:Gem::Requirement
61
+ requirement: &13097360 !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: *28199400
69
+ version_requirements: *13097360
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: geokit
72
- requirement: &28198920 !ruby/object:Gem::Requirement
72
+ requirement: &13096760 !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: *28198920
80
+ version_requirements: *13096760
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: sqlite3-ruby
83
- requirement: &28198440 !ruby/object:Gem::Requirement
83
+ requirement: &13096180 !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: *28198440
91
+ version_requirements: *13096180
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: hpricot
94
- requirement: &28197960 !ruby/object:Gem::Requirement
94
+ requirement: &13095580 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,21 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *28197960
102
+ version_requirements: *13095580
103
+ - !ruby/object:Gem::Dependency
104
+ name: rails
105
+ requirement: &13094980 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 3.1.0
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: *13094980
103
114
  - !ruby/object:Gem::Dependency
104
115
  name: jeweler
105
- requirement: &28197480 !ruby/object:Gem::Requirement
116
+ requirement: &13094460 !ruby/object:Gem::Requirement
106
117
  none: false
107
118
  requirements:
108
119
  - - ! '>='
@@ -110,10 +121,10 @@ dependencies:
110
121
  version: 1.5.1
111
122
  type: :development
112
123
  prerelease: false
113
- version_requirements: *28197480
124
+ version_requirements: *13094460
114
125
  - !ruby/object:Gem::Dependency
115
126
  name: rspec
116
- requirement: &28197000 !ruby/object:Gem::Requirement
127
+ requirement: &13093880 !ruby/object:Gem::Requirement
117
128
  none: false
118
129
  requirements:
119
130
  - - ! '>='
@@ -121,10 +132,10 @@ dependencies:
121
132
  version: 2.6.0
122
133
  type: :development
123
134
  prerelease: false
124
- version_requirements: *28197000
135
+ version_requirements: *13093880
125
136
  - !ruby/object:Gem::Dependency
126
137
  name: rspec-rails
127
- requirement: &28196520 !ruby/object:Gem::Requirement
138
+ requirement: &13093280 !ruby/object:Gem::Requirement
128
139
  none: false
129
140
  requirements:
130
141
  - - ! '>='
@@ -132,10 +143,10 @@ dependencies:
132
143
  version: 2.6.0
133
144
  type: :development
134
145
  prerelease: false
135
- version_requirements: *28196520
146
+ version_requirements: *13093280
136
147
  - !ruby/object:Gem::Dependency
137
148
  name: webrat
138
- requirement: &28196040 !ruby/object:Gem::Requirement
149
+ requirement: &13092700 !ruby/object:Gem::Requirement
139
150
  none: false
140
151
  requirements:
141
152
  - - ! '>='
@@ -143,10 +154,10 @@ dependencies:
143
154
  version: 0.7.2
144
155
  type: :development
145
156
  prerelease: false
146
- version_requirements: *28196040
157
+ version_requirements: *13092700
147
158
  - !ruby/object:Gem::Dependency
148
159
  name: geokit
149
- requirement: &28195560 !ruby/object:Gem::Requirement
160
+ requirement: &13092140 !ruby/object:Gem::Requirement
150
161
  none: false
151
162
  requirements:
152
163
  - - ! '>='
@@ -154,10 +165,10 @@ dependencies:
154
165
  version: 1.5.0
155
166
  type: :development
156
167
  prerelease: false
157
- version_requirements: *28195560
168
+ version_requirements: *13092140
158
169
  - !ruby/object:Gem::Dependency
159
170
  name: sqlite3-ruby
160
- requirement: &28195080 !ruby/object:Gem::Requirement
171
+ requirement: &13091660 !ruby/object:Gem::Requirement
161
172
  none: false
162
173
  requirements:
163
174
  - - ! '>='
@@ -165,10 +176,10 @@ dependencies:
165
176
  version: 1.3.2
166
177
  type: :development
167
178
  prerelease: false
168
- version_requirements: *28195080
179
+ version_requirements: *13091660
169
180
  - !ruby/object:Gem::Dependency
170
181
  name: hpricot
171
- requirement: &28194600 !ruby/object:Gem::Requirement
182
+ requirement: &13091180 !ruby/object:Gem::Requirement
172
183
  none: false
173
184
  requirements:
174
185
  - - ! '>='
@@ -176,10 +187,10 @@ dependencies:
176
187
  version: 0.8.3
177
188
  type: :development
178
189
  prerelease: false
179
- version_requirements: *28194600
190
+ version_requirements: *13091180
180
191
  - !ruby/object:Gem::Dependency
181
192
  name: git
182
- requirement: &28194120 !ruby/object:Gem::Requirement
193
+ requirement: &13090700 !ruby/object:Gem::Requirement
183
194
  none: false
184
195
  requirements:
185
196
  - - ! '>='
@@ -187,18 +198,7 @@ dependencies:
187
198
  version: 1.2.5
188
199
  type: :development
189
200
  prerelease: false
190
- version_requirements: *28194120
191
- - !ruby/object:Gem::Dependency
192
- name: rails
193
- requirement: &28193640 !ruby/object:Gem::Requirement
194
- none: false
195
- requirements:
196
- - - ! '>='
197
- - !ruby/object:Gem::Version
198
- version: 3.1.0.rc5
199
- type: :development
200
- prerelease: false
201
- version_requirements: *28193640
201
+ version_requirements: *13090700
202
202
  description: A Rails plugin for Japanese mobile-phones
203
203
  email: dara@shidara.net
204
204
  executables: []
@@ -421,9 +421,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
421
421
  required_rubygems_version: !ruby/object:Gem::Requirement
422
422
  none: false
423
423
  requirements:
424
- - - ! '>'
424
+ - - ! '>='
425
425
  - !ruby/object:Gem::Version
426
- version: 1.3.1
426
+ version: '0'
427
427
  requirements: []
428
428
  rubyforge_project:
429
429
  rubygems_version: 1.8.6