Skip to content

Commit

Permalink
Remove unnecessary fields from download location type
Browse files Browse the repository at this point in the history
  • Loading branch information
camchenry committed Feb 13, 2020
1 parent 968d648 commit fa478dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 67 deletions.
75 changes: 15 additions & 60 deletions src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,111 +11,66 @@ use std::io::Write;

pub fn download_love(version: &LoveVersion, platform: &Platform, bitness: &Bitness) {
let file_info = match (version, platform, bitness) {
(&LoveVersion::V11_3, &Platform::Windows, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_3, &Platform::Windows, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.3-win64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.3-win64.zip",
},
(&LoveVersion::V11_3, &Platform::Windows, &Bitness::X86) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_3, &Platform::Windows, &Bitness::X86) => LoveDownloadLocation {
filename: "love-11.3-win32.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.3-win32.zip",
},
(&LoveVersion::V11_3, &Platform::MacOs, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_3, &Platform::MacOs, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.3-macos.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.3-macos.zip",
},
(&LoveVersion::V11_2, &Platform::Windows, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_2, &Platform::Windows, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.2-win64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.2-win64.zip",
},
(&LoveVersion::V11_2, &Platform::Windows, &Bitness::X86) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_2, &Platform::Windows, &Bitness::X86) => LoveDownloadLocation {
filename: "love-11.2-win32.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.2-win32.zip",
},
(&LoveVersion::V11_2, &Platform::MacOs, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_2, &Platform::MacOs, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.2-macos.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.2-macos.zip",
},

(&LoveVersion::V11_1, &Platform::Windows, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_1, &Platform::Windows, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.1-win64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.1-win64.zip",
},
(&LoveVersion::V11_1, &Platform::Windows, &Bitness::X86) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_1, &Platform::Windows, &Bitness::X86) => LoveDownloadLocation {
filename: "love-11.1-win32.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.1-win32.zip",
},
(&LoveVersion::V11_1, &Platform::MacOs, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_1, &Platform::MacOs, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.1-macos.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.1-macos.zip",
},

(&LoveVersion::V11_0, &Platform::Windows, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_0, &Platform::Windows, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.0.0-win64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.0.0-win64.zip",
},
(&LoveVersion::V11_0, &Platform::Windows, &Bitness::X86) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_0, &Platform::Windows, &Bitness::X86) => LoveDownloadLocation {
filename: "love-11.0.0-win32.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.0.0-win32.zip",
},
(&LoveVersion::V11_0, &Platform::MacOs, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V11_0, &Platform::MacOs, &Bitness::X64) => LoveDownloadLocation {
filename: "love-11.0.0-macos.zip",
url: "https://bitbucket.org/rude/love/downloads/love-11.0.0-macos.zip",
},

(&LoveVersion::V0_10_2, &Platform::Windows, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V0_10_2, &Platform::Windows, &Bitness::X64) => LoveDownloadLocation {
filename: "love-0.10.2-win64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-0.10.2-win64.zip",
},
(&LoveVersion::V0_10_2, &Platform::Windows, &Bitness::X86) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V0_10_2, &Platform::Windows, &Bitness::X86) => LoveDownloadLocation {
filename: "love-0.10.2-win32.zip",
url: "https://bitbucket.org/rude/love/downloads/love-0.10.2-win32.zip",
},
(&LoveVersion::V0_10_2, &Platform::MacOs, &Bitness::X64) => LoveVersionFileInfo {
version,
platform,
bitness,
(&LoveVersion::V0_10_2, &Platform::MacOs, &Bitness::X64) => LoveDownloadLocation {
filename: "love-0.10.2-macosx-x64.zip",
url: "https://bitbucket.org/rude/love/downloads/love-0.10.2-macosx-x64.zip",
},
Expand Down
11 changes: 4 additions & 7 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ pub struct Project {
}

/// Represents an operating system or other platform/environment.
#[derive(Debug)]
#[derive(Debug, Copy)]
pub enum Platform {
Windows,
MacOs,
}

/// Represents a CPU architecture
#[derive(Debug)]
#[derive(Debug, Copy)]
pub enum Bitness {
X86, // 32 bit
X64, // 64 bit
}

/// Represents a specific version of LÖVE2D
#[derive(Debug)]
#[derive(Debug, Copy)]
pub enum LoveVersion {
V11_3,
V11_2,
Expand All @@ -45,10 +45,7 @@ pub enum LoveVersion {
}

/// File info about remote download
pub struct LoveVersionFileInfo<'a> {
pub version: &'a LoveVersion,
pub platform: &'a crate::Platform,
pub bitness: &'a crate::Bitness,
pub struct LoveDownloadLocation<'a> {
pub filename: &'a str,
pub url: &'a str,
}
Expand Down

0 comments on commit fa478dc

Please sign in to comment.