rudimentary makefile, first "self-serving" version, enable NO_BROWSER flag
This commit is contained in:
parent
7faa12a44f
commit
c27abd6cac
5 changed files with 31 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
/dist
|
||||
|
||||
/target
|
||||
**/*.rs.bk
|
||||
|
||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1710,7 +1710,7 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "upend-rust"
|
||||
name = "upend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "upend-rust"
|
||||
name = "upend"
|
||||
version = "0.1.0"
|
||||
authors = ["Tomáš Mládek <t@mldk.cz>"]
|
||||
edition = "2018"
|
||||
|
|
18
Makefile
Normal file
18
Makefile
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
all: backend frontend
|
||||
rm -fr dist
|
||||
mkdir dist
|
||||
cp target/release/upend dist/upend
|
||||
cp -r ui/dist dist/webui
|
||||
|
||||
backend:
|
||||
cargo build --release
|
||||
|
||||
frontend:
|
||||
cd ui && \
|
||||
npm install && \
|
||||
npm run build
|
||||
|
||||
clean:
|
||||
rm -r target
|
||||
rm -r ui/node_modules ui/dist
|
|
@ -77,6 +77,13 @@ fn main() -> std::io::Result<()> {
|
|||
.service(routes::get_raw)
|
||||
.service(routes::get_lookup)
|
||||
.service(routes::api_refresh)
|
||||
.service(
|
||||
actix_files::Files::new(
|
||||
"/",
|
||||
env::current_exe().unwrap().parent().unwrap().join("webui"),
|
||||
)
|
||||
.index_file("index.html"),
|
||||
)
|
||||
})
|
||||
.bind(&bind)?
|
||||
.run();
|
||||
|
@ -87,7 +94,7 @@ fn main() -> std::io::Result<()> {
|
|||
}
|
||||
|
||||
// TODO REMOVE
|
||||
if !matches.is_present("NO_BROWSER") && false {
|
||||
if !matches.is_present("NO_BROWSER") {
|
||||
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
|
||||
if ui_result.is_err() {
|
||||
warn!("Could not open UI in browser!");
|
||||
|
|
Loading…
Reference in a new issue