Module: Flucti::Parameters
Constant Summary
Constants included
from Utilities
Utilities::SUPPORT_EMAIL_ADDR
Utilities::Miscellaneous::BOGUS_ERROR_MESSAGES
Instance Method Summary
collapse
#clean_name, #command, #error!, #sh, #try_save
#import_pack
#confirm, #puts_list, #puts_long, #puts_subtitle, #puts_title, #qcommand, #quote, #terminal_width
Instance Method Details
#data_store ⇒ Object
18
19
20
|
# File 'lib/flucti/parameters.rb', line 18
def data_store
@data_store ||= store_dir / 'parameters.yml'
end
|
#fetch(key) ⇒ Object
22
23
24
|
# File 'lib/flucti/parameters.rb', line 22
def fetch(key)
cache[key.to_s]
end
|
#store(key, value) ⇒ Object
26
27
28
29
|
# File 'lib/flucti/parameters.rb', line 26
def store(key, value)
cache[key.to_s] = value
data_store.open("w") { |f| f << YAML.dump(cache) }
end
|
#store_dir ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/flucti/parameters.rb', line 6
def store_dir
@store_dir ||= begin
options = []
options << Pathname(ENV['APPDATA']) / 'Flucti' if ENV['APPDATA']
options << Pathname(ENV['HOME']) / '.flucti' if ENV['HOME']
located = options.find { |dir| dir.directory? } || options.find { |dir| dir.dirname.directory? }
located ||= Pathname(Dir.tmpdir) / 'flucti'
located.mkpath
located
end
end
|