Class: Schienenzeppelin::AppGenerator

Inherits:
Rails::Generators::AppGenerator
  • Object
show all
Includes:
GeneratorUtils
Defined in:
lib/schienenzeppelin/app_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GeneratorUtils

included

Constructor Details

#initialize(*args) ⇒ AppGenerator

Returns a new instance of AppGenerator.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/schienenzeppelin/app_generator.rb', line 12

def initialize(*args)
  super

  return unless options[:api]

  self.options = options.merge(
    skip_errors: true,
    skip_high_voltage: true,
    skip_stimulus: true,
    skip_tailwind: true,
    skip_views: true
  ).freeze
end

Class Method Details



77
78
79
# File 'lib/schienenzeppelin/app_generator.rb', line 77

def self.banner
  "sz new #{arguments.map(&:usage).join(' ')} [options]"
end

Instance Method Details

#after_installObject



62
63
64
65
66
# File 'lib/schienenzeppelin/app_generator.rb', line 62

def after_install
  add(:tailwind, :stimulus, :stimulus_components)
  add(:devise)
  add(:capistrano)
end

#create_root_filesObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/schienenzeppelin/app_generator.rb', line 26

def create_root_files
  super

  add(:irbrc)
  add(:foreman)
  add(:dotenv)
  add(:docker)
  add(:docker_compose)
  add(:rubocop)
end

#create_test_filesObject



37
38
39
40
41
42
43
# File 'lib/schienenzeppelin/app_generator.rb', line 37

def create_test_files
  return if options[:skip_test]

  super if options[:testing_framework] == 'minitest'

  add(:rspec) if options[:testing_framework] == 'rspec'
end

#finish_templateObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/schienenzeppelin/app_generator.rb', line 45

def finish_template
  super
  # These require the presence of config/controllers, so they must be done after everything else
  add(:annotate)
  add(:continuous_integration)
  add(:high_voltage)
  add(:generators)
  add(:lograge)
  add(:pundit)
  add(:services)
  add(:sidekiq)
  add(:views, :errors, :scaffold)

  add(:factory_bot)
  add(:shoulda)
end