improve the interface for the build script

This commit is contained in:
Savanni D'Gerinel 2023-08-07 15:14:14 -04:00
parent 7ebbbfd03b
commit 11ca8661fa
5 changed files with 1143 additions and 573 deletions

1672
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
[workspace] [workspace]
members = [ members = [
"dashboard",
"ifc" "ifc"
] ]

View File

@ -2,26 +2,29 @@
set -euo pipefail set -euo pipefail
RUST_ALL_TARGETS="dashboard ifc"
build_rust_targets() {
local CMD=$1
local TARGETS=${@/$CMD}
for target in $TARGETS; do
MODULE=$target CMD=$CMD ./builders/rust.sh
done
}
export CARGO=`which cargo` export CARGO=`which cargo`
if [ -z "${TARGET-}" ]; then if [ -z "${TARGET-}" ]; then
echo "No target defined. build all doesn't exist yet" TARGET="all"
exit 1
fi fi
if [ -z "${CMD-}" ]; then if [ -z "${CMD-}" ]; then
CMD="release" CMD="release"
fi fi
export CMD if [ "${TARGET}" == "all" ]; then
build_rust_targets $CMD $RUST_ALL_TARGETS
case $TARGET in else
ifc) build_rust_targets $CMD $TARGET
MODULE=ifc builders/rust.sh fi
;;
"")
echo "No target defined. build all doesn't exist yet"
;;
esac

View File

@ -15,7 +15,7 @@ lazy_static = { version = "1.4" }
unic-langid = { version = "0.9" } unic-langid = { version = "0.9" }
horrorshow = { version = "0.8" } horrorshow = { version = "0.8" }
http = { version = "*" } http = { version = "*" }
international-fixed-calendar = { path = "../ifc/" } ifc = { path = "../ifc/" }
memorycache = { path = "../memory_cache" } memorycache = { path = "../memory_cache" }
reqwest = { version = "0.11", features = ["json"] } reqwest = { version = "0.11", features = ["json"] }
serde_derive = { version = "1" } serde_derive = { version = "1" }

View File

@ -10,7 +10,7 @@ use fluent::{FluentArgs, FluentValue};
use geo_types::{Latitude, Longitude}; use geo_types::{Latitude, Longitude};
use horrorshow::helper::doctype; use horrorshow::helper::doctype;
use horrorshow::prelude::*; use horrorshow::prelude::*;
use international_fixed_calendar as IFC; use ifc;
use std::{ use std::{
borrow::Cow, borrow::Cow,
net::{IpAddr, Ipv4Addr, SocketAddr}, net::{IpAddr, Ipv4Addr, SocketAddr},
@ -58,7 +58,7 @@ autumn_equinox = Aŭtuna Ekvinokso
winter_solstice = Vintra Solstico winter_solstice = Vintra Solstico
"; ";
fn date(fluent: Arc<fluent_ergonomics::FluentErgo>, today: IFC::IFC) -> impl Render { fn date(fluent: Arc<fluent_ergonomics::FluentErgo>, today: ifc::IFC) -> impl Render {
let mut day_args = FluentArgs::new(); let mut day_args = FluentArgs::new();
day_args.set( day_args.set(
"day", "day",
@ -126,7 +126,7 @@ fn astronomia_eventa_desegno(
/* /*
fn page_template( fn page_template(
fluent: Arc<fluent_ergonomics::FluentErgo>, fluent: Arc<fluent_ergonomics::FluentErgo>,
today: IFC::IFC, today: ifc::IFC,
sun_moon: SunMoon, sun_moon: SunMoon,
event: Option<solstices::Event>, event: Option<solstices::Event>,
) -> String { ) -> String {
@ -156,7 +156,7 @@ async fn page(
longitude: Longitude, longitude: Longitude,
) -> Result<Html<String>, Rejection> { ) -> Result<Html<String>, Rejection> {
let now = Utc::now(); let now = Utc::now();
let d = IFC::IFC::from(now.with_timezone(&New_York).date()); let d = ifc::IFC::from(now.with_timezone(&New_York).date());
let sun_moon = solar_client let sun_moon = solar_client
.request(latitude, longitude, now.with_timezone(&New_York).date()) .request(latitude, longitude, now.with_timezone(&New_York).date())
.await; .await;
@ -170,7 +170,7 @@ async fn page(
#[tokio::main] #[tokio::main]
pub async fn main() { pub async fn main() {
let now = Local::now(); let now = Local::now();
let ifc = IFC::IFC::from(now.date_naive().with_year(12023).unwrap()); let ifc = ifc::IFC::from(now.date_naive().with_year(12023).unwrap());
let next_event = EVENTS.next_event(now.with_timezone(&Utc)).unwrap(); let next_event = EVENTS.next_event(now.with_timezone(&Utc)).unwrap();
println!( println!(