Class: Suspenders::AppGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_appObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/suspenders/generators/app_generator.rb', line 143

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_locales
  build :configure_active_job
  build :configure_rack_timeout
  build :configure_time_formats
  build :configure_slim
  build :disable_xml_params
  build :configure_available_locales
  build :fix_i18n_deprecation_warning
  build :setup_default_rake_task
  build :configure_puma
  build :setup_foreman
end

#copy_miscellaneous_filesObject



223
224
225
226
# File 'lib/suspenders/generators/app_generator.rb', line 223

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

#create_binstubsObject



214
215
216
217
# File 'lib/suspenders/generators/app_generator.rb', line 214

def create_binstubs
  say "Create binstubs"
  build :create_binstubs
end

#create_github_repoObject



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

def create_github_repo
  if !options[:skip_git] && options[:github]
    say 'Creating Github repo'
    build :create_github_repo, options[:github]
  end
end

#create_heroku_appsObject



182
183
184
185
186
187
188
189
190
191
192
# File 'lib/suspenders/generators/app_generator.rb', line 182

def create_heroku_apps
  if options[:heroku]
    say "Creating Heroku apps"
    build :create_heroku_apps, options[:heroku_flags]
    build :set_heroku_serve_static_files
    build :set_heroku_remotes
    build :set_heroku_rails_secrets
    build :provide_deploy_script
    build :configure_automatic_deployment
  end
end

#create_suspenders_viewsObject



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

def create_suspenders_views
  say 'Creating suspenders views'
  build :create_partials_directory
  build :create_shared_flashes
  build :create_shared_javascripts
  build :create_application_layout
end

#customize_error_pagesObject



228
229
230
231
# File 'lib/suspenders/generators/app_generator.rb', line 228

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

#customize_gemfileObject



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/suspenders/generators/app_generator.rb', line 58

def customize_gemfile
  build :replace_gemfile
  build :create_ruby_gemset_file
  build :configure_simple_form
  build :set_ruby_to_version_being_used

  if options[:heroku]
    build :setup_heroku_specific_gems
  end

  bundle_command 'install'
end

#finish_templateObject



27
28
29
30
# File 'lib/suspenders/generators/app_generator.rb', line 27

def finish_template
  invoke :suspenders_customization
  super
end

#init_gitObject



219
220
221
# File 'lib/suspenders/generators/app_generator.rb', line 219

def init_git
  build :init_git
end

#install_bittersObject



164
165
166
167
# File 'lib/suspenders/generators/app_generator.rb', line 164

def install_bitters
  say 'Install Bitters'
  build :install_bitters
end

#install_refillsObject



169
170
171
172
# File 'lib/suspenders/generators/app_generator.rb', line 169

def install_refills
  say "Install Refills"
  build :install_refills
end

#outroObject



241
242
243
244
# File 'lib/suspenders/generators/app_generator.rb', line 241

def outro
  say "Congratulations!"
  say "Remember to run 'bin/setup' and configure errbit"
end

#remove_config_comment_linesObject



233
234
235
# File 'lib/suspenders/generators/app_generator.rb', line 233

def remove_config_comment_lines
  build :remove_config_comment_lines
end

#remove_routes_comment_linesObject



237
238
239
# File 'lib/suspenders/generators/app_generator.rb', line 237

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#setup_databaseObject



71
72
73
74
75
76
77
78
79
# File 'lib/suspenders/generators/app_generator.rb', line 71

def setup_database
  say 'Setting up database'

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

  build :create_database
end

#setup_development_environmentObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/suspenders/generators/app_generator.rb', line 81

def setup_development_environment
  say 'Setting up the development environment'
  build :raise_on_delivery_errors
  build :configure_letter_opener
  build :configure_bullet
  build :raise_on_unpermitted_parameters
  build :provide_setup_script
  build :provide_dev_prime_task
  build :configure_generators
  build :configure_i18n_for_missing_translations
  build :configure_quiet_assets
  build :setup_rubocop
  build :setup_brakeman
  build :setup_bundler_audit
end

#setup_dotfilesObject



201
202
203
# File 'lib/suspenders/generators/app_generator.rb', line 201

def setup_dotfiles
  build :copy_dotfiles
end

#setup_gitObject



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

def setup_git
  if !options[:skip_git]
    say 'Initializing git'
    invoke :setup_gitignore
    invoke :init_git
  end
end

#setup_gitignoreObject



205
206
207
# File 'lib/suspenders/generators/app_generator.rb', line 205

def setup_gitignore
  build :gitignore_files
end

#setup_production_environmentObject



116
117
118
119
120
121
122
123
# File 'lib/suspenders/generators/app_generator.rb', line 116

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

#setup_secret_tokenObject



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

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

#setup_springObject



209
210
211
212
# File 'lib/suspenders/generators/app_generator.rb', line 209

def setup_spring
  say "Springifying binstubs"
  build :setup_spring
end

#setup_staging_environmentObject



125
126
127
128
# File 'lib/suspenders/generators/app_generator.rb', line 125

def setup_staging_environment
  say 'Setting up the staging environment'
  build :setup_staging_environment
end

#setup_stylesheetsObject



159
160
161
162
# File 'lib/suspenders/generators/app_generator.rb', line 159

def setup_stylesheets
  say 'Set up stylesheets'
  build :setup_stylesheets
end

#setup_test_environmentObject



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/suspenders/generators/app_generator.rb', line 97

def setup_test_environment
  say 'Setting up the test environment'
  build :set_up_factory_girl_for_rspec
  build :add_helpers_for_rspec
  build :generate_factories_file
  build :generate_rspec
  build :configure_rspec
  build :configure_background_jobs_for_rspec
  build :enable_database_cleaner
  build :provide_shoulda_matchers_config
  build :configure_spec_support_features
  build :configure_ci
  build :configure_i18n_for_test_environment
  build :configure_i18n_tasks
  build :configure_action_mailer_in_specs
  build :set_up_faker
  build :configure_capybara_webkit
end

#suspenders_customizationObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/suspenders/generators/app_generator.rb', line 32

def suspenders_customization
  invoke :customize_gemfile
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_production_environment
  invoke :setup_staging_environment
  invoke :setup_secret_token
  invoke :create_suspenders_views
  invoke :configure_app
  invoke :setup_stylesheets
  invoke :install_bitters
  invoke :install_refills
  invoke :copy_miscellaneous_files
  invoke :customize_error_pages
  invoke :remove_config_comment_lines
  invoke :remove_routes_comment_lines
  invoke :setup_dotfiles
  invoke :setup_git
  invoke :setup_database
  invoke :create_heroku_apps
  invoke :create_github_repo
  invoke :setup_spring
  invoke :create_binstubs
  invoke :outro
end