Class: MacSetup::Symlink
- Inherits:
-
Object
- Object
- MacSetup::Symlink
- Defined in:
- lib/mac_setup/symlink_installer.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Symlink
constructor
A new instance of Symlink.
- #link ⇒ Object
Constructor Details
#initialize(options) ⇒ Symlink
Returns a new instance of Symlink.
3 4 5 6 7 |
# File 'lib/mac_setup/symlink_installer.rb', line 3 def initialize() @source_path = [:source_path] @file_name = [:name] @target_path = [:target_path] end |
Instance Method Details
#link ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/mac_setup/symlink_installer.rb', line 9 def link short_sorce_path = MacSetup.shorten_path(source_path) short_target_path = MacSetup.shorten_path(target_path) puts "Linking #{short_sorce_path} to #{short_target_path}..." return unless source_exists target_exists? ? replace : FileUtils.ln_s(source_path, target_path) end |