Class: Node::Commands::Generate
- Inherits:
-
ShopifyCli::Command
show all
- Defined in:
- lib/project_types/node/commands/generate.rb,
lib/project_types/node/commands/generate/page.rb,
lib/project_types/node/commands/generate/billing.rb,
lib/project_types/node/commands/generate/webhook.rb
Defined Under Namespace
Classes: Billing, Page, Webhook
Instance Attribute Summary
#ctx, #options
Class Method Summary
collapse
Instance Method Summary
collapse
call, call_help, #initialize, options, prerequisite_task, run_prerequisites, subcommand, subcommand_registry
#hidden?, #hidden_feature
Class Method Details
.extended_help ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/project_types/node/commands/generate.rb', line 19
def self.extended_help
extended_help = "{{bold:Subcommands:}}\n"
subcommand_registry.resolved_commands.sort.each do |name, klass|
extended_help += " {{cyan:#{name}}}: "
if (subcmd_help = klass.help)
extended_help += subcmd_help.gsub("\n ", "\n ")
end
extended_help += "\n"
end
extended_help += ShopifyCli::Context.message('node.generate.extended_help', ShopifyCli::TOOL_NAME)
end
|
.response(code, name, ctx) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/project_types/node/commands/generate.rb', line 39
def self.response(code, name, ctx)
case code
when 1
ctx.message('node.generate.error.generic', name)
when 2
ctx.message('node.generate.error.name_exists', name)
else
ctx.message('node.error.generic')
end
end
|
.run_generate(script, name, ctx) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/project_types/node/commands/generate.rb', line 32
def self.run_generate(script, name, ctx)
stat = ctx.system(script)
unless stat.success?
ctx.abort(response(stat.exitstatus, name, ctx))
end
end
|
Instance Method Details
#call ⇒ Object
11
12
13
|
# File 'lib/project_types/node/commands/generate.rb', line 11
def call(*)
@ctx.puts(self.class.help)
end
|