Support the 'dev' channel during build.

Resolves #306.
This commit is contained in:
Sergio Benitez 2017-06-02 17:41:15 -07:00
parent 6f4c8b1377
commit fa31b6ae42
4 changed files with 15 additions and 15 deletions

View File

@ -16,11 +16,11 @@ plugin = true
[dependencies] [dependencies]
rocket = { version = "0.2.8", path = "../lib/" } rocket = { version = "0.2.8", path = "../lib/" }
log = "^0.3" log = "0.3"
[dev-dependencies] [dev-dependencies]
compiletest_rs = "^0.2" compiletest_rs = "0.2"
[build-dependencies] [build-dependencies]
yansi = "0.2" yansi = "0.2"
version_check = "0.1" version_check = "0.1.2"

View File

@ -5,7 +5,7 @@ extern crate yansi;
extern crate version_check; extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White}; use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{is_nightly, is_min_version, is_min_date}; use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version needed to compile Rocket's codegen. // Specifies the minimum nightly version needed to compile Rocket's codegen.
const MIN_DATE: &'static str = "2017-06-01"; const MIN_DATE: &'static str = "2017-06-01";
@ -21,7 +21,7 @@ macro_rules! printerr {
} }
fn main() { fn main() {
let ok_nightly = is_nightly(); let ok_channel = supports_features();
let ok_version = is_min_version(MIN_VERSION); let ok_version = is_min_version(MIN_VERSION);
let ok_date = is_min_date(MIN_DATE); let ok_date = is_min_date(MIN_DATE);
@ -33,12 +33,12 @@ fn main() {
Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE))); Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
}; };
match (ok_nightly, ok_version, ok_date) { match (ok_channel, ok_version, ok_date) {
(Some(is_nightly), Some((ok_version, version)), Some((ok_date, date))) => { (Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) => {
if !is_nightly { if !ok_channel {
printerr!("{} {}", printerr!("{} {}",
Red.paint("Error:").bold(), Red.paint("Error:").bold(),
White.paint("Rocket requires a nightly version of Rust.")); White.paint("Rocket requires a nightly or dev version of Rust."));
print_version_err(&*version, &*date); print_version_err(&*version, &*date);
printerr!("{}{}{}", printerr!("{}{}{}",
Blue.paint("See the getting started guide ("), Blue.paint("See the getting started guide ("),

View File

@ -48,4 +48,4 @@ rocket_codegen = { version = "0.2.8", path = "../codegen" }
[build-dependencies] [build-dependencies]
yansi = "0.2" yansi = "0.2"
version_check = "^0.1" version_check = "0.1.2"

View File

@ -5,7 +5,7 @@ extern crate yansi;
extern crate version_check; extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White}; use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{is_nightly, is_min_version}; use version_check::{supports_features, is_min_version};
// Specifies the minimum nightly version needed to compile Rocket. // Specifies the minimum nightly version needed to compile Rocket.
const MIN_VERSION: &'static str = "1.19.0-nightly"; const MIN_VERSION: &'static str = "1.19.0-nightly";
@ -20,7 +20,7 @@ macro_rules! printerr {
} }
fn main() { fn main() {
let (ok_nightly, ok_version) = (is_nightly(), is_min_version(MIN_VERSION)); let (ok_channel, ok_version) = (supports_features(), is_min_version(MIN_VERSION));
let print_version_err = |version: &str| { let print_version_err = |version: &str| {
printerr!("{} {}. {} {}.", printerr!("{} {}. {} {}.",
White.paint("Installed version is:"), White.paint("Installed version is:"),
@ -29,11 +29,11 @@ fn main() {
Yellow.paint(MIN_VERSION)); Yellow.paint(MIN_VERSION));
}; };
if let (Some(is_nightly), Some((ok_version, version))) = (ok_nightly, ok_version) { if let (Some(ok_channel), Some((ok_version, version))) = (ok_channel, ok_version) {
if !is_nightly { if !ok_channel {
printerr!("{} {}", printerr!("{} {}",
Red.paint("Error:").bold(), Red.paint("Error:").bold(),
White.paint("Rocket requires a nightly version of Rust.")); White.paint("Rocket requires a nightly or dev version of Rust."));
print_version_err(&*version); print_version_err(&*version);
printerr!("{}{}{}", printerr!("{}{}{}",
Blue.paint("See the getting started guide ("), Blue.paint("See the getting started guide ("),