From ea5a11bcd07b323b43f699bf4fd40e90cfe813f8 Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Tue, 12 Dec 2017 10:14:43 -0800 Subject: [PATCH] Redux - Use rsync instead of copy when preparing files to publish Realized that rsync was installed on our Circle docker image, so that broke everything --- lib/publish-gh-pages.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/publish-gh-pages.js b/lib/publish-gh-pages.js index 3877b599a7..ebc6c36aa0 100755 --- a/lib/publish-gh-pages.js +++ b/lib/publish-gh-pages.js @@ -110,14 +110,16 @@ shell.exec('git rm -rf .'); shell.cd('../..'); -shell.cp( - '-R', - // in github.io case, project is deployed to root. need to not recursively - // copy the deployment-branch to be. - // The !(...) represents the same thing as "everything but this" - // Copies everything in /build except the directory after the !. - path.join('build', PROJECT_PATH, `!(${PROJECT_NAME}-${DEPLOYMENT_BRANCH})`), - path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`) +fromPath = path.join('build', PROJECT_PATH, '/'); +toPath = path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`); +// In github.io case, project is deployed to root. Need to not recursively +// copy the deployment-branch to be. +excludePath = `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`; +// cannot use shell.cp because it doesn't support copying dotfiles and we +// need to copy directories like .circleci, for example +// https://github.com/shelljs/shelljs/issues/79 +shell.exec( + `rsync -rt --exclude=${excludePath} --exclude=.DS_Store ${fromPath} ${toPath}` ); shell.cd(path.join('build', `${PROJECT_NAME}-${DEPLOYMENT_BRANCH}`));