-
-
Save astyfx/517b343fccb6f1fd3556e46178b5beb2 to your computer and use it in GitHub Desktop.
Cactus (http://cactusformac.com/) plugin that generates an external build folder that doesn't overwrite your git files. Perfect for usage with GitHub pages, just stick your .git in the generated build folder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import distutils.dir_util | |
import shutil | |
import os | |
def copytree(src, dst): | |
for item in os.listdir(src): | |
s, d = os.path.join(src, item), os.path.join(dst, item) | |
if os.path.isdir(s): | |
shutil.copytree(s, d, False, None) | |
else: | |
shutil.copy2(s, d) | |
def postBuild(site): | |
build_folder = site._path + "/build" | |
for sub_file in os.listdir(build_folder): | |
if sub_file[0] != ".": | |
sub_file_path = os.path.join(build_folder, sub_file) | |
try: | |
if os.path.isfile(sub_file_path): | |
os.unlink(sub_file_path) | |
elif os.path.isdir(sub_file_path): | |
shutil.rmtree(sub_file_path) | |
except Exception, e: | |
print e | |
copytree(site.build_path, build_folder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment