#java #wget #download #distribution #latest #cookies

libwgetj

Library for using wget to grab Java distributions

17 releases (6 stable)

Uses old Rust 2015

1.0.5 Apr 26, 2017
1.0.4 Jan 20, 2017
1.0.3 Jul 26, 2016
0.1.11 Feb 10, 2016
0.1.2 Mar 30, 2015

#6 in #distributions


Used in wgetj

MIT license

47KB
925 lines

libwgetj

Library wrapping wget to grab Java distributions.

Version

Crates.io Build Status


lib.rs:

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 = Default::default();
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 = Default::default();
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 = Default::default();
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 = Default::default();
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 = Default::default();
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 = Default::default();
cfg.version(Seven).point_release(latest(Seven)).dry_run(true);
match cfg.download() {
    Ok(res) => assert!(res == 0),
    Err(e)  => { println!("{:?}", e); assert!(false) },
}

Dependencies

~175–320KB