Module: Dotpack::Config
- Defined in:
- lib/dotpack/config.rb
Constant Summary collapse
- BASE_DIR =
Dir.home + '/.dotpack'
- FLAVORS_PATH =
BASE_DIR + '/flavors'
Class Method Summary collapse
Class Method Details
.cache_flavors ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dotpack/config.rb', line 28 def self.cache_flavors return if @flavors_cached FileUtils.mkdir_p BASE_DIR unless File.exist? FLAVORS_PATH FileUtils.touch FLAVORS_PATH end @flavors = File.read(FLAVORS_PATH).split @flavors_cached = true end |
.flavors ⇒ Object
11 12 13 14 |
# File 'lib/dotpack/config.rb', line 11 def self.flavors cache_flavors return @flavors end |
.save ⇒ Object
16 17 18 |
# File 'lib/dotpack/config.rb', line 16 def self.save save_flavors end |
.save_flavors ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dotpack/config.rb', line 20 def self.save_flavors return unless @flavors_cached File.open(FLAVORS_PATH, 'w') do |file| @flavors.each{|f| file.puts f} end end |