-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): support plugin specs in slug@branch format
after checking out, run a custom function for each plugin. (action-install-plugins-macos.sh): loop over RIME_PLUGINS instead of plugins/* directories; the behaviour is now consistent with the windows script. ci scripts: update version-info.txt to log plugin slugs instead of directories.
- Loading branch information
Showing
4 changed files
with
76 additions
and
16 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
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 |
---|---|---|
@@ -1,17 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")" | ||
|
||
for slug in "$@" | ||
clone_options=( | ||
# for GitHub pull request #1, git checkout 1/merge | ||
--config 'remote.origin.fetch=+refs/pull/*:refs/remotes/origin/*' | ||
# shallow clone | ||
--depth 1 | ||
# fetch all branches | ||
--no-single-branch | ||
) | ||
|
||
if [[ "${1}" =~ run=.* ]]; then | ||
custom_install="${1#run=}" | ||
shift | ||
fi | ||
|
||
for plugin in "$@" | ||
do | ||
if [[ "${plugin}" =~ @ ]]; then | ||
slug="${plugin%@*}" | ||
branch="${plugin#*@}" | ||
else | ||
slug="${plugin}" | ||
branch='' | ||
fi | ||
plugin_project="${slug##*/}" | ||
plugin_dir="plugins/${plugin_project#librime-}" | ||
if [[ -d "${plugin_dir}" ]] | ||
then | ||
echo "Updating plugin: ${plugin_dir}" | ||
git -C "${plugin_dir}" checkout master | ||
echo "Updating ${plugin} in ${plugin_dir}" | ||
if [[ -n "${branch}" ]]; then | ||
git -C "${plugin_dir}" checkout "${branch}" | ||
fi | ||
git -C "${plugin_dir}" pull | ||
else | ||
git clone --depth 1 "https://github.com/${slug}.git" "${plugin_dir}" | ||
echo "Checking out ${plugin} to ${plugin_dir}" | ||
git clone "${clone_options[@]}" "https://github.com/${slug}.git" "${plugin_dir}" | ||
# pull request ref doesn't work with git clone --branch | ||
if [[ -n "${branch}" ]]; then | ||
git -C "${plugin_dir}" checkout "${branch}" | ||
fi | ||
fi | ||
if [[ -n "${custom_install}" ]]; then | ||
${custom_install} "${plugin}" "${plugin_dir}" | ||
fi | ||
done |
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