trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 199 forks source link

Fixing issue with copy_assets #209

Closed ryanjm closed 9 years ago

ryanjm commented 9 years ago

This is similar to #206, but I think this properly fixes the core issue.

If you have a folder inside of your documentation_assets path it will copy the folder itself into the new folder. According to the documentation the cp_r method will:

Copies src to dest. If src is a directory, this method copies all its contents recursively. If dest is a directory, copies src to dest/src.

I don't believe this is the intention of this method. Again, from the documentation:

# If you want to copy all contents of a directory instead of the
# directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
# use following code.
FileUtils.cp_r 'src/.', 'dest'     # cp_r('src', 'dest') makes src/dest,
                                   # but this doesn't.

That is what I've changed this method to do.

jdcantrell commented 9 years ago

Playing with this pull request and thinking about what's going on here, I think the other PR is more correct. The change in this PR causes an error when you have files in your assets directory. I think we should remove files and directories before we copy so we can make sure we get the latest version in the build folder.

Let me know if there's something I'm missing here. Thanks again for the PR.