Class: SymLink

Inherits:
Object
  • Object
show all
Defined in:
lib/homer/symlink.rb

Class Method Summary collapse

Class Method Details

.add(dotfile) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/homer/symlink.rb', line 8

def self.add(dotfile)
  dotfile = File.expand_path(dotfile)
  raise "#{dotfile} does not exist." unless File.exists?(dotfile)
  filename = File.basename(dotfile)
  filename_to_store = get_unused_filename(filename, filenames)
  symlinks = FileLayer.read_symlink_file
  symlinks[filename_to_store] = FileLayer.get_generic_home_relative_path(dotfile)
  FileLayer.save_symlink_file(symlinks)
  FileLayer.create_symlink(filename_to_store,dotfile)
end

.filenamesObject



3
4
5
6
# File 'lib/homer/symlink.rb', line 3

def self.filenames
  symlinks = FileLayer.read_symlink_file
  symlinks.keys
end