Added track command.

* Moves a specified file into the specified castle.
* Symlinks it into its original position.

Signed-off-by: Joshua Nichols <josh@technicalpickles.com>
This commit is contained in:
j.c.sackett
2010-09-30 20:01:37 -04:00
committed by Joshua Nichols
parent 4776651b27
commit 58767454b3
3 changed files with 63 additions and 4 deletions

View File

@@ -59,6 +59,22 @@ class Homesick
system "git pull --quiet" unless options[:pretend]
end
def mv(source, destination, config = {})
source = Pathname.new(source)
destination = Pathname.new(destination + source.basename)
if destination.exist?
say_status :conflict, "#{destination} exists", :red unless options[:quiet]
if options[:force] || shell.file_collision(destination) { source }
system "mv #{source} #{destination}" unless options[:pretend]
end
else
# this needs some sort of message here.
system "mv #{source} #{destination}" unless options[:pretend]
end
end
def ln_s(source, destination, config = {})
source = Pathname.new(source)
destination = Pathname.new(destination)