mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-24 08:23:33 +03:00
19 lines
428 B
Ruby
19 lines
428 B
Ruby
|
# Symlinks from source to target.
|
||
|
# Depends on target's `#dirname` existing.
|
||
|
class Tasks::Symlink < Task
|
||
|
def initialize(source, target)
|
||
|
@source = source
|
||
|
@target = target
|
||
|
# The actual source is not a dependency; the symlink can dangle freely.
|
||
|
add_dependency(:Files, File.dirname(target))
|
||
|
end
|
||
|
|
||
|
def run()
|
||
|
File.symlink(@source, @target)
|
||
|
end
|
||
|
|
||
|
def name()
|
||
|
"#{super}(#{@source}, #{@target})"
|
||
|
end
|
||
|
end
|