Class: Theme::Command::Pull
- Inherits:
-
ShopifyCLI::Command::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCLI::Command
- ShopifyCLI::Command::SubCommand
- Theme::Command::Pull
- Includes:
- Common::RootHelper, Common::ShopHelper
- Defined in:
- lib/project_types/theme/commands/pull.rb
Instance Attribute Summary
Attributes inherited from ShopifyCLI::Command
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Common::RootHelper
#exist_and_not_empty?, #root_value, #valid_theme_directory?
Methods included from Common::ShopHelper
Methods inherited from ShopifyCLI::Command::SubCommand
Methods inherited from ShopifyCLI::Command
call, call_help, check_node_version, check_ruby_version, check_version, #initialize, options, prerequisite_task, recommend_default_node_range, recommend_default_ruby_range, recommend_node, recommend_ruby, run_prerequisites, subcommand, subcommand_registry
Methods included from ShopifyCLI::Feature::Set
Constructor Details
This class inherits a constructor from ShopifyCLI::Command
Class Method Details
.help ⇒ Object
78 79 80 |
# File 'lib/project_types/theme/commands/pull.rb', line 78 def self.help ShopifyCLI::Context.("theme.pull.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME) end |
Instance Method Details
#call(_args, name) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/project_types/theme/commands/pull.rb', line 43 def call(_args, name) root = root_value(, name) return if exist_and_not_empty?(root) && !valid_theme_directory?(root) development_theme_id = .flags[:development_theme_id] ShopifyCLI::DB.set(development_theme_id: development_theme_id) unless development_theme_id.nil? delete = !.flags[:nodelete] theme = find_theme(root, **.flags) return if theme.nil? include_filter = ShopifyCLI::Theme::IncludeFilter.new(root, .flags[:includes]) ignore_filter = ShopifyCLI::Theme::IgnoreFilter.from_path(root) ignore_filter.add_patterns(.flags[:ignores]) if .flags[:ignores] syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme, include_filter: include_filter, ignore_filter: ignore_filter) begin syncer.start_threads CLI::UI::Frame.open(@ctx.("theme.pull.pulling", theme.name, theme.id, theme.shop)) do UI::SyncProgressBar.new(syncer).progress(:download_theme!, delete: delete) end if syncer.has_any_error? @ctx.warn(@ctx.("theme.pull.done_with_errors")) else @ctx.done(@ctx.("theme.pull.done")) end rescue ShopifyCLI::API::APIRequestNotFoundError @ctx.abort(@ctx.("theme.pull.theme_not_found", "##{theme.id}")) ensure syncer.shutdown end end |