jpmobile 1.0.0.pre → 1.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -217,7 +217,7 @@ Androidの場合はindex_smart_phone_android.html.erb、Windows Phoneの場合
217
217
  自動振り分けを無効化するには、アクションにおいて以下のように設定する
218
218
 
219
219
  def index
220
- self.lookup_context.mobile = nil
220
+ disable_mobile_view!
221
221
  end
222
222
 
223
223
  === 位置情報の取得用リンクの生成
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 0
4
4
  :patch: 0
5
- :build: pre
5
+ :build: pre.1
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ require 'jpmobile/lookup_context'
3
+
2
4
  module ActionController
3
5
  class Base
4
6
  include Jpmobile::Helpers
@@ -16,4 +18,3 @@ module ActionController
16
18
  end
17
19
 
18
20
  ActionController::Request.send :include, Jpmobile::Encoding
19
- ActionView::LookupContext.register_detail(:mobile) {nil}
@@ -6,6 +6,7 @@ ActionView::Base.class_eval { include Jpmobile::Helpers }
6
6
 
7
7
  # :stopdoc:
8
8
  # accept-charset に charset を変更できるようにする
9
+ # ActionView で trans_sid を有効にする
9
10
  module ActionView
10
11
  module Helpers
11
12
  module FormTagHelper
@@ -24,5 +25,9 @@ module ActionView
24
25
  end
25
26
  end
26
27
  end
28
+
29
+ class Base
30
+ delegate :default_url_options, :to => :controller unless respond_to?(:default_url_options)
31
+ end
27
32
  end
28
33
  #:startdoc:
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+ ActionView::LookupContext.register_detail(:mobile) {nil}
data/lib/jpmobile/mail.rb CHANGED
@@ -313,4 +313,18 @@ module Mail
313
313
  alias_method :encoded_without_jpmobile, :encoded
314
314
  alias_method :encoded, :encoded_with_jpmobile
315
315
  end
316
+
317
+ class Sendmail
318
+ def Sendmail.call(path, arguments, destinations, mail)
319
+ encoded_mail = mail.encoded
320
+ if Jpmobile::Util.jis?(encoded_mail)
321
+ encoded_mail = Jpmobile::Util.ascii_8bit(encoded_mail)
322
+ end
323
+
324
+ IO.popen("#{path} #{arguments} #{destinations}", "w+") do |io|
325
+ io.puts encoded_mail.gsub(/\r\r\n/, "\n").to_lf
326
+ io.flush
327
+ end
328
+ end
329
+ end
316
330
  end
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'jpmobile/mail'
3
+ require 'jpmobile/lookup_context'
3
4
 
4
5
  module Jpmobile
5
6
  module Mailer
@@ -26,6 +27,15 @@ module Jpmobile
26
27
 
27
28
  m
28
29
  end
30
+
31
+ class << self
32
+ protected
33
+ def set_payload_for_mail(payload, mail) #:nodoc:
34
+ super
35
+
36
+ payload[:mail] = Jpmobile::Util.ascii_8bit(mail.encoded).gsub(/\r\n/, "\n")
37
+ end
38
+ end
29
39
  end
30
40
  end
31
41
  end
@@ -103,6 +103,7 @@ module Jpmobile::Mobile
103
103
  (charset.nil? or charset == "") ? self.class::MAIL_CHARSET : charset
104
104
  end
105
105
  def to_mail_encoding(str)
106
+ str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
106
107
  str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_PC_EMAIL, false)
107
108
  Jpmobile::Util.encode(str, mail_charset)
108
109
  end
data/lib/jpmobile/util.rb CHANGED
@@ -11,6 +11,9 @@ module Jpmobile
11
11
  WAVE_DASH = [0x301c].pack("U")
12
12
  FULLWIDTH_TILDE = [0xff5e].pack("U")
13
13
 
14
+ OVERLINE = [0x203e].pack("U")
15
+ FULLWIDTH_MACRON = [0xffe3].pack("U")
16
+
14
17
  module_function
15
18
  def deep_apply(obj, &proc)
16
19
  case obj
@@ -85,6 +88,8 @@ module Jpmobile
85
88
  def utf8_to_sjis(utf8_str)
86
89
  # 波ダッシュ対策
87
90
  utf8_str = wavedash_to_fullwidth_tilde(utf8_str)
91
+ # オーバーライン対策(不可逆的)
92
+ utf8_str = overline_to_fullwidth_macron(utf8_str)
88
93
 
89
94
  if utf8_str.respond_to?(:encode)
90
95
  utf8_str.encode(SJIS, :crlf_newline => true)
@@ -197,6 +202,14 @@ module Jpmobile
197
202
  utf8_str.gsub(FULLWIDTH_TILDE, WAVE_DASH)
198
203
  end
199
204
 
205
+ def overline_to_fullwidth_macron(utf8_str)
206
+ utf8_str.gsub(OVERLINE, FULLWIDTH_MACRON)
207
+ end
208
+
209
+ def fullwidth_macron_to_overline(utf8_str)
210
+ utf8_str.gsub(FULLWIDTH_MACRON, OVERLINE)
211
+ end
212
+
200
213
  def force_encode(str, from, to)
201
214
  s = str.dup
202
215
  return str if detect_encoding(str) == to
@@ -42,6 +42,10 @@ describe Jpmobile::Util, ".deep_apply" do
42
42
  utf8_to_sjis([0xffe3].pack("U")).should == sjis("\x81\x50")
43
43
  end
44
44
 
45
+ it "U+203Eが0x8150に変換されること" do
46
+ utf8_to_sjis([0x203e].pack("U")).should == sjis("\x81\x50")
47
+ end
48
+
45
49
  it "jis_string_regexpでISO-2022-JPの文字列がマッチすること" do
46
50
  jis_string_regexp.match(ascii_8bit(utf8_to_jis("abcしからずんばこじをえずdef"))).should_not be_nil
47
51
  jis_to_utf8(jis("\x1b\x24\x42#{$1}\x1b\x28\x42")).should == "しからずんばこじをえず"
@@ -1,13 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
3
  # Set up gems listed in the Gemfile.
4
- gemfile = File.expand_path('../../Gemfile', __FILE__)
5
- begin
6
- ENV['BUNDLE_GEMFILE'] = gemfile
7
- require 'bundler'
8
- Bundler.setup
9
- rescue Bundler::GemNotFound => e
10
- STDERR.puts e.message
11
- STDERR.puts "Try running `bundle install`."
12
- exit!
13
- end if File.exist?(gemfile)
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -4,4 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- RailsRoot::Application.config.secret_token = '23417af8bf908eea220f39faa992f7a25a753df87b6f0f4bfd9fec3ccf0dad629004cc608a9aaed4532f58231f16dfa9875cd21fbb4c58bde26bdc4aa9103979'
7
+ RailsRoot::Application.config.secret_token = '3092a5d3b9fa0a566c76906c744a1cec4b95b0702622918a932fa39c4c5f2b74fb6bd1ca243162c51ed5e5622cfe249e0798bc05fde2660255f29bf2451df095'
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ require 'jpmobile/lookup_context'
3
+
2
4
  module ActionController
3
5
  class Base
4
6
  include Jpmobile::Helpers
@@ -16,4 +18,3 @@ module ActionController
16
18
  end
17
19
 
18
20
  ActionController::Request.send :include, Jpmobile::Encoding
19
- ActionView::LookupContext.register_detail(:mobile) {nil}
@@ -6,6 +6,7 @@ ActionView::Base.class_eval { include Jpmobile::Helpers }
6
6
 
7
7
  # :stopdoc:
8
8
  # accept-charset に charset を変更できるようにする
9
+ # ActionView で trans_sid を有効にする
9
10
  module ActionView
10
11
  module Helpers
11
12
  module FormTagHelper
@@ -24,5 +25,9 @@ module ActionView
24
25
  end
25
26
  end
26
27
  end
28
+
29
+ class Base
30
+ delegate :default_url_options, :to => :controller unless respond_to?(:default_url_options)
31
+ end
27
32
  end
28
33
  #:startdoc:
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+ ActionView::LookupContext.register_detail(:mobile) {nil}
@@ -313,4 +313,18 @@ module Mail
313
313
  alias_method :encoded_without_jpmobile, :encoded
314
314
  alias_method :encoded, :encoded_with_jpmobile
315
315
  end
316
+
317
+ class Sendmail
318
+ def Sendmail.call(path, arguments, destinations, mail)
319
+ encoded_mail = mail.encoded
320
+ if Jpmobile::Util.jis?(encoded_mail)
321
+ encoded_mail = Jpmobile::Util.ascii_8bit(encoded_mail)
322
+ end
323
+
324
+ IO.popen("#{path} #{arguments} #{destinations}", "w+") do |io|
325
+ io.puts encoded_mail.gsub(/\r\r\n/, "\n").to_lf
326
+ io.flush
327
+ end
328
+ end
329
+ end
316
330
  end
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'jpmobile/mail'
3
+ require 'jpmobile/lookup_context'
3
4
 
4
5
  module Jpmobile
5
6
  module Mailer
@@ -26,6 +27,15 @@ module Jpmobile
26
27
 
27
28
  m
28
29
  end
30
+
31
+ class << self
32
+ protected
33
+ def set_payload_for_mail(payload, mail) #:nodoc:
34
+ super
35
+
36
+ payload[:mail] = Jpmobile::Util.ascii_8bit(mail.encoded).gsub(/\r\n/, "\n")
37
+ end
38
+ end
29
39
  end
30
40
  end
31
41
  end
@@ -103,6 +103,7 @@ module Jpmobile::Mobile
103
103
  (charset.nil? or charset == "") ? self.class::MAIL_CHARSET : charset
104
104
  end
105
105
  def to_mail_encoding(str)
106
+ str = Jpmobile::Emoticon.utf8_to_unicodecr(str)
106
107
  str = Jpmobile::Emoticon.unicodecr_to_external(str, Jpmobile::Emoticon::CONVERSION_TABLE_TO_PC_EMAIL, false)
107
108
  Jpmobile::Util.encode(str, mail_charset)
108
109
  end
@@ -11,6 +11,9 @@ module Jpmobile
11
11
  WAVE_DASH = [0x301c].pack("U")
12
12
  FULLWIDTH_TILDE = [0xff5e].pack("U")
13
13
 
14
+ OVERLINE = [0x203e].pack("U")
15
+ FULLWIDTH_MACRON = [0xffe3].pack("U")
16
+
14
17
  module_function
15
18
  def deep_apply(obj, &proc)
16
19
  case obj
@@ -85,6 +88,8 @@ module Jpmobile
85
88
  def utf8_to_sjis(utf8_str)
86
89
  # 波ダッシュ対策
87
90
  utf8_str = wavedash_to_fullwidth_tilde(utf8_str)
91
+ # オーバーライン対策(不可逆的)
92
+ utf8_str = overline_to_fullwidth_macron(utf8_str)
88
93
 
89
94
  if utf8_str.respond_to?(:encode)
90
95
  utf8_str.encode(SJIS, :crlf_newline => true)
@@ -197,6 +202,14 @@ module Jpmobile
197
202
  utf8_str.gsub(FULLWIDTH_TILDE, WAVE_DASH)
198
203
  end
199
204
 
205
+ def overline_to_fullwidth_macron(utf8_str)
206
+ utf8_str.gsub(OVERLINE, FULLWIDTH_MACRON)
207
+ end
208
+
209
+ def fullwidth_macron_to_overline(utf8_str)
210
+ utf8_str.gsub(FULLWIDTH_MACRON, OVERLINE)
211
+ end
212
+
200
213
  def force_encode(str, from, to)
201
214
  s = str.dup
202
215
  return str if detect_encoding(str) == to
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpmobile
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- - pre
10
- version: 1.0.0.pre
4
+ prerelease: 6
5
+ version: 1.0.0.pre.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Yoji Shidara
@@ -16,7 +11,7 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-01-28 00:00:00 +09:00
14
+ date: 2011-02-25 00:00:00 +09:00
20
15
  default_executable:
21
16
  dependencies:
22
17
  - !ruby/object:Gem::Dependency
@@ -26,8 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
24
  version: "0"
32
25
  type: :development
33
26
  prerelease: false
@@ -39,10 +32,6 @@ dependencies:
39
32
  requirements:
40
33
  - - ">="
41
34
  - !ruby/object:Gem::Version
42
- segments:
43
- - 3
44
- - 0
45
- - 3
46
35
  version: 3.0.3
47
36
  type: :development
48
37
  prerelease: false
@@ -54,10 +43,6 @@ dependencies:
54
43
  requirements:
55
44
  - - ">="
56
45
  - !ruby/object:Gem::Version
57
- segments:
58
- - 2
59
- - 3
60
- - 0
61
46
  version: 2.3.0
62
47
  type: :development
63
48
  prerelease: false
@@ -69,10 +54,6 @@ dependencies:
69
54
  requirements:
70
55
  - - ">="
71
56
  - !ruby/object:Gem::Version
72
- segments:
73
- - 2
74
- - 3
75
- - 0
76
57
  version: 2.3.0
77
58
  type: :development
78
59
  prerelease: false
@@ -84,8 +65,6 @@ dependencies:
84
65
  requirements:
85
66
  - - ">="
86
67
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
68
  version: "0"
90
69
  type: :development
91
70
  prerelease: false
@@ -97,8 +76,6 @@ dependencies:
97
76
  requirements:
98
77
  - - ">="
99
78
  - !ruby/object:Gem::Version
100
- segments:
101
- - 0
102
79
  version: "0"
103
80
  type: :development
104
81
  prerelease: false
@@ -110,8 +87,6 @@ dependencies:
110
87
  requirements:
111
88
  - - ">="
112
89
  - !ruby/object:Gem::Version
113
- segments:
114
- - 0
115
90
  version: "0"
116
91
  type: :development
117
92
  prerelease: false
@@ -123,8 +98,6 @@ dependencies:
123
98
  requirements:
124
99
  - - ">="
125
100
  - !ruby/object:Gem::Version
126
- segments:
127
- - 0
128
101
  version: "0"
129
102
  type: :development
130
103
  prerelease: false
@@ -136,10 +109,6 @@ dependencies:
136
109
  requirements:
137
110
  - - ">="
138
111
  - !ruby/object:Gem::Version
139
- segments:
140
- - 1
141
- - 5
142
- - 1
143
112
  version: 1.5.1
144
113
  type: :development
145
114
  prerelease: false
@@ -151,10 +120,6 @@ dependencies:
151
120
  requirements:
152
121
  - - ">="
153
122
  - !ruby/object:Gem::Version
154
- segments:
155
- - 2
156
- - 3
157
- - 0
158
123
  version: 2.3.0
159
124
  type: :development
160
125
  prerelease: false
@@ -166,10 +131,6 @@ dependencies:
166
131
  requirements:
167
132
  - - ">="
168
133
  - !ruby/object:Gem::Version
169
- segments:
170
- - 2
171
- - 3
172
- - 0
173
134
  version: 2.3.0
174
135
  type: :development
175
136
  prerelease: false
@@ -181,10 +142,6 @@ dependencies:
181
142
  requirements:
182
143
  - - ">="
183
144
  - !ruby/object:Gem::Version
184
- segments:
185
- - 0
186
- - 7
187
- - 2
188
145
  version: 0.7.2
189
146
  type: :development
190
147
  prerelease: false
@@ -196,10 +153,6 @@ dependencies:
196
153
  requirements:
197
154
  - - ">="
198
155
  - !ruby/object:Gem::Version
199
- segments:
200
- - 1
201
- - 5
202
- - 0
203
156
  version: 1.5.0
204
157
  type: :development
205
158
  prerelease: false
@@ -211,10 +164,6 @@ dependencies:
211
164
  requirements:
212
165
  - - ">="
213
166
  - !ruby/object:Gem::Version
214
- segments:
215
- - 1
216
- - 3
217
- - 2
218
167
  version: 1.3.2
219
168
  type: :development
220
169
  prerelease: false
@@ -226,10 +175,6 @@ dependencies:
226
175
  requirements:
227
176
  - - ">="
228
177
  - !ruby/object:Gem::Version
229
- segments:
230
- - 0
231
- - 8
232
- - 3
233
178
  version: 0.8.3
234
179
  type: :development
235
180
  prerelease: false
@@ -241,10 +186,6 @@ dependencies:
241
186
  requirements:
242
187
  - - ">="
243
188
  - !ruby/object:Gem::Version
244
- segments:
245
- - 1
246
- - 2
247
- - 5
248
189
  version: 1.2.5
249
190
  type: :development
250
191
  prerelease: false
@@ -256,10 +197,6 @@ dependencies:
256
197
  requirements:
257
198
  - - ">="
258
199
  - !ruby/object:Gem::Version
259
- segments:
260
- - 3
261
- - 0
262
- - 3
263
200
  version: 3.0.3
264
201
  type: :development
265
202
  prerelease: false
@@ -298,6 +235,7 @@ files:
298
235
  - lib/jpmobile/helpers.rb
299
236
  - lib/jpmobile/hook_action_controller.rb
300
237
  - lib/jpmobile/hook_action_view.rb
238
+ - lib/jpmobile/lookup_context.rb
301
239
  - lib/jpmobile/mail.rb
302
240
  - lib/jpmobile/mailer.rb
303
241
  - lib/jpmobile/mobile/abstract_mobile.rb
@@ -473,6 +411,7 @@ files:
473
411
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb
474
412
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb
475
413
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb
414
+ - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb
476
415
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb
477
416
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb
478
417
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb
@@ -534,23 +473,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
534
473
  requirements:
535
474
  - - ">="
536
475
  - !ruby/object:Gem::Version
537
- segments:
538
- - 0
539
476
  version: "0"
540
477
  required_rubygems_version: !ruby/object:Gem::Requirement
541
478
  none: false
542
479
  requirements:
543
480
  - - ">"
544
481
  - !ruby/object:Gem::Version
545
- segments:
546
- - 1
547
- - 3
548
- - 1
549
482
  version: 1.3.1
550
483
  requirements: []
551
484
 
552
485
  rubyforge_project:
553
- rubygems_version: 1.3.7
486
+ rubygems_version: 1.5.2
554
487
  signing_key:
555
488
  specification_version: 3
556
489
  summary: A Rails plugin for Japanese mobile-phones
@@ -698,6 +631,7 @@ test_files:
698
631
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb
699
632
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb
700
633
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb
634
+ - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb
701
635
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb
702
636
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb
703
637
  - test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb