From 499f0de508b0cd7588a2c738133f9a719e6d891a Mon Sep 17 00:00:00 2001 From: PoiScript Date: Thu, 10 Oct 2019 13:41:35 +0800 Subject: [PATCH] chore: remove orgize-demos package --- .travis.yml | 8 +-- Cargo.toml | 1 - Procfile | 1 - RustConfig | 1 - demos/.gitignore | 1 - demos/Cargo.toml | 15 ------ demos/src/main.rs | 121 ---------------------------------------------- 7 files changed, 1 insertion(+), 147 deletions(-) delete mode 100644 Procfile delete mode 100644 RustConfig delete mode 100644 demos/.gitignore delete mode 100644 demos/Cargo.toml delete mode 100644 demos/src/main.rs diff --git a/.travis.yml b/.travis.yml index 26ba9ff..b459cf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: rust + rust: - stable - nightly @@ -16,13 +17,6 @@ script: - cargo fmt --all -- --check - cargo test --all-features -deploy: - provider: heroku - api_key: $HEROKU_API_KEY - app: orgize - on: - condition: "$TRAVIS_RUST_VERSION == stable" - notifications: email: on_failure: change diff --git a/Cargo.toml b/Cargo.toml index 0e1e26d..1a53406 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ readme = "README.md" edition = "2018" license = "MIT" keywords = ["orgmode", "emacs", "parser"] -exclude = ["/demos", "/fuzz"] [package.metadata.docs.rs] all-features = true diff --git a/Procfile b/Procfile deleted file mode 100644 index b5e2e72..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: ./target/release/orgize-demos diff --git a/RustConfig b/RustConfig deleted file mode 100644 index 55153d7..0000000 --- a/RustConfig +++ /dev/null @@ -1 +0,0 @@ -BUILD_PATH="demos" diff --git a/demos/.gitignore b/demos/.gitignore deleted file mode 100644 index eb5a316..0000000 --- a/demos/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target diff --git a/demos/Cargo.toml b/demos/Cargo.toml deleted file mode 100644 index 825156e..0000000 --- a/demos/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "orgize-demos" -version = "0.1.0" -authors = ["PoiScript "] -edition = "2018" -publish = false - -[profile.release] -lto = true - -[dependencies] -actix-web = { version = "1.0.8", default-features = false } -orgize = { path = "..", features = ["syntect"] } -serde = { version = "1.0.101", features = ["derive"] } -serde_json = "1.0.41" diff --git a/demos/src/main.rs b/demos/src/main.rs deleted file mode 100644 index f4b7228..0000000 --- a/demos/src/main.rs +++ /dev/null @@ -1,121 +0,0 @@ -use actix_web::{get, post, web, App, HttpResponse, HttpServer}; -use orgize::Org; -use serde::Deserialize; -use std::env; -use std::io::Result; - -use orgize::export::html::{DefaultHtmlHandler, SyntectHtmlHandler}; -use orgize::syntect::html::IncludeBackground; - -#[get("/")] -fn index() -> HttpResponse { - HttpResponse::Ok().content_type("text/html").body( - r#"

Orgize demos

-
-

Input content:

-
- -
-

Output format:

- Json
- HTML
- Org
- HTML with highlight
-

Highlight theme:

- -

Highlight background:

- -

-
"#, - ) -} - -#[derive(Deserialize)] -struct FormData { - format: String, - content: String, - theme: String, - background: String, -} - -#[post("/export")] -fn export(form: web::Form) -> Result { - let org = Org::parse(&form.content); - match &*form.format { - "json" => Ok(HttpResponse::Ok() - .content_type("application/json") - .body(serde_json::to_string(&org)?)), - "html" => { - let mut writer = Vec::new(); - org.html(&mut writer)?; - Ok(HttpResponse::Ok() - .content_type("text/html") - .body(String::from_utf8(writer).unwrap())) - } - "syntect" => { - let mut handler = SyntectHtmlHandler::new(DefaultHtmlHandler); - - match &*form.theme { - "InspiredGitHub" - | "base16-ocean.dark" - | "base16-eighties.dark" - | "base16-mocha.dark" - | "base16-ocean.light" - | "Solarized (dark)" - | "Solarized (light)" => handler.theme = form.theme.clone(), - _ => return Ok(HttpResponse::BadRequest().body("Unsupported theme".to_string())), - } - - match &*form.background { - "yes" => handler.background = IncludeBackground::Yes, - "no" => handler.background = IncludeBackground::No, - _ => { - return Ok(HttpResponse::BadRequest().body("Unsupported background".to_string())) - } - } - - let mut writer = Vec::new(); - org.html_with_handler(&mut writer, &mut handler)?; - - Ok(HttpResponse::Ok() - .content_type("text/html") - .body(String::from_utf8(writer).unwrap())) - } - "org" => { - let mut writer = Vec::new(); - org.org(&mut writer)?; - Ok(HttpResponse::Ok() - .content_type("text/plain") - .body(String::from_utf8(writer).unwrap())) - } - _ => Ok(HttpResponse::BadRequest().body("Unsupported format".to_string())), - } -} - -fn main() -> Result<()> { - let port = env::var("PORT") - .unwrap_or_else(|_| "3000".into()) - .parse() - .expect("PORT must be a number"); - - HttpServer::new(|| App::new().service(index).service(export)) - .bind(("0.0.0.0", port))? - .run() -}