Class: Typstify::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/typstify/install/install_generator.rb

Overview

rails g typstify:install

Drops in the initializer and the shared branding partial every starter template imports.

Instance Method Summary collapse

Instance Method Details

#create_brandingObject



20
21
22
23
# File 'lib/generators/typstify/install/install_generator.rb', line 20

def create_branding
  copy_file Typstify.template_pack_path.join("shared", "branding.typ").to_s,
            "app/views/shared/branding.typ"
end

#create_initializerObject



16
17
18
# File 'lib/generators/typstify/install/install_generator.rb', line 16

def create_initializer
  template "typstify.rb", "config/initializers/typstify.rb"
end

#reportObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/typstify/install/install_generator.rb', line 25

def report
  say ""
  say "Typstify installed.", :green
  say ""
  say "  Next:  rails g typstify:template invoice"
  say "         rake typstify:preview[invoices/show]"
  say ""
  say "  Fonts: templates use Inter, which ships with the gem. To use your own,"
  say "         vendor the files and set c.font_paths in the initializer."
  say "         See https://github.com/TheSoloHacker47/typstify/blob/main/docs/fonts-and-docker.md"
  say ""
end