Class: Castkit::CLI::Generate
- Inherits:
-
Thor
- Object
- Thor
- Castkit::CLI::Generate
- Defined in:
- lib/castkit/cli/generate.rb
Overview
Thor CLI class for generating Castkit components.
Provides ‘castkit generate` commands for each major Castkit component, including types, data objects, contracts, validators, serializers, and plugins.
All generators support the ‘–no-spec` flag to skip spec file creation.
Instance Method Summary collapse
-
#contract(name, *fields) ⇒ void
Generates a new contract class.
-
#dataobject(name, *fields) ⇒ void
Generates a new DataObject class.
-
#plugin(name, *fields) ⇒ void
Generates a new plugin module.
-
#serializer(name, *fields) ⇒ void
Generates a new custom serializer class.
-
#type(name) ⇒ void
Generates a new custom type.
-
#validator(name, *fields) ⇒ void
Generates a new validator class.
Instance Method Details
#contract(name, *fields) ⇒ void
This method returns an undefined value.
Generates a new contract class.
27 28 29 30 31 |
# File 'lib/castkit/cli/generate.rb', line 27 def contract(name, *fields) args = [Castkit::Inflector.pascalize(name), fields] args << "--no-spec" unless [:spec] Castkit::Generators::Contract.start(args) end |
#dataobject(name, *fields) ⇒ void
This method returns an undefined value.
Generates a new DataObject class.
40 41 42 43 44 |
# File 'lib/castkit/cli/generate.rb', line 40 def dataobject(name, *fields) args = [Castkit::Inflector.pascalize(name), fields] args << "--no-spec" unless [:spec] Castkit::Generators::DataObject.start(args) end |
#plugin(name, *fields) ⇒ void
This method returns an undefined value.
Generates a new plugin module.
53 54 55 56 57 |
# File 'lib/castkit/cli/generate.rb', line 53 def plugin(name, *fields) args = [Castkit::Inflector.pascalize(name), fields] args << "--no-spec" unless [:spec] Castkit::Generators::Plugin.start(args) end |
#serializer(name, *fields) ⇒ void
This method returns an undefined value.
Generates a new custom serializer class.
66 67 68 69 70 |
# File 'lib/castkit/cli/generate.rb', line 66 def serializer(name, *fields) args = [Castkit::Inflector.pascalize(name), fields] args << "--no-spec" unless [:spec] Castkit::Generators::Serializer.start(args) end |
#type(name) ⇒ void
This method returns an undefined value.
Generates a new custom type.
78 79 80 81 82 |
# File 'lib/castkit/cli/generate.rb', line 78 def type(name) args = [Castkit::Inflector.pascalize(name)] args << "--no-spec" unless [:spec] Castkit::Generators::Type.start(args) end |
#validator(name, *fields) ⇒ void
This method returns an undefined value.
Generates a new validator class.
91 92 93 94 95 |
# File 'lib/castkit/cli/generate.rb', line 91 def validator(name, *fields) args = [Castkit::Inflector.pascalize(name), fields] args << "--no-spec" unless [:spec] Castkit::Generators::Validator.start(args) end |