Add travis integration (#81)

* Add travis integration

* Update examples/rainbow to work on stable
This commit is contained in:
Alexandre Bury 2016-12-19 16:45:11 +01:00 committed by ticki
parent 32ff8ba96e
commit 0395780f25
2 changed files with 15 additions and 5 deletions

10
.travis.yml Normal file
View File

@ -0,0 +1,10 @@
language: rust
cache: cargo
rust:
- stable
- beta
- nightly
script:
- cargo build --verbose
- cargo test --verbose
- cargo test --release --verbose

View File

@ -1,5 +1,3 @@
#![feature(step_by)]
extern crate termion; extern crate termion;
use termion::event::Key; use termion::event::Key;
@ -10,8 +8,10 @@ use std::io::{Write, stdout, stdin};
fn rainbow<W: Write>(stdout: &mut W, blue: u8) { fn rainbow<W: Write>(stdout: &mut W, blue: u8) {
write!(stdout, "{}{}", termion::cursor::Goto(1, 1), termion::clear::All).unwrap(); write!(stdout, "{}{}", termion::cursor::Goto(1, 1), termion::clear::All).unwrap();
for red in (0..255).step_by(8 as u8) { for red in 0..32 {
for green in (0..255).step_by(4) { let red = red * 8;
for green in 0..64 {
let green = green * 4;
write!(stdout, "{} ", termion::color::Bg(termion::color::Rgb(red, green, blue))).unwrap(); write!(stdout, "{} ", termion::color::Bg(termion::color::Rgb(red, green, blue))).unwrap();
} }
write!(stdout, "\n\r").unwrap(); write!(stdout, "\n\r").unwrap();
@ -24,7 +24,7 @@ fn main() {
let stdin = stdin(); let stdin = stdin();
let mut stdout = stdout().into_raw_mode().unwrap(); let mut stdout = stdout().into_raw_mode().unwrap();
writeln!(stdout, "{}{}{}Use the arrow keys to change the blue in the rainbow.", writeln!(stdout, "{}{}{}Use the up/down arrow keys to change the blue in the rainbow.",
termion::clear::All, termion::clear::All,
termion::cursor::Goto(1, 1), termion::cursor::Goto(1, 1),
termion::cursor::Hide).unwrap(); termion::cursor::Hide).unwrap();