Sha256: 7a8863f38e72e42e4d1d06b7774a20e585fe7f63ab32277d3567d35077d27e1e

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'blueprint/generator/base'

module Blueprint
  module Generator
    class RailsApp < Base
      def self.template_path
        'rails_app'
      end

      private

        def ask_questions
          config[:title] = ask("Application title: ")
        end

        def execute
          cmd_title("Generate rails application with path #{name}")

          # Create application
          shell "rails new #{name} --skip-bundle --database=postgresql --no-rc --skip-test-unit"
          cd_path(name)

          # Copy dotfiles
          copy_file('.editorconfig')
          copy_file('.gitignore')
          copy_file('.ruby-version')

          # Create config/examples
          cmd_title('Create config\'s examples')
          shell 'mkdir config/examples'
          shell 'rm config/database.yml'
          shell 'mv config/secrets.yml config/examples/secrets.yml'
          copy_file_from_template('database.yml', 'config/examples/database.yml')

          # Create Gemfile
          copy_file_from_template('Gemfile')

          # Init views
          shell 'rm app/views/layouts/application.html.erb'
          copy_file_from_template('views/application.slim', 'app/views/layouts/application.html.slim')
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blueprint-0.2.0 lib/blueprint/generator/rails_app.rb