Class: SpecForge::CLI::New
Overview
Command for generating new blueprints or factories from templates
Creates workflow blueprints or test data factories with sensible defaults and realistic examples to get you started quickly.
Defined Under Namespace
Classes: Proxy
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#call ⇒ void
Creates a new blueprint or factory file from templates.
Methods inherited from Command
aliases, example, #initialize, option, register
Methods included from Actions
Constructor Details
This class inherits a constructor from SpecForge::CLI::Command
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Creates a new blueprint or factory file from templates
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/spec_forge/cli/new.rb', line 57 def call type = arguments.first&.downcase name = arguments.second if type.nil? || name.nil? puts "Error: Both type and name are required." puts "Usage: spec_forge new <type> <name>" puts "" puts "Examples:" puts " spec_forge new blueprint users" puts " spec_forge new factory user" exit(1) end # Clean up the name name = normalize_name(name) case type when "blueprint", "blueprints", "spec", "specs" create_new_blueprint(name) when "factory", "factories" create_new_factory(name) else puts "Error: Unknown type '#{type}'" puts "Valid types: blueprint, factory" exit(1) end end |