Crate libwgetj [−] [src]
libwgetj API
Wraps wget with some cookie management to allow downloading Java releases from the command line.
Examples
use libwgetj::{DownloadConfig, latest}; use libwgetj::Arch::*; use libwgetj::Archive::*; use libwgetj::OS::*; use libwgetj::Package::*; use libwgetj::Version::*; // Setup a dry run (don't actually download) for the default Java 8 JDK 64-bit Linux tar.gz // (latest point release). let mut cfg = DownloadConfig::new(); cfg.dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, } // Download Java 8 JDK 64-bit Linux tar.gz (older point release). let mut cfg = DownloadConfig::new(); cfg.point_release(40).dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, } // Download Java 8 JDK 64-bit Mac OSX dmg (latest point release). let mut cfg = DownloadConfig::new(); cfg.archive(DMG).os(Mac).dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, } // Download Java 8 JDK 32-bit Windows exe (latest point release). let mut cfg = DownloadConfig::new(); cfg.archive(EXE).os(Windows).arch(I586).dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, } // Download Java 8 JRE 32-bit Linux rpm (latest point release). let mut cfg = DownloadConfig::new(); cfg.archive(RPM).arch(I586).package(JRE).dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, } // Download Java 7 JDK 64-bit Linux tar.gz (latest point release). let mut cfg = DownloadConfig::new(); cfg.version(Seven).point_release(latest(Seven)).dry_run(true); match cfg.download() { Ok(res) => assert!(res == 0), Err(e) => { println!("{:?}", e); assert!(false) }, }
Structs
DownloadConfig |
The Java download configuration. The download function will read from this configuration and build a url specific to the configuration. |
LibwgetjError |
An error thrown by the libwgetj library. |
Enums
Arch |
CPU Architecture |
Archive |
The download archive type. |
OS |
Supported OS downloads |
Package |
Java package type. |
Version |
Java Major Version |
Functions
latest |
Produce the latest point release version for each supported major version. |
version |
Generate a version string. |