-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOnlyfile
More file actions
62 lines (50 loc) · 2.18 KB
/
Copy pathOnlyfile
File metadata and controls
62 lines (50 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// This is for prerelease.
# Internal helper for release builds
_release_build():
cargo build --release
# Run cargo check
check():
cargo fmt --all -- --check
cargo check --workspace --all-targets
cargo clippy --workspace --all-targets -- -D warnings
# Run the full test suite
test() ? @has("cargo-nextest"):
cargo nextest run
test():
cargo test
# Run formatter, type checks, and tests
ci() & check & test:
echo "CI complete!"
# Install the local only binary
install() ? @os("windows") & _release_build shell?=pwsh:
New-Item -ItemType Directory -Force -Path (Join-Path $env:LOCALAPPDATA "Programs\Only") | Out-Null
Copy-Item target/release/only.exe -Destination (Join-Path $env:TEMP "only-install-staged.exe") -Force
$parentPid = (Get-CimInstance Win32_Process -Filter "ProcessId=$PID").ParentProcessId; $shellPath = (Get-Process -Id $PID).Path; $stagedPath = Join-Path $env:TEMP "only-install-staged.exe"; $installPath = Join-Path $env:LOCALAPPDATA "Programs\Only\only.exe"; $script = "Wait-Process -Id $parentPid; Copy-Item -LiteralPath '$stagedPath' -Destination '$installPath' -Force; Remove-Item -LiteralPath '$stagedPath' -Force"; $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($script)); Start-Process -WindowStyle Hidden -FilePath $shellPath -ArgumentList "-NoProfile", "-EncodedCommand", $encoded
Write-Output "Install will complete after this only process exits: $(Join-Path $env:LOCALAPPDATA "Programs\Only\only.exe")"
install() & _release_build:
mkdir -p "$HOME/.local/bin"
cp target/release/only "$HOME/.local/bin/.only-install"
chmod +x "$HOME/.local/bin/.only-install"
mv "$HOME/.local/bin/.only-install" "$HOME/.local/bin/only"
echo "Installed only to $HOME/.local/bin/only"
# Development builds
[dev]
# Build the project in development mode.
build():
cargo build
# Run the project in development mode
run():
cargo run
# Release builds
[rel]
# Build the project in release mode.
build():
cargo build --release
# Run the project in release mode
run():
cargo run --release
# Run the release test suite
test() ? @has("cargo-nextest"):
cargo nextest run --release
test():
cargo test --release