Method: Cow::Application#create_cache

Defined in:
lib/cow/application.rb

#create_cache(_cache = CACHE_FILE) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cow/application.rb', line 34

def create_cache(_cache = CACHE_FILE)
  dir_name = File.dirname(_cache)
  if !File.exist?(dir_name)
    puts 'Cache directory is not found. Creating...'
    Dir.mkdir(dir_name)
  else
    if !File.directory?(dir_name)
      raise 'Cache directory path is already found but it is not a directory!!!'
    end
  end

  File.write(_cache, Cow::Application::Cache.new.to_yaml)
end