Skip to content

Commit

Permalink
fix: use macos compatible sed syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed AbouZaid <[email protected]>
  • Loading branch information
aabouzaid committed Sep 22, 2024
1 parent 7d20c03 commit 6f9ffd8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
46 changes: 40 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,50 @@ jobs:
asdf plugin list --urls --refs
asdf global asdf-plugin-manager latest
asdf plugin remove asdf-plugin-manager
- name: Test asdf-plugin-manager cli
- name: Setup asdf-plugin-manager cli
run: |
cp -a cli/asdf-plugin-manager.sh /usr/local/bin/asdf-plugin-manager
cd test
- name: Install | Test asdf-plugin-manager cli
working-directory: test
env:
ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME: .install.plugin-versions
run: |
set -euox pipefail
asdf-plugin-manager list
asdf-plugin-manager add-all
asdf plugin list --refs
- name: Validate installed plugins
# Validate.
PLUGIN_GIT_REF=$(grep -oE "[^ ]\w{6}$" ${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME})
asdf plugin list --refs | grep "${PLUGIN_GIT_REF}" &&
echo "[Passed] The plugin git ref in ${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME} matches the installed one."
- name: Update | Test asdf-plugin-manager cli
working-directory: test
env:
ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME: .update.plugin-versions
run: |
set -euox pipefail
PLUGIN_GIT_REF=$(grep -oE "[^ ]\w{6}$" test/.plugin-versions)
asdf plugin list --refs | grep "${PLUGIN_GIT_REF}" &&
echo "[Passed] The plugin git ref in test/.plugin-versions matches the installed one."
asdf plugin list --refs
asdf-plugin-manager update-all
# Validate.
PLUGIN_GIT_URL"$(cat ${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME} | awk '/^venom/ {print $2}')"
PLUGIN_GIT_REF_UPDATED="$(git ls-remote ${PLUGIN_GIT_URL} HEAD | head -c 7)"
asdf plugin list --refs | grep "${PLUGIN_GIT_REF_UPDATED}"
- name: Export | Test asdf-plugin-manager cli
working-directory: test
run: |
set -euox pipefail
asdf plugin add jq
asdf plugin list --refs --urls |
awk '{OFS = ","; print $1,$2,$4}' | tee asdf-plugin.csv
asdf-plugin-manager export |
awk '{OFS = ","; print $1,$2,$3}' | tee asdf-plugin-manager.csv
# Validate.
diff asdf-plugin.csv tee asdf-plugin-manager.csv
- name: Remove | Test asdf-plugin-manager cli
working-directory: test
run: |
set -euox pipefail
asdf plugin list
asdf-plugin-manager remove-all
# Validate.
test -z "$(asdf plugin list)"
4 changes: 3 additions & 1 deletion cli/asdf-plugin-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ update_plugins() {
fi

echo "[INFO] Updating git-ref in plugin version file: $(print_plugin_versions_filename)"
sed -i "/^\b${plugin_name}\b/ s/${plugin_ref_managed}/${plugin_ref_after_update}/" "$(print_plugin_versions_filename)"
cat "$(print_plugin_versions_filename)" |
sed "/^\b${plugin_name}\b/ s/${plugin_ref_managed}/${plugin_ref_after_update}/" |
tee "$(print_plugin_versions_filename)"

echo '!!!'
echo "[CAUTION] Please review the changes since last update:"
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions test/.update.plugin-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# name git-url git-ref
venom https://github.com/aabouzaid/asdf-venom.git dea0c86

0 comments on commit 6f9ffd8

Please sign in to comment.