Module: Flutter::Pub::Downloader
- Defined in:
- lib/cocoapods-embed-flutter/flutter/downloader.rb
Overview
The Downloader modules name-spaces all the classes and methods for downloading and caching remote Flutter projects.
Class Method Summary collapse
-
.download(request, target, can_cache: true, cache_path: Pod::Config.instance.cache_root + 'Pods') ⇒ Response
Downloads a package from the given ‘request` to the given `target` location.
Class Method Details
.download(request, target, can_cache: true, cache_path: Pod::Config.instance.cache_root + 'Pods') ⇒ Response
TODO:
Implement caching for remote sources.
Downloads a package from the given ‘request` to the given `target` location.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cocoapods-embed-flutter/flutter/downloader.rb', line 28 def self.download( request, target, can_cache: true, cache_path: Pod::Config.instance.cache_root + 'Pods' ) can_cache &&= !Pod::Config.instance.skip_download_cache request = Pod::Downloader.preprocess_request(request) # if can_cache # raise ArgumentError, 'Must provide a `cache_path` when caching.' unless cache_path # cache = Pod::Downloader::Cache.new(cache_path) # result = cache.download_pod(request) # else # raise ArgumentError, 'Must provide a `target` when caching is disabled.' unless target # result, = Pod::Downloader.download_request(request, target) # Pod::Installer::PodSourcePreparer.new(result.spec, result.location).prepare! # end raise ArgumentError, 'Must provide a `target` when caching is disabled.' unless target result, = Pod::Downloader.download_request(request, target) if target && result.location && target != result.location Pod::UI. "Copying #{request.name} from `#{result.location}` to #{UI.path target}", '> ' do Pod::Downloader::Cache.read_lock(result.location) do FileUtils.rm_rf target FileUtils.cp_r(result.location, target) end end end result end |