Class: Docwright::Generators::ManualGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/docwright/generators/manual_generator.rb

Constant Summary collapse

TEMPLATES =
{
  "overview.md" => <<~MD,
  "business_rules.md" => <<~MD,
  "setup.md" => <<~MD,
  "architecture.md" => <<~MD,
  "deployment.md" => <<~MD,
  "security.md" => <<~MD,
  "troubleshooting.md" => <<~MD,
  "changelog.md" => <<~MD,
  "readme.md" => <<~MD
    # [App Name]

    ## Overview
    <!-- Brief description of the application -->

    ## Quick start
    <!-- Fastest way to get the app running locally -->

    ## Documentation
    <!-- Link to or summarize key documentation -->
  MD
}.freeze

Instance Method Summary collapse

Instance Method Details

#generateObject



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/docwright/generators/manual_generator.rb', line 111

def generate
  FileUtils.mkdir_p("docs")
  TEMPLATES.each do |filename, content|
    path = "docs/#{filename}"
    if File.exist?(path)
      puts "DocWright: skipped #{path} (already exists)"
    else
      File.write(path, content)
      puts "DocWright: wrote #{path}"
    end
  end
end

#generate_single(path, filename) ⇒ Object



124
125
126
127
128
129
130
131
132
# File 'lib/docwright/generators/manual_generator.rb', line 124

def generate_single(path, filename)
  return if File.exist?(path)

  content = TEMPLATES[filename]
  return unless content

  FileUtils.mkdir_p(File.dirname(path))
  File.write(path, content)
end