Skip to content

Commit

Permalink
fix(migrate): add the template's lint rules to the migration script a…
Browse files Browse the repository at this point in the history
…nd dependencies check (#129)

* add the yamllint from the template to migration script

* patch: add check for yq and gracefully exit if not found

* add check for jq
  • Loading branch information
EricRibeiro authored Mar 15, 2022
1 parent 3e07cc9 commit 6923ba0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ verify_run() {
echo "This does not appear to be the root of a CircleCI project"
exit 1
fi

# Ensure jq is installed
if ! command -v jq >/dev/null 2>&1; then
echo "Looks like you don't have \"jq\" installed"
echo "Please install it and run the script again: https://stedolan.github.io/jq/download/."
exit 1
fi

# Ensure yq is installed
if ! command -v yq >/dev/null 2>&1; then
echo "Looks like you don't have \"yq\" installed"
echo "Please install it and run the script again: https://github.com/mikefarah/yq#install."
exit 1
fi
}

backup_contents() {
Expand All @@ -30,6 +44,10 @@ download_template() {
curl -Ls "$ORB_TEMPLATE_DOWNLOAD_URL" -o "$ORB_TEMP_DIR/orb-template.tar.gz"
tar -xzf "$ORB_TEMP_DIR/orb-template.tar.gz" -C "$ORB_TEMP_DIR" --strip-components 1
cp -r "${ORB_TEMP_DIR}/.circleci/." .circleci/

if [[ ! -e .yamllint ]]; then
cp "${ORB_TEMP_DIR}/.yamllint" .yamllint
fi
}

copy_custom_components() {
Expand Down

0 comments on commit 6923ba0

Please sign in to comment.