ovasquez / mkdocs-merge

Merge the source of multiple MkDocs sites into a single one
https://ovasquez.github.io/mkdocs-merge/
MIT License
24 stars 6 forks source link

When mkdocs-merge is used as a module, subsequent merges fail #2

Closed mihaipopescu closed 6 years ago

mihaipopescu commented 6 years ago

First let me say thanks for this package. It's really good considering what I've seen out there and I've integrated it into my own package which I plan to open source in the near future. It's a mkdocs-merge-server which uses mkdocs-merge to merge multiple mkdocs documentation source packages and also serve the final merged website.

The problem that I hit with your package was that subsequent merges failed with a similar failure I saw here https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree/28055993#28055993 where I also found the workaround.

So basically what I did was to do this this:

        distutils.dir_util._path_created = {}
        new_pages = mkdocsmerge.__main__.merge_sites(sites, self._main_site_folder, True)

Also, I have to admit that there was a bit of a friction when I use your package as a module due to the cli extensions and not a more detailed organization.

ovasquez commented 6 years ago

Hi @mihaipopescu, thanks for the detailed explanation of the issue. Regarding the issue with shutil, I should find some time this week to update it. Thanks for sending the pointer to stack overflow.

About the following:

friction when I use your package as a module due to the cli extensions and not a more detailed organization

Do you have any suggestions? I started this code as a weekend project for my immediate needs, but I'm open to modify, update or increase the functionality provided by the package if it can help the community.

mihaipopescu commented 6 years ago

Hi @ovasquezm,

I also work on my project only 1 day per week so I know how it is but I like the project because the code is simple.

The friction I mentioned was due to the fact that the code was not structured so it can be easily be used as a module.

I think we can move the helper functions and the logic from the run method into a different file (maybe merge.py). This would separate them from the @click allowing module clients to use the functions without problems.

mihaipopescu commented 6 years ago

The two PRs will likely conflict. Let's see how github manages it or if it's going to be some more manual work involved.

ovasquez commented 6 years ago

I published a new version of the package 0.4.0. Again, thanks for all the help with this update.