Sha256: 5b8b108e93b3a43985071f5112c26d15c345c22aeeea730381f3c6bc306ec234

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require "rails/generators"
require "rails/generators/rails/app/app_generator"

module Arkenstone
  class AppGenerator < Rails::Generators::AppGenerator
    class_option :skip_test, type: :boolean, aliases: "-T", default: true,
                 desc: "Skip test files"

    class_option :skip_spring, type: :boolean, default: true,
                 desc: "Don't install Spring application preloader"

    class_option :authentication, type: :boolean, aliases: "-A", default: false,
                 desc: "Create User model and configure authentication"

    class_option :database, type: :string, aliases: "-d", default: "postgresql",
                 desc: "Configure for selected database (options: #{DATABASES.join("/")})"

    class_option :github, type: :boolean, aliases: "-H", default: false,
                 desc: "Create a GitHub repository with the same name as the project"

    def finish_template
      invoke :forge_the_arkenstone
      super
    end

    def forge_the_arkenstone
      build :set_ruby_version
      build :set_up_authentication if options[:authentication]
      build :create_simple_form_files
      build :customize_application_layout
      build :set_up_database
      build :config_travis_ci
      build :create_factories_file
      build :create_partials_directory
      build :create_flashes_partial
      build :set_up_rspec
      build :customize_rails_helper
      build :set_up_database_cleaner
      build :clean_up_ruby_files
      build :set_up_style_sheets
      build :set_up_bitters
      build :configure_locale
      build :create_home_page
      build :create_binstubs
      build :initialize_git_repo
      build :create_initial_git_commit
      build :create_github_repo if options[:github]
    end

    protected

    def get_builder_class
      Arkenstone::AppBuilder
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arkenstone-0.1.0 lib/arkenstone/generators/app_generator.rb