mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-25 06:40:03 +00:00
feat: Support install directly from git repo (#1162)
Fixed #3 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
dd35fba232
commit
ca00cbaccc
22 changed files with 1810 additions and 28 deletions
61
e2e-tests/git.sh
Normal file
61
e2e-tests/git.sh
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
test_cargo_binstall_install() {
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
cargo_binstall_version="$(cargo binstall -V)"
|
||||
echo "$cargo_binstall_version"
|
||||
|
||||
[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ]
|
||||
}
|
||||
|
||||
unset CARGO_INSTALL_ROOT
|
||||
|
||||
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
|
||||
export CARGO_HOME
|
||||
export PATH="$CARGO_HOME/bin:$PATH"
|
||||
|
||||
GIT="$(mktemp -d 2>/dev/null || mktemp -d -t 'git')"
|
||||
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]; then
|
||||
# Convert it to windows path so `--git "file://$GIT"` would work
|
||||
# on windows.
|
||||
GIT="$(cygpath -w "$GIT")"
|
||||
fi
|
||||
|
||||
git init "$GIT"
|
||||
cp manifests/github-test-Cargo.toml "$GIT/Cargo.toml"
|
||||
(
|
||||
cd "$GIT"
|
||||
git config user.email 'test@example.com'
|
||||
git config user.name 'test'
|
||||
git add Cargo.toml
|
||||
git commit -m "Add Cargo.toml"
|
||||
)
|
||||
|
||||
# Install binaries using `--git`
|
||||
"./$1" binstall --force --git "file://$GIT" --no-confirm cargo-binstall
|
||||
|
||||
test_cargo_binstall_install
|
||||
|
||||
cp -r manifests/workspace/* "$GIT"
|
||||
(
|
||||
cd "$GIT"
|
||||
git add .
|
||||
git commit -m 'Update to workspace'
|
||||
)
|
||||
|
||||
# Install binaries using `--git`
|
||||
"./$1" binstall --force --git "file://$GIT" --no-confirm cargo-binstall
|
||||
|
||||
test_cargo_binstall_install
|
||||
|
||||
# Install binaries using `--git`
|
||||
"./$1" binstall --force --git "file://$GIT" --no-confirm cargo-watch
|
||||
|
||||
cargo_watch_version="$(cargo watch -V)"
|
||||
echo "$cargo_watch_version"
|
||||
|
||||
[ "$cargo_watch_version" = "cargo-watch 8.4.0" ]
|
3
e2e-tests/manifests/workspace/Cargo.toml
Normal file
3
e2e-tests/manifests/workspace/Cargo.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[workspace]
|
||||
members = ["crates/*/*/*/*/*/*", "b/*/*/*/*"]
|
||||
exclude = ["b/c/d/e/*"]
|
13
e2e-tests/manifests/workspace/b/c/d/e/f/Cargo.toml
Normal file
13
e2e-tests/manifests/workspace/b/c/d/e/f/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "cargo-binstall2"
|
||||
description = "Rust binary package installer for CI integration"
|
||||
repository = "https://bitbucket.org/nobodyxusdcdc/hello-world"
|
||||
version = "0.0.0"
|
||||
rust-version = "1.61.0"
|
||||
authors = ["ryan <ryan@kurte.nz>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "cargo-binstall"
|
||||
version = "0.12.0"
|
||||
repository = "https://github.com/cargo-bins/cargo-binstall"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "cargo-watch"
|
||||
version = "8.4.0"
|
||||
repository = "https://github.com/watchexec/cargo-watch"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-watch"
|
Loading…
Add table
Add a link
Reference in a new issue