tengine_support 0.3.16 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/tengine/support/config/definition.rb +11 -1
- data/lib/tengine/support/config/definition/has_many_children.rb +10 -1
- data/lib/tengine/support/config/logger.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config/amqp_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config/logger_spec.rb +2 -2
- data/spec/{tengine_support → tengine/support}/config/mongoid_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config_spec/dump_skelton_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config_spec/load_config_file_by_config_option_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config_spec/load_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/config_spec/load_spec_01.yml.erb +0 -0
- data/spec/{tengine_support → tengine/support}/config_spec/load_spec_02.yml.erb +0 -0
- data/spec/{tengine_support → tengine/support}/config_spec/parse_spec.rb +54 -8
- data/spec/{tengine_support → tengine/support}/core_ext/array/deep_dup_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/core_ext/hash/deep_dup_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/core_ext/hash/keys_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/null_logger_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/yaml_with_erb_spec.rb +1 -1
- data/spec/{tengine_support → tengine/support}/yaml_with_erb_spec/test1.yml.erb +0 -0
- data/spec/{tengine_support → tengine/support}/yaml_with_erb_spec/test2_with_erb.yml +0 -0
- data/spec/{tengine_support → tengine/support}/yaml_with_erb_spec/test3_without_erb.yml +0 -0
- data/spec/{tengine_support → tengine/support}/yaml_with_erb_spec/test4_with_invalid_erb.yml +0 -0
- data/tengine_support.gemspec +21 -21
- metadata +38 -38
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.17
|
@@ -59,7 +59,17 @@ module Tengine::Support::Config::Definition
|
|
59
59
|
result
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
|
+
define_method("#{field.__name__}=") do |value|
|
64
|
+
val =
|
65
|
+
case field.type
|
66
|
+
when :boolean then !!value
|
67
|
+
when :integer then value.nil? ? nil : value.to_i
|
68
|
+
when :string then value.nil? ? nil : value.to_s
|
69
|
+
else value
|
70
|
+
end
|
71
|
+
instance_variable_set("@#{field.__name__}", val)
|
72
|
+
end
|
63
73
|
end
|
64
74
|
end
|
65
75
|
|
@@ -87,7 +87,16 @@ module Tengine::Support::Config::Definition::HasManyChildren
|
|
87
87
|
instance_variable_get("@#{field.__name__}") ||
|
88
88
|
(field.default.respond_to?(:to_proc) ? self.instance_eval(&field.deault) : field.default)
|
89
89
|
end
|
90
|
-
|
90
|
+
define_method("#{field.__name__}=") do |value|
|
91
|
+
val =
|
92
|
+
case field.type
|
93
|
+
when :boolean then !!value
|
94
|
+
when :integer then value.nil? ? nil : value.to_i
|
95
|
+
when :string then value.nil? ? nil : value.to_s
|
96
|
+
else value
|
97
|
+
end
|
98
|
+
instance_variable_set("@#{field.__name__}", val)
|
99
|
+
end
|
91
100
|
end
|
92
101
|
end
|
93
102
|
|
@@ -6,7 +6,7 @@ class Tengine::Support::Config::Logger
|
|
6
6
|
include Tengine::Support::Config::Definition
|
7
7
|
|
8
8
|
field :output, 'file path or "STDOUT" / "STDERR" / "NULL".', :type => :string, :default => "STDOUT"
|
9
|
-
field :rotation, 'rotation file count or daily,weekly,monthly.', :type => :string
|
9
|
+
field :rotation, 'rotation file count or daily,weekly,monthly.' # , :type => :string
|
10
10
|
field :rotation_size, 'number of max log file size.', :type => :integer
|
11
11
|
field :level, 'Logging severity threshold. debug/info/warn/error/fatal.', :type => :string, :default => "info"
|
12
12
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
3
3
|
|
4
4
|
require 'logger'
|
5
5
|
require 'tempfile'
|
@@ -17,7 +17,7 @@ describe 'Tengine::Support::Config::Logger' do
|
|
17
17
|
|
18
18
|
describe Tengine::Support::Config::Logger.rotation do
|
19
19
|
it { subject.should be_a(Tengine::Support::Config::Definition::Field)}
|
20
|
-
its(:type){ should ==
|
20
|
+
its(:type){ should == nil} # 文字列か整数値なので指定していません
|
21
21
|
its(:__name__){ should == :rotation }
|
22
22
|
its(:description){ should == 'rotation file count or daily,weekly,monthly.'}
|
23
23
|
its(:default){ should == nil}
|
File without changes
|
File without changes
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
3
3
|
|
4
4
|
describe "config" do
|
5
5
|
describe :parse! do
|
6
6
|
context "setting1" do
|
7
|
-
shared_examples_for "
|
7
|
+
shared_examples_for "common_data" do
|
8
8
|
it { subject.action.should == 'start'}
|
9
9
|
it { subject.config.should == nil}
|
10
10
|
it { subject.process.should be_a(App1::ProcessConfig) }
|
11
|
-
it { subject.process.daemon.should == nil}
|
11
|
+
# it { subject.process.daemon.should == nil}
|
12
12
|
it { subject.process.pid_dir.should == nil}
|
13
13
|
it { subject.db.should be_a(Tengine::Support::Config::Mongoid::Connection) }
|
14
14
|
it { subject.db.host.should == "mongo1"}
|
15
|
-
it { subject.db.port.should == 27017}
|
15
|
+
# it { subject.db.port.should == 27017}
|
16
16
|
it { subject.db.username.should == 'goku'}
|
17
17
|
it { subject.db.password.should == 'ideyoshenlong'}
|
18
18
|
it { subject.db.database.should == "tengine_production"}
|
@@ -27,14 +27,34 @@ describe "config" do
|
|
27
27
|
it { subject.log_common.rotation.should == 3}
|
28
28
|
it { subject.log_common.rotation_size.should == 1024 * 1024}
|
29
29
|
it { subject.log_common.level.should == "debug"}
|
30
|
-
it { subject.application_log.output.should == "STDOUT"}
|
30
|
+
# it { subject.application_log.output.should == "STDOUT"}
|
31
31
|
it { subject.application_log.rotation.should == 3}
|
32
32
|
it { subject.application_log.rotation_size.should == 1024 * 1024}
|
33
33
|
it { subject.application_log.level.should == "debug"}
|
34
|
-
it { subject.process_stdout_log.output.should == "STDOUT"}
|
34
|
+
# it { subject.process_stdout_log.output.should == "STDOUT"}
|
35
35
|
it { subject.process_stdout_log.rotation.should == 3}
|
36
36
|
it { subject.process_stdout_log.rotation_size.should == 1024 * 1024}
|
37
37
|
it { subject.process_stdout_log.level.should == "info"}
|
38
|
+
# it { subject.process_stderr_log.output.should == "STDOUT"}
|
39
|
+
it { subject.process_stderr_log.rotation.should == 3}
|
40
|
+
it { subject.process_stderr_log.rotation_size.should == 1024 * 1024}
|
41
|
+
it { subject.process_stderr_log.level.should == "debug"}
|
42
|
+
end
|
43
|
+
|
44
|
+
shared_examples_for "data1" do
|
45
|
+
it { subject.db.port.should == 27017}
|
46
|
+
it { subject.process.daemon.should == nil}
|
47
|
+
it { subject.application_log.output.should == "STDOUT"}
|
48
|
+
it { subject.process_stdout_log.output.should == "STDOUT"}
|
49
|
+
it { subject.process_stderr_log.output.should == "STDOUT"}
|
50
|
+
end
|
51
|
+
|
52
|
+
shared_examples_for "data2" do
|
53
|
+
it { subject.db.port.should == 27020}
|
54
|
+
it { subject.process.daemon.should == true}
|
55
|
+
it { subject.application_log.output.should == "./log/application.log"}
|
56
|
+
it { subject.process_stdout_log.output.should == "./log/suite_stdout.log"}
|
57
|
+
it { subject.process_stderr_log.output.should == "./log/suite_stderr.log"}
|
38
58
|
end
|
39
59
|
|
40
60
|
context "use long option name" do
|
@@ -43,7 +63,8 @@ describe "config" do
|
|
43
63
|
@suite.parse!(%w[--action=start --db-host=mongo1 --db-username=goku --db-password=ideyoshenlong --log-common-level=debug --process-stdout-log-level=info])
|
44
64
|
end
|
45
65
|
subject{ @suite }
|
46
|
-
it_should_behave_like "
|
66
|
+
it_should_behave_like "common_data"
|
67
|
+
it_should_behave_like "data1"
|
47
68
|
end
|
48
69
|
|
49
70
|
context "use short option name" do
|
@@ -52,7 +73,32 @@ describe "config" do
|
|
52
73
|
@suite.parse!(%w[-k start -O mongo1 -U goku -S ideyoshenlong --log-common-level=debug --process-stdout-log-level=info])
|
53
74
|
end
|
54
75
|
subject{ @suite }
|
55
|
-
it_should_behave_like "
|
76
|
+
it_should_behave_like "common_data"
|
77
|
+
it_should_behave_like "data1"
|
78
|
+
end
|
79
|
+
|
80
|
+
context "field value specified" do
|
81
|
+
context "long option name" do
|
82
|
+
before(:all) do
|
83
|
+
@suite = build_suite1
|
84
|
+
@suite.parse!(%w[-k start -O mongo1 -U goku -S ideyoshenlong --log-common-level=debug --process-stdout-log-level=info] +
|
85
|
+
%w[--process-daemon --db-port=27020])
|
86
|
+
end
|
87
|
+
subject{ @suite }
|
88
|
+
it_should_behave_like "common_data"
|
89
|
+
it_should_behave_like "data2"
|
90
|
+
end
|
91
|
+
|
92
|
+
context "short options name" do
|
93
|
+
before(:all) do
|
94
|
+
@suite = build_suite1
|
95
|
+
@suite.parse!(%w[-k start -O mongo1 -U goku -S ideyoshenlong --log-common-level=debug --process-stdout-log-level=info] +
|
96
|
+
%w[-D -P 27020])
|
97
|
+
end
|
98
|
+
subject{ @suite }
|
99
|
+
it_should_behave_like "common_data"
|
100
|
+
it_should_behave_like "data2"
|
101
|
+
end
|
56
102
|
end
|
57
103
|
|
58
104
|
context "show help" do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/tengine_support.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "tengine_support"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.17"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["saishu", "w-irie", "taigou", "totty", "hiroshinakao", "g-morita", "guemon", "aoetk", "hattori-at-nt", "t-yamada", "y-karashima", "akm"]
|
12
|
-
s.date = "2011-11-
|
12
|
+
s.date = "2011-11-23"
|
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
14
|
s.email = "tengine@nautilus-technologies.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -49,25 +49,25 @@ Gem::Specification.new do |s|
|
|
49
49
|
"spec/spec_helper.rb",
|
50
50
|
"spec/support/app1.rb",
|
51
51
|
"spec/support/suite.rb",
|
52
|
-
"spec/
|
53
|
-
"spec/
|
54
|
-
"spec/
|
55
|
-
"spec/
|
56
|
-
"spec/
|
57
|
-
"spec/
|
58
|
-
"spec/
|
59
|
-
"spec/
|
60
|
-
"spec/
|
61
|
-
"spec/
|
62
|
-
"spec/
|
63
|
-
"spec/
|
64
|
-
"spec/
|
65
|
-
"spec/
|
66
|
-
"spec/
|
67
|
-
"spec/
|
68
|
-
"spec/
|
69
|
-
"spec/
|
70
|
-
"spec/
|
52
|
+
"spec/tengine/support/config/amqp_spec.rb",
|
53
|
+
"spec/tengine/support/config/logger_spec.rb",
|
54
|
+
"spec/tengine/support/config/mongoid_spec.rb",
|
55
|
+
"spec/tengine/support/config_spec.rb",
|
56
|
+
"spec/tengine/support/config_spec/dump_skelton_spec.rb",
|
57
|
+
"spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb",
|
58
|
+
"spec/tengine/support/config_spec/load_spec.rb",
|
59
|
+
"spec/tengine/support/config_spec/load_spec_01.yml.erb",
|
60
|
+
"spec/tengine/support/config_spec/load_spec_02.yml.erb",
|
61
|
+
"spec/tengine/support/config_spec/parse_spec.rb",
|
62
|
+
"spec/tengine/support/core_ext/array/deep_dup_spec.rb",
|
63
|
+
"spec/tengine/support/core_ext/hash/deep_dup_spec.rb",
|
64
|
+
"spec/tengine/support/core_ext/hash/keys_spec.rb",
|
65
|
+
"spec/tengine/support/null_logger_spec.rb",
|
66
|
+
"spec/tengine/support/yaml_with_erb_spec.rb",
|
67
|
+
"spec/tengine/support/yaml_with_erb_spec/test1.yml.erb",
|
68
|
+
"spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml",
|
69
|
+
"spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml",
|
70
|
+
"spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml",
|
71
71
|
"tengine_support.gemspec"
|
72
72
|
]
|
73
73
|
s.homepage = "http://github.com/tengine/tengine_support"
|
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.
|
4
|
+
version: 0.3.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -20,11 +20,11 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2011-11-
|
23
|
+
date: 2011-11-23 00:00:00.000000000Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70103819887020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70103819887020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70103819885900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.6.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70103819885900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &70103819884700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.7.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70103819884700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70103819862800 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.18
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70103819862800
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &70103819861580 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70103819861580
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &70103819860420 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.5.3
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70103819860420
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: autotest
|
93
|
-
requirement: &
|
93
|
+
requirement: &70103819858940 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70103819858940
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdiscount
|
104
|
-
requirement: &
|
104
|
+
requirement: &70103819857380 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70103819857380
|
113
113
|
description: tengine_support provides utility classes/modules which is not included
|
114
114
|
in active_support. It doesn't depend on other tengine gems.
|
115
115
|
email: tengine@nautilus-technologies.com
|
@@ -151,25 +151,25 @@ files:
|
|
151
151
|
- spec/spec_helper.rb
|
152
152
|
- spec/support/app1.rb
|
153
153
|
- spec/support/suite.rb
|
154
|
-
- spec/
|
155
|
-
- spec/
|
156
|
-
- spec/
|
157
|
-
- spec/
|
158
|
-
- spec/
|
159
|
-
- spec/
|
160
|
-
- spec/
|
161
|
-
- spec/
|
162
|
-
- spec/
|
163
|
-
- spec/
|
164
|
-
- spec/
|
165
|
-
- spec/
|
166
|
-
- spec/
|
167
|
-
- spec/
|
168
|
-
- spec/
|
169
|
-
- spec/
|
170
|
-
- spec/
|
171
|
-
- spec/
|
172
|
-
- spec/
|
154
|
+
- spec/tengine/support/config/amqp_spec.rb
|
155
|
+
- spec/tengine/support/config/logger_spec.rb
|
156
|
+
- spec/tengine/support/config/mongoid_spec.rb
|
157
|
+
- spec/tengine/support/config_spec.rb
|
158
|
+
- spec/tengine/support/config_spec/dump_skelton_spec.rb
|
159
|
+
- spec/tengine/support/config_spec/load_config_file_by_config_option_spec.rb
|
160
|
+
- spec/tengine/support/config_spec/load_spec.rb
|
161
|
+
- spec/tengine/support/config_spec/load_spec_01.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/hash/deep_dup_spec.rb
|
166
|
+
- spec/tengine/support/core_ext/hash/keys_spec.rb
|
167
|
+
- spec/tengine/support/null_logger_spec.rb
|
168
|
+
- spec/tengine/support/yaml_with_erb_spec.rb
|
169
|
+
- spec/tengine/support/yaml_with_erb_spec/test1.yml.erb
|
170
|
+
- spec/tengine/support/yaml_with_erb_spec/test2_with_erb.yml
|
171
|
+
- spec/tengine/support/yaml_with_erb_spec/test3_without_erb.yml
|
172
|
+
- spec/tengine/support/yaml_with_erb_spec/test4_with_invalid_erb.yml
|
173
173
|
- tengine_support.gemspec
|
174
174
|
homepage: http://github.com/tengine/tengine_support
|
175
175
|
licenses:
|
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
segments:
|
188
188
|
- 0
|
189
|
-
hash:
|
189
|
+
hash: -1778274084898480628
|
190
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
191
|
none: false
|
192
192
|
requirements:
|