class FileLayer

Public Class Methods

delete_homer_folder() click to toggle source

Deletes the homer root

# File lib/homer/file_layer.rb, line 20
def delete_homer_folder
  FileUtils.rm_rf(root_path)
end
dotfiles_directory_path() click to toggle source

This is the directory to which the dotfiles will be moved

# File lib/homer/file_layer.rb, line 54
def dotfiles_directory_path
  return File.join(root_path, "dotfiles/")
end
dotfiles_path() click to toggle source

This is the dotfiles list YML file . This is where a mapping of files in dotfiles folder to actual location in filesystem exists

# File lib/homer/file_layer.rb, line 49
def dotfiles_path
  return File.join(dotfiles_directory_path, "dotfiles_list.yml")
end
get_generic_home_relative_path(filepath) click to toggle source
# File lib/homer/file_layer.rb, line 63
def get_generic_home_relative_path(filepath)
  filepath.gsub(/\/home\/[^\/]*\//, "~/")
end
prepare_homer_folder() click to toggle source

Creates the homer root directory if it does not exist already Creates the dotfiles directory if it does not exist already Creates a dotfiles list YML file if it does not exist already

# File lib/homer/file_layer.rb, line 11
def prepare_homer_folder
  Dir.mkdir(root_path) unless Dir.exists?(root_path)
  Dir.mkdir(dotfiles_directory_path) unless Dir.exists?(dotfiles_directory_path)
  File.new(dotfiles_path , "w") unless File.exists?(dotfiles_path)
rescue Exception => e
  raise "~/.homer cannot be created : #{e.message}"
end
root_path() click to toggle source

This is where homer

# File lib/homer/file_layer.rb, line 59
def root_path
  return File.join(Dir.home, ".homer")
end