Class: ShopifyCLI::Theme::Syncer::Uploader
- Inherits:
-
Object
- Object
- ShopifyCLI::Theme::Syncer::Uploader
- Extended by:
- Forwardable
- Includes:
- JsonDeleteHandler, JsonUpdateHandler
- Defined in:
- lib/shopify_cli/theme/syncer/uploader.rb,
lib/shopify_cli/theme/syncer/uploader/bulk.rb,
lib/shopify_cli/theme/syncer/uploader/bulk_job.rb,
lib/shopify_cli/theme/syncer/uploader/bulk_item.rb,
lib/shopify_cli/theme/syncer/uploader/bulk_request.rb,
lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all.rb,
lib/shopify_cli/theme/syncer/uploader/json_delete_handler.rb,
lib/shopify_cli/theme/syncer/uploader/json_update_handler.rb,
lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all_form.rb,
lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb,
lib/shopify_cli/theme/syncer/uploader/forms/select_delete_strategy.rb,
lib/shopify_cli/theme/syncer/uploader/forms/select_update_strategy.rb
Defined Under Namespace
Modules: Forms, JsonDeleteHandler, JsonUpdateHandler Classes: Bulk, BulkItem, BulkJob, BulkRequest
Instance Attribute Summary collapse
-
#syncer ⇒ Object
readonly
Returns the value of attribute syncer.
Instance Method Summary collapse
- #delete_files! ⇒ Object
-
#initialize(syncer, delete, delay_low_priority_files, &update_progress_bar_block) ⇒ Uploader
constructor
A new instance of Uploader.
- #upload! ⇒ Object
Methods included from JsonUpdateHandler
Methods included from JsonDeleteHandler
Constructor Details
#initialize(syncer, delete, delay_low_priority_files, &update_progress_bar_block) ⇒ Uploader
Returns a new instance of Uploader.
40 41 42 43 44 45 46 |
# File 'lib/shopify_cli/theme/syncer/uploader.rb', line 40 def initialize(syncer, delete, delay_low_priority_files, &) @syncer = syncer @delete = delete @delay_low_priority_files = delay_low_priority_files @update_progress_bar_block = @progress_bar_mutex = Mutex.new end |
Instance Attribute Details
#syncer ⇒ Object (readonly)
Returns the value of attribute syncer.
19 20 21 |
# File 'lib/shopify_cli/theme/syncer/uploader.rb', line 19 def syncer @syncer end |
Instance Method Details
#delete_files! ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/shopify_cli/theme/syncer/uploader.rb', line 59 def delete_files! return unless delete? files_present_remotely = checksums.keys files_present_locally = theme.theme_files.map(&:relative_path) json_files, other_files = (files_present_remotely - files_present_locally) .map { |file| theme[file] } .reject { |file| ignore_file?(file) } .partition(&:json?) enqueue_deletes(other_files) enqueue_json_deletes(json_files) end |
#upload! ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/shopify_cli/theme/syncer/uploader.rb', line 48 def upload! fetch_checksums! delete_files! if bulk_updates_activated? && overwrite_json? bulk_upload! else async_upload! end end |