rudimentary makefile, first "self-serving" version, enable NO_BROWSER flag
parent
7faa12a44f
commit
c27abd6cac
|
@ -1,3 +1,5 @@
|
||||||
|
/dist
|
||||||
|
|
||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "upend-rust"
|
name = "upend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "upend-rust"
|
name = "upend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Tomáš Mládek <t@mldk.cz>"]
|
authors = ["Tomáš Mládek <t@mldk.cz>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
|
@ -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_raw)
|
||||||
.service(routes::get_lookup)
|
.service(routes::get_lookup)
|
||||||
.service(routes::api_refresh)
|
.service(routes::api_refresh)
|
||||||
|
.service(
|
||||||
|
actix_files::Files::new(
|
||||||
|
"/",
|
||||||
|
env::current_exe().unwrap().parent().unwrap().join("webui"),
|
||||||
|
)
|
||||||
|
.index_file("index.html"),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.bind(&bind)?
|
.bind(&bind)?
|
||||||
.run();
|
.run();
|
||||||
|
@ -87,7 +94,7 @@ fn main() -> std::io::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO REMOVE
|
// 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()));
|
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
|
||||||
if ui_result.is_err() {
|
if ui_result.is_err() {
|
||||||
warn!("Could not open UI in browser!");
|
warn!("Could not open UI in browser!");
|
||||||
|
|
Loading…
Reference in New Issue