diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..77cf74f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,53 @@ +language: rust + +os: + - linux + - osx + - windows + +rust: + - nightly + - beta + - stable + +matrix: + allow_failures: + - rust: nightly + +before_script: + - | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH + +script: + - cargo build + - cargo test + +addons: + apt: + packages: + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + - libssl-dev + +after_success: + - travis-cargo --only stable doc-upload + - travis-cargo coveralls --no-sudo + - | + if [[ "$TRAVIS_RUST_VERSION" == stable ]]; then + bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh) + # Uncomment the following line for coveralls.io + cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID + # Uncomment the following two lines create and upload a report for codecov.io + cargo tarpaulin --out Xml + bash <(curl -s https://codecov.io/bash) + fi + +notifications: + email: + on_success: never + +env: + global: + - TRAVIS_CARGO_NIGHTLY_FEATURE=dev diff --git a/Cargo.toml b/Cargo.toml index 44a4ba5..af06cfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "wifi-rs" version = "0.2.2" +edition = "2018" authors = ["Tochukwu Nkemdilim "] description = "Interface with and manage Wireless Network (WiFi)" license = "MIT" diff --git a/examples/hotspot/Cargo.toml b/examples/hotspot/Cargo.toml index 06fb137..aa05eb9 100644 --- a/examples/hotspot/Cargo.toml +++ b/examples/hotspot/Cargo.toml @@ -1,6 +1,7 @@ [package] -name = "wifi-cli" +name = "wifi-connect" version = "0.1.0" +edition = "2018" authors = ["Tochukwu Nkemdilim "] [dependencies] diff --git a/examples/hotspot/src/main.rs b/examples/hotspot/src/main.rs index 52ec701..ba8812b 100644 --- a/examples/hotspot/src/main.rs +++ b/examples/hotspot/src/main.rs @@ -1,8 +1,5 @@ -extern crate wifi_rs; - use std::io; -use wifi_rs::WiFi; -use wifi_rs::prelude::*; +use wifi_rs::{prelude::*, WiFi}; fn main() -> Result<(), io::Error> { let config = Some(Config { @@ -12,13 +9,7 @@ fn main() -> Result<(), io::Error> { let mut wifi = WiFi::new(config); let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One)); - wifi.create_hotspot( - "test-hotspot", - "password", - Some( - &config - ) - ); + wifi.create_hotspot("test-hotspot", "password", Some(&config)); Ok(()) } diff --git a/examples/wifi-cli/Cargo.toml b/examples/wifi-cli/Cargo.toml index 55cdfdc..7190dba 100644 --- a/examples/wifi-cli/Cargo.toml +++ b/examples/wifi-cli/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "wifi-cli" version = "0.1.0" +edition = "2018" authors = ["Tochukwu Nkemdilim "] [dependencies] diff --git a/examples/wifi-cli/src/main.rs b/examples/wifi-cli/src/main.rs index 774a6cc..6831e0c 100644 --- a/examples/wifi-cli/src/main.rs +++ b/examples/wifi-cli/src/main.rs @@ -1,10 +1,7 @@ -extern crate clap; -extern crate wifi_rs; - use clap::{App, Arg}; use std::io; -use wifi_rs::WiFi; use wifi_rs::prelude::*; +use wifi_rs::WiFi; fn main() -> Result<(), io::Error> { let matches = App::new("Wi-Fi") @@ -58,4 +55,4 @@ fn main() -> Result<(), io::Error> { println!("Connection Status: {:?}", wifi.connect(ssid, password)); Ok(()) -} \ No newline at end of file +} diff --git a/src/connectivity/providers/osx.rs b/src/connectivity/providers/osx.rs index 383ab85..7a4f4df 100644 --- a/src/connectivity/providers/osx.rs +++ b/src/connectivity/providers/osx.rs @@ -1,5 +1,7 @@ -use connectivity::{Connectivity, WifiConnectionError}; -use platforms::{Connection, WiFi, WifiError, WifiInterface}; +use crate::{ + connectivity::{Connectivity, WifiConnectionError}, + platforms::{Connection, WiFi, WifiError, WifiInterface}, +}; use std::process::Command; /// Wireless network connectivity functionality. diff --git a/src/hotspot/providers/linux.rs b/src/hotspot/providers/linux.rs index 71fb61a..9836756 100644 --- a/src/hotspot/providers/linux.rs +++ b/src/hotspot/providers/linux.rs @@ -20,10 +20,7 @@ pub struct HotspotConfig { #[allow(dead_code)] impl HotspotConfig { pub fn new(band: Option, channel: Option) -> HotspotConfig { - HotspotConfig { - band, - channel - } + HotspotConfig { band, channel } } } diff --git a/src/hotspot/providers/osx.rs b/src/hotspot/providers/osx.rs index 1a4a92a..d8beb74 100644 --- a/src/hotspot/providers/osx.rs +++ b/src/hotspot/providers/osx.rs @@ -1,9 +1,8 @@ -use hotspot::WifiHotspot; -use platforms::WiFi; +use crate::{hotspot::WifiHotspot, platforms::WiFi}; /// Configuration for a wireless hotspot. #[allow(dead_code)] -pub struct HotspotConfig {} +pub struct HotspotConfig; /// Wireless hotspot functionality for a wifi interface. impl WifiHotspot for WiFi {} diff --git a/src/hotspot/providers/windows.rs b/src/hotspot/providers/windows.rs index 4686eb1..3bc83e9 100644 --- a/src/hotspot/providers/windows.rs +++ b/src/hotspot/providers/windows.rs @@ -1,9 +1,11 @@ -use hotspot::{WifiHotspot, WifiHotspotError}; -use platforms::{WiFi, WifiError, WifiInterface}; +use crate::{ + hotspot::{WifiHotspot, WifiHotspotError}, + platforms::{WiFi, WifiError, WifiInterface}, +}; use std::process::Command; /// Configuration for a wireless hotspot. -pub struct HotspotConfig {} +pub struct HotspotConfig; impl WiFi { /// Attempts to turn on a wireless networ if down. diff --git a/src/lib.rs b/src/lib.rs index 84f959f..38561d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,10 +4,10 @@ mod platforms; /// Pre-requisite module for `Connectivity`, `Hotspot` functionality. pub mod prelude { - pub use crate::connectivity::*; - pub use crate::hotspot::*; - pub use crate::hotspot::providers::prelude::*; - pub use crate::platforms::Config; + pub use crate::connectivity::*; + pub use crate::hotspot::providers::prelude::*; + pub use crate::hotspot::*; + pub use crate::platforms::Config; } pub use crate::platforms::WiFi; diff --git a/src/platforms/osx.rs b/src/platforms/osx.rs index c3207b5..9faa339 100644 --- a/src/platforms/osx.rs +++ b/src/platforms/osx.rs @@ -1,4 +1,4 @@ -use platforms::{Config, WifiError, WifiInterface}; +use crate::platforms::{Config, WifiError, WifiInterface}; use std::process::Command; #[derive(Debug)] diff --git a/src/platforms/windows.rs b/src/platforms/windows.rs index 1252ab4..ba08b66 100644 --- a/src/platforms/windows.rs +++ b/src/platforms/windows.rs @@ -1,6 +1,4 @@ -use platforms::Config; -use platforms::WifiError; -use platforms::WifiInterface; +use crate::platforms::{Config, WifiError, WifiInterface}; use std::process::Command; const WINDOWS_INTERFACE: &'static str = "Wireless Network Connection";