tengine_support 0.3.26 → 0.3.27

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -8,3 +8,4 @@ rvm:
8
8
  gemfile:
9
9
  - gemfiles/Gemfile.activesupport-3.0.10
10
10
  - gemfiles/Gemfile.activesupport-3.1.1
11
+ - gemfiles/Gemfile.activesupport-3.2.3
data/Gemfile CHANGED
@@ -6,6 +6,8 @@ source "http://rubygems.org"
6
6
  gem "activesupport", ">= 3.0.0"
7
7
  group :test do
8
8
  gem "eventmachine", "~> 0.12.0"
9
+ gem "bson_ext", "~> 1.3"
10
+ gem "mongoid", "~> 2.3.3"
9
11
  end
10
12
 
11
13
  # Add dependencies to develop your gem here.
@@ -13,7 +15,7 @@ end
13
15
  group :development do
14
16
  gem "rspec", "~> 2.6.0"
15
17
  gem "yard", "~> 0.7.2"
16
- gem "bundler", "~> 1.0.18"
18
+ gem "bundler", "~> 1.1.3"
17
19
  gem "jeweler", "~> 1.6.4"
18
20
  # gem "rcov", ">= 0"
19
21
  gem "simplecov", "~> 0.5.3"
data/README.md CHANGED
@@ -18,4 +18,4 @@ tengine_support is distributed under the LGPL and MPL
18
18
 
19
19
  ## Copyright
20
20
 
21
- Copyright (c) 2011 nautilus-technologies.com
21
+ Copyright (c) 2012 Groovenauts, Inc.
data/Rakefile CHANGED
@@ -19,8 +19,8 @@ Jeweler::Tasks.new do |gem|
19
19
  gem.license = "MPL/LGPL"
20
20
  gem.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
21
21
  gem.description = "tengine_support provides utility classes/modules which is not included in active_support. It doesn't depend on other tengine gems."
22
- gem.email = "tengine@nautilus-technologies.com"
23
- gem.authors = %w[shyouhei akm]
22
+ gem.email = "tengine-info@groovenauts.jp"
23
+ gem.authors = %w[shyouhei akm taigou]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.26
1
+ 0.3.27
@@ -6,6 +6,7 @@ source "http://rubygems.org"
6
6
  gem "activesupport", "= 3.0.10"
7
7
  group :test do
8
8
  gem "eventmachine", "~> 0.12.0"
9
+ gem "mongoid", "~> 2.2.6"
9
10
  end
10
11
 
11
12
  # Add dependencies to develop your gem here.
@@ -13,7 +14,7 @@ end
13
14
  group :development do
14
15
  gem "rspec", "~> 2.6.0"
15
16
  gem "yard", "~> 0.7.2"
16
- gem "bundler", "~> 1.0.18"
17
+ gem "bundler", "~> 1.1.3"
17
18
  gem "jeweler", "~> 1.6.4"
18
19
  # gem "rcov", ">= 0"
19
20
  gem "simplecov", "~> 0.5.3"
@@ -6,6 +6,7 @@ source "http://rubygems.org"
6
6
  gem "activesupport", "= 3.1.1"
7
7
  group :test do
8
8
  gem "eventmachine", "~> 0.12.0"
9
+ gem "mongoid", "~> 2.3.3"
9
10
  end
10
11
 
11
12
  # Add dependencies to develop your gem here.
@@ -13,7 +14,7 @@ end
13
14
  group :development do
14
15
  gem "rspec", "~> 2.6.0"
15
16
  gem "yard", "~> 0.7.2"
16
- gem "bundler", "~> 1.0.18"
17
+ gem "bundler", "~> 1.1.3"
17
18
  gem "jeweler", "~> 1.6.4"
18
19
  # gem "rcov", ">= 0"
19
20
  gem "simplecov", "~> 0.5.3"
@@ -0,0 +1,24 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "activesupport", "= 3.2.3"
7
+ group :test do
8
+ gem "eventmachine", "~> 0.12.0"
9
+ gem "mongoid", "~> 2.4.9"
10
+ end
11
+
12
+ # Add dependencies to develop your gem here.
13
+ # Include everything needed to run rake, tests, features, etc.
14
+ group :development do
15
+ gem "rspec", "~> 2.6.0"
16
+ gem "yard", "~> 0.7.2"
17
+ gem "bundler", "~> 1.1.3"
18
+ gem "jeweler", "~> 1.6.4"
19
+ # gem "rcov", ">= 0"
20
+ gem "simplecov", "~> 0.5.3"
21
+ gem "autotest"
22
+
23
+ gem 'rdiscount'
24
+ end
@@ -56,10 +56,11 @@ class Tengine::Support::Config::Logger
56
56
  end
57
57
  rotation = options[:rotation]
58
58
  shift_age = (rotation =~ /\A\d+\Z/) ? rotation.to_i : rotation
59
- result = ::Logger.new(dev, shift_age, options[:rotation_size])
60
- result.level = ::Logger.const_get(options[:level].to_s.upcase)
61
59
  dtf = options[:datetime_format]
60
+ result = ::Logger.new(dev, shift_age, options[:rotation_size])
61
+ result.formatter = (options[:formatter] || dtf) ? Logger::Formatter.new : nil
62
62
  result.datetime_format = dtf if dtf
63
+ result.level = ::Logger.const_get(options[:level].to_s.upcase)
63
64
  progname = options[:progname]
64
65
  result.progname = progname if progname
65
66
  result
@@ -2,7 +2,7 @@
2
2
 
3
3
  # このファイルはクラスやモジュールを定義せず、tengine/support/core_ext/*.rbをrequireするだけです
4
4
  Dir.chdir(File.expand_path("../../../", File.dirname(__FILE__))) do
5
- Dir['tengine/support/core_ext/array'].each do |f|
6
- require File.basename(f)
5
+ Dir['tengine/support/core_ext/array/*.rb'].each do |f|
6
+ require f
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # このファイルはクラスやモジュールを定義せず、tengine/support/core_ext/*.rbをrequireするだけです
4
4
  Dir.chdir(File.expand_path("../../../", File.dirname(__FILE__))) do
5
- Dir['tengine/support/core_ext/hash'].each do |f|
6
- require File.basename(f)
5
+ Dir['tengine/support/core_ext/hash/*.rb'].each do |f|
6
+ require f
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # このファイルはクラスやモジュールを定義せず、tengine/support/core_ext/*.rbをrequireするだけです
4
4
  Dir.chdir(File.expand_path("../../", File.dirname(__FILE__))) do
5
- Dir['tengine/support/core_ext'].each do |f|
6
- require File.basename(f)
5
+ Dir['tengine/support/core_ext/*.rb'].each do |f|
6
+ require f
7
7
  end
8
8
  end
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'mongoid'
3
+
4
+ module Mongoid::Document::ClassMethods
5
+
6
+ def human_name(options = nil)
7
+ @@human_name_exception_handler ||= lambda{|*args| self.name }
8
+ options = {
9
+ :scope => [i18n_scope, :models],
10
+ :exception_handler => @@human_name_exception_handler
11
+ }.update(options || {})
12
+ I18n.translate(self.name.underscore, options)
13
+ end
14
+ end
@@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
3
3
 
4
4
  require 'logger'
5
5
  require 'tempfile'
6
+ require 'active_support/core_ext/logger'
6
7
 
7
8
  describe 'Tengine::Support::Config::Logger' do
8
9
 
@@ -168,7 +169,14 @@ describe 'Tengine::Support::Config::Logger' do
168
169
  context "デフォルトの場合" do
169
170
  subject{ Tengine::Support::Config::Logger.new.instantiate_children.new_logger }
170
171
  its(:datetime_format){ should == nil}
171
- its(:formatter){ should == nil}
172
+
173
+ require 'active_support/version'
174
+ if ActiveSupport::VERSION::STRING =~ /^3\.0\./
175
+ its(:formatter){ should be_a(Logger::SimpleFormatter)}
176
+ else
177
+ its(:formatter){ should == nil}
178
+ end
179
+
172
180
  its(:level){ should == 1}
173
181
  its(:progname){ should == nil}
174
182
  end
@@ -199,7 +207,7 @@ describe 'Tengine::Support::Config::Logger' do
199
207
  }.instantiate_children.new_logger
200
208
  end
201
209
  its(:datetime_format){ should == "%Y/%m/%d %H:%M:%S"}
202
- its(:formatter){ should == nil}
210
+ its(:formatter){ should be_a(Logger::Formatter)}
203
211
  its(:level){ should == 1}
204
212
  its(:progname){ should == "foobar"}
205
213
  it "実際に出力してみる" do
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'mongoid'
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
4
+ require 'tengine/support/mongoid'
5
+
6
+ class TestModel1
7
+ include Mongoid::Document
8
+ end
9
+
10
+ describe Mongoid::Document do
11
+ describe :human_name do
12
+ before do
13
+ I18n.backend = I18n::Backend::Simple.new
14
+ I18n.backend.store_translations :ja, :mongoid => {:models => {
15
+ :test_model1 => "テストモデル1"
16
+ } }
17
+ end
18
+
19
+ context "リソースが登録されていない場合" do
20
+ before{ I18n.locale = :en }
21
+ subject{ TestModel1 }
22
+ it{ TestModel1.human_name.should == 'TestModel1' }
23
+ its(:i18n_scope){ should == :mongoid }
24
+ end
25
+
26
+ context "リソースが登録されている場合" do
27
+ before{ I18n.locale = :ja }
28
+ subject{ TestModel1 }
29
+ it{ TestModel1.human_name.should == 'テストモデル1' }
30
+ it{ TestModel1.name.should == "TestModel1" }
31
+ it{ TestModel1.name.underscore.should == "test_model1" }
32
+ it{ I18n.t(:test_model1, :scope => [:mongoid, :models]).should == "テストモデル1" }
33
+ end
34
+
35
+ end
36
+ end
@@ -5,13 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tengine_support"
8
- s.version = "0.3.26"
8
+ s.version = "0.3.27"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["shyouhei", "akm", "taigou"]
12
- s.date = "2012-02-16"
12
+ s.date = "2012-05-02"
13
13
  s.description = "tengine_support provides utility classes/modules which is not included in active_support. It doesn't depend on other tengine gems."
14
- s.email = "tengine@nautilus-technologies.com"
14
+ s.email = "tengine-info@groovenauts.jp"
15
15
  s.extra_rdoc_files = [
16
16
  "README.md"
17
17
  ]
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "VERSION",
27
27
  "gemfiles/Gemfile.activesupport-3.0.10",
28
28
  "gemfiles/Gemfile.activesupport-3.1.1",
29
+ "gemfiles/Gemfile.activesupport-3.2.3",
29
30
  "lib/tengine/support.rb",
30
31
  "lib/tengine/support/config.rb",
31
32
  "lib/tengine/support/config/amqp.rb",
@@ -49,6 +50,7 @@ Gem::Specification.new do |s|
49
50
  "lib/tengine/support/core_ext/hash/keys.rb",
50
51
  "lib/tengine/support/core_ext/module.rb",
51
52
  "lib/tengine/support/core_ext/module/private_constant.rb",
53
+ "lib/tengine/support/mongoid.rb",
52
54
  "lib/tengine/support/null_logger.rb",
53
55
  "lib/tengine/support/yaml_with_erb.rb",
54
56
  "lib/tengine_support.rb",
@@ -72,6 +74,7 @@ Gem::Specification.new do |s|
72
74
  "spec/tengine/support/core_ext/hash/compact_spec.rb",
73
75
  "spec/tengine/support/core_ext/hash/deep_dup_spec.rb",
74
76
  "spec/tengine/support/core_ext/hash/keys_spec.rb",
77
+ "spec/tengine/support/mongoid_spec.rb",
75
78
  "spec/tengine/support/null_logger_spec.rb",
76
79
  "spec/tengine/support/yaml_with_erb_spec.rb",
77
80
  "spec/tengine/support/yaml_with_erb_spec/test1.yml.erb",
@@ -83,7 +86,7 @@ Gem::Specification.new do |s|
83
86
  s.homepage = "http://github.com/tengine/tengine_support"
84
87
  s.licenses = ["MPL/LGPL"]
85
88
  s.require_paths = ["lib"]
86
- s.rubygems_version = "1.8.16"
89
+ s.rubygems_version = "1.8.12"
87
90
  s.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
88
91
 
89
92
  if s.respond_to? :specification_version then
@@ -93,7 +96,7 @@ Gem::Specification.new do |s|
93
96
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
94
97
  s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
95
98
  s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
96
- s.add_development_dependency(%q<bundler>, ["~> 1.0.18"])
99
+ s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
97
100
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
98
101
  s.add_development_dependency(%q<simplecov>, ["~> 0.5.3"])
99
102
  s.add_development_dependency(%q<autotest>, [">= 0"])
@@ -102,7 +105,7 @@ Gem::Specification.new do |s|
102
105
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
103
106
  s.add_dependency(%q<rspec>, ["~> 2.6.0"])
104
107
  s.add_dependency(%q<yard>, ["~> 0.7.2"])
105
- s.add_dependency(%q<bundler>, ["~> 1.0.18"])
108
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
106
109
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
107
110
  s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
108
111
  s.add_dependency(%q<autotest>, [">= 0"])
@@ -112,7 +115,7 @@ Gem::Specification.new do |s|
112
115
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
113
116
  s.add_dependency(%q<rspec>, ["~> 2.6.0"])
114
117
  s.add_dependency(%q<yard>, ["~> 0.7.2"])
115
- s.add_dependency(%q<bundler>, ["~> 1.0.18"])
118
+ s.add_dependency(%q<bundler>, ["~> 1.1.3"])
116
119
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
117
120
  s.add_dependency(%q<simplecov>, ["~> 0.5.3"])
118
121
  s.add_dependency(%q<autotest>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tengine_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.26
4
+ version: 0.3.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-02-16 00:00:00.000000000Z
14
+ date: 2012-05-02 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
18
- requirement: &70123005106240 !ruby/object:Gem::Requirement
18
+ requirement: &2160555620 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 3.0.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70123005106240
26
+ version_requirements: *2160555620
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
- requirement: &70123005105760 !ruby/object:Gem::Requirement
29
+ requirement: &2160553820 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 2.6.0
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70123005105760
37
+ version_requirements: *2160553820
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: yard
40
- requirement: &70123005105280 !ruby/object:Gem::Requirement
40
+ requirement: &2160552160 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
@@ -45,21 +45,21 @@ dependencies:
45
45
  version: 0.7.2
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70123005105280
48
+ version_requirements: *2160552160
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: bundler
51
- requirement: &70123005104800 !ruby/object:Gem::Requirement
51
+ requirement: &2160550840 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ~>
55
55
  - !ruby/object:Gem::Version
56
- version: 1.0.18
56
+ version: 1.1.3
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70123005104800
59
+ version_requirements: *2160550840
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: jeweler
62
- requirement: &70123005104320 !ruby/object:Gem::Requirement
62
+ requirement: &2160549300 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ~>
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 1.6.4
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70123005104320
70
+ version_requirements: *2160549300
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: simplecov
73
- requirement: &70123005103840 !ruby/object:Gem::Requirement
73
+ requirement: &2160547040 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ~>
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 0.5.3
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70123005103840
81
+ version_requirements: *2160547040
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: autotest
84
- requirement: &70123005103360 !ruby/object:Gem::Requirement
84
+ requirement: &2160545500 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70123005103360
92
+ version_requirements: *2160545500
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rdiscount
95
- requirement: &70123005102880 !ruby/object:Gem::Requirement
95
+ requirement: &2160543180 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0'
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *70123005102880
103
+ version_requirements: *2160543180
104
104
  description: tengine_support provides utility classes/modules which is not included
105
105
  in active_support. It doesn't depend on other tengine gems.
106
- email: tengine@nautilus-technologies.com
106
+ email: tengine-info@groovenauts.jp
107
107
  executables: []
108
108
  extensions: []
109
109
  extra_rdoc_files:
@@ -119,6 +119,7 @@ files:
119
119
  - VERSION
120
120
  - gemfiles/Gemfile.activesupport-3.0.10
121
121
  - gemfiles/Gemfile.activesupport-3.1.1
122
+ - gemfiles/Gemfile.activesupport-3.2.3
122
123
  - lib/tengine/support.rb
123
124
  - lib/tengine/support/config.rb
124
125
  - lib/tengine/support/config/amqp.rb
@@ -142,6 +143,7 @@ files:
142
143
  - lib/tengine/support/core_ext/hash/keys.rb
143
144
  - lib/tengine/support/core_ext/module.rb
144
145
  - lib/tengine/support/core_ext/module/private_constant.rb
146
+ - lib/tengine/support/mongoid.rb
145
147
  - lib/tengine/support/null_logger.rb
146
148
  - lib/tengine/support/yaml_with_erb.rb
147
149
  - lib/tengine_support.rb
@@ -165,6 +167,7 @@ files:
165
167
  - spec/tengine/support/core_ext/hash/compact_spec.rb
166
168
  - spec/tengine/support/core_ext/hash/deep_dup_spec.rb
167
169
  - spec/tengine/support/core_ext/hash/keys_spec.rb
170
+ - spec/tengine/support/mongoid_spec.rb
168
171
  - spec/tengine/support/null_logger_spec.rb
169
172
  - spec/tengine/support/yaml_with_erb_spec.rb
170
173
  - spec/tengine/support/yaml_with_erb_spec/test1.yml.erb
@@ -185,6 +188,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
188
  - - ! '>='
186
189
  - !ruby/object:Gem::Version
187
190
  version: '0'
191
+ segments:
192
+ - 0
193
+ hash: 2647105739452243185
188
194
  required_rubygems_version: !ruby/object:Gem::Requirement
189
195
  none: false
190
196
  requirements:
@@ -193,10 +199,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
199
  version: '0'
194
200
  requirements: []
195
201
  rubyforge_project:
196
- rubygems_version: 1.8.16
202
+ rubygems_version: 1.8.12
197
203
  signing_key:
198
204
  specification_version: 3
199
205
  summary: tengine_support provides utility classes/modules which isn't included in
200
206
  active_support.
201
207
  test_files: []
202
- has_rdoc: