Class: Nova::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/nova/generator.rb

Constant Summary collapse

FILES =

Flat structure for all template files Each entry contains:

  • path: relative path where the file should be created

  • template: name of the template file to use (nil for directories)

  • type: optional type for special handling (e.g., ‘prefixed_example’)

[
  # Main README
  { path: 'shape/README.md', template: 'readme_template.md' },
  
  # 1_big-picture section
  { path: 'shape/1_big-picture', template: nil }, # directory
  { path: 'shape/1_big-picture/README.md', template: 'big_picture_readme_template.md' },
  { path: 'shape/1_big-picture/prd_example.md', template: 'prd_example_template.md' },
  { path: 'shape/1_big-picture/flowchart.md', template: 'flowchart_template.md' },
  
  # 2_user-stories section
  { path: 'shape/2_user-stories', template: nil }, # directory
  { path: 'shape/2_user-stories/README.md', template: 'user_stories_readme_template.md' },
  { path: 'shape/2_user-stories/example.md', template: 'user_story_example.md' },
  
  # 3_design-system section
  { path: 'shape/3_design-system', template: nil }, # directory
  { path: 'shape/3_design-system/README.md', template: 'design_system_readme_template.md' },
  { path: 'shape/3_design-system/design_decisions.md', template: 'design_decisions_example.md' },
  
  # 4_prompts section
  { path: 'shape/4_prompts', template: nil }, # directory
  { path: 'shape/4_prompts/README.md', template: 'prompts_readme_template.md' },
  { path: 'shape/4_prompts/01_generate_app.md', template: 'prompts_examples/01_generate_app.md' },
  { path: 'shape/4_prompts/02_generate_styleguide.md', template: 'prompts_examples/02_generate_styleguide.md' },
  { path: 'shape/4_prompts/03_generate_static_pages.md', template: 'prompts_examples/03_generate_static_pages.md' },
  { path: 'shape/4_prompts/04_authentication_feature.md', template: 'prompts_examples/04_authentication_feature.md' },
  
  # Code directory
  { path: 'code', template: nil } # directory
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name) ⇒ Generator

Returns a new instance of Generator.



45
46
47
# File 'lib/nova/generator.rb', line 45

def initialize(app_name)
  @app_name = app_name
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



6
7
8
# File 'lib/nova/generator.rb', line 6

def app_name
  @app_name
end

Instance Method Details

#generateObject



49
50
51
52
53
54
55
# File 'lib/nova/generator.rb', line 49

def generate
  create_main_directories
  create_all_files_and_directories
  create_windsurfrules_file
  create_cursorcontext_file
  display_success_message
end