Class: Extension::Commands::Create
- Inherits:
-
ShopifyCli::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCli::Command
- ShopifyCli::SubCommand
- Extension::Commands::Create
- Defined in:
- lib/project_types/extension/commands/create.rb
Instance Attribute Summary
Attributes inherited from ShopifyCli::Command
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ShopifyCli::SubCommand
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
29 30 31 32 33 34 35 36 37 |
# File 'lib/project_types/extension/commands/create.rb', line 29 def self.help " Create a new app extension.\n Usage: {{command:\#{ShopifyCli::TOOL_NAME} create extension <name>}}\n Options:\n {{command:--type=TYPE}} The type of extension you would like to create.\n {{command:--name=NAME}} The name of your extension (50 characters).\u201D\n HELP\nend\n" |
Instance Method Details
#call(args, _) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/project_types/extension/commands/create.rb', line 11 def call(args, _) with_create_form(args) do |form| if Dir.exist?(form.directory_name) @ctx.abort(@ctx.('create.errors.directory_exists', form.directory_name)) end if form.type.create(form.directory_name, @ctx) ExtensionProject.write_cli_file(context: @ctx, type: form.type.identifier) ExtensionProject.write_env_file(context: @ctx, title: form.name) @ctx.puts(@ctx.('create.ready_to_start', form.directory_name, form.name)) @ctx.puts(@ctx.('create.learn_more', form.type.name)) else @ctx.puts(@ctx.('create.try_again')) end end end |