Class: ShopifyCLI::Theme::DevServer::HotReload::RemoteFileDeleter

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb

Instance Method Summary collapse

Constructor Details

#initialize(ctx, theme:, streams:) ⇒ RemoteFileDeleter

Returns a new instance of RemoteFileDeleter.



8
9
10
11
12
# File 'lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb', line 8

def initialize(ctx, theme:, streams:)
  @ctx = ctx
  @theme = theme
  @streams = streams
end

Instance Method Details

#delete(file) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb', line 14

def delete(file)
  retries = 6

  until retries.zero?
    retries -= 1

    _status, body = fetch_asset(file)
    retries = 0 if deleted_file?(body)

    wait
  end

  notify(file)
end