Class: LgPodPlugin::LDownloader
- Inherits:
-
Object
- Object
- LgPodPlugin::LDownloader
- Defined in:
- lib/lg_pod_plugin/downloader.rb
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ LDownloader
constructor
A new instance of LDownloader.
-
#pre_download_pod ⇒ Object
预下载处理.
Constructor Details
#initialize(name, options = {}) ⇒ LDownloader
Returns a new instance of LDownloader.
12 13 14 15 16 17 18 19 |
# File 'lib/lg_pod_plugin/downloader.rb', line 12 def initialize(name, = {}) self.name = name self. = Hash.new.deep_merge() self.git = self.[:git] self.tag = self.[:tag] self.branch = self.[:branch] self.commit = self.[:commit] end |
Instance Method Details
#pre_download_pod ⇒ Object
预下载处理
22 23 24 25 26 27 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 |
# File 'lib/lg_pod_plugin/downloader.rb', line 22 def pre_download_pod if self.branch LgPodPlugin.log_green "Using `#{name}` (#{branch})" else LgPodPlugin.log_green "Using `#{name}`" end hash_map = LRequest.shared.get_cache_key_params # 发现本地有缓存, 不需要更新缓存 if LRequest.shared.single_git need_download = LRequest.shared.cache.find_pod_cache(name, hash_map) unless need_download hash_map.delete(:commit) need_download = LRequest.shared.cache.find_pod_cache(name, hash_map) end else need_download = LRequest.shared.cache.find_pod_cache(name, hash_map) end if need_download LgPodPlugin.log_green "find the new commit of `#{name}`, Git downloading now." # 本地 git 下载 pod 目录 LRequest.shared.git_util.pre_download_git_repository else is_delete = LRequest.shared.request_params["is_delete"] ||= false if self.real_name == self.name LRequest.shared.libs.delete(self.name) if is_delete else LRequest.shared.libs.delete(self.real_name) if is_delete end LgPodPlugin.log_green "find the cache of `#{name}`, you can use it now." end end |