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



130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/suspenders/generators/app_generator.rb', line 130

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_active_job
  build :configure_time_formats
  build :configure_simple_form
  build :disable_xml_params
  build :fix_i18n_deprecation_warning
  build :setup_default_rake_task
  build :configure_unicorn
  build :setup_foreman
  build :configure_airbrake
end

#copy_miscellaneous_filesObject



216
217
218
219
# File 'lib/suspenders/generators/app_generator.rb', line 216

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

#create_github_repoObject



186
187
188
189
190
191
# File 'lib/suspenders/generators/app_generator.rb', line 186

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



177
178
179
180
181
182
183
184
# File 'lib/suspenders/generators/app_generator.rb', line 177

def create_heroku_apps
  unless options[:skip_heroku]
    say "Creating Heroku apps"
    build :create_heroku_apps, options[:heroku_flags]
    build :set_heroku_serve_static_files
    build :set_heroku_rails_secrets
  end
end

#create_suspenders_viewsObject



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

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



221
222
223
224
# File 'lib/suspenders/generators/app_generator.rb', line 221

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

#customize_gemfileObject



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

def customize_gemfile
  build :replace_gemfile
  build :set_ruby_to_version_being_used

  unless options[:skip_heroku]
    build :setup_heroku_specific_gems
  end

  bundle_command 'install'

  build :version_gems_in_gemfile
end

#finish_templateObject



24
25
26
27
# File 'lib/suspenders/generators/app_generator.rb', line 24

def finish_template
  invoke :suspenders_customization
  super
end

#init_gitObject



212
213
214
# File 'lib/suspenders/generators/app_generator.rb', line 212

def init_git
  build :init_git
end

#initial_commit_and_branchingObject



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

def initial_commit_and_branching
  if !options[:skip_git]
    say 'Creating initial commit and branches'
    build :create_initial_commit
    build :setup_deployment_environment_branches
  end
end

#outroObject



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

def outro
  say 'Congratulations! You just pulled our suspenders.'
  say 'Remember to update the README with specifics for your project.'
end

#push_to_originObject



170
171
172
173
174
175
# File 'lib/suspenders/generators/app_generator.rb', line 170

def push_to_origin
  if !options[:skip_git] && options[:origin]
    say 'Pushing to origin remote'
    build :setup_and_push_to_origin_remote, options[:origin]
  end
end

#remove_routes_comment_linesObject



226
227
228
# File 'lib/suspenders/generators/app_generator.rb', line 226

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_stairsObject



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

def run_stairs
  build :run_stairs
end

#setup_bundler_auditObject



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

def setup_bundler_audit
  say "Setting up bundler-audit"
  build :setup_bundler_audit
end

#setup_databaseObject



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

def setup_database
  say 'Setting up database'

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

  build :create_database
end

#setup_development_environmentObject



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

def setup_development_environment
  say 'Setting up the development environment'
  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_rubocop
end

#setup_gitObject



154
155
156
157
158
159
160
# File 'lib/suspenders/generators/app_generator.rb', line 154

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

#setup_gitignoreObject



198
199
200
# File 'lib/suspenders/generators/app_generator.rb', line 198

def setup_gitignore
  build :gitignore_files
end

#setup_javascriptsObject



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

def setup_javascripts
  say 'Set up javascripts'
  build :setup_javascripts
end

#setup_production_environmentObject



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

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

#setup_secret_tokenObject



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

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

#setup_segmentObject



193
194
195
196
# File 'lib/suspenders/generators/app_generator.rb', line 193

def setup_segment
  say 'Setting up Segment'
  build :setup_segment
end

#setup_springObject



207
208
209
210
# File 'lib/suspenders/generators/app_generator.rb', line 207

def setup_spring
  say "Springifying binstubs"
  build :setup_spring
end

#setup_staging_environmentObject



112
113
114
115
# File 'lib/suspenders/generators/app_generator.rb', line 112

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

#setup_stylesheetsObject



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

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

#setup_test_environmentObject



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/suspenders/generators/app_generator.rb', line 90

def setup_test_environment
  say 'Setting up the test environment'
  build :set_up_factory_girl_for_rspec
  build :generate_rspec
  build :configure_rspec
  build :enable_database_cleaner
  build :configure_spec_support_features
  build :configure_i18n_for_test_environment
  build :configure_i18n_tasks
  build :configure_action_mailer_in_specs
end

#suspenders_customizationObject



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

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 :setup_javascripts
  invoke :copy_miscellaneous_files
  invoke :customize_error_pages
  invoke :remove_routes_comment_lines
  invoke :setup_git
  invoke :setup_database
  invoke :create_heroku_apps
  invoke :create_github_repo
  invoke :setup_segment
  invoke :setup_bundler_audit
  invoke :setup_spring
  invoke :run_stairs
  invoke :initial_commit_and_branching
  invoke :push_to_origin
  invoke :outro
end