class Onotole::AppGenerator

Public Class Methods

start() click to toggle source
Calls superclass method
# 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

Public Instance Methods

bundleinstall() click to toggle source
# 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() click to toggle source

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

# 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() click to toggle source

def bundler_stubs_install

say 'Bundler stubs install'
build :rvm_bundler_stubs_install

end

# 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() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 233
def create_github_repo
  return if options[:skip_git]
  return unless options[:github]
  say 'Creating Github repo'
  build :create_github_repo, options[:github]
end
create_heroku_apps() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 218
def create_heroku_apps
  if options[:heroku]
    say 'Creating Heroku apps'
    build :create_heroku_apps, options[: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() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 87
def custom_gems_setup
  if options[:user_gems]
    build :users_gems
  else
    build :user_gems_from_args_or_default_set
  end
end
customize_error_pages() click to toggle source
# 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() click to toggle source
# 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 options[:heroku]
end
finish_template() click to toggle source
Calls superclass method
# File lib/onotole/generators/app_generator.rb, line 41
def finish_template
  invoke :onotole_customization
  super
end
git_first_commit() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 214
def git_first_commit
  invoke :git_init_commit unless options[:skip_git]
end
git_init_commit() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 253
def git_init_commit
  build :git_init_commit
end
init_git() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 262
def init_git
  build :init_git
end
onotole_customization() click to toggle source
# 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() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 289
def outro
  build :show_goodbye_message
end
post_init() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 293
def post_init
  build :post_init
  build :add_bullet_gem_configuration
end
pre_commit_cleanup() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 302
def pre_commit_cleanup
  build :clean_by_rubocop
end
prevent_double_usage() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 298
def prevent_double_usage
  build :prevent_double_usage
end
remove_config_comment_lines() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 281
def remove_config_comment_lines
  build :remove_config_comment_lines if options[:clean_comments] == true
end
remove_routes_comment_lines() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 285
def remove_routes_comment_lines
  build :remove_routes_comment_lines if options[:clean_comments] == true
end
setup_database() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 101
def setup_database
  say 'Setting up database'

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

  build :create_database
end
setup_development_environment() click to toggle source
# 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() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 245
def setup_dotfiles
  build :copy_dotfiles
end
setup_git() click to toggle source

def install_refills

say "Install Refills"
build :install_refills

end

# File lib/onotole/generators/app_generator.rb, line 202
def setup_git
  return if options[:skip_git]
  say 'Initializing git'
  invoke :init_git
end
setup_gitignore() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 208
def setup_gitignore
  return if options[:skip_git]
  say 'Replace .gitignore'
  invoke :setup_gitignore
end
setup_production_environment() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 240
def setup_segment
  say 'Setting up Segment'
  build :setup_segment
end
setup_spring() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 257
def setup_spring
  say 'Springifying binstubs'
  build :setup_spring
end
setup_staging_environment() click to toggle source
# 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() click to toggle source
# 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

Protected Instance Methods

get_builder_class() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 308
def get_builder_class
  Onotole::AppBuilder
end
using_active_record?() click to toggle source
# File lib/onotole/generators/app_generator.rb, line 312
def using_active_record?
  !options[:skip_active_record]
end