Don't try to symlink a castle to itself. Fixes #14

This commit is contained in:
Josh Nichols
2011-05-30 21:04:41 -04:00
parent 54697866f5
commit e19617be2f
2 changed files with 35 additions and 7 deletions

View File

@@ -21,7 +21,12 @@ class Homesick < Thor
inside repos_dir do
destination = nil
if File.exist?(uri)
destination = Pathname.new(uri).basename
uri = Pathname.new(uri).expand_path
if uri.to_s.start_with?(repos_dir)
raise "Castle already cloned to #{uri}"
end
destination = uri.basename
ln_s uri, destination
elsif uri =~ GITHUB_NAME_REPO_PATTERN