symlink subdirs with .homesick_subdir

This commit is contained in:
muratayusuke
2013-05-24 17:40:35 +00:00
parent 236373b7d7
commit a76d09d3f6
3 changed files with 52 additions and 3 deletions

View File

@@ -120,6 +120,21 @@ describe "homesick" do
existing_dotdir_link.readlink.should == dotdir
end
end
context "when .homesick_subdir exists" do
let(:castle) { given_castle("glencairn", "glencairn", [".config"]) }
it "can symlink in sub directory" do
dotdir = castle.directory(".config")
dotfile = dotdir.file(".some_dotfile")
homesick.symlink("glencairn")
home_dotdir = home.join(".config")
home_dotdir.symlink?.should == false
home_dotdir.join(".some_dotfile").readlink.should == dotfile
end
end
end
describe "list" do

View File

@@ -16,12 +16,19 @@ RSpec.configure do |config|
homesick.stub(:say_status)
end
def given_castle(name, path=name)
def given_castle(name, path=name, subdirs=[])
castles.directory(path) do |castle|
Dir.chdir(castle) do
system "git init >/dev/null 2>&1"
system "git remote add origin git://github.com/technicalpickles/#{name}.git >/dev/null 2>&1"
return castle.directory("home")
castle_home = castle.directory("home")
if subdirs then
subdir_file = castle_home.join(Homesick::SUBDIR_FILENAME)
subdirs.each do |subdir|
system "echo #{subdir} >> #{subdir_file}"
end
end
return castle_home
end
end
end