Class: Scrapbook::NewGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/scrapbook/new_generator.rb

Overview

A generator to create a new scrapbook at either the default (scrapbook) or specified path from the Rails application root.

Instance Method Summary collapse

Instance Method Details

#newObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/scrapbook/new_generator.rb', line 11

def new
  create_file("#{name}/pages/.keep")

  # TODO: Investigate using hooks to default to ERB, but allow templates to overwrite
  create_file("#{name}/pages.html.erb",
    <<~HTML
      <h1>Welcome to Scrapbook</h1>
      <p>Feel free to customize this page and add more folders and pages to your Scrapbook</p>
    HTML
  )
end