Class: Theme::Command::Publish
- Inherits:
-
ShopifyCLI::Command::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCLI::Command
- ShopifyCLI::Command::SubCommand
- Theme::Command::Publish
- Includes:
- Common::ShopHelper
- Defined in:
- lib/project_types/theme/commands/publish.rb
Instance Attribute Summary
Attributes inherited from ShopifyCLI::Command
Class Method Summary collapse
Instance Method Summary collapse
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
44 45 46 |
# File 'lib/project_types/theme/commands/publish.rb', line 44 def self.help ShopifyCLI::Context.("theme.publish.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME) end |
Instance Method Details
#call(args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/project_types/theme/commands/publish.rb', line 16 def call(args, *) theme = if (theme_id = args.first) ShopifyCLI::Theme::Theme.new(@ctx, id: theme_id) else form = Forms::Select.ask( @ctx, [], title: @ctx.("theme.publish.select", shop), exclude_roles: ["live", "development", "demo"], cmd: :publish ) return unless form form.theme end return unless Forms::ConfirmStore.ask( @ctx, [], title: @ctx.("theme.publish.confirm", theme.name, theme.shop), force: .flags[:force], ).confirmed? theme.publish @ctx.done(@ctx.("theme.publish.done", theme.preview_url)) rescue ShopifyCLI::API::APIRequestNotFoundError @ctx.puts(@ctx.("theme.publish.not_found", theme.id)) end |