lorj 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/logging.rb +16 -16
- data/lib/lorj/version.rb +1 -1
- data/lib/lorj_account.rb +66 -29
- data/lib/lorj_config.rb +1 -2
- data/lib/prc.rb +1 -1
- data/lib/prc_core_config.rb +2 -2
- data/lib/prc_section_config.rb +5 -0
- data/spec/03_prc_section_config_spec.rb +196 -0
- data/spec/12_lorj_account_spec.rb +31 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cdd89f8867872019b885eaeca7358bf1108c61
|
4
|
+
data.tar.gz: 44eac4c611e38053086be179682cef327f8d8341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3fd2b28bfbf55a97b05bbb6626821f2668afead59e991fa05fb5d128111071f15c3814f39dec2b163862550629c9f6188f57784d679e3c213d2d5ecb9985bd8
|
7
|
+
data.tar.gz: e6c9f1f3b9d3869f820c502774944a878a6d8da999239362cd1c502d395a28835b5ac5cdf4a8a9c00840fd980b4a8ed2933d441044efece20668aab81136f1ea
|
data/Rakefile
CHANGED
data/lib/logging.rb
CHANGED
@@ -142,19 +142,19 @@ module PrcLib
|
|
142
142
|
|
143
143
|
# Log to STDOUT and Log file and INFO class message
|
144
144
|
def info(message)
|
145
|
-
@out_logger.info(message + ANSI.
|
145
|
+
@out_logger.info(message + ANSI.clear_eol)
|
146
146
|
@file_logger.info(message)
|
147
147
|
end
|
148
148
|
|
149
149
|
# Log to STDOUT and Log file and DEBUG class message
|
150
150
|
def debug(message)
|
151
|
-
@out_logger.debug(message + ANSI.
|
151
|
+
@out_logger.debug(message + ANSI.clear_eol)
|
152
152
|
@file_logger.debug(message)
|
153
153
|
end
|
154
154
|
|
155
155
|
# Log to STDOUT and Log file and ERROR class message
|
156
156
|
def error(message)
|
157
|
-
@out_logger.error(message + ANSI.
|
157
|
+
@out_logger.error(message + ANSI.clear_eol)
|
158
158
|
@file_logger.error(message)
|
159
159
|
end
|
160
160
|
|
@@ -163,17 +163,16 @@ module PrcLib
|
|
163
163
|
# the exception class is given.
|
164
164
|
# The exception class should provide message and backtrace.
|
165
165
|
def fatal(message, e = nil)
|
166
|
-
@out_logger.fatal(message + ANSI.
|
167
|
-
@file_logger.fatal(format("%s\n%s\n%s",
|
168
|
-
|
169
|
-
|
170
|
-
e.backtrace.join("\n"))) if e
|
166
|
+
@out_logger.fatal(message + ANSI.clear_eol)
|
167
|
+
return @file_logger.fatal(format("%s\n%s\n%s",
|
168
|
+
message, e.message,
|
169
|
+
e.backtrace.join("\n"))) if e
|
171
170
|
@file_logger.fatal(message)
|
172
171
|
end
|
173
172
|
|
174
173
|
# Log to STDOUT and Log file and WARNING class message
|
175
174
|
def warn(message)
|
176
|
-
@out_logger.warn(message + ANSI.
|
175
|
+
@out_logger.warn(message + ANSI.clear_eol)
|
177
176
|
@file_logger.warn(message)
|
178
177
|
end
|
179
178
|
|
@@ -186,7 +185,7 @@ module PrcLib
|
|
186
185
|
# Print out a message, not logged in the log file. This message is printed
|
187
186
|
# out systematically as not taking care of logger level.
|
188
187
|
def unknown(message)
|
189
|
-
@out_logger.unknown(message + ANSI.
|
188
|
+
@out_logger.unknown(message + ANSI.clear_eol)
|
190
189
|
end
|
191
190
|
|
192
191
|
private
|
@@ -274,7 +273,8 @@ module PrcLib
|
|
274
273
|
p.pop
|
275
274
|
end
|
276
275
|
log_object.fatal(format(message, *p), e)
|
277
|
-
puts 'Issues found. Please fix it and retry. Process aborted.'
|
276
|
+
puts format('Issues found. Please fix it and retry. Process aborted. '\
|
277
|
+
"See details in log file '%s'.", PrcLib.log_file)
|
278
278
|
exit rc
|
279
279
|
end
|
280
280
|
|
@@ -283,16 +283,16 @@ module PrcLib
|
|
283
283
|
nil
|
284
284
|
end
|
285
285
|
|
286
|
+
# Print the message to the same line.
|
286
287
|
def state(message, *p)
|
287
|
-
print(format("%s
|
288
|
-
format(message, *p)
|
289
|
-
ANSI.clear_line)) if log_object.level <= Logger::INFO
|
288
|
+
print(format("%s%s ...\r", ANSI.clear_line,
|
289
|
+
format(message, *p))) if log_object.level <= Logger::INFO
|
290
290
|
nil
|
291
291
|
end
|
292
292
|
|
293
293
|
# Not DEBUG and not INFO. Just printed to the output.
|
294
|
-
def high_level_msg(message)
|
295
|
-
print(format(
|
294
|
+
def high_level_msg(message, *p)
|
295
|
+
print(format(message, *p)) if log_object.level > 1
|
296
296
|
nil
|
297
297
|
end
|
298
298
|
end
|
data/lib/lorj/version.rb
CHANGED
data/lib/lorj_account.rb
CHANGED
@@ -126,8 +126,6 @@ module Lorj
|
|
126
126
|
# runtime Config layer
|
127
127
|
config_layers << define_runtime_layer
|
128
128
|
|
129
|
-
Lorj.defaults.load # Loading global application defaults
|
130
|
-
|
131
129
|
if PrcLib.data_path.nil?
|
132
130
|
PrcLib.fatal(1, 'Internal PrcLib.data_path was not set.')
|
133
131
|
end
|
@@ -168,8 +166,10 @@ module Lorj
|
|
168
166
|
options = { :keys => [key], :section => section }
|
169
167
|
|
170
168
|
indexes = _identify_indexes(options, exclusive?(key, section))
|
169
|
+
names = []
|
170
|
+
indexes.each { |index| names << @config_layers[index][:name] }
|
171
171
|
|
172
|
-
options[:data_options] =
|
172
|
+
options[:data_options] = _set_data_options_per_names(names)
|
173
173
|
|
174
174
|
return _get(options) if _exist?(options)
|
175
175
|
|
@@ -186,31 +186,38 @@ module Lorj
|
|
186
186
|
# otherwise, search in all layers.
|
187
187
|
#
|
188
188
|
# * *Args* :
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
189
|
+
# - +key+ : key name. It do not support it to be a key tree (Arrays of
|
190
|
+
# keys).
|
191
|
+
# - +options+ : possible options:
|
192
|
+
# - +:section+ : Force to use a specific section name.
|
193
|
+
# - +:name+ : layer to exclusively get data.
|
194
|
+
# - +:indexes+ : layer index to exclusively get data.
|
195
|
+
# If neither :name or :index is set, get will search
|
196
|
+
# data on all predefined layers, first found, first listed.
|
192
197
|
# * *Returns* :
|
193
198
|
# - key value.
|
194
199
|
# * *Raises* :
|
195
200
|
# Nothing
|
196
|
-
def where?(key,
|
201
|
+
def where?(key, options = {})
|
197
202
|
key = key.to_sym if key.class == String
|
203
|
+
options = {} unless options.is_a?(Hash)
|
198
204
|
|
205
|
+
section = options[:section]
|
199
206
|
section = Lorj.defaults.get_meta_section(key) if section.nil?
|
200
207
|
|
201
|
-
|
208
|
+
indexes = _identify_array_indexes(options, exclusive?(key, section))
|
202
209
|
|
203
|
-
|
204
|
-
|
205
|
-
indexes = [0, 1]
|
206
|
-
options[:indexes] = indexes
|
207
|
-
else
|
208
|
-
indexes = [0, 1, 2, 3]
|
209
|
-
end
|
210
|
+
names = []
|
211
|
+
indexes.each { |index| names << @config_layers[index][:name] }
|
210
212
|
|
211
|
-
|
213
|
+
where_options = {
|
214
|
+
:keys => [key],
|
215
|
+
:section => section,
|
216
|
+
:indexes => indexes,
|
217
|
+
:data_options => _set_data_options_per_names(names)
|
218
|
+
}
|
212
219
|
|
213
|
-
_where?(
|
220
|
+
_where?(where_options)
|
214
221
|
end
|
215
222
|
|
216
223
|
# check key/value existence in config layers
|
@@ -244,7 +251,10 @@ module Lorj
|
|
244
251
|
|
245
252
|
indexes = _identify_indexes(options, exclusive?(key, section))
|
246
253
|
|
247
|
-
|
254
|
+
names = []
|
255
|
+
indexes.each { |index| names << @config_layers[index][:name] }
|
256
|
+
|
257
|
+
options[:data_options] = _set_data_options_per_names(names)
|
248
258
|
|
249
259
|
_exist?(options)
|
250
260
|
end
|
@@ -456,35 +466,62 @@ module Lorj
|
|
456
466
|
|
457
467
|
private
|
458
468
|
|
469
|
+
def _identify_array_indexes(options, account_exclusive)
|
470
|
+
def_indexes = options[:indexes] if options.key?(:indexes)
|
471
|
+
if options[:names].is_a?(Array)
|
472
|
+
def_indexes = layers_indexes(options[:names])
|
473
|
+
end
|
474
|
+
|
475
|
+
indexes = exclusive_indexes(account_exclusive)
|
476
|
+
options[:indexes] = indexes
|
477
|
+
|
478
|
+
return indexes if def_indexes.nil? || def_indexes.length == 0
|
479
|
+
|
480
|
+
def_indexes.delete_if { |index| !indexes.include?(index) }
|
481
|
+
|
482
|
+
def_indexes
|
483
|
+
end
|
484
|
+
|
485
|
+
def layers_indexes(names)
|
486
|
+
return nil unless names.is_a?(Array)
|
487
|
+
|
488
|
+
indexes = [] if names.is_a?(Array)
|
489
|
+
names.each do |name|
|
490
|
+
indexes << layer_index(name) if name.is_a?(String)
|
491
|
+
end
|
492
|
+
indexes
|
493
|
+
end
|
494
|
+
|
495
|
+
def exclusive_indexes(account_exclusive)
|
496
|
+
return [0, 1] if account_exclusive
|
497
|
+
[0, 1, 2, 3]
|
498
|
+
end
|
499
|
+
|
459
500
|
def _identify_indexes(options, account_exclusive)
|
460
501
|
index = options[:index] if options.key?(:index)
|
461
502
|
index = layer_index(options[:name]) if options.key?(:name)
|
462
503
|
|
463
|
-
|
464
|
-
|
465
|
-
options[:indexes] = indexes
|
466
|
-
else
|
467
|
-
indexes = [0, 1, 2, 3]
|
468
|
-
end
|
504
|
+
indexes = exclusive_indexes(account_exclusive)
|
505
|
+
options[:indexes] = indexes
|
469
506
|
|
470
507
|
indexes = [index] if !index.nil? && indexes.include?(index)
|
471
508
|
indexes
|
472
509
|
end
|
473
510
|
|
474
|
-
def
|
511
|
+
def _set_data_options_per_names(names)
|
475
512
|
data_options = []
|
476
513
|
|
477
|
-
|
514
|
+
names.each { |name| data_options << _data_options_per_layer(name) }
|
478
515
|
|
479
516
|
data_options
|
480
517
|
end
|
481
518
|
|
482
519
|
# This internal function defines default section name per config index.
|
483
520
|
# TODO: Change local and default way to get default values, not in /:default
|
484
|
-
def _data_options_per_layer(
|
521
|
+
def _data_options_per_layer(layer_name)
|
485
522
|
# runtime and local and default uses :default section
|
486
|
-
case
|
487
|
-
when
|
523
|
+
case layer_name
|
524
|
+
when 'local', 'default'
|
488
525
|
# local & default are SectionConfig and is forced to use :default as
|
489
526
|
# section name for each data.
|
490
527
|
{ :section => :default }
|
data/lib/lorj_config.rb
CHANGED
@@ -118,8 +118,6 @@ module Lorj
|
|
118
118
|
# runtime Config layer
|
119
119
|
config_layers << define_runtime_layer
|
120
120
|
|
121
|
-
Lorj.defaults.load # Loading global application defaults
|
122
|
-
|
123
121
|
if PrcLib.data_path.nil?
|
124
122
|
PrcLib.fatal(1, 'Internal PrcLib.data_path was not set.')
|
125
123
|
end
|
@@ -169,6 +167,7 @@ module Lorj
|
|
169
167
|
def initialize_local_filename(config_name = nil)
|
170
168
|
config_default_name = 'config.yaml'
|
171
169
|
|
170
|
+
config_name = nil unless config_name.is_a?(String)
|
172
171
|
if config_name
|
173
172
|
if File.dirname(config_name) == '.'
|
174
173
|
config_name = File.join(PrcLib.data_path, config_name)
|
data/lib/prc.rb
CHANGED
@@ -119,7 +119,7 @@ module PrcLib
|
|
119
119
|
def app_defaults=(v)
|
120
120
|
return if @app_defaults
|
121
121
|
|
122
|
-
v = File.join(File.dirname(__FILE__), v) unless v
|
122
|
+
v = File.join(File.dirname(__FILE__), v) unless v.include?('/')
|
123
123
|
|
124
124
|
@app_defaults = File.expand_path(v)
|
125
125
|
end
|
data/lib/prc_core_config.rb
CHANGED
@@ -382,7 +382,7 @@ module PRC
|
|
382
382
|
def _do_where?(config_layers, keys, options, data_opts)
|
383
383
|
layer_indexes = []
|
384
384
|
config_layers.each_index do | index |
|
385
|
-
config =
|
385
|
+
config = config_layers[index][:config]
|
386
386
|
|
387
387
|
data_options = options.clone
|
388
388
|
data_options.delete_if do |key|
|
@@ -391,7 +391,7 @@ module PRC
|
|
391
391
|
data_options.merge!(data_opts[index]) if data_opts[index].is_a?(Hash)
|
392
392
|
|
393
393
|
config.data_options(data_options)
|
394
|
-
layer_indexes <<
|
394
|
+
layer_indexes << config_layers[index][:name] if config.exist?(keys)
|
395
395
|
end
|
396
396
|
return layer_indexes if layer_indexes.length > 0
|
397
397
|
false
|
data/lib/prc_section_config.rb
CHANGED
@@ -30,26 +30,31 @@ module PRC
|
|
30
30
|
# * *Raises* :
|
31
31
|
# Nothing
|
32
32
|
def [](*keys)
|
33
|
+
return nil if keys.length == 0
|
33
34
|
return _get(:default, *keys) if @data_options[:section].nil?
|
34
35
|
_get(@data_options[:section], *keys)
|
35
36
|
end
|
36
37
|
|
37
38
|
def []=(*keys, value)
|
39
|
+
return nil if keys.length == 0
|
38
40
|
return _set(:default, *keys, value) if @data_options[:section].nil?
|
39
41
|
_set(@data_options[:section], *keys, value)
|
40
42
|
end
|
41
43
|
|
42
44
|
def exist?(*keys)
|
45
|
+
return nil if keys.length == 0
|
43
46
|
return _exist?(:default, *keys) if @data_options[:section].nil?
|
44
47
|
_exist?(@data_options[:section], *keys)
|
45
48
|
end
|
46
49
|
|
47
50
|
def where?(*keys)
|
51
|
+
return nil if keys.length == 0
|
48
52
|
return _exist?(:default, *keys) if @data_options[:section].nil?
|
49
53
|
_where?(@data_options[:section], *keys)
|
50
54
|
end
|
51
55
|
|
52
56
|
def del(*keys)
|
57
|
+
return nil if keys.length == 0
|
53
58
|
return _del(:default, *keys) if @data_options[:section].nil?
|
54
59
|
_del(@data_options[:section], *keys)
|
55
60
|
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
# require 'byebug'
|
19
|
+
|
20
|
+
$LOAD_PATH << File.join('..', 'lib')
|
21
|
+
|
22
|
+
require 'rh.rb'
|
23
|
+
require 'prc.rb'
|
24
|
+
require 'prc_base_config.rb' # Load BaseConfig parent class
|
25
|
+
require 'prc_section_config.rb' # Load SectionConfig class
|
26
|
+
|
27
|
+
describe 'class: PRC::SectionConfig,' do
|
28
|
+
context 'PRC::SectionConfig' do
|
29
|
+
it '.new created a new instance' do
|
30
|
+
config = PRC::SectionConfig.new
|
31
|
+
expect(config).to be
|
32
|
+
end
|
33
|
+
|
34
|
+
it '.new(:default => {:test => :toto},'\
|
35
|
+
':section => {:key => :value}) set expected default data' do
|
36
|
+
config = PRC::SectionConfig.new(:default => { :test => :toto },
|
37
|
+
:section => { :key => :value })
|
38
|
+
expect(config.data).to eq(:default => { :test => :toto },
|
39
|
+
:section => { :key => :value })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'config = nil' do
|
44
|
+
before(:all) do
|
45
|
+
@config = PRC::SectionConfig.new
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'config[:test1] = "value" set internal data to '\
|
49
|
+
':default=>{:test1=>"value"}' do
|
50
|
+
@config[:test1] = 'value'
|
51
|
+
expect(@config.data).to eq(:default => { :test1 => 'value' })
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'config[:test1, :test2] = "value" set internal data to '\
|
55
|
+
':default=>{:test1 => { :test2 => "value"}}' do
|
56
|
+
@config[:test1, :test2] = 'value'
|
57
|
+
expect(@config.data).to eq(:default =>
|
58
|
+
{ :test1 => { :test2 => 'value' } })
|
59
|
+
end
|
60
|
+
context 'config.data_options(:section => :mysection)' do
|
61
|
+
it 'return true' do
|
62
|
+
expect(@config.data_options(:section => :mysection)).to eq(:section =>
|
63
|
+
:mysection)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'config[:test1, :test2] = "value2" set '\
|
67
|
+
'mysection=>{:test1 => { :test2 => "value2"}}' do
|
68
|
+
@config[:test1, :test2] = 'value2'
|
69
|
+
expect(@config.data[:mysection]).to eq(:test1 => { :test2 => 'value2' })
|
70
|
+
end
|
71
|
+
it 'config[:test1, :test2] returns "value2"' do
|
72
|
+
expect(@config[:test1, :test2]).to eq('value2')
|
73
|
+
end
|
74
|
+
it 'config.data_options({})' do
|
75
|
+
expect(@config.data_options({})).to eq({})
|
76
|
+
end
|
77
|
+
it 'config[:test1, :test2] returns "value"' do
|
78
|
+
expect(@config[:test1, :test2]).to eq('value')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'SectionConfig.new {:default => {:test => :toto},'\
|
84
|
+
':section => {:key => :value} }' do
|
85
|
+
before(:all) do
|
86
|
+
@config = PRC::SectionConfig.new(:default => { :test => :toto },
|
87
|
+
:section => { :key => :value })
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'config.del(:test) return :toto' do
|
91
|
+
expect(@config.del(:test)).to eq(:toto)
|
92
|
+
expect(@config.data).to eq(:default => {},
|
93
|
+
:section => { :key => :value })
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'config.del(:key) returns nil' do
|
97
|
+
expect(@config.del(:key)).to equal(nil)
|
98
|
+
expect(@config.data).to eq(:default => {},
|
99
|
+
:section => { :key => :value })
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'SectionConfig.new {:test1 => { :test2 => "value" }}' do
|
104
|
+
before(:all) do
|
105
|
+
@config = PRC::SectionConfig.new(:test1 => { :test2 => 'value' })
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'config[] return nil' do
|
109
|
+
expect(@config[]).to equal(nil)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'config[:test1] returns nil.' do
|
113
|
+
expect(@config[:test1]).to equal(nil)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'config[:test1, :test2] returns nil.' do
|
117
|
+
expect(@config[:test1, :test2]).to equal(nil)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'config[:test2] returns nil.' do
|
121
|
+
expect(@config[:test2]).to equal(nil)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'config[:test2] returns nil.' do
|
125
|
+
expect(@config[:test2]).to equal(nil)
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'with config.data_options({:section => :test1})' do
|
129
|
+
expect(@config.data_options(:section =>
|
130
|
+
:test1)).to eq(:section => :test1)
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'config[:test1] returns nil.' do
|
134
|
+
expect(@config[:test1]).to equal(nil)
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'config[:test1, :test2] returns nil.' do
|
138
|
+
expect(@config[:test1, :test2]).to equal(nil)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "config[:test2] returns NOW 'value'." do
|
142
|
+
expect(@config[:test2]).to eq('value')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'SectionConfig.new {:test1 => { :test2 => "value" }}' do
|
147
|
+
before(:all) do
|
148
|
+
@config = PRC::SectionConfig.new(:test1 => { :test2 => 'value' })
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'config.exist? return nil' do
|
152
|
+
expect(@config.exist?).to equal(nil)
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'config.exist?(test1) return false.' do
|
156
|
+
expect(@config.exist?(:test1)).to equal(false)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'config.exist?(:test1, :test2) return false.' do
|
160
|
+
expect(@config.exist?(:test1, :test2)).to equal(false)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'config.exist?(:test) return false.' do
|
164
|
+
expect(@config.exist?(:test)).to equal(false)
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'config.exist?(:test1, :test) return false.' do
|
168
|
+
expect(@config.exist?(:test1, :test)).to equal(false)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'config.exist?(:test1, :test2, :test3) return false.' do
|
172
|
+
expect(@config.exist?(:test1, :test2, :test3)).to equal(false)
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'with config.data_options({:section => :test1})' do
|
176
|
+
expect(@config.data_options(:section =>
|
177
|
+
:test1)).to eq(:section => :test1)
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'config.exist? return nil' do
|
181
|
+
expect(@config.exist?).to equal(nil)
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'config.exist?(test1) return false.' do
|
185
|
+
expect(@config.exist?(:test1)).to equal(false)
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'config.exist?(:test1, :test2) return false.' do
|
189
|
+
expect(@config.exist?(:test1, :test2)).to equal(false)
|
190
|
+
end
|
191
|
+
|
192
|
+
it 'config.exist?(:test2) return true.' do
|
193
|
+
expect(@config.exist?(:test2)).to equal(true)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -73,6 +73,37 @@ describe 'class: Lorj::Account,' do
|
|
73
73
|
expect(@account.where?(:keypair_name)).to eq(%w(local default))
|
74
74
|
end
|
75
75
|
|
76
|
+
it 'account.where?(:keypair_name, :names => %w(default)) '\
|
77
|
+
'return %w(default)' do
|
78
|
+
expect(@account.where?(:keypair_name,
|
79
|
+
:names => %w(default))).to eq(%w(default))
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'account.where?(:keypair_name, :names => %w(runtime account)) '\
|
83
|
+
'return false' do
|
84
|
+
expect(@account.where?(:keypair_name,
|
85
|
+
:names => %w(runtime account))).to equal(false)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'account.where?(:keypair_name, :names => %w(default runtime default)) '\
|
89
|
+
'return %w(default default)' do
|
90
|
+
expect(@account.where?(:keypair_name,
|
91
|
+
:names => %w(default runtime
|
92
|
+
default))).to eq(%w(default default))
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'account.where?(:keypair_name, :names => %w(default runtime)) '\
|
96
|
+
'return %w(default)' do
|
97
|
+
expect(@account.where?(:keypair_name,
|
98
|
+
:names => %w(default runtime))).to eq(%w(default))
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'account.where?(:keypair_name, :names => %w(runtime default)) '\
|
102
|
+
'return %w(default)' do
|
103
|
+
expect(@account.where?(:keypair_name,
|
104
|
+
:names => %w(runtime default))).to eq(%w(default))
|
105
|
+
end
|
106
|
+
|
76
107
|
it "after account.local_del(:keypair_name) value is 'default_key'" do
|
77
108
|
expect(@account.local_del(:keypair_name)).to eq('nova_local')
|
78
109
|
expect(@account.where?(:keypair_name)).to eq(%w(default))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- forj team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- spec/00_lorj_log_spec.rb
|
203
203
|
- spec/01_hash_rh_spec.rb
|
204
204
|
- spec/02_prc_base_config_spec.rb
|
205
|
+
- spec/03_prc_section_config_spec.rb
|
205
206
|
- spec/04_prc_core_config_spec.rb
|
206
207
|
- spec/11_lorj_config_spec.rb
|
207
208
|
- spec/12_lorj_account_spec.rb
|
@@ -235,6 +236,7 @@ test_files:
|
|
235
236
|
- spec/00_lorj_log_spec.rb
|
236
237
|
- spec/01_hash_rh_spec.rb
|
237
238
|
- spec/02_prc_base_config_spec.rb
|
239
|
+
- spec/03_prc_section_config_spec.rb
|
238
240
|
- spec/04_prc_core_config_spec.rb
|
239
241
|
- spec/11_lorj_config_spec.rb
|
240
242
|
- spec/12_lorj_account_spec.rb
|