From 24668063699661c3e6d7bd2ec1c5133d1da0ccfc Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 23 Feb 2019 02:44:53 +0100 Subject: [PATCH] Remove `sync_cask_tap_templates` script. (#59340) --- developer/bin/sync_cask_tap_templates | 77 --------------------------- 1 file changed, 77 deletions(-) delete mode 100755 developer/bin/sync_cask_tap_templates diff --git a/developer/bin/sync_cask_tap_templates b/developer/bin/sync_cask_tap_templates deleted file mode 100755 index 0c8d30f64b..0000000000 --- a/developer/bin/sync_cask_tap_templates +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail - -readonly homebrew_online='https://github.com/Homebrew' -readonly repos_dir="$(mktemp -d)" -readonly main_repo_dir="$(mktemp -d)" # From where files will be copied -readonly cask_repos=(homebrew-cask-versions homebrew-cask-fonts homebrew-cask-eid homebrew-cask-drivers) # homebrew-cask is absent since it's the repo all the others are compared against - -function message { - echo "${1}" -} - -function get_main_repo { - curl --silent --location "${homebrew_online}/homebrew-cask/archive/master.zip" | ditto -xk - "${main_repo_dir}" - mv "${main_repo_dir}/homebrew-cask-master/"{,.[^.]}* "${main_repo_dir}" - rmdir "${main_repo_dir}/homebrew-cask-master" -} - -function get_repo { - local repo_name repo_dir - - repo_name="${1}" - repo_dir="${repos_dir}/${repo_name}" - - cd "${repos_dir}" || exit 1 - message "Cloning ${repo_name}…" - git clone "${homebrew_online}/${repo_name}.git" --quiet --depth=1 - cd "${repo_dir}" || exit 1 -} - -function copy_templates { - local repo_name - - repo_name="${1}" - - for file in \ - .editorconfig \ - .gitattributes \ - .github \ - .gitignore \ - .travis.yml \ - Casks/.rubocop.yml \ - CODE_OF_CONDUCT.md \ - ; do - rm -rf "${file}" - cp -r "${main_repo_dir}/${file}" "${file}" - done - - rm '.github/ISSUE_TEMPLATE/02_feature_request.md' # Feature requests only make sense in the main repo - /usr/bin/sed -i '' -E "s:homebrew-cask/(pulls|issues|search):${repo_name}/\1:" '.github/PULL_REQUEST_TEMPLATE.md' # PULL_REQUEST_TEMPLATE has repo-specific links -} - -function push_changes { - local is_repo_changed - - is_repo_changed="$(git status --porcelain --ignore-submodules=dirty 2> /dev/null)" - if [[ -n "${is_repo_changed}" ]]; then - git add --all # Stage everything so 'git diff' does not miss aything (like new paths) - - for modified_path in $(git diff --name-only --staged); do - echo -n "Detected changes to ${modified_path}. " - git commit "${modified_path}" --message "$(basename "${modified_path}"): update to match main repo" --quiet - done - - echo 'Updating…' - git push origin master --quiet - fi -} - -get_main_repo -for repo in "${cask_repos[@]}"; do - get_repo "${repo}" - copy_templates "${repo}" - push_changes -done