Browse Source

split ticker-update into libticker

master
Astro 2 years ago
parent
commit
db76004e82
  1. 11
      Cargo.lock
  2. 11
      libticker/Cargo.toml
  3. 0
      libticker/src/config.rs
  4. 0
      libticker/src/ics/mod.rs
  5. 0
      libticker/src/ics/parser.rs
  6. 0
      libticker/src/ics/tokenizer.rs
  7. 7
      libticker/src/lib.rs
  8. 0
      libticker/src/model.rs
  9. 0
      libticker/src/schema.rs
  10. 1
      ticker-update/Cargo.toml
  11. 17
      ticker-update/src/main.rs

11
Cargo.lock

@ -503,6 +503,16 @@ name = "libc"
version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libticker"
version = "0.1.0"
dependencies = [
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "linked-hash-map"
version = "0.5.2"
@ -1169,6 +1179,7 @@ dependencies = [
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libticker 0.1.0",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",

11
libticker/Cargo.toml

@ -0,0 +1,11 @@
[package]
name = "libticker"
version = "0.1.0"
authors = ["Astro <astro@spaceboyz.net>"]
edition = "2018"
[dependencies]
diesel = { version = "~1", features = ["postgres", "chrono"] }
chrono = "~0.4"
serde = { version = "~1.0", features = ["derive"] }
serde_yaml = "~0.8"

0
ticker-update/src/config.rs → libticker/src/config.rs

0
ticker-update/src/ics/mod.rs → libticker/src/ics/mod.rs

0
ticker-update/src/ics/parser.rs → libticker/src/ics/parser.rs

0
ticker-update/src/ics/tokenizer.rs → libticker/src/ics/tokenizer.rs

7
libticker/src/lib.rs

@ -0,0 +1,7 @@
#[macro_use]
extern crate diesel;
pub mod config;
pub mod ics;
pub mod model;
pub mod schema;

0
ticker-update/src/model.rs → libticker/src/model.rs

0
ticker-update/src/schema.rs → libticker/src/schema.rs

1
ticker-update/Cargo.toml

@ -12,3 +12,4 @@ serde = { version = "~1.0", features = ["derive"] }
serde_yaml = "~0.8"
num_cpus = "~1"
crossbeam = "~0.7"
libticker = { path = "../libticker" }

17
ticker-update/src/main.rs

@ -1,6 +1,3 @@
#[macro_use]
extern crate diesel;
use std::mem::replace;
use std::io::Read;
use std::fs::read_to_string;
@ -10,14 +7,12 @@ use chrono::offset::Utc;
use reqwest::header::{IF_NONE_MATCH, IF_MODIFIED_SINCE, ETAG, LAST_MODIFIED, USER_AGENT};
use diesel::{Connection, pg::PgConnection, prelude::*};
mod config;
use config::{Config, CalendarOptions};
mod schema;
use schema::{calendars::dsl::calendars};
mod model;
use model::{Calendar, NewCalendar, Event};
mod ics;
use ics::{Parser, Object, Timestamp, GetValue};
use libticker::{
config::{Config, CalendarOptions},
schema::{self, calendars::dsl::calendars},
model::{Calendar, NewCalendar, Event},
ics::{Parser, Object, Timestamp, GetValue},
};
fn extract_vevent_objs(results: &mut Vec<Object>, mut obj: Object) {
let children = replace(&mut obj.children, vec![]);

Loading…
Cancel
Save