Class: Onotole::AppBuilder

Inherits:
Rails::AppBuilder
  • Object
show all
Extended by:
Forwardable
Includes:
Actions, AfterInstallPatch, BeforeBundlePatch, DefalutScripts, DefaultFrontend, Deploy, EditMenuQuestions, Git, Goodbye, Helpers, Mail, Tests, UserGemsMenu
Defined in:
lib/onotole/app_builder.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Methods included from Deploy

#configure_automatic_deployment, #create_heroku_apps, #provide_deploy_script

Methods included from DefalutScripts

#add_custom_formbuilder, #add_dotenv_to_startup, #apply_vendorjs_folder, #configure_background_jobs_for_rspec, #configure_i18n_for_missing_translations, #configure_rack_timeout, #configure_support_path, #configure_time_formats, #copy_application_record, #copy_dotfiles, #copy_miscellaneous_files, #create_database, #disallow_wrapping_parameters, #enable_rack_canonical_host, #enable_rack_deflater, #fix_i18n_deprecation_warning, #provide_dev_prime_task, #provide_kill_postgres_connections_task, #provide_setup_script, #raise_on_unpermitted_parameters, #readme, #remove_config_comment_lines, #remove_routes_comment_lines, #replace_gemfile, #seeds_organisation, #set_ruby_to_version_being_used, #set_up_forego, #setup_default_rake_task, #setup_secret_token, #setup_spring, #setup_staging_environment, #use_postgres_config_template

Methods included from DefaultFrontend

#add_fonts_autoload, #add_vendor_css_path, #configure_quiet_assets, #create_application_layout, #create_partials_directory, #create_shared_flashes, #create_shared_javascripts, #customize_error_pages, #install_bitters, #install_refills, #setup_asset_host, #setup_segment, #setup_stylesheets

Methods included from Goodbye

#airbrake_check, #ckeditor_check, #devise_user_check, #github_check, #graphviz_check, #image_optim_check, #rack_cors_check, #show_goodbye_message

Methods included from Mail

#configure_action_mailer, #configure_action_mailer_in_specs, #configure_smtp, #raise_on_delivery_errors, #set_test_delivery_method

Methods included from Tests

#configure_capybara_webkit, #configure_generators, #configure_i18n_for_test_environment, #configure_rspec, #configure_spec_support_features, #enable_database_cleaner, #generate_factories_file, #generate_rspec, #provide_shoulda_matchers_config, #raise_on_missing_assets_in_test, #set_up_factory_girl_for_rspec

Methods included from Git

#create_github_repo, #git_init_commit, #gitignore_files, #init_git, #install_user_gems_from_github

Methods included from Helpers

#add_gems_from_args, #add_to_user_choise, #br, #choice, #clean_by_rubocop, #cleanup_comments, #cover_def_by, #heroku_adapter, #install_from_github, #mkdir_and_touch, #multiple_choice, #pgsql_db_exist?, #quiet_suffix, #rails_generator, #raise_on_missing_translations_in, #serve_static_files_line, #touch, #user_choose?, #user_gems_from_args_or_default_set, #variant_in_options?, #yes_no_question

Methods included from AfterInstallPatch

#after_install_acive_skin, #after_install_active_admin_bootstrap, #after_install_active_admin_theme, #after_install_activeadmin, #after_install_annotate, #after_install_bootstrap3, #after_install_bootstrap3_sass, #after_install_carrierwave, #after_install_ckeditor, #after_install_create_github_repo, #after_install_devise, #after_install_devise_bootstrap_views, #after_install_face_of_active_admin, #after_install_flattened_active_admin, #after_install_font_awesome_sass, #after_install_fotoramajs, #after_install_gmaps4rails, #after_install_guard, #after_install_guard_rubocop, #after_install_image_optim, #after_install_mailcatcher, #after_install_materialize_sass, #after_install_normalize, #after_install_overcommit, #after_install_paper_trail, #after_install_pundit, #after_install_rack_cors, #after_install_rails_admin, #after_install_redis, #after_install_redis_namespace, #after_install_redis_rails, #after_install_responders, #after_install_rubocop, #after_install_sitemap_generator, #after_install_tinymce, #after_install_typus, #after_install_underscore_rails, #after_install_validates_timeliness, #post_init

Methods included from BeforeBundlePatch

#add_active_admin_import_gem, #add_active_admin_simple_life_gem, #add_active_admin_theme_gem, #add_active_record_doctor_gem, #add_active_skin_gem, #add_activeadmin_gem, #add_activerecord_import_gem, #add_airbrake_gem, #add_annotate_gem, #add_axlsx_gem, #add_axlsx_rails_gem, #add_bootstrap3_gem, #add_bootstrap3_sass_gem, #add_bundler_audit_gem, #add_carrierwave_gem, #add_ckeditor_gem, #add_cyrillizer_gem, #add_devise_bootstrap_views_gem, #add_devise_gem, #add_dotenv_heroku_gem, #add_face_of_active_admin_gem, #add_faker_gem, #add_flamegraph_gem, #add_flattened_active_admin_gem, #add_font_awesome_sass_gem, #add_fotoramajs_gem, #add_geocoder_gem, #add_git_up_gem, #add_gmaps4rails_gem, #add_guard_gem, #add_guard_rubocop_gem, #add_haml_gem, #add_hirbunicode_gem, #add_image_optim_gem, #add_invisible_captcha_gem, #add_kaminari_gem, #add_mailcatcher_gem, #add_materialize_sass_gem, #add_meta_request_gem, #add_newrelic_rpm_gem, #add_overcommit_gem, #add_paper_trail_gem, #add_prawn_gem, #add_pundit_gem, #add_rack_cors_gem, #add_rack_mini_profiler_gem, #add_railroady_gem, #add_rails_admin_gem, #add_rails_db_gem, #add_redis_gem, #add_redis_namespace_gem, #add_redis_rails_gem, #add_responders_gem, #add_rubocop_gem, #add_rubycritic_gem, #add_sitemap_generator_gem, #add_slim_gem, #add_stackprof_gem, #add_therubyracer_gem, #add_tinymce_gem, #add_typus_gem, #add_underscore_rails_gem, #add_user_gems, #add_validates_timeliness_gem, #add_will_paginate_gem, #setup_default_gems

Methods included from EditMenuQuestions

#add_github_repo_creation_choice, #ask_cleanup_commens, #choose_authenticate_engine, #choose_authorization_engine, #choose_cache_storage, #choose_cms_engine, #choose_develoder_tools, #choose_file_storage, #choose_frontend, #choose_pagimation, #choose_template_engine, #choose_undroup_gems, #choose_wysiwyg, #show_active_admin_plugins_submenu, #users_init_commit_choice

Methods included from UserGemsMenu

#users_gems

Methods included from Actions

#action_mailer_host, #ask_stylish, #configure_application_file, #configure_environment, #replace_in_file, #say_color

Class Attribute Details

.active_admin_theme_selectedObject

Returns the value of attribute active_admin_theme_selected.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def active_admin_theme_selected
  @active_admin_theme_selected
end

.app_file_cssObject

Returns the value of attribute app_file_css.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def app_file_css
  @app_file_css
end

.app_file_scssObject

Returns the value of attribute app_file_scss.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def app_file_scss
  @app_file_scss
end

.devise_modelObject

Returns the value of attribute devise_model.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def devise_model
  @devise_model
end

.file_storage_nameObject

Returns the value of attribute file_storage_name.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def file_storage_name
  @file_storage_name
end

.js_fileObject

Returns the value of attribute js_file.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def js_file
  @js_file
end

.quietObject

Returns the value of attribute quiet.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def quiet
  @quiet
end

.use_asset_pipellineObject

Returns the value of attribute use_asset_pipelline.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def use_asset_pipelline
  @use_asset_pipelline
end

.user_choiceObject

Returns the value of attribute user_choice.



35
36
37
# File 'lib/onotole/app_builder.rb', line 35

def user_choice
  @user_choice
end

Instance Method Details

#add_bullet_gem_configurationObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/onotole/app_builder.rb', line 53

def add_bullet_gem_configuration
  config = <<-RUBY
  config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.rails_logger = true
  end

  RUBY

  inject_into_file(
    'config/environments/development.rb',
    config,
    after: "config.action_mailer.raise_delivery_errors = true\n"
  )
end

#configure_active_jobObject



90
91
92
93
94
95
# File 'lib/onotole/app_builder.rb', line 90

def configure_active_job
  configure_application_file(
    'config.active_job.queue_adapter = :delayed_job'
  )
  configure_environment 'test', 'config.active_job.queue_adapter = :inline'
end

#configure_ciObject



78
79
80
# File 'lib/onotole/app_builder.rb', line 78

def configure_ci
  template 'circle.yml.erb', 'circle.yml'
end

#configure_newrelicObject



74
75
76
# File 'lib/onotole/app_builder.rb', line 74

def configure_newrelic
  template 'newrelic.yml.erb', 'config/newrelic.yml'
end

#configure_pumaObject



97
98
99
100
# File 'lib/onotole/app_builder.rb', line 97

def configure_puma
  remove_file 'config/puma.rb'
  template 'puma.rb.erb', 'config/puma.rb'
end

#configure_simple_formObject



82
83
84
85
86
87
88
# File 'lib/onotole/app_builder.rb', line 82

def configure_simple_form
  if user_choose?(:bootstrap3_sass) || user_choose?(:bootstrap3)
    rails_generator 'simple_form:install --bootstrap'
  else
    rails_generator 'simple_form:install'
  end
end

#delete_commentsObject

def rvm_bundler_stubs_install

if system "rvm -v | grep 'rvm.io'"
  run 'chmod +x $rvm_path/hooks/after_cd_bundler'
  run 'bundle install --binstubs=./bundler_stubs'
end

end



109
110
111
112
113
114
# File 'lib/onotole/app_builder.rb', line 109

def delete_comments
  return unless options[:clean_comments] || user_choose?(:clean_comments)
  cleanup_comments 'Gemfile'
  remove_config_comment_lines
  remove_routes_comment_lines
end

#prevent_double_usageObject



116
117
118
119
120
121
122
123
# File 'lib/onotole/app_builder.rb', line 116

def prevent_double_usage
  unless !pgsql_db_exist?("#{app_name}_development") || !pgsql_db_exist?("#{app_name}_test")
    say_color RED, "   YOU HAVE EXISTING DB WITH #{app_name.upcase}!!!"
    say_color RED, "   WRITE 'Y' TO CONTINUE WITH DELETION OF ALL DATA"
    say_color RED, '   ANY OTHER INPUT FOR EXIT'
    exit 0 unless STDIN.gets.chomp == 'Y'
  end
end

#set_up_houndObject



70
71
72
# File 'lib/onotole/app_builder.rb', line 70

def set_up_hound
  copy_file 'hound.yml', '.hound.yml'
end