module Dotpack::Config
Constants
- BASE_DIR
- FLAVORS_PATH
Public Class Methods
flavor(f)
click to toggle source
# File lib/dotpack/config.rb, line 12 def self.flavor(f) cache_flavors @flavors[f] end
flavors()
click to toggle source
# File lib/dotpack/config.rb, line 28 def self.flavors cache_flavors @flavors.clone end
remove_flavor(f)
click to toggle source
# File lib/dotpack/config.rb, line 23 def self.remove_flavor(f) cache_flavors @flavors.delete f end
save()
click to toggle source
# File lib/dotpack/config.rb, line 33 def self.save save_flavors end
save_flavors()
click to toggle source
# File lib/dotpack/config.rb, line 37 def self.save_flavors return unless @flavors_cached File.open(FLAVORS_PATH, 'w') do |file| file.puts JSON.unparse(@flavors) end end
set_flavor(f, value='')
click to toggle source
# File lib/dotpack/config.rb, line 17 def self.set_flavor(f, value='') value = '' if value.nil? cache_flavors @flavors[f] = value end
Private Class Methods
cache_flavors()
click to toggle source
# File lib/dotpack/config.rb, line 45 def self.cache_flavors return if @flavors_cached FileUtils.mkdir_p BASE_DIR unless File.exist? FLAVORS_PATH File.write FLAVORS_PATH, "{}" end @flavors = JSON.parse(File.read(FLAVORS_PATH)) @flavors_cached = true end