tools 0.0.7 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/Rakefile +8 -2
- data/aux +481 -16
- data/aux2 +15 -2
- data/lib/files/requireds.rb +12 -2
- data/lib/lib/cache.rb +115 -26
- data/lib/lib/config.rb +48 -58
- data/lib/lib/display.rb +7 -5
- data/lib/lib/files.rb +15 -7
- data/lib/lib/log.rb +11 -3
- data/lib/lib/net.rb +123 -7
- data/lib/lib/prompt.rb +54 -0
- data/lib/lib/utils.rb +143 -18
- data/lib/tools.rb +1 -0
- data/lib/tools/version.rb +1 -1
- data/tools.gemspec +31 -18
- metadata +191 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f59a100bc3bb9f6e9e579d4b4a9ce1f23716ac6b4bc7d768c7fbfe0d2b4948
|
4
|
+
data.tar.gz: d9b22b9c213951c7926bd8f3b761b5453f8dc2cec44e03c2f070adde5cb0fbb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88bb67f1aa54d2a56ed148350d0d36cf6f857c8664323ea37c2653b3392d4b684a4cffa30633dd5af192732a3347e03c2981ba77f283f468575eab4b67452c2a
|
7
|
+
data.tar.gz: '047383184b054bbee57cad4076559d7f0db2bf73d276d907e1ac7d3b3ff345157e9b656ca7f8b3a56b826b1bb5381f249cf97fd202765cd830e303844f31dfff'
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.5.1
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
2
|
+
|
3
|
+
|
4
|
+
require 'bundler/gem_helper'
|
5
|
+
Bundler::GemHelper.install_tasks :name => "tools"
|
6
|
+
|
7
|
+
#require 'bundler/gem_tasks'
|
3
8
|
require_relative 'lib/tools/version'
|
4
9
|
|
10
|
+
|
5
11
|
# Default.
|
6
12
|
task :default => :help
|
7
13
|
|
@@ -34,7 +40,7 @@ end
|
|
34
40
|
|
35
41
|
desc "Release the gem in Artifactory (DEV)"
|
36
42
|
task :push do
|
37
|
-
gem_file = "#{ENV['PWD']}/pkg/
|
43
|
+
gem_file = "#{ENV['PWD']}/pkg/tools-#{Tools::VERSION}.gem"
|
38
44
|
gem_server_url = 'https://rubygems.org'
|
39
45
|
system("gem push #{gem_file} --host #{gem_server_url}")
|
40
46
|
end
|
data/aux
CHANGED
@@ -4,9 +4,364 @@ require 'rubygems'
|
|
4
4
|
require 'tools'
|
5
5
|
|
6
6
|
|
7
|
-
#puts ToolsUtil.get_date
|
8
7
|
|
9
|
-
#
|
8
|
+
# class Filesize
|
9
|
+
# include Comparabletool
|
10
|
+
|
11
|
+
# TYPE_PREFIXES = {
|
12
|
+
# # Unit prefixes used for SI file sizes.
|
13
|
+
# :SI => %w{k M G T P E Z Y},
|
14
|
+
# # Unit prefixes used for binary file sizes.
|
15
|
+
# :BINARY => %w{Ki Mi Gi Ti Pi Ei Zi Yi}
|
16
|
+
# }
|
17
|
+
|
18
|
+
# # @deprecated Please use TYPE_PREFIXES[:SI] instead
|
19
|
+
# PREFIXES = TYPE_PREFIXES[:SI]
|
20
|
+
|
21
|
+
# # Set of rules describing file sizes according to SI units.
|
22
|
+
# SI = {
|
23
|
+
# :regexp => /^([\d,.]+)?\s?([kmgtpezy]?)b$/i,
|
24
|
+
# :multiplier => 1000,
|
25
|
+
# :prefixes => TYPE_PREFIXES[:SI],
|
26
|
+
# :presuffix => '' # deprecated
|
27
|
+
# }
|
28
|
+
# # Set of rules describing file sizes according to binary units.
|
29
|
+
# BINARY = {
|
30
|
+
# :regexp => /^([\d,.]+)?\s?(?:([kmgtpezy])i)?b$/i,
|
31
|
+
# :multiplier => 1024,
|
32
|
+
# :prefixes => TYPE_PREFIXES[:BINARY],
|
33
|
+
# :presuffix => 'i' # deprecated
|
34
|
+
# }
|
35
|
+
|
36
|
+
# # @param [Number] size A file size, in bytes.
|
37
|
+
# # @param [SI, BINARY] type Which type to use for conversions.
|
38
|
+
# def initialize(size, type = BINARY)
|
39
|
+
# @bytes = size.to_i
|
40
|
+
# @type = type
|
41
|
+
# end
|
42
|
+
|
43
|
+
# # @return [Number] Returns the size in bytes.
|
44
|
+
# def to_i
|
45
|
+
# @bytes
|
46
|
+
# end
|
47
|
+
# alias_method :to_int, :to_i
|
48
|
+
|
49
|
+
# # @param [String] unit Which unit to convert to.
|
50
|
+
# # @return [Float] Returns the size in a given unit.
|
51
|
+
# def to(unit = 'B')
|
52
|
+
# to_parts = self.class.parse(unit)
|
53
|
+
# prefix = to_parts[:prefix]
|
54
|
+
|
55
|
+
# if prefix == 'B' or prefix.empty?
|
56
|
+
# return to_i.to_f
|
57
|
+
# end
|
58
|
+
|
59
|
+
# to_type = to_parts[:type]
|
60
|
+
# size = @bytes
|
61
|
+
|
62
|
+
# pos = (@type[:prefixes].map { |s| s[0].chr.downcase }.index(prefix.downcase) || -1) + 1
|
63
|
+
|
64
|
+
# size = size/(to_type[:multiplier].to_f**(pos)) unless pos < 1
|
65
|
+
# end
|
66
|
+
# alias_method :to_f, :to
|
67
|
+
|
68
|
+
# # @param (see #to_f)
|
69
|
+
# # @return [String] Same as {#to_f}, but as a string, with the unit appended.
|
70
|
+
# # @see #to_f
|
71
|
+
# def to_s(unit = 'B')
|
72
|
+
# "%.2f %s" % [to(unit).to_f.to_s, unit]
|
73
|
+
# end
|
74
|
+
|
75
|
+
# # Same as {#to_s} but with an automatic determination of the most
|
76
|
+
# # sensible unit.
|
77
|
+
# #
|
78
|
+
# # @return [String]
|
79
|
+
# # @see #to_s
|
80
|
+
# def pretty
|
81
|
+
# size = @bytes
|
82
|
+
# if size < @type[:multiplier]
|
83
|
+
# unit = "B"
|
84
|
+
# else
|
85
|
+
# pos = (Math.log(size) / Math.log(@type[:multiplier])).floor
|
86
|
+
# pos = @type[:prefixes].size-1 if pos > @type[:prefixes].size - 1
|
87
|
+
|
88
|
+
# unit = @type[:prefixes][pos-1] + "B"
|
89
|
+
# end
|
90
|
+
|
91
|
+
# to_s(unit)
|
92
|
+
# end
|
93
|
+
|
94
|
+
# # @return [Filesize]
|
95
|
+
# def +(other)
|
96
|
+
# self.class.new(@bytes + other.to_i, @type)
|
97
|
+
# end
|
98
|
+
|
99
|
+
# # @return [Filesize]
|
100
|
+
# def -(other)
|
101
|
+
# self.class.new(@bytes - other.to_i, @type)
|
102
|
+
# end
|
103
|
+
|
104
|
+
# # @return [Filesize]
|
105
|
+
# def *(other)
|
106
|
+
# self.class.new(@bytes * other.to_i, @type)
|
107
|
+
# end
|
108
|
+
|
109
|
+
# # @return [Filesize]
|
110
|
+
# def /(other)
|
111
|
+
# result = @bytes / other.to_f
|
112
|
+
# if other.is_a? Filesize
|
113
|
+
# result
|
114
|
+
# else
|
115
|
+
# self.class.new(result, @type)
|
116
|
+
# end
|
117
|
+
# end
|
118
|
+
|
119
|
+
# def <=>(other)
|
120
|
+
# self.to_i <=> other.to_i
|
121
|
+
# end
|
122
|
+
|
123
|
+
# # @return [Array<self, other>]
|
124
|
+
# # @api private
|
125
|
+
# def coerce(other)
|
126
|
+
# return self, other
|
127
|
+
# end
|
128
|
+
|
129
|
+
# class << self
|
130
|
+
# # Parses a string, which describes a file size, and returns a
|
131
|
+
# # Filesize object.
|
132
|
+
# #
|
133
|
+
# # @param [String] arg A file size to parse.
|
134
|
+
# # @raise [ArgumentError] Raised if the file size cannot be parsed properly.
|
135
|
+
# # @return [Filesize]
|
136
|
+
# def from(arg)
|
137
|
+
# parts = parse(arg)
|
138
|
+
# prefix = parts[:prefix]
|
139
|
+
# size = parts[:size]
|
140
|
+
# type = parts[:type]
|
141
|
+
|
142
|
+
# raise ArgumentError, "Unparseable filesize" unless type
|
143
|
+
|
144
|
+
# offset = (type[:prefixes].map { |s| s[0].chr.downcase }.index(prefix.downcase) || -1) + 1
|
145
|
+
|
146
|
+
# new(size * (type[:multiplier] ** (offset)), type)
|
147
|
+
# end
|
148
|
+
|
149
|
+
# # @return [Hash<:prefix, :size, :type>]
|
150
|
+
# # @api private
|
151
|
+
# def parse(string)
|
152
|
+
# type = nil
|
153
|
+
# # in this order, so we prefer binary :)
|
154
|
+
# [BINARY, SI].each { |_type|
|
155
|
+
# if string =~ _type[:regexp]
|
156
|
+
# type = _type
|
157
|
+
# break
|
158
|
+
# end
|
159
|
+
# }
|
160
|
+
|
161
|
+
# prefix = $2 || ''
|
162
|
+
# size = ($1 || 0).to_f
|
163
|
+
|
164
|
+
# return { :prefix => prefix, :size => size, :type => type}
|
165
|
+
# end
|
166
|
+
# end
|
167
|
+
|
168
|
+
# end
|
169
|
+
|
170
|
+
|
171
|
+
# # The size of a floppy disk
|
172
|
+
# Floppy = Filesize.from("1474 KiB")
|
173
|
+
# # The size of a CD
|
174
|
+
# CD = Filesize.from("700 MB")
|
175
|
+
# # The size of a common DVD
|
176
|
+
# DVD_5 = Filesize.from("4.38 GiB")
|
177
|
+
# # The same as a DVD 5
|
178
|
+
# DVD = DVD_5
|
179
|
+
# # The size of a single-sided dual-layer DVD
|
180
|
+
# DVD_9 = Filesize.from("7.92 GiB")
|
181
|
+
# # The size of a double-sided single-layer DVD
|
182
|
+
# DVD_10 = DVD_5 * 2
|
183
|
+
# # The size of a double-sided DVD, combining a DVD-9 and a DVD-5
|
184
|
+
# DVD_14 = DVD_9 + DVD_5
|
185
|
+
# # The size of a double-sided dual-layer DVD
|
186
|
+
# DVD_18 = DVD_14 * 2
|
187
|
+
# # The size of a Zip disk
|
188
|
+
# ZIP = Filesize.from("100 MB")
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
# puts ZIP
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
# ap "timeo".similar "timeout"
|
201
|
+
# ap "notifica".similar "notifica_email"
|
202
|
+
# ap "notifica".similar "notifica_slack"
|
203
|
+
# ap "notifoca_".similar "notifica_email"
|
204
|
+
# ap "notifaca".similar "notifica_slack"
|
205
|
+
|
206
|
+
|
207
|
+
# args = ['cmdapi', 'gbix' ,'search' ,'host' , '--query', 'name=*cmdapi*', '--query' ,'host=*cmdapi*']
|
208
|
+
|
209
|
+
# status, query = args.extract_option_value '--query', true
|
210
|
+
|
211
|
+
# ap Hash[*query]
|
212
|
+
|
213
|
+
|
214
|
+
#ToolsConfig.change_value_in_config "/home/francisco/.newcmdapi/cmdapi.config", false ,'cmdapi','teste_insert_config','status'
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
#{'cmdapi' => {"teste_insert_config" => {"status" => false }}}
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
# choices = %w(vodka beer wine whisky bourbon)
|
223
|
+
# prompt.multi_select("Select drinks?", choices)
|
224
|
+
# specialname="Hello!#$@"
|
225
|
+
# cleanedname = specialname.gsub(/[^a-zA-Z0-9\-]/,"")
|
226
|
+
|
227
|
+
# ap specialname
|
228
|
+
# ap cleanedname
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
# r = ToolsPrompt.yes? 'Do you like Ruby?'
|
233
|
+
# ap r
|
234
|
+
# r = ToolsPrompt.ask 'What is your name?', default: ENV['USER']
|
235
|
+
# ap r
|
236
|
+
# r = ToolsPrompt.mask("What is your secret?")
|
237
|
+
|
238
|
+
# aux = [
|
239
|
+
# "\tScorpion".yellow,
|
240
|
+
# "\tKano".yellow,
|
241
|
+
# "\tJax".yellow,
|
242
|
+
# ]
|
243
|
+
|
244
|
+
# r = ToolsPrompt.select("Choose your destiny?", aux)
|
245
|
+
# ap r
|
246
|
+
|
247
|
+
|
248
|
+
# choices = %w(vodka beer wine whisky bourbon)
|
249
|
+
# prompt.multi_select("Select drinks?", choices)
|
250
|
+
|
251
|
+
# choices = %w(emacs nano vim)
|
252
|
+
# prompt.enum_select("Select an editor?", choices)
|
253
|
+
|
254
|
+
|
255
|
+
# name = prompt.ask("What is your name?") do |q|
|
256
|
+
# q.required true
|
257
|
+
# q.validate /\A\w+\Z/
|
258
|
+
# q.modify :capitalize
|
259
|
+
# end
|
260
|
+
# ap name
|
261
|
+
|
262
|
+
|
263
|
+
# ap prompt.keypress("Press any key to continue, resumes automatically in 3 seconds ...".yellow, timeout: 3)
|
264
|
+
|
265
|
+
# default_editor = '/home/francisco/sublime_text_3/sublime_text'
|
266
|
+
|
267
|
+
# result = ToolsFiles.open_file '/home/francisco/.newcmdapi/oldcmdapi.config'
|
268
|
+
# unless result.true?
|
269
|
+
# ap result
|
270
|
+
# end
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
#ToolsCache.create_cache_file 'cmdapi', '/home/francisco/.newcmdapi/teste-persistent.cache', 60
|
275
|
+
|
276
|
+
# cache.clear
|
277
|
+
|
278
|
+
# ToolsCache.cmdapi_set :ldap, {:rogerio => {:name => 'rogerio'}}
|
279
|
+
# ToolsCache.cmdapi_set :ldap, {:wagner => {:name => 'wagner'}}
|
280
|
+
|
281
|
+
# ToolsCache.cmdapi_set :cloud, [100,200]
|
282
|
+
# ToolsCache.cmdapi_set :cloud, 300
|
283
|
+
# ToolsCache.cmdapi_set :cloud, [300,500,'teste']
|
284
|
+
# ToolsCache.cmdapi_set :cloud, "teste2"
|
285
|
+
# ToolsCache.cmdapi_set :cloud, {:teste => 1}
|
286
|
+
|
287
|
+
|
288
|
+
# ToolsCache.cmdapi_set :nat, "texto para nat"
|
289
|
+
# ToolsCache.cmdapi_set :nat, "texto para nat_ depois da primeira"
|
290
|
+
|
291
|
+
|
292
|
+
# # ToolsCache.cmdapi_setext :ldap, {:francisco => {:name => 'francisco'}}
|
293
|
+
# # ToolsCache.cmdapi_setext :ldap, {:wagner => {:name => 'wagner'}, :leandro => {:name => 'leandro'}}
|
294
|
+
|
295
|
+
#ap ToolsCache.cmdapi_list
|
296
|
+
#sleep 30
|
297
|
+
#ap ToolsCache.cmdapi_list
|
298
|
+
#sleep 30
|
299
|
+
#ap ToolsCache.cmdapi_list
|
300
|
+
|
301
|
+
|
302
|
+
# ToolsCache.cmdapi_unset :nat
|
303
|
+
# ToolsCache.cmdapi_set :nat, "texto para nat_ depois da primeira"
|
304
|
+
|
305
|
+
|
306
|
+
# cache = ToolsCache.cmdapi_list
|
307
|
+
# ap cache
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
# ToolsCache.cmdapi_unsetext :ldap, :francisco
|
312
|
+
|
313
|
+
|
314
|
+
# cache = ToolsCache.cmdapi_list
|
315
|
+
# ap cache
|
316
|
+
|
317
|
+
|
318
|
+
# cache.each do |key|
|
319
|
+
# puts "#{key} - #{cache[key]}"
|
320
|
+
# end
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
# ap ToolsCache.cmdapi_get 'ldap'
|
328
|
+
|
329
|
+
|
330
|
+
# ap ToolsCache.cmdapi_list
|
331
|
+
|
332
|
+
# valor = '100'
|
333
|
+
# ToolsCache.cmdapi_add "variável", valor
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
# file_to_load = "/home/francisco/2018/xykotools/cmdapi/lib/files/proxy_sample.txt"
|
340
|
+
# file = ToolsFiles.load_file file_to_load
|
341
|
+
# ap file
|
342
|
+
|
343
|
+
|
344
|
+
# ToolsLog.create_log_file 'xyko', '/home/francisco/2018/xykotools/tools/xyko.log'
|
345
|
+
|
346
|
+
# ToolsLog.xyko_info 'Minitest.: test_cmdapi_ldap_validate'
|
347
|
+
# ToolsLog.xyko_info 'teste do methodo1', :yellow
|
348
|
+
# ToolsLog.xyko_info 'teste do methodo1', :light_green
|
349
|
+
|
350
|
+
|
351
|
+
#ToolsDisplay.show_colorize "Minitest.:".red + " test_cmdapi_ldap_validate".white
|
352
|
+
|
353
|
+
|
354
|
+
# teste = '123'
|
355
|
+
|
356
|
+
# ap teste.num?
|
357
|
+
# ap teste
|
358
|
+
|
359
|
+
# ap NetAddr::CIDR.methods.sort
|
360
|
+
# net = NetAddr::CIDR.create ip
|
361
|
+
# ap net
|
362
|
+
|
363
|
+
|
364
|
+
# teste = false
|
10
365
|
# if teste.boolean?
|
11
366
|
# if teste
|
12
367
|
# puts "true"
|
@@ -14,7 +369,7 @@ require 'tools'
|
|
14
369
|
# puts "false"
|
15
370
|
# end
|
16
371
|
# end
|
17
|
-
|
372
|
+
# ap teste.boolean?
|
18
373
|
|
19
374
|
# ToolsDisplay.show "teste", :green
|
20
375
|
# ToolsDisplay.show "TEXT SAMELINE sem cor ", :sameline
|
@@ -71,33 +426,143 @@ require 'tools'
|
|
71
426
|
# ToolsConfig.load_config home, 'config'
|
72
427
|
# ToolsConfig.write_config home, 'config'
|
73
428
|
|
429
|
+
#ToolsLog.create_log_file 'tools', '/home/francisco/2018/xykotools/tools/xyko.log'
|
430
|
+
|
431
|
+
# class Hash
|
432
|
+
# def has_shape?(shape)
|
433
|
+
# all? do |k, v|
|
434
|
+
# Hash === v ? v.has_shape?(shape[k]) : shape[k] === v
|
435
|
+
# end
|
436
|
+
# end
|
437
|
+
# end
|
438
|
+
|
439
|
+
|
440
|
+
# cmdapi_home = "/home/francisco/2018/xykotools/tools"
|
441
|
+
# cmdapi_configfile = cmdapi_home + '/cmdapi.config'
|
442
|
+
# ToolsConfig.create_config_file 'cmdapi', cmdapi_configfile, :yaml, # {:first_time => true}
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
# config_file_path = ToolsUtil.get_variable "cmdapi_config_file"
|
452
|
+
# config_file_type = ToolsUtil.get_variable "cmdapi_config_type"
|
74
453
|
|
75
|
-
# ToolsConfig.
|
76
|
-
# config_file = (ToolsUtil.get_variable 'config_file_location')
|
454
|
+
# config_file = ToolsConfig.load_config config_file_path
|
77
455
|
|
78
456
|
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
457
|
+
# data = {
|
458
|
+
# :cloud => {
|
459
|
+
# :region_default => "devh",
|
460
|
+
# :use_ssl => true,
|
461
|
+
# :time_out => 120,
|
462
|
+
# :regions => {
|
463
|
+
# :"devhl,devh,devl,qa2" => {
|
464
|
+
# :region => "RJDEV",
|
465
|
+
# :secretkey => "Jfm8nuodLGebK089ObWchDcPbXJLui66j0lNusVI_5vrS3jaYKYivr-hhRGYjI-ret2dWETL9qw7NOOrQFstWQ",
|
466
|
+
# :apikey => "H-KPAqnrjKOuASLYkMSEMr49gGIku5NWzhIwTPMKb5MvOjdpgx6apYgPCeV04xoPt4bG415Z5U9sCb4FM9rkYw",
|
467
|
+
# :url => "https://rjdev.globoi.com/client/api"
|
468
|
+
# },
|
469
|
+
# :"cm10,cm18,cm19,cm21,cm22,cm25,cmstg" => {
|
470
|
+
# :region => "RJCME",
|
471
|
+
# :secretkey => "LvoZc-0p92hxrunOFhrbkacPTE8GdvKnkx3cfm6QSGG_4m_YHvvkThGjmhRwBMvaPtoLFFHxIL9RhQPPk399gw",
|
472
|
+
# :apikey => "dKDvCQZeAm5ZDEQ8XhaCNDobWbr0xgrhMVX2eYyGWesxTg3Rs21u8Xt-RHjFoWimSfnTH9aTHr1Y0v7L2Lhtrw",
|
473
|
+
# :url => "https://rjcme.globoi.com/client/api"
|
474
|
+
# },
|
475
|
+
# :lab => {
|
476
|
+
# :region => "RJLAB",
|
477
|
+
# :apikey => "RAqpmpw-gbk9ey1ijreESn2tEq_eii1q5VR_lCzk5Q5Nr44om85EjBhuX7g9q6CmBYX8pg2_ofmNHPC_kLOr_Q",
|
478
|
+
# :secretkey => "snAlbaR9I8t6YlVvti4Xn96gFPWjY8VDkOeLc84Wm6q9sAYsnnTbhaQRztDHF91PkEPZZgQInFEdGNpleiDvYA",
|
479
|
+
# :url => "https://10.170.2.42:8443/client/api"
|
480
|
+
# }
|
481
|
+
# }
|
482
|
+
# }
|
483
|
+
# }
|
484
|
+
# ToolsConfig.insert_in_config config_file_path, data
|
485
|
+
|
486
|
+
# data = {
|
487
|
+
# :default_options => {
|
488
|
+
# :editor => "/home/francisco/sublime_text_3/sublime_text",
|
489
|
+
# :check_config => true,
|
490
|
+
# :check_version => {
|
491
|
+
# :status => false,
|
492
|
+
# :latest => "2017-07-21T09:38:23-03:00",
|
493
|
+
# :ttl => 60,
|
494
|
+
# :renew => 60,
|
495
|
+
# :update => true
|
496
|
+
# }
|
82
497
|
# }
|
498
|
+
|
499
|
+
# }
|
500
|
+
# ToolsConfig.insert_in_config config_file_path, data
|
501
|
+
# #end
|
502
|
+
|
503
|
+
# config_file = ToolsConfig.load_config config_file_path
|
504
|
+
|
505
|
+
# require 'hash_validator'
|
506
|
+
|
507
|
+
# cloud_shape = {
|
508
|
+
# cloud: {
|
509
|
+
# region_default: 'string',
|
510
|
+
# use_ssl: 'boolean',
|
511
|
+
# time_out: 'integer',
|
512
|
+
# regions: Hash,
|
513
|
+
# }
|
83
514
|
# }
|
84
515
|
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
516
|
+
# cloud_regions_shape = {
|
517
|
+
# region: 'string',
|
518
|
+
# secretkey: 'string',
|
519
|
+
# apikey: 'string',
|
520
|
+
# url: 'string',
|
521
|
+
# }
|
522
|
+
|
523
|
+
# validator = HashValidator.validate(config_file, cloud_shape)
|
524
|
+
# ap validator.errors unless validator.valid?
|
525
|
+
|
526
|
+
# config_file[:cloud][:regions].each do |k,v|
|
527
|
+
# validator = HashValidator.validate(v, cloud_regions_shape)
|
528
|
+
# ap validator.errors unless validator.valid?
|
529
|
+
# end
|
530
|
+
|
531
|
+
# default_shape = {
|
532
|
+
# :editor => 'string',
|
533
|
+
# :check_config => true,
|
534
|
+
# :check_version => {
|
535
|
+
# :status => 'boolean',
|
536
|
+
# :latest => "2017-07-21T09:38:23-03:00",
|
537
|
+
# :ttl => 'integer',
|
538
|
+
# :renew => 'integer',
|
539
|
+
# :update => 'boolean',
|
89
540
|
# }
|
90
|
-
#
|
541
|
+
# }
|
542
|
+
|
543
|
+
|
544
|
+
# exit
|
545
|
+
|
91
546
|
|
92
|
-
# ToolsConfig.insert_in_config config_file, data
|
93
|
-
# ToolsConfig.insert_in_config config_file, data2
|
94
547
|
|
95
|
-
# config = ToolsConfig.load_config config_file
|
96
548
|
|
97
549
|
|
550
|
+
# config = ToolsConfig.load_config config_file
|
551
|
+
|
98
552
|
# ap config
|
99
553
|
|
100
554
|
|
555
|
+
#realize Supso::Filer::Mount["/mnt/projetos/apikeys/globosdn_controller"]
|
556
|
+
|
557
|
+
#globointerno.cmfdnc01:/dev/portal/
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
# config = ToolsConfig.load_config config_file
|
562
|
+
|
563
|
+
# ap config
|
564
|
+
|
565
|
+
# ap ToolsConfig.test_config config_file
|
101
566
|
|
102
567
|
# ToolsCache.create_cache_file 'xyko', '/home/francisco/2018/xykotools/tools'
|
103
568
|
|