diff --git a/.ci/built_in_manifest b/.ci/built_in_manifest new file mode 100644 index 000000000..f4325fad7 --- /dev/null +++ b/.ci/built_in_manifest @@ -0,0 +1,12 @@ +https://raw.githubusercontent.com/magnars/dash.el/master/dash.el core/libs/dash.el +https://raw.githubusercontent.com/creichert/ido-vertical-mode.el/master/ido-vertical-mode.el core/libs/ido-vertical-mode.el +https://raw.githubusercontent.com/sigma/mocker.el/master/mocker.el core/libs/mocker.el +https://raw.githubusercontent.com/melpa/package-build/master/package-build.el core/libs/package-build.el +https://raw.githubusercontent.com/melpa/package-build/master/package-recipe-mode.el core/libs/package-recipe-mode.el +https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el core/libs/quelpa.el +https://raw.githubusercontent.com/Malabarba/spinner.el/master/spinner.el core/libs/spinner.el +https://raw.githubusercontent.com/Wilfred/ht.el/master/ht.el core/libs/ht.el +https://raw.githubusercontent.com/diasjorge/emacs-load-env-vars/master/load-env-vars.el core/libs/load-env-vars.el +https://raw.githubusercontent.com/melpa/package-build/master/package-build-badges.el core/libs/package-build-badges.el +https://raw.githubusercontent.com/melpa/package-build/master/package-recipe.el core/libs/package-recipe.el +https://raw.githubusercontent.com/purcell/page-break-lines/master/page-break-lines.el core/libs/page-break-lines.el diff --git a/.travis.yml b/.travis.yml index a7ff3c4b7..2ed346231 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ script: deploy: - provider: script skip_cleanup: true - script: ".travisci/pub_org.sh" + script: ".travisci/pub_auto_update.sh" on: branch: develop condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG diff --git a/.travisci/pub_org.sh b/.travisci/pub_auto_update.sh similarity index 81% rename from .travisci/pub_org.sh rename to .travisci/pub_auto_update.sh index b15f106d8..75495318b 100755 --- a/.travisci/pub_org.sh +++ b/.travisci/pub_auto_update.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -## ORG documentation publishing script for Travis CI integration +## Auto-update publishing script for Travis CI integration ## ## Copyright (c) 2012-2014 Sylvain Benner ## Copyright (c) 2014-2018 Sylvain Benner & Contributors @@ -39,7 +39,7 @@ if [ $? -ne 0 ]; then fi fold_end "CLONING_TARGET_REPOSITORY" -fold_start "APPLYING DOCUMENTATION PATCH" +fold_start "APPLYING_DOCUMENTATION_PATCH" cd "/tmp/${PUBLISH}" if [ ! -f /tmp/docfmt.patch ]; then echo "Documentation doesn't need fixes. Aborting." @@ -50,7 +50,20 @@ if [ $? -ne 0 ]; then echo "Failed to apply documentation fixes patch" exit 2 fi -fold_end "APPLYING DOCUMENTATION PATCH" +fold_end "APPLYING_DOCUMENTATION_PATCH" + +fold_start "APPLYING_BUILT_IN_PATCH" +cd "/tmp/${PUBLISH}" +if [ ! -f /tmp/built_in.patch ]; then + echo "Built-in files don't need updating. Aborting." + exit 0 +fi +git am < /tmp/built_in.patch +if [ $? -ne 0 ]; then + echo "Failed to apply built-in patch." + exit 2 +fi +fold_end "APPLYING_BUILT_IN_PATCH" fold_start "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME" cd ~/.emacs.d @@ -60,7 +73,7 @@ rem_rev=$(git rev-parse '@{u}') echo "Base revision: $base_revision" echo "Remote revision: $rem_rev" if [ "$base_revision" != "$rem_rev" ]; then - echo "Looks like Spacemacs head has changed while we generated files." + echo "Looks like Spacemacs head has changed since CI started." echo "Aborting." exit 0 fi @@ -86,7 +99,7 @@ fi fold_end "PUSHING_CHANGES_TO_${BOT_NAME}/${PUBLISH}" fold_start "OPENING_PR_TO_SPACEMACS_REPO" -echo "[bot] Documentation formatting" > msg +echo "[bot] Auto-update" > msg echo >> msg echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg /tmp/hub pull-request -b "${TRAVIS_BRANCH}" -F msg diff --git a/.travisci/pub_prep.sh b/.travisci/pub_prep.sh index e0301cc04..11114d5fc 100755 --- a/.travisci/pub_prep.sh +++ b/.travisci/pub_prep.sh @@ -56,12 +56,45 @@ if [ $? -ne 0 ]; then else git format-patch -1 HEAD --stdout > /tmp/docfmt.patch if [ $? -ne 0 ]; then - echo "Failed to create patch file." + echo "Failed to create documentation patch file." + exit 2 fi cat /tmp/docfmt.patch fi +git reset --hard HEAD~1 fold_end "CREATING_DOCUMENTATION_PATCH_FILE" +fold_start "UPDATING_BUILT_IN_FILES" +built_in_manifest="${TRAVIS_BUILD_DIR}/.ci/built_in_manifest" +lines=$(cat "${built_in_manifest}") +while read line; do + url=$(echo $line | cut -f1 -d " ") + target=$(echo $line | cut -f2 -d " ") + curl "${url}" --output "${TRAVIS_BUILD_DIR}/${target}" + if [ $? -ne 0 ]; then + echo "Failed to update built in file: ${target} from url: ${url}" + echo "Please update manifest file: .emacs.d/.ci/built_in_manifest" + exit 2 + fi +done <"${built_in_manifest}" +fold_end "UPDATING_BUILT_IN_FILES" + +fold_start "CREATING_BUILT_IN_PATCH_FILE" +git add --all +git commit -m "Built-in files auto-update: $(date -u)" +if [ $? -ne 0 ]; then + echo "Built-in files don't need an update." +else + git format-patch -1 HEAD --stdout > /tmp/built_in.patch + if [ $? -ne 0 ]; then + echo "Failed to create built-in patch file." + exit 2 + fi + cat /tmp/built_in.patch +fi +git reset --hard HEAD~1 +fold_end "CREATING_BUILT_IN_PATCH_FILE" + rm -rf ~/.emacs.d mv "${TRAVIS_BUILD_DIR}" ~/.emacs.d cd ~/.emacs.d