Class: Makit::Cli::Generators::GeneratorFactory
- Inherits:
-
Object
- Object
- Makit::Cli::Generators::GeneratorFactory
- Defined in:
- lib/makit/cli/generators/generator_factory.rb
Overview
Factory class for creating appropriate generator instances based on project type
Constant Summary collapse
- GENERATORS =
Mapping of project types to their corresponding generator classes
{ "gem" => RubyGenerator, "crate" => RustGenerator, "nuget" => DotnetGenerator, "dotnet" => DotnetGenerator, "node" => NodeGenerator, }.freeze
Class Method Summary collapse
-
.available_types ⇒ Array<String>
Get list of available project types.
-
.create(type, name, options = {}) ⇒ BaseGenerator
Create a generator instance for the specified project type.
Class Method Details
.available_types ⇒ Array<String>
Get list of available project types
43 44 45 |
# File 'lib/makit/cli/generators/generator_factory.rb', line 43 def self.available_types GENERATORS.keys end |
.create(type, name, options = {}) ⇒ BaseGenerator
Create a generator instance for the specified project type
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/makit/cli/generators/generator_factory.rb', line 29 def self.create(type, name, = {}) generator_class = GENERATORS[type.downcase] unless generator_class available_types = GENERATORS.keys.join(", ") raise ArgumentError, "Unknown project type '#{type}'. Available types: #{available_types}" end generator_class.new(name, ) end |