Class: Suspenders::AppGenerator
- Inherits:
-
Rails::Generators::AppGenerator
- Object
- Rails::Generators::AppGenerator
- Suspenders::AppGenerator
- Defined in:
- lib/suspenders/generators/app_generator.rb
Instance Method Summary collapse
- #configure_app ⇒ Object
- #copy_miscellaneous_files ⇒ Object
- #copy_project_markdown_files ⇒ Object
- #create_github_repo ⇒ Object
- #create_heroku_apps ⇒ Object
- #create_suspenders_views ⇒ Object
- #customize_error_pages ⇒ Object
- #customize_gemfile ⇒ Object
- #finish_template ⇒ Object
- #init_git ⇒ Object
- #initial_commit_and_branching ⇒ Object
-
#initialize(*args) ⇒ AppGenerator
constructor
A new instance of AppGenerator.
- #outro ⇒ Object
- #push_to_origin ⇒ Object
- #remove_routes_comment_lines ⇒ Object
- #run_autofixes ⇒ Object
- #run_setup ⇒ Object
- #setup_bundler_audit ⇒ Object
- #setup_css_framework ⇒ Object
- #setup_database ⇒ Object
- #setup_development_environment ⇒ Object
- #setup_git ⇒ Object
- #setup_gitignore ⇒ Object
- #setup_javascripts ⇒ Object
- #setup_production_environment ⇒ Object
- #setup_secret_token ⇒ Object
- #setup_segment ⇒ Object
- #setup_spring ⇒ Object
- #setup_staging_environment ⇒ Object
- #setup_stylesheets ⇒ Object
- #setup_test_environment ⇒ Object
- #suspenders_customization ⇒ Object
Constructor Details
#initialize(*args) ⇒ AppGenerator
Returns a new instance of AppGenerator.
36 37 38 39 40 41 42 |
# File 'lib/suspenders/generators/app_generator.rb', line 36 def initialize(*args) super if [:webpack] && `which yarn`.empty? raise Rails::Generators::Error, 'ERROR: yarn is required in order to use webpack' end end |
Instance Method Details
#configure_app ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/suspenders/generators/app_generator.rb', line 159 def configure_app say 'Configuring app' build :configure_action_mailer build :configure_active_job build :configure_time_formats build :configure_simple_form build :fix_i18n_deprecation_warning build :setup_default_rake_task build :configure_puma build :setup_foreman build :configure_airbrake build :configure_lib_directory end |
#copy_miscellaneous_files ⇒ Object
263 264 265 266 |
# File 'lib/suspenders/generators/app_generator.rb', line 263 def copy_miscellaneous_files say 'Copying miscellaneous support files' build :copy_miscellaneous_files end |
#copy_project_markdown_files ⇒ Object
79 80 81 82 |
# File 'lib/suspenders/generators/app_generator.rb', line 79 def copy_project_markdown_files build :readme build :pull_request_template end |
#create_github_repo ⇒ Object
233 234 235 236 237 238 |
# File 'lib/suspenders/generators/app_generator.rb', line 233 def create_github_repo if ![:skip_git] && [:github] say 'Creating Github repo' build :create_github_repo, [:github] end end |
#create_heroku_apps ⇒ Object
224 225 226 227 228 229 230 231 |
# File 'lib/suspenders/generators/app_generator.rb', line 224 def create_heroku_apps unless [:skip_heroku] say "Creating Heroku apps" build :create_heroku_apps, [:heroku_flags] build :set_heroku_serve_static_files build :set_heroku_rails_secrets end end |
#create_suspenders_views ⇒ Object
151 152 153 154 155 156 157 |
# File 'lib/suspenders/generators/app_generator.rb', line 151 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_pages ⇒ Object
268 269 270 271 |
# File 'lib/suspenders/generators/app_generator.rb', line 268 def customize_error_pages say 'Customizing the 500/404/422 pages' build :customize_error_pages end |
#customize_gemfile ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/suspenders/generators/app_generator.rb', line 84 def customize_gemfile build :replace_gemfile build :set_ruby_to_version_being_used build :add_webpacker if [:webpack] unless [:skip_heroku] build :setup_heroku_specific_gems end bundle_command 'install' build :version_gems_in_gemfile end |
#finish_template ⇒ Object
44 45 46 47 |
# File 'lib/suspenders/generators/app_generator.rb', line 44 def finish_template invoke :suspenders_customization super end |
#init_git ⇒ Object
259 260 261 |
# File 'lib/suspenders/generators/app_generator.rb', line 259 def init_git build :init_git end |
#initial_commit_and_branching ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/suspenders/generators/app_generator.rb', line 209 def initial_commit_and_branching if ![:skip_git] say 'Creating initial commit and branches' build :create_initial_commit build :setup_deployment_environment_branches end end |
#outro ⇒ Object
288 289 290 291 |
# File 'lib/suspenders/generators/app_generator.rb', line 288 def outro say 'Congratulations! You just pulled our suspenders.' say 'Remember to update the README with specifics for your project.' end |
#push_to_origin ⇒ Object
217 218 219 220 221 222 |
# File 'lib/suspenders/generators/app_generator.rb', line 217 def push_to_origin if ![:skip_git] && [:origin] say 'Pushing to origin remote' build :setup_and_push_to_origin_remote, [:origin] end end |
#remove_routes_comment_lines ⇒ Object
273 274 275 |
# File 'lib/suspenders/generators/app_generator.rb', line 273 def remove_routes_comment_lines build :remove_routes_comment_lines end |
#run_autofixes ⇒ Object
204 205 206 207 |
# File 'lib/suspenders/generators/app_generator.rb', line 204 def run_autofixes say 'Running rubocop and i18n autofixes' build :run_autofixes end |
#run_setup ⇒ Object
277 278 279 280 281 282 283 284 285 286 |
# File 'lib/suspenders/generators/app_generator.rb', line 277 def run_setup build :copy_env_example if [:webpack] build :inject_webpacker_into_setup build :run_bin_setup build :run_webpacker_install else build :run_bin_setup end end |
#setup_bundler_audit ⇒ Object
249 250 251 252 |
# File 'lib/suspenders/generators/app_generator.rb', line 249 def setup_bundler_audit say "Setting up bundler-audit" build :setup_bundler_audit end |
#setup_css_framework ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/suspenders/generators/app_generator.rb', line 184 def setup_css_framework if [:css_framework] say "Installing #{[:css_framework]}" case [:css_framework] when 'bourbon_n_friends' then build :install_bourbon_n_friends when 'bootstrap' then build :install_bootstrap when 'foundation' then build :install_foundation else say "Unrecognized Css Framework" end end end |
#setup_database ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/suspenders/generators/app_generator.rb', line 98 def setup_database say 'Setting up database' if 'postgresql' == [:database] build :use_postgres_config_template end build :create_database end |
#setup_development_environment ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/suspenders/generators/app_generator.rb', line 108 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 build :configure_quiet_assets end |
#setup_git ⇒ Object
196 197 198 199 200 201 202 |
# File 'lib/suspenders/generators/app_generator.rb', line 196 def setup_git if ![:skip_git] say 'Initializing git' invoke :setup_gitignore invoke :init_git end end |
#setup_gitignore ⇒ Object
245 246 247 |
# File 'lib/suspenders/generators/app_generator.rb', line 245 def setup_gitignore build :gitignore_files end |
#setup_javascripts ⇒ Object
178 179 180 181 182 |
# File 'lib/suspenders/generators/app_generator.rb', line 178 def setup_javascripts say 'Set up javascript' build :setup_javascripts build :inject_webpacker_into_layout if [:webpack] end |
#setup_production_environment ⇒ Object
131 132 133 134 135 136 137 138 139 |
# File 'lib/suspenders/generators/app_generator.rb', line 131 def setup_production_environment say 'Setting up the production environment' build :configure_newrelic build :configure_smtp build :enable_rack_canonical_host build :configure_production_log_level build :enable_rack_deflater build :setup_asset_host end |
#setup_secret_token ⇒ Object
146 147 148 149 |
# File 'lib/suspenders/generators/app_generator.rb', line 146 def setup_secret_token say 'Moving secret token out of version control' build :setup_secret_token end |
#setup_segment ⇒ Object
240 241 242 243 |
# File 'lib/suspenders/generators/app_generator.rb', line 240 def setup_segment say 'Setting up Segment' build :setup_segment end |
#setup_spring ⇒ Object
254 255 256 257 |
# File 'lib/suspenders/generators/app_generator.rb', line 254 def setup_spring say "Springifying binstubs" build :setup_spring end |
#setup_staging_environment ⇒ Object
141 142 143 144 |
# File 'lib/suspenders/generators/app_generator.rb', line 141 def setup_staging_environment say 'Setting up the staging environment' build :setup_staging_environment end |
#setup_stylesheets ⇒ Object
173 174 175 176 |
# File 'lib/suspenders/generators/app_generator.rb', line 173 def setup_stylesheets say 'Set up stylesheets' build :setup_stylesheets end |
#setup_test_environment ⇒ Object
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/suspenders/generators/app_generator.rb', line 120 def setup_test_environment say 'Setting up the test environment' 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_customization ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/suspenders/generators/app_generator.rb', line 49 def suspenders_customization invoke :copy_project_markdown_files 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_setup invoke :run_autofixes invoke :initial_commit_and_branching invoke :push_to_origin invoke :setup_css_framework invoke :outro end |