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]
rocket = { version = "0.2.8", path = "../lib/" }
log = "^0.3"
log = "0.3"
[dev-dependencies]
compiletest_rs = "^0.2"
compiletest_rs = "0.2"
[build-dependencies]
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;
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.
const MIN_DATE: &'static str = "2017-06-01";
@ -21,7 +21,7 @@ macro_rules! printerr {
}
fn main() {
let ok_nightly = is_nightly();
let ok_channel = supports_features();
let ok_version = is_min_version(MIN_VERSION);
let ok_date = is_min_date(MIN_DATE);
@ -33,12 +33,12 @@ fn main() {
Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
};
match (ok_nightly, ok_version, ok_date) {
(Some(is_nightly), Some((ok_version, version)), Some((ok_date, date))) => {
if !is_nightly {
match (ok_channel, ok_version, ok_date) {
(Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) => {
if !ok_channel {
printerr!("{} {}",
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);
printerr!("{}{}{}",
Blue.paint("See the getting started guide ("),

View File

@ -48,4 +48,4 @@ rocket_codegen = { version = "0.2.8", path = "../codegen" }
[build-dependencies]
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;
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.
const MIN_VERSION: &'static str = "1.19.0-nightly";
@ -20,7 +20,7 @@ macro_rules! printerr {
}
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| {
printerr!("{} {}. {} {}.",
White.paint("Installed version is:"),
@ -29,11 +29,11 @@ fn main() {
Yellow.paint(MIN_VERSION));
};
if let (Some(is_nightly), Some((ok_version, version))) = (ok_nightly, ok_version) {
if !is_nightly {
if let (Some(ok_channel), Some((ok_version, version))) = (ok_channel, ok_version) {
if !ok_channel {
printerr!("{} {}",
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);
printerr!("{}{}{}",
Blue.paint("See the getting started guide ("),