From c5b7dd2918da7187c153597f4895c63f12d9c30e 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 6a01e01..0accf72 100644 --- a/lib/homesick/actions.rb +++ b/lib/homesick/actions.rb @@ -120,6 +120,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 8e4f5a5..7200508 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -120,6 +120,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