params 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.
- data/lib/params.rb +19 -17
- data/lib/params/version.rb +1 -1
- data/test/params/params_spec.rb +3 -3
- metadata +2 -2
data/lib/params.rb
CHANGED
@@ -276,8 +276,6 @@ module Params
|
|
276
276
|
override_param(result_name, results[result_name])
|
277
277
|
end
|
278
278
|
|
279
|
-
print_global_parameters
|
280
|
-
|
281
279
|
# Prints help and parameters if needed.
|
282
280
|
if @show_help_and_exit
|
283
281
|
# Print parameters + description and exit.
|
@@ -287,7 +285,17 @@ module Params
|
|
287
285
|
end
|
288
286
|
exit
|
289
287
|
end
|
290
|
-
|
288
|
+
|
289
|
+
# Add parameters to log init messages (used by Log.init if param:print_params_to_stdout is true)
|
290
|
+
@init_debug_messages << "\n"
|
291
|
+
@init_debug_messages << 'Initialized executable parameters:'
|
292
|
+
@init_debug_messages << '---------------------------------'
|
293
|
+
counter=0
|
294
|
+
@globals_db.values.each do |param|
|
295
|
+
counter += 1
|
296
|
+
@init_debug_messages << "#{counter}: #{param.name}=#{param.value}"
|
297
|
+
end
|
298
|
+
@init_debug_messages << '---------------------------------'
|
291
299
|
end
|
292
300
|
|
293
301
|
# Load yml params and override default values.
|
@@ -380,18 +388,6 @@ paths:
|
|
380
388
|
return results
|
381
389
|
end # end of Parse function
|
382
390
|
|
383
|
-
def Params.print_global_parameters
|
384
|
-
@init_debug_messages << "\n"
|
385
|
-
@init_debug_messages << 'Initialized global parameters:'
|
386
|
-
@init_debug_messages << '---------------------------------'
|
387
|
-
counter=0
|
388
|
-
@globals_db.values.each do |param|
|
389
|
-
counter += 1
|
390
|
-
@init_debug_messages << "#{counter}: #{param.name}=#{param.value}"
|
391
|
-
end
|
392
|
-
@init_debug_messages << '---------------------------------'
|
393
|
-
end
|
394
|
-
|
395
391
|
def Params.to_simple_hash
|
396
392
|
@globals_db.map { |param|
|
397
393
|
param.value
|
@@ -405,11 +401,17 @@ paths:
|
|
405
401
|
end
|
406
402
|
#define default params:
|
407
403
|
# 1. configuration file
|
408
|
-
|
404
|
+
if $0 =~ /content_server/
|
405
|
+
Params.path('conf_file', '~/.bbfs/etc/config_content_server.yml', 'Configuration file path.')
|
406
|
+
elsif $0 =~ /backup_server/
|
407
|
+
Params.path('conf_file', '~/.bbfs/etc/config_backup_server.yml', 'Configuration file path.')
|
408
|
+
else
|
409
|
+
Params.path('conf_file', nil, 'Configuration file path.')
|
410
|
+
end
|
409
411
|
# 2. Print params to stdout
|
410
412
|
Params.boolean('print_params_to_stdout', false, 'print_params_to_stdout or not during Params.init')
|
411
413
|
|
412
|
-
private_class_method :
|
414
|
+
private_class_method :parse_command_line_arguments, \
|
413
415
|
:raise_error_if_param_exists, :raise_error_if_param_does_not_exist, \
|
414
416
|
:read_yml_params, :override_param, :executable_name
|
415
417
|
end
|
data/lib/params/version.rb
CHANGED
data/test/params/params_spec.rb
CHANGED
@@ -8,9 +8,9 @@ require_relative '../../lib/params.rb'
|
|
8
8
|
|
9
9
|
module Params
|
10
10
|
# make private methods or Params public for testing capability.
|
11
|
-
public_class_method :
|
12
|
-
|
13
|
-
|
11
|
+
public_class_method :parse_command_line_arguments, \
|
12
|
+
:raise_error_if_param_exists, :raise_error_if_param_does_not_exist, \
|
13
|
+
:read_yml_params, :override_param
|
14
14
|
|
15
15
|
module Spec
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Dynamically stores, parses and providers params. Uses module local readers.
|
16
16
|
email: bbfsdev@gmail.com
|