Class: Script::Commands::Push
- Inherits:
-
ShopifyCli::Command
- Object
- CLI::Kit::BaseCommand
- ShopifyCli::Command
- Script::Commands::Push
- Defined in:
- lib/project_types/script/commands/push.rb
Instance Attribute Summary
Attributes inherited from ShopifyCli::Command
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ShopifyCli::Command
call, call_help, #initialize, options, prerequisite_task, 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
30 31 32 |
# File 'lib/project_types/script/commands/push.rb', line 30 def self.help ShopifyCli::Context.('script.push.help', ShopifyCli::TOOL_NAME) end |
Instance Method Details
#call(_args, _name) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/project_types/script/commands/push.rb', line 10 def call(_args, _name) ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop]) project = ScriptProject.current api_key = project.env[:api_key] return @ctx.puts(self.class.help) unless api_key && ScriptProject::SUPPORTED_LANGUAGES.include?(project.language) Layers::Application::PushScript.call( ctx: @ctx, language: project.language, extension_point_type: project.extension_point_type, script_name: project.script_name, source_file: project.source_file, api_key: api_key, force: .flags.key?(:force) ) @ctx.puts(@ctx.('script.push.script_pushed', api_key: api_key)) rescue StandardError => e UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.('script.push.error.operation_failed')) end |