Track makes entries in .manifest

When a user tracks a file or directory that is in
a nested folder, Homesick creates a .manifest in the
user's castle (if there isn't one already) and adds
an entry listing the file or directory's parent
directory (if it isn't already listed).
This commit is contained in:
Eric West
2013-05-24 07:52:54 -05:00
parent 7332aa4acd
commit b93eea0e24
2 changed files with 38 additions and 0 deletions

View File

@@ -191,5 +191,34 @@ describe "homesick" do
tracked_file.should exist
File.realdirpath(some_nested_dir).should == File.realdirpath(tracked_file)
end
describe "manifest" do
it 'should add the nested files parent to the manifest' do
castle = given_castle('castle_repo')
some_nested_file = home.file('some/nested/file.txt')
homesick.track(some_nested_file.to_s, 'castle_repo')
manifest = Pathname.new(castle.parent.join('.manifest'))
File.open(manifest, 'r') do |f|
f.readline.should == "some/nested\n"
end
end
it 'should NOT add anything if the files parent is already listed' do
castle = given_castle('castle_repo')
some_nested_file = home.file('some/nested/file.txt')
other_nested_file = home.file('some/nested/other.txt')
homesick.track(some_nested_file.to_s, 'castle_repo')
homesick.track(other_nested_file.to_s, 'castle_repo')
manifest = Pathname.new(castle.parent.join('.manifest'))
File.open(manifest, 'r') do |f|
f.readlines.size.should == 1
end
end
end
end
end