Class: Onotole::AppGenerator
- Inherits:
-
Rails::Generators::AppGenerator
- Object
- Rails::Generators::AppGenerator
- Onotole::AppGenerator
- Defined in:
- lib/onotole/generators/app_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bundleinstall ⇒ Object
-
#configure_app ⇒ Object
def create_onotole_views say ‘Creating onotole views’ build :create_partials_directory build :create_shared_flashes build :create_shared_javascripts build :create_application_layout end.
-
#copy_miscellaneous_files ⇒ Object
def bundler_stubs_install say ‘Bundler stubs install’ build :rvm_bundler_stubs_install end.
- #create_github_repo ⇒ Object
- #create_heroku_apps ⇒ Object
- #custom_gems_setup ⇒ Object
- #customize_error_pages ⇒ Object
- #customize_gemfile ⇒ Object
- #finish_template ⇒ Object
- #git_first_commit ⇒ Object
- #git_init_commit ⇒ Object
- #init_git ⇒ Object
- #onotole_customization ⇒ Object
- #outro ⇒ Object
- #post_init ⇒ Object
- #pre_commit_cleanup ⇒ Object
- #prevent_double_usage ⇒ Object
- #remove_config_comment_lines ⇒ Object
- #remove_routes_comment_lines ⇒ Object
- #setup_database ⇒ Object
- #setup_development_environment ⇒ Object
- #setup_dotfiles ⇒ Object
-
#setup_git ⇒ Object
def install_refills say “Install Refills” build :install_refills end.
- #setup_gitignore ⇒ Object
- #setup_production_environment ⇒ Object
- #setup_secret_token ⇒ Object
- #setup_segment ⇒ Object
- #setup_spring ⇒ Object
- #setup_staging_environment ⇒ Object
- #setup_test_environment ⇒ Object
Class Method Details
.start ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/onotole/generators/app_generator.rb', line 6 def self.start class_option :database, type: :string, aliases: '-d', default: 'postgresql', desc: "Configure for selected database (options: #{DATABASES.join('/')})" class_option :heroku, type: :boolean, aliases: '-H', default: false, desc: 'Create staging and production Heroku apps' class_option :heroku_flags, type: :string, default: '', desc: 'Set extra Heroku flags' class_option :github, type: :string, aliases: '-G', default: nil, desc: 'Create Github repository and add remote origin pointed to repo' class_option :skip_test_unit, type: :boolean, aliases: '-T', default: true, desc: 'Skip Test::Unit files' class_option :skip_turbolinks, type: :boolean, default: true, desc: 'Skip turbolinks gem' class_option :skip_bundle, type: :boolean, aliases: '-B', default: true, desc: "Don't run bundle install" class_option :user_gems, type: :boolean, aliases: '-c', default: false, desc: 'Ask user for gem choice' class_option :clean_comments, type: :boolean, aliases: '--clean_comments', default: false, desc: 'Clean up comments in config & routes files' GEMPROCLIST.each do |gem_name| class_option gem_name.to_sym, type: :boolean, aliases: "--#{gem_name}", default: false, desc: "#{gem_name.to_s.humanize} gem install" end super end |
Instance Method Details
#bundleinstall ⇒ Object
95 96 97 98 99 |
# File 'lib/onotole/generators/app_generator.rb', line 95 def bundleinstall bundle_command 'install' build :install_user_gems_from_github build :configure_simple_form end |
#configure_app ⇒ Object
def create_onotole_views
say 'Creating onotole views'
build :create_partials_directory
build :create_shared_flashes
build :create_shared_javascripts
build :create_application_layout
end
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/onotole/generators/app_generator.rb', line 170 def configure_app say 'Configuring app' build :configure_support_path build :configure_action_mailer build :configure_active_job build :configure_time_formats build :fix_i18n_deprecation_warning build :setup_default_rake_task build :configure_puma build :set_up_forego build :apply_vendorjs_folder build :add_vendor_css_path build :add_fonts_autoload build :add_custom_formbuilder build :copy_application_record end |
#copy_miscellaneous_files ⇒ Object
def bundler_stubs_install
say 'Bundler stubs install'
build :rvm_bundler_stubs_install
end
271 272 273 274 |
# File 'lib/onotole/generators/app_generator.rb', line 271 def copy_miscellaneous_files say 'Copying miscellaneous support files' build :copy_miscellaneous_files end |
#create_github_repo ⇒ Object
233 234 235 236 237 238 |
# File 'lib/onotole/generators/app_generator.rb', line 233 def create_github_repo return if [:skip_git] return unless [:github] say 'Creating Github repo' build :create_github_repo, [:github] end |
#create_heroku_apps ⇒ Object
218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/onotole/generators/app_generator.rb', line 218 def create_heroku_apps if [:heroku] say 'Creating Heroku apps' build :create_heroku_apps, [:heroku_flags] build :provide_review_apps_setup_script build :set_heroku_serve_static_files build :set_heroku_remotes build :set_heroku_rails_secrets build :create_heroku_pipelines_config_file build :create_heroku_pipeline build :provide_deploy_script build :configure_automatic_deployment end end |
#custom_gems_setup ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/onotole/generators/app_generator.rb', line 87 def custom_gems_setup if [:user_gems] build :users_gems else build :user_gems_from_args_or_default_set end end |
#customize_error_pages ⇒ Object
276 277 278 279 |
# File 'lib/onotole/generators/app_generator.rb', line 276 def customize_error_pages say 'Customizing the 500/404/422 pages' build :customize_error_pages end |
#customize_gemfile ⇒ Object
80 81 82 83 84 85 |
# File 'lib/onotole/generators/app_generator.rb', line 80 def customize_gemfile build :replace_gemfile build :set_ruby_to_version_being_used build :set_up_heroku_specific_gems if [:heroku] end |
#finish_template ⇒ Object
41 42 43 44 |
# File 'lib/onotole/generators/app_generator.rb', line 41 def finish_template invoke :onotole_customization super end |
#git_first_commit ⇒ Object
214 215 216 |
# File 'lib/onotole/generators/app_generator.rb', line 214 def git_first_commit invoke :git_init_commit unless [:skip_git] end |
#git_init_commit ⇒ Object
253 254 255 |
# File 'lib/onotole/generators/app_generator.rb', line 253 def git_init_commit build :git_init_commit end |
#init_git ⇒ Object
262 263 264 |
# File 'lib/onotole/generators/app_generator.rb', line 262 def init_git build :init_git end |
#onotole_customization ⇒ Object
46 47 48 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 78 |
# File 'lib/onotole/generators/app_generator.rb', line 46 def onotole_customization invoke :prevent_double_usage invoke :customize_gemfile invoke :custom_gems_setup # invoke :bundler_stubs_install invoke :setup_git invoke :bundleinstall invoke :setup_development_environment invoke :setup_test_environment invoke :setup_production_environment invoke :setup_staging_environment invoke :setup_secret_token invoke :configure_app # invoke :create_onotole_views # 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 :post_init invoke :setup_gitignore invoke :setup_database invoke :create_heroku_apps invoke :create_github_repo invoke :setup_segment invoke :setup_spring invoke :pre_commit_cleanup invoke :git_first_commit invoke :outro end |
#outro ⇒ Object
289 290 291 |
# File 'lib/onotole/generators/app_generator.rb', line 289 def outro build :show_goodbye_message end |
#post_init ⇒ Object
293 294 295 296 |
# File 'lib/onotole/generators/app_generator.rb', line 293 def post_init build :post_init build :add_bullet_gem_configuration end |
#pre_commit_cleanup ⇒ Object
302 303 304 |
# File 'lib/onotole/generators/app_generator.rb', line 302 def pre_commit_cleanup build :clean_by_rubocop end |
#prevent_double_usage ⇒ Object
298 299 300 |
# File 'lib/onotole/generators/app_generator.rb', line 298 def prevent_double_usage build :prevent_double_usage end |
#remove_config_comment_lines ⇒ Object
281 282 283 |
# File 'lib/onotole/generators/app_generator.rb', line 281 def remove_config_comment_lines build :remove_config_comment_lines if [:clean_comments] == true end |
#remove_routes_comment_lines ⇒ Object
285 286 287 |
# File 'lib/onotole/generators/app_generator.rb', line 285 def remove_routes_comment_lines build :remove_routes_comment_lines if [:clean_comments] == true end |
#setup_database ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/onotole/generators/app_generator.rb', line 101 def setup_database say 'Setting up database' build :use_postgres_config_template if 'postgresql' == [:database] build :create_database end |
#setup_development_environment ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/onotole/generators/app_generator.rb', line 109 def setup_development_environment say 'Setting up the development environment' build :raise_on_missing_assets_in_test build :raise_on_delivery_errors build :set_test_delivery_method build :raise_on_unpermitted_parameters build :seeds_organisation build :provide_setup_script build :provide_dev_prime_task build :provide_kill_postgres_connections_task build :configure_generators build :configure_i18n_for_missing_translations build :configure_quiet_assets build :add_dotenv_to_startup end |
#setup_dotfiles ⇒ Object
245 246 247 |
# File 'lib/onotole/generators/app_generator.rb', line 245 def setup_dotfiles build :copy_dotfiles end |
#setup_git ⇒ Object
def install_refills
say "Install Refills"
build :install_refills
end
202 203 204 205 206 |
# File 'lib/onotole/generators/app_generator.rb', line 202 def setup_git return if [:skip_git] say 'Initializing git' invoke :init_git end |
#setup_gitignore ⇒ Object
208 209 210 211 212 |
# File 'lib/onotole/generators/app_generator.rb', line 208 def setup_gitignore return if [:skip_git] say 'Replace .gitignore' invoke :setup_gitignore end |
#setup_production_environment ⇒ Object
142 143 144 145 146 147 148 149 150 |
# File 'lib/onotole/generators/app_generator.rb', line 142 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_token ⇒ Object
157 158 159 160 |
# File 'lib/onotole/generators/app_generator.rb', line 157 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/onotole/generators/app_generator.rb', line 240 def setup_segment say 'Setting up Segment' build :setup_segment end |
#setup_spring ⇒ Object
257 258 259 260 |
# File 'lib/onotole/generators/app_generator.rb', line 257 def setup_spring say 'Springifying binstubs' build :setup_spring end |
#setup_staging_environment ⇒ Object
152 153 154 155 |
# File 'lib/onotole/generators/app_generator.rb', line 152 def setup_staging_environment say 'Setting up the staging environment' build :setup_staging_environment end |
#setup_test_environment ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/onotole/generators/app_generator.rb', line 125 def setup_test_environment say 'Setting up the test environment' build :set_up_factory_girl_for_rspec build :generate_factories_file # build :set_up_hound 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_action_mailer_in_specs build :configure_capybara_webkit end |