Skip to content

Commit

Permalink
Fix problem with multiple generation of books that include symlinks.
Browse files Browse the repository at this point in the history
I ran into this particular problem when generating a book with node.js code -- the node_modules in particular.
  • Loading branch information
eee-c committed Apr 6, 2012
1 parent 2f521ac commit 5463e86
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/git-scribe/generate.rb
Expand Up @@ -330,7 +330,7 @@ def liquid_template(file)
# create a new file by concatenating all the ones we find
def gather_and_process
files = Dir.glob("book/*")
FileUtils.cp_r files, 'output'
FileUtils.cp_r files, 'output', :remove_destination => true
end

def ex(command)
Expand Down
17 changes: 17 additions & 0 deletions test/gen_test.rb
Expand Up @@ -11,6 +11,23 @@
end
end

test "scribe don't crash on symlinks when run twice" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
FileUtils.mkdir_p 'book/includes/sub1'
FileUtils.mkdir_p 'book/includes/sub2'
FileUtils.touch 'book/includes/sub1/real_file'
FileUtils.ln_s '../sub1/real_file', 'book/includes/sub2/link_file'

assert_nothing_raised do
@scribe.gen('html')
@scribe.gen('html')
end
end
end
end

test "scribe can generate single page html" do
in_temp_dir do
@scribe.init('t')
Expand Down

0 comments on commit 5463e86

Please sign in to comment.