Module: Baltix::Actor::Link
- Defined in:
- lib/baltix/actor/link.rb
Defined Under Namespace
Classes: NoDestinationDirError, NoFileError, NoSourceDirError
Class Method Summary collapse
Class Method Details
.apply(context) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/baltix/actor/link.rb', line 7 def apply context target_dir = context['target_dir'] || raise(NoDestinationDirError) source_dir = context['source_dir'] || raise(NoSourceDirError) file = context['file'] || raise(NoFileError) target_file = File.join(context['target_prefix'] || '', target_dir, file) source_file = File.join(source_dir, file) FileUtils.mkdir_p(File.dirname(target_file)) FileUtils.rm_rf(target_file) FileUtils.ln_s(source_file, target_file, force: true) $stdout.puts " #{source_file} -> #{target_file}" end |