Class: ShopifyCLI::Theme::Syncer::Downloader

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/shopify_cli/theme/syncer/downloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(syncer, delete, &update_progress_bar_block) ⇒ Downloader

Returns a new instance of Downloader.



21
22
23
24
25
# File 'lib/shopify_cli/theme/syncer/downloader.rb', line 21

def initialize(syncer, delete, &update_progress_bar_block)
  @syncer = syncer
  @delete = delete
  @update_progress_bar_block = update_progress_bar_block
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



11
12
13
# File 'lib/shopify_cli/theme/syncer/downloader.rb', line 11

def ctx
  @ctx
end

#syncerObject (readonly)

Returns the value of attribute syncer.



11
12
13
# File 'lib/shopify_cli/theme/syncer/downloader.rb', line 11

def syncer
  @syncer
end

Instance Method Details

#download!Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/shopify_cli/theme/syncer/downloader.rb', line 27

def download!
  fetch_checksums!

  if delete_local_files?
    to_be_deleted.each { |file| delete(file) }
  end

  enqueue_get(checksums.keys)
  wait!(&@update_progress_bar_block)
end