Class: LgPodPlugin::Concurrency

Inherits:
Object
  • Object
show all
Defined in:
lib/lg_pod_plugin/installer/concurrency.rb

Class Method Summary collapse

Class Method Details

.async_download_pods(installers) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lg_pod_plugin/installer/concurrency.rb', line 9

def self.async_download_pods(installers)
  return if installers.empty?
  hash = installers.map(&:download_params).uniq
  json_text = JSON.generate(hash)
  file_path = LFileManager.download_director.join(LUtils.md5(json_text)).to_path + ".json"
  # pp file_path
  File.open(file_path, 'w+') { |f| f.write(json_text) }
  pwd = Pathname.new(File.dirname(__FILE__)).realpath
  FileUtils.chdir pwd
  system("./PodDownload #{file_path}")
  installers.each(&:copy_file_to_caches)
end