-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
651b2ff
commit fe52683
Showing
9 changed files
with
85 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,13 +1,14 @@ | ||
[package] | ||
name = "upnotify" | ||
description = "A tool that prints to stdout when the status of a URL changes." | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
reqwest = { version = "0.11.20", features = ["blocking"] } | ||
clap = "4.4.0" | ||
reqwest = { version = "0.11.20", features = ["blocking", "native-tls-vendored"] } | ||
clap = { version = "4.4.0", features = ["cargo"] } | ||
|
||
[[bin]] | ||
name = "upnotify" |
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,3 +1,3 @@ | ||
ARCH=arm64 | ||
PLATFORM=darwin | ||
UPNOTIFY_BINARY=target/aarch64-apple-darwin/release/upnotify | ||
export ARCH=arm64 | ||
export PLATFORM=darwin | ||
export UPNOTIFY_BINARY=target/aarch64-apple-darwin/release/upnotify |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export ARCH=arm64 | ||
export PLATFORM=linux | ||
export UPNOTIFY_BINARY=target/aarch64-unknown-linux-gnu/release/upnotify |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export ARCH=amd64 | ||
export PLATFORM=darwin | ||
export UPNOTIFY_BINARY=target/x86_64-apple-darwin/release/upnotify |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export ARCH=amd64 | ||
export PLATFORM=linux | ||
export UPNOTIFY_BINARY=target/x86_64-unknown-linux-gnu/release/upnotify |
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,31 +1,71 @@ | ||
target:=`rustc -vV | sed -n 's|host: ||p'` | ||
os_family:=os_family() | ||
archive_type:=if os_family == "windows" { "zip" } else { "tarball" } | ||
package_type:="none" | ||
os:=os() | ||
arch:=arch() | ||
version:=`git tag` | ||
version:=`toml get Cargo.toml package.version --raw` | ||
archive_name:="upnotify-{{version}}-{{target}}" | ||
msg:="Unknown error" | ||
|
||
default: build | ||
|
||
sys-info: | ||
@echo "os_family {{os_family()}}" | ||
@echo "os {{os()}}" | ||
@echo "arch: {{arch()}}" | ||
die: | ||
@echo "Error: {{msg}}" | ||
|
||
assert-darwin-host: | ||
@{{ if os == "macos" { "true" } else { "just msg=\"Not a darwin host\" die" } }} | ||
|
||
clean: | ||
rm -rf target | ||
rm -rf target dist | ||
|
||
build: | ||
cargo build --release --target {{target}} | ||
|
||
build-mac-m1: | ||
just target=aarch64-apple-darwin archive | ||
just target=aarch64-apple-darwin assert-darwin-host archive | ||
|
||
build-linux-amd64: | ||
docker run --rm --platform linux/amd64 --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp \ | ||
rust:1.70.0 sh -c "cargo install just toml-cli && just archive" | ||
|
||
build-linux-arm64: | ||
docker run --rm --platform linux/arm64 --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp \ | ||
rust:1.70.0 sh -c "cargo install just toml-cli && just archive" | ||
|
||
archive-tarball: | ||
tar czf target/{{target}}/release/upnotify-{{version}}-{{target}}.tar.gz target/{{target}}/release/upnotify | ||
tar czf dist/{{target}}/{{archive_name}}.tar.gz target/{{target}}/release/upnotify | ||
|
||
archive-zip: | ||
zip target/{{target}}/release/upnotify-{{version}}-{{target}}.zip target/{{target}}/release/upnotify | ||
zip dist/{{target}}/{{archive_name}}.zip target/{{target}}/release/upnotify | ||
|
||
archive-all: | ||
just archive-tarball archive-zip | ||
|
||
archive: build | ||
just archive-{{archive_type}} | ||
just archive-{{archive_type}} | ||
|
||
package-none: | ||
@echo "Nothing to do; specify a package_type" | ||
|
||
package-rpm: | ||
#!/usr/bin/env bash | ||
mkdir -p dist/{{target}} | ||
source build/{{target}}.env | ||
nfpm package -p rpm -f <(VERSION={{version}} envsubst < build/nfpm.yaml.tmpl) --target dist/{{target}}/ | ||
package-deb: | ||
#!/usr/bin/env bash | ||
mkdir -p dist/{{target}} | ||
source build/{{target}}.env | ||
nfpm package -p deb -f <(VERSION={{version}} envsubst < build/nfpm.yaml.tmpl) --target dist/{{target}}/ | ||
linux-packages: | ||
just target=x86_64-unknown-linux-gnu package-deb package-rpm | ||
just target=aarch64-unknown-linux-gnu package-deb package-rpm | ||
|
||
package: | ||
just package-{{package_type}} | ||
|
||
homebrew-program: | ||
|
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