Class: Theme::Command::Push
- Inherits:
-
ShopifyCLI::Command::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCLI::Command
- ShopifyCLI::Command::SubCommand
- Theme::Command::Push
- Includes:
- Common::RootHelper, Common::ShopHelper
- Defined in:
- lib/project_types/theme/commands/push.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
91 92 93 |
# File 'lib/project_types/theme/commands/push.rb', line 91 def self.help ShopifyCLI::Context.("theme.push.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME) end |
Instance Method Details
#call(_args, name) ⇒ Object
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 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/project_types/theme/commands/push.rb', line 48 def call(_args, name) root = root_value(, name) return unless 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? if theme.live? && !.flags[:allow_live] question = @ctx.("theme.push.live") question += @ctx.("theme.push.theme", theme.name, theme.id) if .flags[:live] return unless CLI::UI::Prompt.confirm(question) end 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, stable: .flags[:stable]) begin syncer.start_threads if .flags[:json] syncer.standard_reporter.disable! syncer.upload_theme!(delete: delete) else CLI::UI::Frame.open(@ctx.("theme.push.info.pushing", theme.name, theme.id, theme.shop)) do UI::SyncProgressBar.new(syncer).progress(:upload_theme!, delete: delete) end end push_completion_handler(theme, syncer.has_any_error?) ensure syncer.shutdown end rescue ShopifyCLI::API::APIRequestNotFoundError @ctx.abort(@ctx.("theme.push.theme_not_found", "##{theme.id}")) end |