Class: Node::Commands::Generate::Billing
- Inherits:
-
ShopifyCli::SubCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCli::Command
- ShopifyCli::SubCommand
- Node::Commands::Generate::Billing
- Defined in:
- lib/project_types/node/commands/generate/billing.rb
Constant Summary collapse
- BILLING_TYPES =
{ 'recurring-billing' => ['./node_modules/.bin/generate-node-app', 'recurring-billing'], 'one-time-billing' => ['./node_modules/.bin/generate-node-app', 'one-time-billing'], }
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
33 34 35 |
# File 'lib/project_types/node/commands/generate/billing.rb', line 33 def self.help ShopifyCli::Context.('node.generate.billing.help', ShopifyCli::TOOL_NAME) end |
Instance Method Details
#call(args, _name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/project_types/node/commands/generate/billing.rb', line 11 def call(args, _name) selected_type = BILLING_TYPES[args[1]] unless selected_type selected_type = CLI::UI::Prompt.ask(@ctx.('node.generate.billing.type_select')) do |handler| BILLING_TYPES.each do |key, value| handler.option(key) { value } end end end billing_type_name = BILLING_TYPES.key(selected_type) selected_type[0] = File.join(ShopifyCli::Project.current.directory, selected_type[0]) selected_type[0] = "\"#{selected_type[0]}\"" selected_type = selected_type.join(' ') spin_group = CLI::UI::SpinGroup.new spin_group.add(@ctx.('node.generate.billing.generating', billing_type_name)) do |spinner| Node::Commands::Generate.run_generate(selected_type, billing_type_name, @ctx) spinner.update_title(@ctx.('node.generate.billing.generated', billing_type_name)) end spin_group.wait end |