-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to use a matching branch from core
- Loading branch information
1 parent
ff210c6
commit 656f374
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Default to the main branch if we don't find a matching branch on the starter repository. | ||
CORE_REPO_BRANCH="main" | ||
|
||
# Look for a matching branch on the starter repository when running tests on CircleCI. | ||
CI_BRANCH=$CIRCLE_BRANCH | ||
if [[ -v CI_BRANCH ]] | ||
then | ||
# Default to the main branch if we don't find a matching branch on the starter repository. | ||
BRANCH_NAMES_JSON=$(curl -H "Accept: application.vnd.github+json" "https://api.github.com/repos/bullet-train-co/bullet_train-core/branches?per_page=100") | ||
#echo "This is what we're getting from the GitHub API:" | ||
#echo "${BRANCH_NAMES_JSON}" | ||
BRANCH_NAMES=$(echo $BRANCH_NAMES_JSON | jq -r '.[].name') | ||
echo "These are the branches on the core repo:" | ||
echo "${BRANCH_NAMES}" | ||
|
||
for BRANCH in $BRANCH_NAMES; do | ||
if [ ${BRANCH} == $CIRCLE_BRANCH ] | ||
then | ||
CORE_REPO_BRANCH=$BRANCH | ||
break | ||
fi | ||
done | ||
fi | ||
|
||
|
||
if [ $CORE_REPO_BRANCH == "main" ] | ||
then | ||
# Do nothing and use the published version of the gems? | ||
else | ||
|
||
echo "Cloning from ${CORE_REPO_BRANCH}..." | ||
git clone -b $CORE_REPO_BRANCH --depth 1 https://github.com/bullet-train-co/bullet_train.git . | ||
|
||
# TODO: Maybe generate this list automatically based on the subdirectories in core that contain a .gemspec? | ||
packages=( | ||
"bullet_train" | ||
"bullet_train-api" | ||
"bullet_train-fields" | ||
"bullet_train-has_uuid" | ||
"bullet_train-incoming_webhooks" | ||
"bullet_train-integrations" | ||
"bullet_train-integrations-stripe" | ||
"bullet_train-obfuscates_id" | ||
"bullet_train-outgoing_webhooks" | ||
"bullet_train-roles" | ||
"bullet_train-scope_questions" | ||
"bullet_train-scope_validator" | ||
"bullet_train-sortable" | ||
"bullet_train-super_load_and_authorize_resource" | ||
"bullet_train-super_scaffolding" | ||
"bullet_train-themes" | ||
"bullet_train-themes-light" | ||
"bullet_train-themes-tailwind_css" | ||
) | ||
|
||
for package in "${packages[@]}" | ||
do | ||
: | ||
grep -v "gem \"$package\"" Gemfile > Gemfile.tmp | ||
mv Gemfile.tmp Gemfile | ||
echo "gem \"$package\", path: \"../../$package\"" >> Gemfile | ||
done | ||
|
||
updates="${packages[@]}" | ||
bundle lock --update $updates | ||
|
||
fi | ||
|
||
|