Class: Extension::Forms::Create
- Inherits:
-
ShopifyCLI::Form
- Object
- ShopifyCLI::Form
- Extension::Forms::Create
- Defined in:
- lib/project_types/extension/forms/create.rb
Defined Under Namespace
Classes: ExtensionProjectDetails
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Attributes inherited from ShopifyCLI::Form
Instance Method Summary collapse
Methods inherited from ShopifyCLI::Form
ask, flag_arguments, #initialize, positional_arguments
Constructor Details
This class inherits a constructor from ShopifyCLI::Form
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
8 9 10 |
# File 'lib/project_types/extension/forms/create.rb', line 8 def app @app end |
Instance Method Details
#ask ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/project_types/extension/forms/create.rb', line 23 def ask ShopifyCLI::Result.wrap(ExtensionProjectDetails.new) .then(&Questions::AskApp.new(ctx: ctx, api_key: api_key)) .then(&Questions::AskType.new(ctx: ctx, type: type)) .then(&Questions::AskTemplate.new(ctx: ctx, template: template)) .then(&Questions::AskName.new(ctx: ctx, name: name)) .unwrap { |e| raise e } .tap do |project_details| ctx.abort(ctx.("create.incomplete_configuration")) unless project_details.complete? self.app = project_details.app self.type = project_details.type self.template = project_details.template self.name = project_details.name end end |
#directory_name ⇒ Object
40 41 42 |
# File 'lib/project_types/extension/forms/create.rb', line 40 def directory_name name.strip.gsub(/( )/, "_").downcase end |