Class: Suspenders::AppGenerator

Inherits:
Rails::Generators::AppGenerator
  • Object
show all
Defined in:
lib/suspenders/generators/app_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



196
197
198
# File 'lib/suspenders/generators/app_generator.rb', line 196

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

Instance Method Details

#configure_appObject



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/suspenders/generators/app_generator.rb', line 101

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_locales_and_time_zone
  build :configure_time_formats
  build :configure_sourcemaps_for_sass
  build :setup_rakefile
  build :replace_default_puma_configuration
  build :set_up_forego
  build :setup_rack_mini_profiler
end

#copy_miscellaneous_filesObject



138
139
140
141
# File 'lib/suspenders/generators/app_generator.rb', line 138

def copy_miscellaneous_files
  say 'Copying miscellaneous support files'
  build :copy_miscellaneous_files
end

#create_heroku_appsObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/suspenders/generators/app_generator.rb', line 113

def create_heroku_apps
  if options[:heroku]
    say "Creating Heroku apps"
    build :create_heroku_apps, options[:heroku_flags]
    build :set_heroku_remotes
    build :set_heroku_rails_secrets
    build :set_heroku_application_host
    build :set_heroku_auto_migrate
    build :set_heroku_backup_schedule
    build :set_heroku_sentry_configuration
    build :set_heroku_smtp_settings
    build :set_heroku_buildpacks
    build :create_heroku_pipeline
    build :configure_automatic_deployment
  end
end

#customize_error_pagesObject



143
144
145
146
# File 'lib/suspenders/generators/app_generator.rb', line 143

def customize_error_pages
  say 'Customizing the 500/404/422 pages'
  build :customize_error_pages
end

#customize_gemfileObject



60
61
62
63
64
# File 'lib/suspenders/generators/app_generator.rb', line 60

def customize_gemfile
  build :replace_gemfile, options[:path]
  bundle_command 'install'
  bundle_command 'binstubs bundler --force'
end

#finish_templateObject



38
39
40
41
# File 'lib/suspenders/generators/app_generator.rb', line 38

def finish_template
  invoke :suspenders_customization
  super
end

#generate_autoprefixerObject



185
186
187
# File 'lib/suspenders/generators/app_generator.rb', line 185

def generate_autoprefixer
  generate("suspenders:autoprefixer")
end

#generate_defaultObject



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/suspenders/generators/app_generator.rb', line 152

def generate_default
  generate("suspenders:json")
  generate("suspenders:static")
  generate("suspenders:stylesheet_base")
  generate("suspenders:testing")
  generate("suspenders:ci")
  generate("suspenders:js_driver")
  generate("suspenders:db_optimizations")
  generate("suspenders:factories")
  generate("suspenders:lint")
  generate("suspenders:stylelint")
  generate("suspenders:decorator")
  generate("suspenders:faker")
  generate("suspenders:security")
  generate("suspenders:import_dump")
  generate("suspenders:jobs")
  generate("suspenders:inline_svg")
end

#generate_deployment_defaultObject



171
172
173
174
175
176
177
178
179
# File 'lib/suspenders/generators/app_generator.rb', line 171

def generate_deployment_default
  generate("suspenders:staging:pull_requests")
  generate("suspenders:production:force_tls")
  generate("suspenders:production:email")
  generate("suspenders:production:timeout")
  generate("suspenders:production:error_reporting")
  generate("suspenders:production:deployment")
  generate("suspenders:production:manifest")
end

#generate_outroObject



189
190
191
192
193
194
# File 'lib/suspenders/generators/app_generator.rb', line 189

def generate_outro
  build :run_rubocop_autocorrect

  say "Congratulations! You just pulled our suspenders."
  say "Read README.md!"
end

#generate_viewsObject



181
182
183
# File 'lib/suspenders/generators/app_generator.rb', line 181

def generate_views
  generate("suspenders:views")
end

#remove_config_comment_linesObject



148
149
150
# File 'lib/suspenders/generators/app_generator.rb', line 148

def remove_config_comment_lines
  build :remove_config_comment_lines
end

#setup_databaseObject



66
67
68
69
70
71
72
73
74
# File 'lib/suspenders/generators/app_generator.rb', line 66

def setup_database
  say 'Setting up database'

  if 'postgresql' == options[:database]
    build :use_postgres_config_template
  end

  build :create_database
end

#setup_default_directoriesObject



134
135
136
# File 'lib/suspenders/generators/app_generator.rb', line 134

def setup_default_directories
  build :setup_default_directories
end

#setup_development_environmentObject



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/suspenders/generators/app_generator.rb', line 76

def setup_development_environment
  say 'Setting up the development environment'
  build :configure_local_mail
  build :raise_on_missing_assets_in_test
  build :raise_on_delivery_errors
  build :set_test_delivery_method
  build :raise_on_unpermitted_parameters
  build :provide_setup_script
  build :configure_generators
  build :configure_i18n_for_missing_translations
  build :configure_quiet_assets
end

#setup_dotfilesObject



130
131
132
# File 'lib/suspenders/generators/app_generator.rb', line 130

def setup_dotfiles
  build :copy_dotfiles
end

#setup_production_environmentObject



89
90
91
92
93
94
# File 'lib/suspenders/generators/app_generator.rb', line 89

def setup_production_environment
  say 'Setting up the production environment'
  build :enable_rack_canonical_host
  build :enable_rack_deflater
  build :setup_asset_host
end

#setup_secret_tokenObject



96
97
98
99
# File 'lib/suspenders/generators/app_generator.rb', line 96

def setup_secret_token
  say 'Moving secret token out of version control'
  build :setup_secret_token
end

#suspenders_customizationObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/suspenders/generators/app_generator.rb', line 43

def suspenders_customization
  invoke :customize_gemfile
  invoke :setup_development_environment
  invoke :setup_production_environment
  invoke :setup_secret_token
  invoke :configure_app
  invoke :copy_miscellaneous_files
  invoke :customize_error_pages
  invoke :setup_dotfiles
  invoke :setup_database
  invoke :generate_default
  invoke :setup_default_directories
  invoke :create_heroku_apps
  invoke :generate_deployment_default
  invoke :remove_config_comment_lines
end