From e530df7239d976536ee7c2a10830eb326a1ee7f8 Mon Sep 17 00:00:00 2001 From: muratayusuke Date: Sun, 9 Jun 2013 23:10:21 +0000 Subject: [PATCH] fix #35 --- lib/homesick/actions.rb | 1 + spec/homesick_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/homesick/actions.rb b/lib/homesick/actions.rb index 82c4036..107f5b2 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -109,6 +109,7 @@ class Homesick say_status :conflict, "#{destination} exists", :red unless options[:quiet] if options[:force] || shell.file_collision(destination) { source } + system "rm -rf #{destination}" unless options[:pretend] system "ln -sf #{source} #{destination}" unless options[:pretend] end else diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 0d5c83a..756c28e 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -119,6 +119,17 @@ describe "homesick" do existing_dotdir_link.readlink.should == dotdir end + + it "can override existing directory" do + somewhere_else = create_construct + existing_dotdir = home.directory(".vim") + + dotdir = castle.directory(".vim") + + homesick.symlink("glencairn") + + existing_dotdir.readlink.should == dotdir + end end context "with '.config' in .homesick_subdir" do