Class: MrMurano::ConfigMigrate
- Inherits:
-
Object
- Object
- MrMurano::ConfigMigrate
show all
- Includes:
- Verbose
- Defined in:
- lib/MrMurano/Config-Migrate.rb
Constant Summary
Constants included
from Verbose
Verbose::TABULARIZE_DATA_FORMAT_ERROR
Instance Method Summary
collapse
Methods included from Verbose
ask_yes_no, #ask_yes_no, #assert, assert, cmd_confirm_delete!, #cmd_confirm_delete!, debug, #debug, dump_file_json, dump_file_plain, dump_file_yaml, #dump_output_file, #error, error, #error_file_format!, fancy_ticks, #fancy_ticks, #load_file_json, #load_file_plain, #load_file_yaml, #load_input_file, outf, #outf, #outformat_engine, #pluralize?, pluralize?, #prepare_hash_csv, #read_hashf!, #tabularize, tabularize, verbose, #verbose, warning, #warning, #whirly_interject, whirly_interject, #whirly_linger, whirly_linger, #whirly_msg, whirly_msg, #whirly_pause, whirly_pause, #whirly_start, whirly_start, #whirly_stop, whirly_stop, #whirly_unpause, whirly_unpause
Instance Method Details
#import_secret ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/MrMurano/Config-Migrate.rb', line 17
def import_secret
solsecret = Pathname.new($cfg['location.base']) + '.Solutionfile.secret'
return unless solsecret.exist?
solsecret.open do |io|
ss = YAML.load(io)
pff = $cfg.file_at('passwords', :user)
pwd = MrMurano::Passwords.new(pff)
ps = load_passwords_maybe(pwd, pff, ss)
update_passwords_maybe(pwd, ps, ss)
update_config_from_secrets(ss)
end
end
|
#load_passwords_maybe(pwd, pff, ss) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/MrMurano/Config-Migrate.rb', line 31
def load_passwords_maybe(pwd, pff, ss)
return nil unless pff.exist?
pwd.load
pwd.get($cfg['net.host'], ss['email'])
end
|
#update_config_from_secrets(ss) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/MrMurano/Config-Migrate.rb', line 56
def update_config_from_secrets(ss)
$cfg.set('user.name', ss['email'])
$project.refresh_user_name
$cfg.set('application.id', ss['solution_id']) if ss.key? 'solution_id'
$cfg.set('product.id', ss['product_id']) if ss.key? 'product_id'
end
|
#update_passwords_maybe(pwd, ps, ss) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/MrMurano/Config-Migrate.rb', line 40
def update_passwords_maybe(pwd, ps, ss)
if ps.nil?
pwd.set($cfg['net.host'], ss['email'], ss['password'])
pwd.save
elsif ps != ss['password']
okay = ask(
'A different password for this account already exists. Overwrite? N/y'
)
if okay =~ /^y/i
pwd.set($cfg['net.host'], ss['email'], ss['password'])
pwd.save
end
end
end
|