Sha256: f7f480cdad0ff253e9bdb05dc3c385691cf8a2d0ec83a5b575978ad23dd36c03

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Siracha
  class AppBuilder < ::Rails::AppBuilder

    def app
      before_build_app
      super
    end

    def leftovers
      configure_generators
      set_ruby_to_version_being_used
      Dir[load_file_root + '/*.rb'].each do |file|
        apply file
      end
    end

    def load_file_root
      File.expand_path("../steps/", File.dirname(__FILE__))
    end

    private

    def before_build_app
      apply File.join(__dir__, 'before_build.rb')
    end

    def configure_generators
      config = <<-RUBY
        config.generators do |generate|
          generate.helper false
          generate.javascripts false
          generate.request_specs false
          generate.routing_specs false
          generate.stylesheets false
          generate.test_framework :rspec
          generate.view_specs false
        end
      RUBY
      inject_into_class 'config/application.rb', 'Application', config
    end

    def set_ruby_to_version_being_used
      create_file '.ruby-version', "#{Siracha::RUBY_VERSION}\n"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
siracha-0.1.1 lib/siracha/app_builder.rb