Class: SymLink
- Inherits:
-
Object
- Object
- SymLink
- Defined in:
- lib/homer/symlink.rb
Class Method Summary collapse
-
.add(dotfile) ⇒ Object
Adds file to dotfiles_list , moves the file to dotfiles folder and creates a symlink with original filepath.
-
.filenames ⇒ Object
Returns all files in dotfiles_list.
Class Method Details
.add(dotfile) ⇒ Object
Adds file to dotfiles_list , moves the file to dotfiles folder and creates a symlink with original filepath
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/homer/symlink.rb', line 11 def self.add(dotfile) dotfile = File.(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 |
.filenames ⇒ Object
Returns all files in dotfiles_list
4 5 6 7 |
# File 'lib/homer/symlink.rb', line 4 def self.filenames symlinks = FileLayer.read_symlink_file symlinks.keys end |