Sha256: 204937df157255e632145eedc0190062cf8cd19ea17af54213ec390478b732e0

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

module Scrapbook
  # A generator to create a new scrapbook at either the default (scrapbook) or specified
  # path from the Rails application root.
  class NewGenerator < Rails::Generators::Base
    argument :name, optional: true, default: 'scrapbook'

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scrapbook-0.3.2 lib/generators/scrapbook/new_generator.rb
scrapbook-0.3.1 lib/generators/scrapbook/new_generator.rb
scrapbook-0.3.0 lib/generators/scrapbook/new_generator.rb
scrapbook-0.2.2 lib/generators/scrapbook/new_generator.rb
scrapbook-0.2.1 lib/generators/scrapbook/new_generator.rb
scrapbook-0.2.0 lib/generators/scrapbook/new_generator.rb