Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor #25

Merged
merged 12 commits into from
Aug 31, 2024
608 changes: 297 additions & 311 deletions change

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions scripts/update-version
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/sh

new_version=$1
version_file="change"
version_file='change'

[ ! -e $version_file ] &&
{ echo "$version_file not found in current directory"; exit 1; }
[ ! -f $version_file ] && echo "$version_file not found in current directory" >&2 && exit 1

sed -i.backup "s|\(^change_version=\"\).*\(\"$\)|\1$new_version\2|" $version_file &&
rm "${version_file}.backup" &&
git add "$version_file" &&
{ echo "success - changed version to $new_version"; exit 0; }
sed -E -i.backup "s,^(version=\").*(\")$,\1$new_version\2," "$version_file" &&
rm "$version_file.backup" && git add "$version_file" &&
echo "success: changed version to $new_version" && exit

echo "failure - something when wrong"
echo "failure: something when wrong" >&2
exit 1
2 changes: 1 addition & 1 deletion tests/change-err-changelog/setup/exp-stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
couldn't find CHANGELOG.md
could not find CHANGELOG.md
2 changes: 1 addition & 1 deletion tests/change-err-repo/setup/exp-stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
the current directory doesn't contain .git
the current directory does not contain .git
2 changes: 1 addition & 1 deletion tests/change-symbols/setup/CHANGELOG-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Asterisk * escaped asterisk \*.
- Exclamation ! four backslashes \.
- 'apostrophe pair' `escaped tick pair`.
- Tilda ~ escaped tick ` ampersand &.
- Tilda ~ escaped tick ` ampersand & bar | end.

### Changed
- [file link](./run-test).
Expand Down
3 changes: 1 addition & 2 deletions tests/change-symbols/setup/run-test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git commit --quiet -am "fix: add second file"
git tag 0.1.0

git add exp-stderr
git commit --quiet -am "fix: tilda ~ escaped tick \` ampersand &"
git commit --quiet -am "fix: tilda ~ escaped tick \` ampersand & bar | end"
git rm --quiet --cached exp-stderr
git commit --quiet -am "chore: escaped apostrophe \' escaped quote \""

Expand Down Expand Up @@ -38,7 +38,6 @@ git commit --quiet -am "fix: (paren pair) {curly pair} [square pair]"
git rm --quiet --cached exp-stderr
git commit --quiet -am "chore: [file link](./run-test)"


git remote add origin https://github.com/adamtabrams/change.git

change >act-stdout 2>act-stderr
Expand Down
2 changes: 1 addition & 1 deletion tests/init-err-repo/setup/exp-stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
the current directory doesn't contain .git
the current directory does not contain .git
2 changes: 1 addition & 1 deletion tests/init-err-tag/setup/exp-stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
couldn't find any valid version tags
could not find any valid version tags
2 changes: 1 addition & 1 deletion tests/init-err-url/setup/exp-stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
remote url isn't set for this repo
remote url is not set for this repo
Loading