rdm 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -8
- data/bin/rdm +10 -10
- data/example/.rdm/templates/configs/<%=config_path%> +2 -0
- data/example/.rdm/templates/configs/<%=role_config_path%> +2 -0
- data/example/Rdm.packages +17 -1
- data/example/configs/app/default.yml +2 -0
- data/example/configs/app/production.yml +2 -0
- data/example/configs/database/default.yml +3 -0
- data/example/env_files/development.env +3 -0
- data/example/env_files/production.env +5 -0
- data/example/env_files/test.env +3 -0
- data/example/infrastructure/repository/Package.rb +1 -0
- data/lib/rdm.rb +7 -14
- data/lib/rdm/cli/config.rb +31 -0
- data/lib/rdm/config.rb +11 -0
- data/lib/rdm/config_locals.rb +11 -0
- data/lib/rdm/config_manager.rb +68 -0
- data/lib/rdm/config_scope.rb +23 -0
- data/lib/rdm/errors.rb +0 -3
- data/lib/rdm/gen/config.rb +59 -0
- data/lib/rdm/gen/init.rb +4 -0
- data/lib/rdm/package.rb +9 -18
- data/lib/rdm/package_importer.rb +17 -3
- data/lib/rdm/package_parser.rb +0 -1
- data/lib/rdm/packages/compiler_service.rb +7 -1
- data/lib/rdm/settings.rb +21 -10
- data/lib/rdm/source.rb +18 -1
- data/lib/rdm/source_parser.rb +45 -2
- data/lib/rdm/spec_runner/runner.rb +2 -2
- data/lib/rdm/templates/configs/<%=config_path%> +2 -0
- data/lib/rdm/templates/configs/<%=role_config_path%> +2 -0
- data/lib/rdm/templates/init/Rdm.packages +12 -0
- data/lib/rdm/templates/init/env_files/development.env +3 -0
- data/lib/rdm/templates/init/env_files/production.env +3 -0
- data/lib/rdm/templates/init/env_files/test.env +3 -0
- data/lib/rdm/version.rb +1 -1
- data/rdm.gemspec +0 -3
- data/spec/fixtures/SampleSource.rb +4 -2
- data/spec/fixtures/config.yml +2 -0
- data/spec/rdm/cli/gen_package_spec.rb +2 -0
- data/spec/rdm/config_manager_spec.rb +136 -0
- data/spec/rdm/gen/config_spec.rb +31 -0
- data/spec/rdm/gen/init_spec.rb +12 -0
- data/spec/rdm/gen/package_spec.rb +0 -1
- data/spec/rdm/package_importer_spec.rb +2 -34
- data/spec/rdm/rdm_spec.rb +1 -1
- data/spec/rdm/source_parser_spec.rb +59 -0
- data/spec/spec_helper.rb +0 -1
- metadata +27 -63
- data/example/config/app.yml +0 -6
- data/example/infrastructure/repository/fixture.txt +0 -1
- data/lib/rdm/utils/ostruct_utils.rb +0 -12
- data/lib/rdm/yml_config/config_caster.rb +0 -32
- data/lib/rdm/yml_config/config_manager.rb +0 -39
- data/lib/rdm/yml_config/config_validator.rb +0 -51
- data/lib/rdm/yml_config/env_config.rb +0 -46
- data/lib/rdm/yml_config/env_config_dsl.rb +0 -92
- data/lib/rdm/yml_config/validate_config.rb +0 -13
- data/spec/fixtures/app.yml +0 -17
- data/spec/rdm/yml_config/config_caster_spec.rb +0 -64
- data/spec/rdm/yml_config/config_manager_spec.rb +0 -7
- data/spec/rdm/yml_config/config_validator_spec.rb +0 -190
- data/spec/rdm/yml_config/env_config_dsl_spec.rb +0 -123
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Rdm::EnvConfigDSL do
|
4
|
-
subject { described_class.new }
|
5
|
-
let(:env_context) {
|
6
|
-
Proc.new do
|
7
|
-
string :url, optional: true do
|
8
|
-
length({ min: 4, max: 7, equal_to: 2 })
|
9
|
-
end
|
10
|
-
|
11
|
-
array :connections, each: :string, default: [4] do
|
12
|
-
size({ min: 0, max: 20})
|
13
|
-
end
|
14
|
-
|
15
|
-
hash :log_level do
|
16
|
-
symbol :output do
|
17
|
-
inclusion({ in: [:warn, :debug, :fatal, :error, :info] })
|
18
|
-
end
|
19
|
-
|
20
|
-
integer :level
|
21
|
-
end
|
22
|
-
|
23
|
-
array :some_array, each: :hash do
|
24
|
-
string :key do
|
25
|
-
length({ min: 4, max: 10 })
|
26
|
-
end
|
27
|
-
|
28
|
-
string :one_more_key, optional: true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
}
|
32
|
-
|
33
|
-
it 'handle dsl' do
|
34
|
-
subject.instance_exec(&env_context)
|
35
|
-
|
36
|
-
expect(subject.data.first).to be_a(Rdm::EnvConfig)
|
37
|
-
expect(subject.data.map(&:to_hash)).to match(
|
38
|
-
[
|
39
|
-
{
|
40
|
-
name: :url,
|
41
|
-
type: :string,
|
42
|
-
optional: true,
|
43
|
-
validates: {
|
44
|
-
length: {
|
45
|
-
min: 4,
|
46
|
-
max: 7,
|
47
|
-
equal_to: 2
|
48
|
-
}
|
49
|
-
}
|
50
|
-
},
|
51
|
-
{
|
52
|
-
name: :connections,
|
53
|
-
type: :array,
|
54
|
-
optional: false,
|
55
|
-
default: [4],
|
56
|
-
children: [
|
57
|
-
{
|
58
|
-
type: :string,
|
59
|
-
optional: false,
|
60
|
-
validates: {
|
61
|
-
size: {
|
62
|
-
min: 0,
|
63
|
-
max: 20
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
]
|
68
|
-
},
|
69
|
-
{
|
70
|
-
name: :log_level,
|
71
|
-
type: :hash,
|
72
|
-
optional: false,
|
73
|
-
children: [
|
74
|
-
{
|
75
|
-
name: :output,
|
76
|
-
type: :symbol,
|
77
|
-
optional: false,
|
78
|
-
validates: {
|
79
|
-
inclusion: {
|
80
|
-
in: [:warn, :debug, :fatal, :error, :info]
|
81
|
-
}
|
82
|
-
}
|
83
|
-
},
|
84
|
-
{
|
85
|
-
name: :level,
|
86
|
-
type: :integer,
|
87
|
-
optional: false
|
88
|
-
}
|
89
|
-
]
|
90
|
-
},
|
91
|
-
{
|
92
|
-
name: :some_array,
|
93
|
-
type: :array,
|
94
|
-
optional: false,
|
95
|
-
children: [
|
96
|
-
{
|
97
|
-
type: :hash,
|
98
|
-
optional: false,
|
99
|
-
children: [
|
100
|
-
{
|
101
|
-
name: :key,
|
102
|
-
type: :string,
|
103
|
-
optional: false,
|
104
|
-
validates: {
|
105
|
-
length: {
|
106
|
-
min: 4,
|
107
|
-
max: 10
|
108
|
-
}
|
109
|
-
}
|
110
|
-
},
|
111
|
-
{
|
112
|
-
name: :one_more_key,
|
113
|
-
type: :string,
|
114
|
-
optional: true
|
115
|
-
}
|
116
|
-
]
|
117
|
-
}
|
118
|
-
]
|
119
|
-
}
|
120
|
-
]
|
121
|
-
)
|
122
|
-
end
|
123
|
-
end
|