mirror of
https://github.com/ivabus/pantry
synced 2024-11-24 17:35:08 +03:00
git foo
will automatically install and run git-foo
(#3537)
This commit is contained in:
parent
0d2e40d20a
commit
85a0f8857a
3 changed files with 84 additions and 42 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -3,5 +3,4 @@
|
||||||
"deno.lint": true,
|
"deno.lint": true,
|
||||||
"deno.unstable": true,
|
"deno.unstable": true,
|
||||||
"deno.config": ".github/deno.jsonc",
|
"deno.config": ".github/deno.jsonc",
|
||||||
"deno.importMap": "../cli/import-map.json"
|
|
||||||
}
|
}
|
31
projects/git-scm.org/git-shim
Executable file
31
projects/git-scm.org/git-shim
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
find_git_command() {
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
-*);;
|
||||||
|
*)
|
||||||
|
echo $arg
|
||||||
|
return # found the command!
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
libexec="$(cd "$(dirname "$0")/.." && pwd)"/libexec
|
||||||
|
|
||||||
|
# extract the git subcommand
|
||||||
|
cmd=$(find_git_command "$@")
|
||||||
|
|
||||||
|
if [ -z "$cmd" ]; then
|
||||||
|
exec "$libexec/git" "$@"
|
||||||
|
elif [ -x "$libexec/git-$_CMD" -a -f "$libexec/git-$cmd" ]; then
|
||||||
|
exec "$libexec/git" "$@"
|
||||||
|
elif type "git-$cmd" >/dev/null 2>&1; then
|
||||||
|
exec "$libexec/git" "$@"
|
||||||
|
elif command -v pkgx >/dev/null 2>&1 && pkg=$(pkgx --provider git-$cmd); then
|
||||||
|
exec pkgx +$pkg "$libexec/git" "$@"
|
||||||
|
else
|
||||||
|
exec "$libexec/git" "$@"
|
||||||
|
fi
|
|
@ -12,6 +12,7 @@ dependencies:
|
||||||
curl.se/ca-certs: '*'
|
curl.se/ca-certs: '*'
|
||||||
perl.org: '*'
|
perl.org: '*'
|
||||||
libexpat.github.io: ~2
|
libexpat.github.io: ~2
|
||||||
|
pkgx.sh: ^1
|
||||||
|
|
||||||
runtime:
|
runtime:
|
||||||
env:
|
env:
|
||||||
|
@ -19,65 +20,76 @@ runtime:
|
||||||
GIT_SSL_CAINFO: ${{deps.curl.se/ca-certs.prefix}}/ssl/cert.pem
|
GIT_SSL_CAINFO: ${{deps.curl.se/ca-certs.prefix}}/ssl/cert.pem
|
||||||
|
|
||||||
build:
|
build:
|
||||||
script: |
|
script:
|
||||||
mv props/config.mak .
|
- mv props/config.mak .
|
||||||
|
|
||||||
./configure $CONF
|
- ./configure
|
||||||
make install $BAKE
|
--prefix={{ prefix }}
|
||||||
|
--with-perl={{ deps.perl.org.prefix }}
|
||||||
|
--with-gitconfig=etc/gitconfig
|
||||||
|
|
||||||
cd contrib/subtree
|
- make install --jobs {{ hw.concurrency }} NO_TCLTK=1
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
if test "{{ hw.platform }}" = "darwin"; then
|
- run: |
|
||||||
cd "$SRCROOT/contrib/credential/osxkeychain"
|
make
|
||||||
make
|
make install
|
||||||
mv git-credential-osxkeychain "{{prefix}}"/bin
|
working-directory: contrib/subtree
|
||||||
make clean
|
|
||||||
cd "$SRCROOT/contrib/subtree"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mv git-subtree "{{prefix}}"/libexec
|
- run: |
|
||||||
|
make
|
||||||
|
mv git-credential-osxkeychain "{{prefix}}"/bin
|
||||||
|
make clean
|
||||||
|
working-directory: contrib/credential/osxkeychain
|
||||||
|
if: darwin
|
||||||
|
|
||||||
cd "{{prefix}}"
|
- run: mv git-subtree "{{prefix}}"/libexec
|
||||||
DEBUG=1 fix-shebangs.ts bin/* libexec/*
|
working-directory: contrib/subtree
|
||||||
|
|
||||||
mkdir -p etc
|
- run: fix-shebangs.ts bin/* libexec/*
|
||||||
cp "$SRCROOT"/props/git* etc
|
working-directory: ${{prefix}}
|
||||||
|
|
||||||
|
- run: cp "$SRCROOT"/props/gitconfig "$SRCROOT"/props/gitignore .
|
||||||
|
working-directory: ${{prefix}}/etc
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
rm bin/git
|
||||||
|
cp $SRCROOT/props/git-shim bin/git
|
||||||
|
working-directory: ${{prefix}}
|
||||||
env:
|
env:
|
||||||
V: 1
|
V: 1
|
||||||
BAKE:
|
|
||||||
- --jobs {{ hw.concurrency }}
|
|
||||||
- NO_TCLTK=1
|
|
||||||
CONF:
|
|
||||||
- --prefix={{ prefix }}
|
|
||||||
- --with-perl={{ deps.perl.org.prefix }}
|
|
||||||
- --with-gitconfig=etc/gitconfig
|
|
||||||
INSTALL_STRIP: -s
|
INSTALL_STRIP: -s
|
||||||
|
|
||||||
test: |
|
test:
|
||||||
git clone https://github.com/teaxyz/white-paper 2>&1 | tee clone-output.txt
|
# bug in pkgx where it doesn’t auto sync for --provides
|
||||||
|
- pkgx --sync
|
||||||
|
|
||||||
# check that the templates can be found
|
# check that the templates can be found
|
||||||
if grep -q 'warning: templates not found in' clone-output.txt; then
|
- run: |
|
||||||
false
|
git clone https://github.com/teaxyz/white-paper 2>&1 | tee clone-output.txt
|
||||||
fi
|
if grep -q 'warning: templates not found in' clone-output.txt; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
working-directory: $(mktemp -d)
|
||||||
|
|
||||||
mkdir foo
|
- cd $(mktemp -d)
|
||||||
cd foo
|
|
||||||
touch .DS_Store testfile
|
- run: |
|
||||||
git init
|
touch .DS_Store testfile
|
||||||
git add .
|
git init
|
||||||
test "$(git diff --name-only --cached)" = "testfile"
|
git add .
|
||||||
|
test "$(git diff --name-only --cached)" = "testfile"
|
||||||
|
|
||||||
# necessary so `git commit` will work
|
# necessary so `git commit` will work
|
||||||
git config user.email "you@example.com"
|
- |
|
||||||
git config user.name "Your Name"
|
git config user.email "you@example.com"
|
||||||
|
git config user.name "Your Name"
|
||||||
|
|
||||||
# necessary to check the libexec binaries work
|
# necessary to check the libexec binaries work
|
||||||
git commit --message "test"
|
- git commit --message "test"
|
||||||
|
|
||||||
git subtree add --prefix teaxyz-subtree https://github.com/teaxyz/white-paper main --squash
|
- git subtree add --prefix teaxyz-subtree https://github.com/teaxyz/white-paper main --squash
|
||||||
|
|
||||||
|
- git gone --version
|
||||||
|
|
||||||
provides:
|
provides:
|
||||||
linux:
|
linux:
|
||||||
|
|
Loading…
Reference in a new issue