Skip to content

Commit

Permalink
chore: update auto check (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Nov 28, 2024
1 parent 573996e commit e8245d8
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions scripts/automate-checklist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function auto-check() {
fi


if ! update-astrolib-in-taskfile "$repo" "$owner"; then
if ! update-arcadia-in-taskfile "$repo" "$owner"; then
return 1
fi


if ! update-astrolib-in-goreleaser "$repo" "$owner"; then
if ! update-arcadia-in-goreleaser "$repo" "$owner"; then
return 1
fi

Expand Down Expand Up @@ -130,7 +130,7 @@ function update-mod-file() {
local owner=$2
local folder=./
local file_pattern=go.mod
local target="module github.com\/snivilised\/astrolib"
local target="module github.com\/snivilised\/arcadia"
local replacement="module github.com\/$owner\/$repo"
update-all-generic "update-mod-file" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}
Expand All @@ -140,49 +140,49 @@ function update-source-id-variable-in-translate-defs() {
local owner=$2
local folder=./i18n/
local file_pattern=translate-defs.go
local target="AstrolibSourceID"
local target="ArcadiaSourceID"
tc_repo=$(echo "${repo:0:1}" | tr '[:lower:]' '[:upper:]')${repo:1}
local replacement="${tc_repo}SourceID"
update-all-generic "update-source-id-variable-in-translate-defs" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}

function update-astrolib-in-taskfile() {
function update-arcadia-in-taskfile() {
local repo=$1
local owner=$2
local folder=./
local file_pattern=Taskfile.yml
local target=astrolib
local target=arcadia
local replacement=$repo
update-all-generic "update-astrolib-in-taskfile" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
update-all-generic "update-arcadia-in-taskfile" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}

function update-workflow-names() {
local repo=$1
local owner=$2
local folder=.github/workflows
local file_pattern="*.yml"
local target="name: Astrolib"
local target="name: Arcadia"
tc_repo=$(echo "${repo:0:1}" | tr '[:lower:]' '[:upper:]')${repo:1}
local replacement="name: $tc_repo"
update-all-generic "💥 update-workflow-names" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}

function update-astrolib-in-goreleaser() {
function update-arcadia-in-goreleaser() {
local repo=$1
local owner=$2
local folder=./
local file_pattern=.goreleaser.yaml
local target=astrolib
local target=arcadia
local replacement=$repo
update-all-generic "update-astrolib-in-goreleaser" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
update-all-generic "update-arcadia-in-goreleaser" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}

function rename-templ-data-id() {
local repo=$1
local owner=$2
local folder=./
local file_pattern="*.go"
local target="astrolibTemplData"
local target="arcadiaTemplData"
local replacement="${repo}TemplData"
update-all-generic "rename-templ-data-id" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}
Expand All @@ -192,26 +192,26 @@ function update-readme() {
local owner=$2
local folder=./
local file_pattern=README.md
local target="astrolib: "
local target="arcadia: "
local replacement="${repo}: "


if ! update-all-generic "update-readme(astrolib:)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
if ! update-all-generic "update-readme(arcadia:)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
return 1
fi

target="snivilised\/astrolib"
target="snivilised\/arcadia"
replacement="$owner\/$repo"

if ! update-all-generic "update-readme(snivilised/astrolib)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
if ! update-all-generic "update-readme(snivilised/arcadia)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
return 1
fi

target="astrolib Continuous Integration"
target="arcadia Continuous Integration"
tc_repo=$(echo "${repo:0:1}" | tr '[:lower:]' '[:upper:]')${repo:1}
replacement="$tc_repo Continuous Integration"

if ! update-all-generic "update-readme(astrolib Continuous Integration)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
if ! update-all-generic "update-readme(arcadia Continuous Integration)" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"; then
return 1
fi

Expand All @@ -223,16 +223,16 @@ function update-import-statements() {
local owner=$2
local folder=./
local file_pattern="*.go"
local target="snivilised\/astrolib"
local target="snivilised\/arcadia"
local replacement="$owner\/$repo"
update-all-generic "update-import-statements" "$repo" "$owner" "$folder" "$file_pattern" "$target" "$replacement"
}

function rename-language-files() {
local repo=$1
find . -name 'astrolib*.json' -type f -print0 |
find . -name 'arcadia*.json' -type f -print0 |
while IFS= read -r -d '' file; do
mv "$file" "$(dirname "$file")/$(basename "$file" | sed "s/^astrolib/$repo/")"
mv "$file" "$(dirname "$file")/$(basename "$file" | sed "s/^arcadia/$repo/")"
done
return $?
}
Expand Down

0 comments on commit e8245d8

Please sign in to comment.