Move rink-web to its own subcrate

This commit is contained in:
Tiffany Bennett 2016-10-03 22:23:15 -04:00
parent bbcc6978c9
commit dfed8befbd
3 changed files with 19 additions and 15 deletions

View file

@ -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
View 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"

View file

@ -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.");
}