mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
Move rink-web to its own subcrate
This commit is contained in:
parent
bbcc6978c9
commit
dfed8befbd
3 changed files with 19 additions and 15 deletions
|
@ -12,7 +12,6 @@ keywords = ["unit", "math", "conversion", "cli", "tool"]
|
|||
[features]
|
||||
default = ["linefeed", "chrono-humanize", "gpl", "currency"]
|
||||
ircbot = ["irc", "glob"]
|
||||
web = ["hyper", "url", "sandbox"]
|
||||
sandbox = ["libc", "ipc-channel"]
|
||||
gpl = []
|
||||
currency = ["hyper", "xml-rs", "json"]
|
||||
|
@ -26,7 +25,6 @@ linefeed = { version = "0.1.4", optional = true }
|
|||
irc = { version = "0.11.3", optional = true }
|
||||
glob = { version = "0.2.11", optional = true }
|
||||
hyper = { version = "0.9.10", optional = true }
|
||||
url = { version = "1.2.0", optional = true }
|
||||
libc = { version = "0.2.14", optional = true }
|
||||
ipc-channel = { version = "0.5.1", optional = true }
|
||||
xml-rs = { version = "0.3.4", optional = true }
|
||||
|
@ -40,6 +38,5 @@ doc = false
|
|||
name = "rink-irc"
|
||||
doc = false
|
||||
|
||||
[[bin]]
|
||||
name = "rink-web"
|
||||
doc = false
|
||||
[workspace]
|
||||
members = ["web"]
|
||||
|
|
17
web/Cargo.toml
Normal file
17
web/Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
|||
[package]
|
||||
name = "rink-web"
|
||||
version = "0.3.2"
|
||||
authors = ["Tiffany Bennett <tiffany@stormbit.net>"]
|
||||
description = "Web interface to Rink"
|
||||
homepage = "https://github.com/tiffany352/rink-rs"
|
||||
repository = "https://github.com/tiffany352/rink-rs"
|
||||
readme = "README.md"
|
||||
license = "MPL-2.0"
|
||||
|
||||
[dependencies.rink]
|
||||
path = "../"
|
||||
features = ["hyper", "sandbox"]
|
||||
|
||||
[dependencies]
|
||||
hyper = "0.9.10"
|
||||
url = "1.2.0"
|
|
@ -2,14 +2,10 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#[cfg(feature = "web")]
|
||||
extern crate hyper;
|
||||
#[cfg(feature = "web")]
|
||||
extern crate url;
|
||||
#[cfg(feature = "web")]
|
||||
extern crate rink;
|
||||
|
||||
#[cfg(feature = "web")]
|
||||
static TEMPLATE: &'static str = r##"
|
||||
<html>
|
||||
<head>
|
||||
|
@ -24,7 +20,6 @@ static TEMPLATE: &'static str = r##"
|
|||
</html>
|
||||
"##;
|
||||
|
||||
#[cfg(feature = "web")]
|
||||
fn main() {
|
||||
use hyper;
|
||||
use hyper::status::StatusCode;
|
||||
|
@ -80,8 +75,3 @@ fn main() {
|
|||
let port = args().nth(1).map(|x| x.parse::<u16>().expect("Invalid port number")).unwrap_or(8000);
|
||||
Server::http(&*format!("127.0.0.1:{}", port)).unwrap().handle(req).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "web"))]
|
||||
fn main() {
|
||||
println!("Rink was not compiled with web support.");
|
||||
}
|
Loading…
Reference in a new issue