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



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/suspenders/generators/app_generator.rb', line 122

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_time_zone
  build :configure_time_formats
  build :configure_rack_timeout
  build :disable_xml_params
  build :fix_i18n_deprecation_warning
  build :setup_default_rake_task
  build :configure_unicorn
  build :setup_foreman
end

#copy_miscellaneous_filesObject



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

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

#create_github_repoObject



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

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



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

def create_heroku_apps
  if options[:heroku]
    say 'Creating Heroku apps'
    build :create_heroku_apps
    build :set_heroku_remotes
    build :set_heroku_rails_secrets
  end
end

#create_suspenders_viewsObject



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

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



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

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

#customize_gemfileObject



46
47
48
49
50
51
52
53
54
55
# File 'lib/suspenders/generators/app_generator.rb', line 46

def customize_gemfile
  build :replace_gemfile
  build :set_ruby_to_version_being_used

  if options[:heroku]
    build :setup_heroku_specific_gems
  end

  bundle_command 'install'
end

#finish_templateObject



18
19
20
21
# File 'lib/suspenders/generators/app_generator.rb', line 18

def finish_template
  invoke :suspenders_customization
  super
end

#init_gitObject



178
179
180
# File 'lib/suspenders/generators/app_generator.rb', line 178

def init_git
  build :init_git
end

#install_bittersObject



140
141
142
143
# File 'lib/suspenders/generators/app_generator.rb', line 140

def install_bitters
  say 'Install Bitters'
  build :install_bitters
end

#outroObject



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

def outro
  say 'Congratulations! You just pulled our suspenders.'
  say "Remember to run 'rails generate airbrake' with your API key."
end

#remove_routes_comment_linesObject



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

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



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

def run_bundle
  # Let's not: We'll bundle manually at the right spot
end

#setup_coffeescriptObject



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

def setup_coffeescript
  say 'Setting up CoffeeScript defaults'
  build :remove_turbolinks
end

#setup_databaseObject



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

def setup_database
  say 'Setting up database'

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

  build :create_database
end

#setup_development_environmentObject



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

def setup_development_environment
  say 'Setting up the development environment'
  build :raise_on_delivery_errors
  build :raise_on_unpermitted_parameters
  build :provide_setup_script
  build :provide_dev_prime_task
  build :configure_generators
  build :configure_i18n_for_missing_translations
end

#setup_gitObject



145
146
147
148
149
150
151
# File 'lib/suspenders/generators/app_generator.rb', line 145

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

#setup_gitignoreObject



174
175
176
# File 'lib/suspenders/generators/app_generator.rb', line 174

def setup_gitignore
  build :gitignore_files
end

#setup_production_environmentObject



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

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

#setup_secret_tokenObject



104
105
106
107
# File 'lib/suspenders/generators/app_generator.rb', line 104

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

#setup_segment_ioObject



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

def setup_segment_io
  say 'Setting up Segment.io'
  build :setup_segment_io
end

#setup_staging_environmentObject



99
100
101
102
# File 'lib/suspenders/generators/app_generator.rb', line 99

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

#setup_stylesheetsObject



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

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

#setup_test_environmentObject



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

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

#suspenders_customizationObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/suspenders/generators/app_generator.rb', line 23

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 :setup_coffeescript
  invoke :configure_app
  invoke :setup_stylesheets
  invoke :install_bitters
  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_io
  invoke :outro
end