Class: U3d::Downloader::MacDownloader
- Inherits:
-
Object
- Object
- U3d::Downloader::MacDownloader
- Defined in:
- lib/u3d/downloader.rb
Class Method Summary collapse
-
.download_all(version, cached_versions) ⇒ Object
Downloads all packages available for given version.
-
.download_specific(package, version, cached_versions) ⇒ Object
Downloads a specific package for given version.
Class Method Details
.download_all(version, cached_versions) ⇒ Object
Downloads all packages available for given version
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/u3d/downloader.rb', line 101 def download_all(version, cached_versions) if cached_versions[version].nil? UI.error "No version #{version} was found in cache. It might need updating." return nil end files = [] ini_file = INIparser.load_ini(version, cached_versions) ini_file.keys.each do |k| result = download_specific(k, version, cached_versions) files << [k, result[0], result[1]] unless result.nil? end files end |
.download_specific(package, version, cached_versions) ⇒ Object
Downloads a specific package for given version
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/u3d/downloader.rb', line 116 def download_specific(package, version, cached_versions) if cached_versions[version].nil? UI.error "No version #{version} was found in cache. It might need updating." return nil end ini_file = INIparser.load_ini(version, cached_versions) if ini_file[package].empty? UI.error "No package \"#{package}\" was found for version #{version}." return nil end url = cached_versions[version] dir = File.join(DOWNLOAD_PATH, DOWNLOAD_DIRECTORY, version) Utils.ensure_dir(dir) return [get_package(package, ini_file, dir, url), ini_file[package]] end |