ykutils 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/.rubocop.yml +2 -1
- data/.rubocop_todo.yml +181 -85
- data/Gemfile +11 -11
- data/Gemfile.lock +17 -12
- data/bin/erubix +1 -1
- data/bin/makegrid +4 -4
- data/lib/ykutils/debugutils.rb +44 -32
- data/lib/ykutils/erubyx.rb +30 -19
- data/lib/ykutils/fileoputils.rb +2 -2
- data/lib/ykutils/gridlist.rb +49 -49
- data/lib/ykutils/lines.rb +143 -143
- data/lib/ykutils/lsutils.rb +71 -71
- data/lib/ykutils/nginxconfig.rb +40 -41
- data/lib/ykutils/nginxconfigfiles.rb +31 -31
- data/lib/ykutils/nkfutil.rb +148 -147
- data/lib/ykutils/nkfutil19.rb +9 -11
- data/lib/ykutils/osutil.rb +16 -16
- data/lib/ykutils/retcodex.rb +1 -3
- data/lib/ykutils/stext.rb +427 -425
- data/lib/ykutils/stextx.rb +32 -32
- data/lib/ykutils/stringutils.rb +111 -111
- data/lib/ykutils/treemanager.rb +33 -33
- data/lib/ykutils/treemanagera.rb +21 -21
- data/lib/ykutils/version.rb +1 -1
- data/lib/ykutils/xlines.rb +8 -8
- data/lib/ykutils/yamlop.rb +227 -227
- data/lib/ykutils/yamlxop.rb +35 -35
- data/test_data/4servers.erb +7 -7
- data/test_data/a.bat +5 -5
- data/test_data/a_ncn.bat +12 -12
- data/test_data/v103-3-189-127/a.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/a.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/b.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/b.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/c.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/c.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/d.northern-cross.info/base.yml +28 -28
- data/test_data/v103-3-189-127/d.northern-cross.info/value_host.yml +1 -1
- data/test_data/v103-3-189-127/d.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/d.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/e.northern-cross.info/base.yml +28 -28
- data/test_data/v103-3-189-127/e.northern-cross.info/value_host.yml +1 -1
- data/test_data/v103-3-189-127/e.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/e.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/f.northern-cross.info/base.yml +28 -28
- data/test_data/v103-3-189-127/f.northern-cross.info/value_host.yml +1 -1
- data/test_data/v103-3-189-127/f.northern-cross.net/base.yml +28 -28
- data/test_data/v103-3-189-127/f.northern-cross.net/value_host.yml +1 -1
- data/test_data/v103-3-189-127/t_server_1.erb +7 -7
- data/test_data/v103-3-189-127/template.erb +21 -21
- data/test_data/v103-3-189-127/template_ssl.erb +22 -22
- data/test_data/v103-3-189-127/template_ssl_www.erb +12 -12
- data/test_data/v103-3-189-127/template_www.erb +24 -24
- data/test_data/v103-3-189-127/value.yml +3 -3
- data/test_data/v103-3-189-127/value_ssl.yml +5 -5
- data/ykutils.gemspec +45 -43
- metadata +8 -9
- data/_config.yml +0 -1
data/lib/ykutils/yamlop.rb
CHANGED
@@ -1,227 +1,227 @@
|
|
1
|
-
require "ykutils/specfileop"
|
2
|
-
require "ykutils/stext"
|
3
|
-
require "ykutils/datastructop"
|
4
|
-
|
5
|
-
module Ykutils
|
6
|
-
class YamlOp
|
7
|
-
attr_accessor :valid, :yaml, :ofname
|
8
|
-
|
9
|
-
include SpecFileOp
|
10
|
-
include DataStructOp
|
11
|
-
|
12
|
-
TEST_ID_NO_VALUE = 0
|
13
|
-
TEST_ID_LISTUP_ALL = 1
|
14
|
-
|
15
|
-
def initialize(opts = {}, _argv = [], _debug = false)
|
16
|
-
@fname = nil
|
17
|
-
@check_flag = opts["check"]
|
18
|
-
@ifname = opts["input_file"]
|
19
|
-
@ofname = opts["output_file"]
|
20
|
-
@reform_flag = opts["reform"]
|
21
|
-
@test_id = opts["test_id"]
|
22
|
-
@valid = true
|
23
|
-
@ptext = []
|
24
|
-
end
|
25
|
-
|
26
|
-
def valid?
|
27
|
-
@valid
|
28
|
-
end
|
29
|
-
|
30
|
-
def exec
|
31
|
-
if @reform_flag
|
32
|
-
reform
|
33
|
-
elsif @test_id > 0
|
34
|
-
case @test_id
|
35
|
-
when TEST_ID_LISTUP_ALL
|
36
|
-
test_listup
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
true
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_listup
|
44
|
-
import(@ifname)
|
45
|
-
puts "###listup_all"
|
46
|
-
ary = listup_all
|
47
|
-
ary.each do |it|
|
48
|
-
puts(it)
|
49
|
-
end
|
50
|
-
|
51
|
-
puts "###listup_host"
|
52
|
-
ary = listup_host
|
53
|
-
ary.each do |it|
|
54
|
-
puts(it)
|
55
|
-
end
|
56
|
-
|
57
|
-
puts "###listup_domain"
|
58
|
-
ary = listup_domain
|
59
|
-
ary.each do |it|
|
60
|
-
puts(it)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def load_yaml(fname)
|
65
|
-
@yaml = load_yaml_file(fname)
|
66
|
-
end
|
67
|
-
|
68
|
-
def load_yaml_ifname
|
69
|
-
@yaml = load_yaml_file(@ifname)
|
70
|
-
end
|
71
|
-
|
72
|
-
def load(fname)
|
73
|
-
ret = false
|
74
|
-
if File.file?(fname)
|
75
|
-
@fname = fname
|
76
|
-
@pstext = StructuredTextForAccount.new
|
77
|
-
# @pstext.load_analyze( fname , "C-#{fname}-#{Time.now.to_i}.txt" )
|
78
|
-
@pstext.load_analyze(fname)
|
79
|
-
@yaml = load_yaml_file(fname)
|
80
|
-
ret = true
|
81
|
-
end
|
82
|
-
|
83
|
-
ret
|
84
|
-
end
|
85
|
-
|
86
|
-
def yaml2stext(yaml = @yaml)
|
87
|
-
# begin
|
88
|
-
yaml_str = YAML.dump(yaml)
|
89
|
-
# puts yaml_str
|
90
|
-
# rescue => ex
|
91
|
-
# pp ex
|
92
|
-
# pp caller(0)
|
93
|
-
# exit 1000
|
94
|
-
# end
|
95
|
-
yaml_ary = yaml_str.split("\n")
|
96
|
-
|
97
|
-
@yamlstext = StructuredTextForAccount.new
|
98
|
-
@yamlstext.analyze(yaml_ary)
|
99
|
-
end
|
100
|
-
|
101
|
-
def sort
|
102
|
-
@yamlstext.sort_by(@pstext)
|
103
|
-
end
|
104
|
-
|
105
|
-
def import(fname)
|
106
|
-
ret = false
|
107
|
-
if File.file?(fname) and File.readable?(fname)
|
108
|
-
@ptext = load_plain_text_file(fname).collect { |it| it.chomp }
|
109
|
-
ret = false
|
110
|
-
end
|
111
|
-
ret
|
112
|
-
end
|
113
|
-
|
114
|
-
def importex(fname)
|
115
|
-
ret = import(fname)
|
116
|
-
if ret
|
117
|
-
@ptext_hash = {}
|
118
|
-
i = 0
|
119
|
-
@ptext_hash = make_hash(@ptext, 0) do |l, i|
|
120
|
-
if l !~ /^\s/ and l !~ /^==/
|
121
|
-
key, vale = l.split(":")
|
122
|
-
[key, { "CONTENT" => l, "INDEX" => i }]
|
123
|
-
end
|
124
|
-
end
|
125
|
-
ret = false
|
126
|
-
end
|
127
|
-
ret
|
128
|
-
end
|
129
|
-
|
130
|
-
def listup_all
|
131
|
-
@ptext.select { |l| l !~ /^\s/ and l !~ /^#/ }
|
132
|
-
end
|
133
|
-
|
134
|
-
def listup_host
|
135
|
-
@ptext.select { |l| l !~ /^\s/ and l !~ /^=/ and l !~ /^#/ }
|
136
|
-
end
|
137
|
-
|
138
|
-
def listup_domain
|
139
|
-
@ptext.select { |l| l =~ /^==/ }
|
140
|
-
end
|
141
|
-
|
142
|
-
def output_yaml(obj, fname)
|
143
|
-
File.open(fname, "w") do |file|
|
144
|
-
YAML.dump(obj, file)
|
145
|
-
end
|
146
|
-
rescue StandardError => e
|
147
|
-
pp e
|
148
|
-
pp e.backtrace
|
149
|
-
@valid = false
|
150
|
-
end
|
151
|
-
|
152
|
-
def update_yaml(yaml)
|
153
|
-
buf = File.read(@ifname)
|
154
|
-
File.write(@ofname, buf)
|
155
|
-
File.open(@ifname, "w") do |file|
|
156
|
-
YAML.dump(yaml, file)
|
157
|
-
end
|
158
|
-
rescue StandardError => e
|
159
|
-
pp e
|
160
|
-
pp e.backtrace
|
161
|
-
@valid = false
|
162
|
-
end
|
163
|
-
|
164
|
-
def dump_to_file(fname)
|
165
|
-
File.open(fname, "w") do |file|
|
166
|
-
@yamlstext.dump(file)
|
167
|
-
end
|
168
|
-
rescue StandardError => e
|
169
|
-
pp e
|
170
|
-
pp e.backtrace
|
171
|
-
@valid = false
|
172
|
-
end
|
173
|
-
|
174
|
-
def dump_ptext_to_file(fname)
|
175
|
-
file = File.open(fname, "w") do |file|
|
176
|
-
@ptext.each do |l|
|
177
|
-
file.write(l + "\n")
|
178
|
-
end
|
179
|
-
end
|
180
|
-
rescue StandardError => e
|
181
|
-
pp e
|
182
|
-
pp e.backtrace
|
183
|
-
@valid = false
|
184
|
-
end
|
185
|
-
|
186
|
-
def exchange_ptext(key, value)
|
187
|
-
@ptext[@ptext_hash[key]["INDEX"]] = value
|
188
|
-
@ptext_hash[key]["CONTENT"] = value
|
189
|
-
end
|
190
|
-
|
191
|
-
def reform
|
192
|
-
ret = importex(@ifname)
|
193
|
-
if ret
|
194
|
-
ary = listup_host.collect do |it|
|
195
|
-
key, value = it.split(":")
|
196
|
-
key
|
197
|
-
end
|
198
|
-
str = ary.join(" , ")
|
199
|
-
new_host_list = "=-HOST_LIST: [#{str}]"
|
200
|
-
ary2 = listup_domain.collect do |it|
|
201
|
-
key, value = it.split(":")
|
202
|
-
key
|
203
|
-
end
|
204
|
-
str2 = ary2.join(" , ")
|
205
|
-
new_domain_list = "=-DOMAIN_LIST: [#{str2}]"
|
206
|
-
pp "==new_host_list"
|
207
|
-
pp new_host_list
|
208
|
-
exchange_ptext("=-HOST_LIST", new_host_list)
|
209
|
-
exchange_ptext("=-DOMAIN_LIST", new_domain_list)
|
210
|
-
dump_ptext_to_file(@ofname)
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
def extract_value(ary)
|
215
|
-
ary.collect do |x|
|
216
|
-
x2 = x
|
217
|
-
x.scan(/{([^}]+)}/).each do |y|
|
218
|
-
y.each do |z|
|
219
|
-
re = Regexp.new(%({#{z}}))
|
220
|
-
x2 = x2.gsub(re, @yaml[z])
|
221
|
-
end
|
222
|
-
end
|
223
|
-
x2
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
1
|
+
require "ykutils/specfileop"
|
2
|
+
require "ykutils/stext"
|
3
|
+
require "ykutils/datastructop"
|
4
|
+
|
5
|
+
module Ykutils
|
6
|
+
class YamlOp
|
7
|
+
attr_accessor :valid, :yaml, :ofname
|
8
|
+
|
9
|
+
include SpecFileOp
|
10
|
+
include DataStructOp
|
11
|
+
|
12
|
+
TEST_ID_NO_VALUE = 0
|
13
|
+
TEST_ID_LISTUP_ALL = 1
|
14
|
+
|
15
|
+
def initialize(opts = {}, _argv = [], _debug = false)
|
16
|
+
@fname = nil
|
17
|
+
@check_flag = opts["check"]
|
18
|
+
@ifname = opts["input_file"]
|
19
|
+
@ofname = opts["output_file"]
|
20
|
+
@reform_flag = opts["reform"]
|
21
|
+
@test_id = opts["test_id"]
|
22
|
+
@valid = true
|
23
|
+
@ptext = []
|
24
|
+
end
|
25
|
+
|
26
|
+
def valid?
|
27
|
+
@valid
|
28
|
+
end
|
29
|
+
|
30
|
+
def exec
|
31
|
+
if @reform_flag
|
32
|
+
reform
|
33
|
+
elsif @test_id > 0
|
34
|
+
case @test_id
|
35
|
+
when TEST_ID_LISTUP_ALL
|
36
|
+
test_listup
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_listup
|
44
|
+
import(@ifname)
|
45
|
+
puts "###listup_all"
|
46
|
+
ary = listup_all
|
47
|
+
ary.each do |it|
|
48
|
+
puts(it)
|
49
|
+
end
|
50
|
+
|
51
|
+
puts "###listup_host"
|
52
|
+
ary = listup_host
|
53
|
+
ary.each do |it|
|
54
|
+
puts(it)
|
55
|
+
end
|
56
|
+
|
57
|
+
puts "###listup_domain"
|
58
|
+
ary = listup_domain
|
59
|
+
ary.each do |it|
|
60
|
+
puts(it)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def load_yaml(fname)
|
65
|
+
@yaml = load_yaml_file(fname)
|
66
|
+
end
|
67
|
+
|
68
|
+
def load_yaml_ifname
|
69
|
+
@yaml = load_yaml_file(@ifname)
|
70
|
+
end
|
71
|
+
|
72
|
+
def load(fname)
|
73
|
+
ret = false
|
74
|
+
if File.file?(fname)
|
75
|
+
@fname = fname
|
76
|
+
@pstext = StructuredTextForAccount.new
|
77
|
+
# @pstext.load_analyze( fname , "C-#{fname}-#{Time.now.to_i}.txt" )
|
78
|
+
@pstext.load_analyze(fname)
|
79
|
+
@yaml = load_yaml_file(fname)
|
80
|
+
ret = true
|
81
|
+
end
|
82
|
+
|
83
|
+
ret
|
84
|
+
end
|
85
|
+
|
86
|
+
def yaml2stext(yaml = @yaml)
|
87
|
+
# begin
|
88
|
+
yaml_str = YAML.dump(yaml)
|
89
|
+
# puts yaml_str
|
90
|
+
# rescue => ex
|
91
|
+
# pp ex
|
92
|
+
# pp caller(0)
|
93
|
+
# exit 1000
|
94
|
+
# end
|
95
|
+
yaml_ary = yaml_str.split("\n")
|
96
|
+
|
97
|
+
@yamlstext = StructuredTextForAccount.new
|
98
|
+
@yamlstext.analyze(yaml_ary)
|
99
|
+
end
|
100
|
+
|
101
|
+
def sort
|
102
|
+
@yamlstext.sort_by(@pstext)
|
103
|
+
end
|
104
|
+
|
105
|
+
def import(fname)
|
106
|
+
ret = false
|
107
|
+
if File.file?(fname) and File.readable?(fname)
|
108
|
+
@ptext = load_plain_text_file(fname).collect { |it| it.chomp }
|
109
|
+
ret = false
|
110
|
+
end
|
111
|
+
ret
|
112
|
+
end
|
113
|
+
|
114
|
+
def importex(fname)
|
115
|
+
ret = import(fname)
|
116
|
+
if ret
|
117
|
+
@ptext_hash = {}
|
118
|
+
i = 0
|
119
|
+
@ptext_hash = make_hash(@ptext, 0) do |l, i|
|
120
|
+
if l !~ /^\s/ and l !~ /^==/
|
121
|
+
key, vale = l.split(":")
|
122
|
+
[key, { "CONTENT" => l, "INDEX" => i }]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
ret = false
|
126
|
+
end
|
127
|
+
ret
|
128
|
+
end
|
129
|
+
|
130
|
+
def listup_all
|
131
|
+
@ptext.select { |l| l !~ /^\s/ and l !~ /^#/ }
|
132
|
+
end
|
133
|
+
|
134
|
+
def listup_host
|
135
|
+
@ptext.select { |l| l !~ /^\s/ and l !~ /^=/ and l !~ /^#/ }
|
136
|
+
end
|
137
|
+
|
138
|
+
def listup_domain
|
139
|
+
@ptext.select { |l| l =~ /^==/ }
|
140
|
+
end
|
141
|
+
|
142
|
+
def output_yaml(obj, fname)
|
143
|
+
File.open(fname, "w") do |file|
|
144
|
+
YAML.dump(obj, file)
|
145
|
+
end
|
146
|
+
rescue StandardError => e
|
147
|
+
pp e
|
148
|
+
pp e.backtrace
|
149
|
+
@valid = false
|
150
|
+
end
|
151
|
+
|
152
|
+
def update_yaml(yaml)
|
153
|
+
buf = File.read(@ifname)
|
154
|
+
File.write(@ofname, buf)
|
155
|
+
File.open(@ifname, "w") do |file|
|
156
|
+
YAML.dump(yaml, file)
|
157
|
+
end
|
158
|
+
rescue StandardError => e
|
159
|
+
pp e
|
160
|
+
pp e.backtrace
|
161
|
+
@valid = false
|
162
|
+
end
|
163
|
+
|
164
|
+
def dump_to_file(fname)
|
165
|
+
File.open(fname, "w") do |file|
|
166
|
+
@yamlstext.dump(file)
|
167
|
+
end
|
168
|
+
rescue StandardError => e
|
169
|
+
pp e
|
170
|
+
pp e.backtrace
|
171
|
+
@valid = false
|
172
|
+
end
|
173
|
+
|
174
|
+
def dump_ptext_to_file(fname)
|
175
|
+
file = File.open(fname, "w") do |file|
|
176
|
+
@ptext.each do |l|
|
177
|
+
file.write(l + "\n")
|
178
|
+
end
|
179
|
+
end
|
180
|
+
rescue StandardError => e
|
181
|
+
pp e
|
182
|
+
pp e.backtrace
|
183
|
+
@valid = false
|
184
|
+
end
|
185
|
+
|
186
|
+
def exchange_ptext(key, value)
|
187
|
+
@ptext[@ptext_hash[key]["INDEX"]] = value
|
188
|
+
@ptext_hash[key]["CONTENT"] = value
|
189
|
+
end
|
190
|
+
|
191
|
+
def reform
|
192
|
+
ret = importex(@ifname)
|
193
|
+
if ret
|
194
|
+
ary = listup_host.collect do |it|
|
195
|
+
key, value = it.split(":")
|
196
|
+
key
|
197
|
+
end
|
198
|
+
str = ary.join(" , ")
|
199
|
+
new_host_list = "=-HOST_LIST: [#{str}]"
|
200
|
+
ary2 = listup_domain.collect do |it|
|
201
|
+
key, value = it.split(":")
|
202
|
+
key
|
203
|
+
end
|
204
|
+
str2 = ary2.join(" , ")
|
205
|
+
new_domain_list = "=-DOMAIN_LIST: [#{str2}]"
|
206
|
+
pp "==new_host_list"
|
207
|
+
pp new_host_list
|
208
|
+
exchange_ptext("=-HOST_LIST", new_host_list)
|
209
|
+
exchange_ptext("=-DOMAIN_LIST", new_domain_list)
|
210
|
+
dump_ptext_to_file(@ofname)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def extract_value(ary)
|
215
|
+
ary.collect do |x|
|
216
|
+
x2 = x
|
217
|
+
x.scan(/{([^}]+)}/).each do |y|
|
218
|
+
y.each do |z|
|
219
|
+
re = Regexp.new(%({#{z}}))
|
220
|
+
x2 = x2.gsub(re, @yaml[z])
|
221
|
+
end
|
222
|
+
end
|
223
|
+
x2
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
data/lib/ykutils/yamlxop.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
require "ykutils/debugutils"
|
2
|
-
require "ykutils/stextx"
|
3
|
-
require "ykutils/yamlop"
|
4
|
-
|
5
|
-
module Ykutils
|
6
|
-
class YamlXOp < YamlOp
|
7
|
-
attr_accessor :yaml
|
8
|
-
|
9
|
-
include DebugUtils
|
10
|
-
|
11
|
-
def initialize(_opt, _args, debug)
|
12
|
-
debug_utils_init
|
13
|
-
set_debug(debug)
|
14
|
-
end
|
15
|
-
|
16
|
-
def load(fname)
|
17
|
-
# d_puts "3"
|
18
|
-
# puts_current_method
|
19
|
-
|
20
|
-
# d_puts "fname=#{fname}"
|
21
|
-
@fname = fname
|
22
|
-
# @pstext = StructuredTextForX.new
|
23
|
-
# puts "fname=#{fname}"
|
24
|
-
# @pstext.load_analyze( fname )
|
25
|
-
@yaml = load_yaml_file(fname)
|
26
|
-
end
|
27
|
-
|
28
|
-
def yaml2stext
|
29
|
-
yaml_str = YAML.dump(@yaml)
|
30
|
-
yaml_ary = yaml_str.split("\n")
|
31
|
-
@yamlstext = StructuredTextForAccount.new
|
32
|
-
@yamlstext.analyze(yaml_ary)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
require "ykutils/debugutils"
|
2
|
+
require "ykutils/stextx"
|
3
|
+
require "ykutils/yamlop"
|
4
|
+
|
5
|
+
module Ykutils
|
6
|
+
class YamlXOp < YamlOp
|
7
|
+
attr_accessor :yaml
|
8
|
+
|
9
|
+
include DebugUtils
|
10
|
+
|
11
|
+
def initialize(_opt, _args, debug)
|
12
|
+
debug_utils_init
|
13
|
+
set_debug(debug)
|
14
|
+
end
|
15
|
+
|
16
|
+
def load(fname)
|
17
|
+
# d_puts "3"
|
18
|
+
# puts_current_method
|
19
|
+
|
20
|
+
# d_puts "fname=#{fname}"
|
21
|
+
@fname = fname
|
22
|
+
# @pstext = StructuredTextForX.new
|
23
|
+
# puts "fname=#{fname}"
|
24
|
+
# @pstext.load_analyze( fname )
|
25
|
+
@yaml = load_yaml_file(fname)
|
26
|
+
end
|
27
|
+
|
28
|
+
def yaml2stext
|
29
|
+
yaml_str = YAML.dump(@yaml)
|
30
|
+
yaml_ary = yaml_str.split("\n")
|
31
|
+
@yamlstext = StructuredTextForAccount.new
|
32
|
+
@yamlstext.analyze(yaml_ary)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test_data/4servers.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= server1 %>
|
2
|
-
|
3
|
-
<%= server2 %>
|
4
|
-
|
5
|
-
<%= server3 %>
|
6
|
-
|
7
|
-
<%= server4 %>
|
1
|
+
<%= server1 %>
|
2
|
+
|
3
|
+
<%= server2 %>
|
4
|
+
|
5
|
+
<%= server3 %>
|
6
|
+
|
7
|
+
<%= server4 %>
|
data/test_data/a.bat
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
|
2
|
-
set TD_DIR=%TOP_DIR%\test_data
|
3
|
-
set V103_DIR=%TD_DIR%\v103-3-189-127
|
4
|
-
set A_DIR=%V103_dir%\a.northern-cross.net
|
5
|
-
bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
1
|
+
set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
|
2
|
+
set TD_DIR=%TOP_DIR%\test_data
|
3
|
+
set V103_DIR=%TD_DIR%\v103-3-189-127
|
4
|
+
set A_DIR=%V103_dir%\a.northern-cross.net
|
5
|
+
bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
data/test_data/a_ncn.bat
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
@echo off
|
2
|
-
set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
|
3
|
-
set TD_DIR=%TOP_DIR%\test_data
|
4
|
-
set V103_DIR=%TD_DIR%\v103-3-189-127
|
5
|
-
set A_DIR=%V103_dir%\a.northern-cross.net
|
6
|
-
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
7
|
-
|
8
|
-
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl_www.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
9
|
-
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
|
10
|
-
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_www.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
|
11
|
-
REM bundle exec ruby %TOP_DIR%\bin\erubix2 %A_DIR%\base.yml
|
12
|
-
bundle exec ruby %TOP_DIR%\bin\erubix2 %1
|
1
|
+
@echo off
|
2
|
+
set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
|
3
|
+
set TD_DIR=%TOP_DIR%\test_data
|
4
|
+
set V103_DIR=%TD_DIR%\v103-3-189-127
|
5
|
+
set A_DIR=%V103_dir%\a.northern-cross.net
|
6
|
+
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
7
|
+
|
8
|
+
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl_www.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
|
9
|
+
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
|
10
|
+
REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_www.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
|
11
|
+
REM bundle exec ruby %TOP_DIR%\bin\erubix2 %A_DIR%\base.yml
|
12
|
+
bundle exec ruby %TOP_DIR%\bin\erubix2 %1
|
@@ -1,28 +1,28 @@
|
|
1
|
-
_root:
|
2
|
-
template: 4servers.erb
|
3
|
-
server1:
|
4
|
-
protocol: ssl
|
5
|
-
template: template_ssl.erb
|
6
|
-
value:
|
7
|
-
- value_host.yml
|
8
|
-
- ../value_ssl.yml
|
9
|
-
server2:
|
10
|
-
protocol: ssl
|
11
|
-
domain: www
|
12
|
-
template: template_ssl_www.erb
|
13
|
-
value:
|
14
|
-
- value_host.yml
|
15
|
-
- ../value_ssl.yml
|
16
|
-
server3:
|
17
|
-
protocol:
|
18
|
-
template: template.erb
|
19
|
-
value:
|
20
|
-
- value_host.yml
|
21
|
-
- ../value.yml
|
22
|
-
server4:
|
23
|
-
protocol:
|
24
|
-
domain: www
|
25
|
-
template: template_www.erb
|
26
|
-
value:
|
27
|
-
- value_host.yml
|
28
|
-
- ../value.yml
|
1
|
+
_root:
|
2
|
+
template: 4servers.erb
|
3
|
+
server1:
|
4
|
+
protocol: ssl
|
5
|
+
template: template_ssl.erb
|
6
|
+
value:
|
7
|
+
- value_host.yml
|
8
|
+
- ../value_ssl.yml
|
9
|
+
server2:
|
10
|
+
protocol: ssl
|
11
|
+
domain: www
|
12
|
+
template: template_ssl_www.erb
|
13
|
+
value:
|
14
|
+
- value_host.yml
|
15
|
+
- ../value_ssl.yml
|
16
|
+
server3:
|
17
|
+
protocol:
|
18
|
+
template: template.erb
|
19
|
+
value:
|
20
|
+
- value_host.yml
|
21
|
+
- ../value.yml
|
22
|
+
server4:
|
23
|
+
protocol:
|
24
|
+
domain: www
|
25
|
+
template: template_www.erb
|
26
|
+
value:
|
27
|
+
- value_host.yml
|
28
|
+
- ../value.yml
|
@@ -1 +1 @@
|
|
1
|
-
host: a.northern-cross.net
|
1
|
+
host: a.northern-cross.net
|