rack-ketai 0.1.0 → 0.1.1

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/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  tools/tmp
2
+ pkg
data/README.rdoc CHANGED
@@ -19,7 +19,7 @@
19
19
  == 使えそうなRubyのバージョン
20
20
  適当テストを通ったバージョンです。
21
21
 
22
- CRuby 1.8.5, 1.8.6, 1.8.7, 1.9.1
22
+ CRuby 1.8.5, 1.8.6, 1.8.7, 1.9.1, 1.9.2
23
23
 
24
24
  JRuby 1.4.0
25
25
 
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "rack-ketai"
5
+ gemspec.summary = "A Rack Middleware for Japanese mobile-phones"
6
+ gemspec.email = "info@takeyu-web.com"
7
+ gemspec.homepage = "http://github.com/take-yu/rack-ketai"
8
+ gemspec.authors = ["Yuichi Takeuchi"]
9
+
10
+ gemspec.add_dependency 'rack', '>=1.0.0'
11
+ end
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: gem install jeweler"
14
+ end
15
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -154,6 +154,7 @@ class Rack::Ketai::Carrier::Abstract
154
154
  end
155
155
 
156
156
  def outbound(status, headers, body)
157
+ body = [body].flatten
157
158
  apply_outgoing?(status, headers, body) ? to_external(status, headers, body) : [status, headers, body]
158
159
  end
159
160
 
@@ -0,0 +1,100 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rack-ketai}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Yuichi Takeuchi"]
12
+ s.date = %q{2010-09-09}
13
+ s.email = %q{info@takeyu-web.com}
14
+ s.extra_rdoc_files = [
15
+ "README.rdoc"
16
+ ]
17
+ s.files = [
18
+ ".gitignore",
19
+ "MIT-LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "lib/rack/ketai.rb",
24
+ "lib/rack/ketai/carrier.rb",
25
+ "lib/rack/ketai/carrier/abstract.rb",
26
+ "lib/rack/ketai/carrier/au.rb",
27
+ "lib/rack/ketai/carrier/cidrs/au.rb",
28
+ "lib/rack/ketai/carrier/cidrs/docomo.rb",
29
+ "lib/rack/ketai/carrier/cidrs/softbank.rb",
30
+ "lib/rack/ketai/carrier/docomo.rb",
31
+ "lib/rack/ketai/carrier/emoji/ausjisstrtoemojiid.rb",
32
+ "lib/rack/ketai/carrier/emoji/docomosjisstrtoemojiid.rb",
33
+ "lib/rack/ketai/carrier/emoji/emojidata.rb",
34
+ "lib/rack/ketai/carrier/emoji/emojiidtotypecast.rb",
35
+ "lib/rack/ketai/carrier/emoji/softbankutf8strtoemojiid.rb",
36
+ "lib/rack/ketai/carrier/emoji/softbankwebcodetoutf8str.rb",
37
+ "lib/rack/ketai/carrier/general.rb",
38
+ "lib/rack/ketai/carrier/iphone.rb",
39
+ "lib/rack/ketai/carrier/softbank.rb",
40
+ "lib/rack/ketai/carrier/specs/au.rb",
41
+ "lib/rack/ketai/carrier/specs/docomo.rb",
42
+ "lib/rack/ketai/carrier/specs/softbank.rb",
43
+ "lib/rack/ketai/display.rb",
44
+ "lib/rack/ketai/middleware.rb",
45
+ "rack-ketai.gemspec",
46
+ "spec/spec_helper.rb",
47
+ "spec/unit/au_filter_spec.rb",
48
+ "spec/unit/au_spec.rb",
49
+ "spec/unit/carrier_spec.rb",
50
+ "spec/unit/display_spec.rb",
51
+ "spec/unit/docomo_filter_spec.rb",
52
+ "spec/unit/docomo_spec.rb",
53
+ "spec/unit/emoticon_filter_spec.rb",
54
+ "spec/unit/filter_spec.rb",
55
+ "spec/unit/iphone_spec.rb",
56
+ "spec/unit/middleware_spec.rb",
57
+ "spec/unit/softbank_filter_spec.rb",
58
+ "spec/unit/softbank_spec.rb",
59
+ "spec/unit/valid_addr_spec.rb",
60
+ "test/spec_runner.rb",
61
+ "tools/generate_emoji_dic.rb",
62
+ "tools/update_speclist.rb"
63
+ ]
64
+ s.homepage = %q{http://github.com/take-yu/rack-ketai}
65
+ s.rdoc_options = ["--charset=UTF-8"]
66
+ s.require_paths = ["lib"]
67
+ s.rubygems_version = %q{1.3.7}
68
+ s.summary = %q{A Rack Middleware for Japanese mobile-phones}
69
+ s.test_files = [
70
+ "spec/unit/au_spec.rb",
71
+ "spec/unit/middleware_spec.rb",
72
+ "spec/unit/filter_spec.rb",
73
+ "spec/unit/au_filter_spec.rb",
74
+ "spec/unit/softbank_filter_spec.rb",
75
+ "spec/unit/valid_addr_spec.rb",
76
+ "spec/unit/docomo_spec.rb",
77
+ "spec/unit/display_spec.rb",
78
+ "spec/unit/docomo_filter_spec.rb",
79
+ "spec/unit/iphone_spec.rb",
80
+ "spec/unit/softbank_spec.rb",
81
+ "spec/unit/carrier_spec.rb",
82
+ "spec/unit/emoticon_filter_spec.rb",
83
+ "spec/spec_helper.rb",
84
+ "test/spec_runner.rb"
85
+ ]
86
+
87
+ if s.respond_to? :specification_version then
88
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
89
+ s.specification_version = 3
90
+
91
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
92
+ s.add_runtime_dependency(%q<rack>, [">= 1.0.0"])
93
+ else
94
+ s.add_dependency(%q<rack>, [">= 1.0.0"])
95
+ end
96
+ else
97
+ s.add_dependency(%q<rack>, [">= 1.0.0"])
98
+ end
99
+ end
100
+
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,6 @@ require 'cgi'
6
6
  require 'spec/mocks'
7
7
  require 'rack/mock'
8
8
 
9
- $LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + '/lib'
9
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../lib')
10
10
  require 'rack/ketai'
11
11
 
@@ -30,6 +30,12 @@ describe Rack::Ketai::Carrier::Au::Filter, "外部エンコーディングに変
30
30
  before(:each) do
31
31
  @filter = Rack::Ketai::Carrier::Au::Filter.new
32
32
  end
33
+
34
+ # Rails 3.0.0+Ruby1.9.xのとき、bodyにeachの使えないStringが渡されてエラーになったので
35
+ it "bodyにStringを受け取ってもよきにはからってくれること" do
36
+ status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, 'String')
37
+ body.should == ['String']
38
+ end
33
39
 
34
40
  it "データ中の絵文字IDをSJISの絵文字コードに変換すること" do
35
41
  Rack::Ketai::Carrier::Au::Filter::EMOJI_TO_EMOJIID.should_not be_empty
@@ -30,6 +30,12 @@ describe Rack::Ketai::Carrier::Docomo::Filter, "外部エンコーディング
30
30
  before(:each) do
31
31
  @filter = Rack::Ketai::Carrier::Docomo::Filter.new
32
32
  end
33
+
34
+ # Rails 3.0.0+Ruby1.9.xのとき、bodyにeachの使えないStringが渡されてエラーになったので
35
+ it "bodyにStringを受け取ってもよきにはからってくれること" do
36
+ status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, 'String')
37
+ body.should == ['String']
38
+ end
33
39
 
34
40
  it "データ中の絵文字IDをSJISの絵文字コードに変換すること" do
35
41
  Rack::Ketai::Carrier::Docomo::Filter::EMOJI_TO_EMOJIID.should_not be_empty
@@ -56,7 +62,7 @@ describe Rack::Ketai::Carrier::Docomo::Filter, "外部エンコーディング
56
62
  Rack::Ketai::Carrier::Docomo::Filter::EMOJI_TO_EMOJIID.should_not be_empty
57
63
  Rack::Ketai::Carrier::Docomo::Filter::EMOJI_TO_EMOJIID.each do |emoji, emojiid|
58
64
  internaldata = '今日はいい[e:'+format("%03X", emojiid)+']ですね。'
59
- %w(text/plain text/xml text/json application/json text/javascript application/rss+xml image/jpeg).each do |contenttype|
65
+ %w(text/plain text/xml text/json application/json text/javascript application/rss+xml image/jpeg application/x-shockwave-flash).each do |contenttype|
60
66
  status, headers, body = @filter.outbound(200, { "Content-Type" => contenttype }, [internaldata])
61
67
  body[0].should == internaldata
62
68
  end
@@ -6,6 +6,12 @@ describe Rack::Ketai::Carrier::Softbank::Filter, "内部フィルタを適用す
6
6
  before(:each) do
7
7
  @filter = Rack::Ketai::Carrier::Softbank::Filter.new
8
8
  end
9
+
10
+ # Rails 3.0.0+Ruby1.9.xのとき、bodyにeachの使えないStringが渡されてエラーになったので
11
+ it "bodyにStringを受け取ってもよきにはからってくれること" do
12
+ status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, 'String')
13
+ body.should == ['String']
14
+ end
9
15
 
10
16
  it "POSTデータ中のUTF-8バイナリの絵文字を絵文字IDに変換すること" do
11
17
  Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.should_not be_empty
data/test/spec_runner.rb CHANGED
@@ -7,18 +7,16 @@ class SpecRunner < Test::Unit::TestCase
7
7
  require 'spec'
8
8
  rescue LoadError
9
9
  retry if require "rubygems"
10
- puts "All tests are skipped."
10
+ puts "All tests are skipped.(Please `gem install rspec`)"
11
11
  return
12
12
  end
13
13
  end
14
14
 
15
15
  def test_spec
16
- return unless load_spec
17
- require File.join(File.dirname(__FILE__),
18
- '../spec/spec_helper.rb')
16
+ return unless load_spec
17
+ require File.expand_path(File.join(File.dirname(__FILE__), '../spec/spec_helper.rb'))
19
18
 
20
- argv = Dir.glob(File.join(File.dirname(__FILE__),
21
- '../spec/**/*_spec.rb'))
19
+ argv = Dir.glob(File.expand_path File.join(File.dirname(__FILE__), '../spec/**/*_spec.rb'))
22
20
  argv.unshift '-fs'
23
21
 
24
22
  unless Spec::Runner::CommandLine.run(Spec::Runner::OptionParser.parse(argv, STDOUT, STDERR))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-ketai
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yuichi Takeuchi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-22 00:00:00 +09:00
18
+ date: 2010-09-09 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -46,6 +46,7 @@ files:
46
46
  - .gitignore
47
47
  - MIT-LICENSE
48
48
  - README.rdoc
49
+ - Rakefile
49
50
  - VERSION
50
51
  - lib/rack/ketai.rb
51
52
  - lib/rack/ketai/carrier.rb
@@ -69,6 +70,7 @@ files:
69
70
  - lib/rack/ketai/carrier/specs/softbank.rb
70
71
  - lib/rack/ketai/display.rb
71
72
  - lib/rack/ketai/middleware.rb
73
+ - rack-ketai.gemspec
72
74
  - spec/spec_helper.rb
73
75
  - spec/unit/au_filter_spec.rb
74
76
  - spec/unit/au_spec.rb