tengine_support 0.3.27 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -20
- data/lib/tengine/support/core_ext/enumerable/map_to_hash.rb +20 -0
- data/lib/tengine/support/mongoid.rb +59 -0
- data/lib/tengine/support/null_logger.rb +1 -1
- data/lib/tengine/support.rb +4 -3
- metadata +80 -76
- data/.document +0 -5
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/NULL +0 -1
- data/Rakefile +0 -43
- data/VERSION +0 -1
- data/gemfiles/Gemfile.activesupport-3.0.10 +0 -24
- data/gemfiles/Gemfile.activesupport-3.1.1 +0 -24
- data/gemfiles/Gemfile.activesupport-3.2.3 +0 -24
- data/spec/spec_helper.rb +0 -15
- data/spec/support/app1.rb +0 -27
- data/spec/support/suite.rb +0 -182
- data/spec/tengine/support/config/amqp_spec.rb +0 -32
- data/spec/tengine/support/config/logger_spec.rb +0 -316
- data/spec/tengine/support/config/mongoid_spec.rb +0 -24
- data/spec/tengine/support/config_spec/dump_skelton_spec.rb +0 -171
- data/spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb +0 -94
- data/spec/tengine/support/config_spec/load_spec.rb +0 -239
- data/spec/tengine/support/config_spec/load_spec_01.yml.erb +0 -43
- data/spec/tengine/support/config_spec/load_spec_01_with_other_settings.yml.erb +0 -48
- data/spec/tengine/support/config_spec/load_spec_02.yml.erb +0 -52
- data/spec/tengine/support/config_spec/parse_spec.rb +0 -178
- data/spec/tengine/support/config_spec.rb +0 -217
- data/spec/tengine/support/core_ext/array/deep_dup_spec.rb +0 -69
- data/spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb +0 -16
- data/spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb +0 -29
- data/spec/tengine/support/core_ext/hash/compact_spec.rb +0 -28
- data/spec/tengine/support/core_ext/hash/deep_dup_spec.rb +0 -66
- data/spec/tengine/support/core_ext/hash/keys_spec.rb +0 -88
- data/spec/tengine/support/mongoid_spec.rb +0 -36
- data/spec/tengine/support/null_logger_spec.rb +0 -13
- data/spec/tengine/support/yaml_with_erb_spec/test1.yml.erb +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml +0 -2
- data/spec/tengine/support/yaml_with_erb_spec.rb +0 -76
- data/tengine_support.gemspec +0 -125
data/Gemfile
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
3
|
+
gemspec
|
4
|
+
|
7
5
|
group :test do
|
8
6
|
gem "eventmachine", "~> 0.12.0"
|
9
|
-
gem "
|
10
|
-
gem "mongoid", "~> 2.3.3"
|
11
|
-
end
|
12
|
-
|
13
|
-
# Add dependencies to develop your gem here.
|
14
|
-
# Include everything needed to run rake, tests, features, etc.
|
15
|
-
group :development do
|
16
|
-
gem "rspec", "~> 2.6.0"
|
17
|
-
gem "yard", "~> 0.7.2"
|
18
|
-
gem "bundler", "~> 1.1.3"
|
19
|
-
gem "jeweler", "~> 1.6.4"
|
20
|
-
# gem "rcov", ">= 0"
|
21
|
-
gem "simplecov", "~> 0.5.3"
|
22
|
-
gem "autotest"
|
23
|
-
|
24
|
-
gem 'rdiscount'
|
7
|
+
gem "mongoid", "~> 3.0.0"
|
25
8
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'tengine_support'
|
3
|
+
|
4
|
+
class Tengine::Support::UniqueKeyError < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
module Enumerable
|
8
|
+
|
9
|
+
# このメソッド名はダサイので良い名前募集してます。
|
10
|
+
def map_to_hash(key_method = nil, &block)
|
11
|
+
block ||= lambda{|i| i}
|
12
|
+
inject({}) do |d, i|
|
13
|
+
key = key_method ? i.send(key_method) : i
|
14
|
+
raise Tengine::Support::UniqueKeyError, "duplicated key found: #{key.inspect}" unless d[key].nil?
|
15
|
+
d[key] = block.call(i)
|
16
|
+
d
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -12,3 +12,62 @@ module Mongoid::Document::ClassMethods
|
|
12
12
|
I18n.translate(self.name.underscore, options)
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
require 'tengine/support'
|
17
|
+
|
18
|
+
module Tengine::Support::Mongoid
|
19
|
+
extend self
|
20
|
+
|
21
|
+
# Create indexes for each model given provided file_path directory and
|
22
|
+
# the class is not embedded.
|
23
|
+
#
|
24
|
+
def create_indexes(pattern, connect_to=nil)
|
25
|
+
logger = Logger.new($stdout)
|
26
|
+
|
27
|
+
connect_to ||= 'localhost:27017/tengine_production'
|
28
|
+
host, port, db_name = connect_to.split('/').map{|s| s.split(':')}.flatten
|
29
|
+
|
30
|
+
Mongoid.configure do |c|
|
31
|
+
if Mongoid::VERSION < '3.0.0'
|
32
|
+
c.master = Mongo::Connection.new(host, port).db(db_name)
|
33
|
+
else
|
34
|
+
c.sessions = {
|
35
|
+
default: {
|
36
|
+
database: db_name,
|
37
|
+
hosts: [
|
38
|
+
"#{host}:#{port}"
|
39
|
+
]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Dir.glob("#{pattern}/**/*.rb").each do |file|
|
46
|
+
if model = determine_model(file)
|
47
|
+
model.create_indexes
|
48
|
+
logger.info "Generated indexes for #{model}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def determine_model(file)
|
54
|
+
if file =~ /lib\/(.*).rb$/
|
55
|
+
model_path = $1.split('/')
|
56
|
+
begin
|
57
|
+
parts = model_path.map { |path| path.camelize }
|
58
|
+
name = parts.join('::')
|
59
|
+
klass = name.constantize
|
60
|
+
rescue NameError, LoadError => e
|
61
|
+
begin
|
62
|
+
klass = parts.last.constantize
|
63
|
+
rescue => e
|
64
|
+
return nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if klass.ancestors.include?(::Mongoid::Document) && !klass.embedded
|
70
|
+
return klass
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -4,7 +4,7 @@ require 'tengine/support'
|
|
4
4
|
# NullLoggerはロガーのNull Objectです。
|
5
5
|
# Loggerと同じインタフェースを持ちますが何も動作しません。
|
6
6
|
class Tengine::Support::NullLogger
|
7
|
-
%w[debug info warn error fatal].each do |log_level|
|
7
|
+
%w[debug info warn error fatal level level=].each do |log_level|
|
8
8
|
class_eval("def #{log_level}(*args); end")
|
9
9
|
end
|
10
10
|
end
|
data/lib/tengine/support.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'tengine_support'
|
2
2
|
|
3
3
|
module Tengine::Support
|
4
|
-
autoload :YamlWithErb,
|
5
|
-
autoload :NullLogger,
|
6
|
-
autoload :Config,
|
4
|
+
autoload :YamlWithErb, 'tengine/support/yaml_with_erb'
|
5
|
+
autoload :NullLogger, 'tengine/support/null_logger'
|
6
|
+
autoload :Config, 'tengine/support/config'
|
7
|
+
autoload :Mongoid, 'tengine/support/mongoid'
|
7
8
|
end
|
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:
|
4
|
+
version: 1.1.0
|
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-
|
14
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,65 +23,95 @@ dependencies:
|
|
23
23
|
version: 3.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 3.0.0
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement:
|
33
|
+
name: bundler
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
30
35
|
none: false
|
31
36
|
requirements:
|
32
|
-
- -
|
37
|
+
- - ! '>='
|
33
38
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
39
|
+
version: '0'
|
35
40
|
type: :development
|
36
41
|
prerelease: false
|
37
|
-
version_requirements:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
38
48
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
40
|
-
requirement:
|
49
|
+
name: rake
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
41
51
|
none: false
|
42
52
|
requirements:
|
43
53
|
- - ~>
|
44
54
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
55
|
+
version: 0.9.2.2
|
46
56
|
type: :development
|
47
57
|
prerelease: false
|
48
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.9.2.2
|
49
64
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
51
|
-
requirement:
|
65
|
+
name: rspec
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
52
67
|
none: false
|
53
68
|
requirements:
|
54
69
|
- - ~>
|
55
70
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
71
|
+
version: 2.10.0
|
57
72
|
type: :development
|
58
73
|
prerelease: false
|
59
|
-
version_requirements:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.10.0
|
60
80
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
62
|
-
requirement:
|
81
|
+
name: yard
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
63
83
|
none: false
|
64
84
|
requirements:
|
65
85
|
- - ~>
|
66
86
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
87
|
+
version: 0.8.1
|
68
88
|
type: :development
|
69
89
|
prerelease: false
|
70
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.8.1
|
71
96
|
- !ruby/object:Gem::Dependency
|
72
97
|
name: simplecov
|
73
|
-
requirement:
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
74
99
|
none: false
|
75
100
|
requirements:
|
76
101
|
- - ~>
|
77
102
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0.
|
103
|
+
version: 0.6.4
|
79
104
|
type: :development
|
80
105
|
prerelease: false
|
81
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.6.4
|
82
112
|
- !ruby/object:Gem::Dependency
|
83
113
|
name: autotest
|
84
|
-
requirement:
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
85
115
|
none: false
|
86
116
|
requirements:
|
87
117
|
- - ! '>='
|
@@ -89,10 +119,15 @@ dependencies:
|
|
89
119
|
version: '0'
|
90
120
|
type: :development
|
91
121
|
prerelease: false
|
92
|
-
version_requirements:
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
93
128
|
- !ruby/object:Gem::Dependency
|
94
129
|
name: rdiscount
|
95
|
-
requirement:
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
96
131
|
none: false
|
97
132
|
requirements:
|
98
133
|
- - ! '>='
|
@@ -100,7 +135,12 @@ dependencies:
|
|
100
135
|
version: '0'
|
101
136
|
type: :development
|
102
137
|
prerelease: false
|
103
|
-
version_requirements:
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
104
144
|
description: tengine_support provides utility classes/modules which is not included
|
105
145
|
in active_support. It doesn't depend on other tengine gems.
|
106
146
|
email: tengine-info@groovenauts.jp
|
@@ -109,73 +149,37 @@ extensions: []
|
|
109
149
|
extra_rdoc_files:
|
110
150
|
- README.md
|
111
151
|
files:
|
112
|
-
- .document
|
113
|
-
- .rspec
|
114
|
-
- .travis.yml
|
115
152
|
- Gemfile
|
116
|
-
- 'NULL'
|
117
153
|
- README.md
|
118
|
-
- Rakefile
|
119
|
-
- VERSION
|
120
|
-
- gemfiles/Gemfile.activesupport-3.0.10
|
121
|
-
- gemfiles/Gemfile.activesupport-3.1.1
|
122
|
-
- gemfiles/Gemfile.activesupport-3.2.3
|
123
|
-
- lib/tengine/support.rb
|
124
|
-
- lib/tengine/support/config.rb
|
125
154
|
- lib/tengine/support/config/amqp.rb
|
126
|
-
- lib/tengine/support/config/definition.rb
|
127
155
|
- lib/tengine/support/config/definition/field.rb
|
128
156
|
- lib/tengine/support/config/definition/group.rb
|
129
157
|
- lib/tengine/support/config/definition/has_many_children.rb
|
130
158
|
- lib/tengine/support/config/definition/optparse_visitor.rb
|
131
159
|
- lib/tengine/support/config/definition/suite.rb
|
160
|
+
- lib/tengine/support/config/definition.rb
|
132
161
|
- lib/tengine/support/config/logger.rb
|
133
162
|
- lib/tengine/support/config/mongoid.rb
|
134
|
-
- lib/tengine/support/
|
135
|
-
- lib/tengine/support/core_ext/array.rb
|
163
|
+
- lib/tengine/support/config.rb
|
136
164
|
- lib/tengine/support/core_ext/array/deep_dup.rb
|
137
|
-
- lib/tengine/support/core_ext/
|
165
|
+
- lib/tengine/support/core_ext/array.rb
|
138
166
|
- lib/tengine/support/core_ext/enumerable/deep_freeze.rb
|
139
167
|
- lib/tengine/support/core_ext/enumerable/each_next_tick.rb
|
140
|
-
- lib/tengine/support/core_ext/
|
168
|
+
- lib/tengine/support/core_ext/enumerable/map_to_hash.rb
|
169
|
+
- lib/tengine/support/core_ext/enumerable.rb
|
141
170
|
- lib/tengine/support/core_ext/hash/compact.rb
|
142
171
|
- lib/tengine/support/core_ext/hash/deep_dup.rb
|
143
172
|
- lib/tengine/support/core_ext/hash/keys.rb
|
144
|
-
- lib/tengine/support/core_ext/
|
173
|
+
- lib/tengine/support/core_ext/hash.rb
|
145
174
|
- lib/tengine/support/core_ext/module/private_constant.rb
|
175
|
+
- lib/tengine/support/core_ext/module.rb
|
176
|
+
- lib/tengine/support/core_ext.rb
|
146
177
|
- lib/tengine/support/mongoid.rb
|
147
178
|
- lib/tengine/support/null_logger.rb
|
148
179
|
- lib/tengine/support/yaml_with_erb.rb
|
180
|
+
- lib/tengine/support.rb
|
149
181
|
- lib/tengine_support.rb
|
150
|
-
|
151
|
-
- spec/support/app1.rb
|
152
|
-
- spec/support/suite.rb
|
153
|
-
- spec/tengine/support/config/amqp_spec.rb
|
154
|
-
- spec/tengine/support/config/logger_spec.rb
|
155
|
-
- spec/tengine/support/config/mongoid_spec.rb
|
156
|
-
- spec/tengine/support/config_spec.rb
|
157
|
-
- spec/tengine/support/config_spec/dump_skelton_spec.rb
|
158
|
-
- spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb
|
159
|
-
- spec/tengine/support/config_spec/load_spec.rb
|
160
|
-
- spec/tengine/support/config_spec/load_spec_01.yml.erb
|
161
|
-
- spec/tengine/support/config_spec/load_spec_01_with_other_settings.yml.erb
|
162
|
-
- spec/tengine/support/config_spec/load_spec_02.yml.erb
|
163
|
-
- spec/tengine/support/config_spec/parse_spec.rb
|
164
|
-
- spec/tengine/support/core_ext/array/deep_dup_spec.rb
|
165
|
-
- spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb
|
166
|
-
- spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb
|
167
|
-
- spec/tengine/support/core_ext/hash/compact_spec.rb
|
168
|
-
- spec/tengine/support/core_ext/hash/deep_dup_spec.rb
|
169
|
-
- spec/tengine/support/core_ext/hash/keys_spec.rb
|
170
|
-
- spec/tengine/support/mongoid_spec.rb
|
171
|
-
- spec/tengine/support/null_logger_spec.rb
|
172
|
-
- spec/tengine/support/yaml_with_erb_spec.rb
|
173
|
-
- spec/tengine/support/yaml_with_erb_spec/test1.yml.erb
|
174
|
-
- spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml
|
175
|
-
- spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml
|
176
|
-
- spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml
|
177
|
-
- tengine_support.gemspec
|
178
|
-
homepage: http://github.com/tengine/tengine_support
|
182
|
+
homepage: https://github.com/tengine/tengine/tree/develop/tengine_support
|
179
183
|
licenses:
|
180
184
|
- MPL/LGPL
|
181
185
|
post_install_message:
|
@@ -190,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
194
|
version: '0'
|
191
195
|
segments:
|
192
196
|
- 0
|
193
|
-
hash:
|
197
|
+
hash: 3178106423311432390
|
194
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
199
|
none: false
|
196
200
|
requirements:
|
@@ -199,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
203
|
version: '0'
|
200
204
|
requirements: []
|
201
205
|
rubyforge_project:
|
202
|
-
rubygems_version: 1.8.
|
206
|
+
rubygems_version: 1.8.23
|
203
207
|
signing_key:
|
204
208
|
specification_version: 3
|
205
209
|
summary: tengine_support provides utility classes/modules which isn't included in
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/.travis.yml
DELETED
data/NULL
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Logfile created on 2011-11-18 16:34:49 +0900 by logger.rb/v1.2.7
|
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "tengine_support"
|
18
|
-
gem.homepage = "http://github.com/tengine/tengine_support"
|
19
|
-
gem.license = "MPL/LGPL"
|
20
|
-
gem.summary = "tengine_support provides utility classes/modules which isn't included in active_support."
|
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-info@groovenauts.jp"
|
23
|
-
gem.authors = %w[shyouhei akm taigou]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rspec/core'
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
38
|
-
|
39
|
-
task :default => :spec
|
40
|
-
task :test => :spec # for rubygems-test
|
41
|
-
|
42
|
-
require 'yard'
|
43
|
-
YARD::Rake::YardocTask.new
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.27
|
@@ -1,24 +0,0 @@
|
|
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.0.10"
|
7
|
-
group :test do
|
8
|
-
gem "eventmachine", "~> 0.12.0"
|
9
|
-
gem "mongoid", "~> 2.2.6"
|
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
|
@@ -1,24 +0,0 @@
|
|
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.1.1"
|
7
|
-
group :test do
|
8
|
-
gem "eventmachine", "~> 0.12.0"
|
9
|
-
gem "mongoid", "~> 2.3.3"
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'tengine_support'
|
5
|
-
|
6
|
-
require 'simplecov'
|
7
|
-
SimpleCov.start if ENV["COVERAGE"]
|
8
|
-
|
9
|
-
# Requires supporting files with custom matchers and macros, etc,
|
10
|
-
# in ./support/ and its subdirectories.
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
|
15
|
-
end
|
data/spec/support/app1.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module App1
|
2
|
-
class ProcessConfig
|
3
|
-
include Tengine::Support::Config::Definition
|
4
|
-
field :daemon, "process works on background.", :type => :boolean
|
5
|
-
field :pid_dir, "path/to/dir for PID created.", :type => :directory
|
6
|
-
end
|
7
|
-
|
8
|
-
class LoggerConfig < Tengine::Support::Config::Logger
|
9
|
-
parameter :logger_name
|
10
|
-
depends :process_config
|
11
|
-
depends :log_common
|
12
|
-
field :output,
|
13
|
-
:default => proc{
|
14
|
-
process_config.daemon ?
|
15
|
-
"./log/#{logger_name}.log" : "STDOUT" },
|
16
|
-
:default_description => proc{"if daemon process then \"./log/#{logger_name}.log\" else \"STDOUT\""}
|
17
|
-
field :rotation,
|
18
|
-
:default => proc{ log_common.rotation },
|
19
|
-
:default_description => proc{"value of #{log_common.long_opt}-rotation"}
|
20
|
-
field :rotation_size,
|
21
|
-
:default => proc{ log_common.rotation_size },
|
22
|
-
:default_description => proc{"value of #{log_common.long_opt}-rotation-size"}
|
23
|
-
field :level,
|
24
|
-
:default => proc{ log_common.level },
|
25
|
-
:default_description => proc{"value of #{log_common.long_opt}-level"}
|
26
|
-
end
|
27
|
-
end
|