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’)

[
  # Legacy support file
  { path: '.windsurfrules', template: 'windsurfrules_template.txt' },
  
  # Cursor rules directory and file
  { path: '.cursor', template: nil }, # directory
  { path: '.cursor/rules', template: nil }, # directory
  { path: '.cursor/rules/nova.mdc', template: 'nova.mdc' },
  
  # 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/prd_example.md', template: 'prd_example_template.md' },
  { path: 'shape/1_big-picture/flowchart_example.md', template: 'flowchart_example_template.md' },
  
  # 2_user-stories section
  { path: 'shape/2_user-stories', template: nil }, # directory
  { 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/example.md', template: 'design_decisions_example.md' },
  
  # 4_tasks section
  { path: 'shape/4_tasks', template: nil }, # directory
  { path: 'shape/4_tasks/1_generate_application.md', template: 'tasks_examples/1_generate_application.md' },
  { path: 'shape/4_tasks/2_generate_static_pages.md', template: 'tasks_examples/2_generate_static_pages.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.



47
48
49
# File 'lib/nova/generator.rb', line 47

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



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

def generate
  create_main_directories
  create_all_files_and_directories
  display_success_message
end