Class: Pfm::Command::Configure
- Inherits:
-
Base
- Object
- Base
- Pfm::Command::Configure
show all
- Defined in:
- lib/idlc-sdk-pfm/command/configure.rb
Instance Method Summary
collapse
Methods inherited from Base
#build_base_dir, #build_dir, #build_exists?, #build_setup, #deploy_setup, #deploy_setupv2, #inf_base_dir, #initialize, #run_with_default_options, #templates_dir, #verbose?
Methods included from Helpers
debug, err, msg, system_command
Instance Method Details
#needs_help?(params) ⇒ Boolean
36
37
38
|
# File 'lib/idlc-sdk-pfm/command/configure.rb', line 36
def needs_help?(params)
['-h', '--help'].include? params[0]
end
|
#needs_version?(_params) ⇒ Boolean
27
28
29
30
|
# File 'lib/idlc-sdk-pfm/command/configure.rb', line 27
def needs_version?(_params)
false
end
|
#null?(value) ⇒ Boolean
32
33
34
|
# File 'lib/idlc-sdk-pfm/command/configure.rb', line 32
def null?(value)
value.nil? || value == ''
end
|
#run(params) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/idlc-sdk-pfm/command/configure.rb', line 9
def run(params)
current_set = Pfm::Settings.new
new_settings = {}
current_set.settings.each do |key, setting|
print("#{key} [#{setting.value}]: ")
stdin = STDIN.gets.chomp.strip
required = setting.required?
new_value = setting.value
new_value = stdin unless null?(stdin)
new_settings[key] = Pfm::Settings::Setting.new(new_value, required)
end
current_set.save_config(new_settings)
end
|