]>
git.r.bdr.sh - rbdr/lyricli.rb/blob - lib/lyricli/configuration.rb
5 @config_path = "~/.lyricli.conf"
6 @defaults_path = "defaults.json"
10 @
@instance = Configuration
.new
17 load_config
unless @config
22 load_config
unless @config
28 load_config
unless @config
33 private_class_method
:new
35 # TODO: Apart from this, load a default yml that will be used for this.
36 # And just extend everything from the user's config.
38 path
= File
.expand_path(@config_path)
41 file
= File
.new(path
, "r")
42 @config = MultiJson
.decode(file
.read
)
49 path
= File
.expand_path(@config_path)
50 file
= File
.new(path
, "w")
51 file
.print(MultiJson
.encode(@config))
57 def load_default_config
59 path_root
= File
.expand_path(File
.dirname(__FILE__
))
60 path
= File
.join(path_root
, @defaults_path)
63 file
= File
.new(path
, "r")
64 @config = MultiJson
.decode(file
.read
)