Sha256: afb872055557418072a91e28140426f000675449a5d04de3f2ffae1c53cf86e1

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "tty-prompt"

module RailsApp
  class CLI
    def self.start(args)
      prompt = TTY::Prompt.new

      options_data = OptionsData.new(args)

      app_name = options_data.app_name || prompt.ask("What is the name of your application?", required: true)

      assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets], default: options_data.default_assets)
      styling_choices = [
        {name: "Bootstrap", value: "bootstrap"},
        {name: "Tailwind CSS", value: "tailwind"},
        {name: "Bulma", value: "bulma"},
        {name: "PostCSS", value: "postcss"},
        {name: "SASS", value: "sass"}
      ]
      styling = prompt.select("How would you like to manage styling?", styling_choices, default: options_data.default_styling)

      database = prompt.select("Which database would you like to use?",
        %w[postgresql sqlite3 mysql trilogy oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc],
        default: options_data.default_database)

      # save configuration

      Command.new(app_name: app_name, assets: assets, styling: styling, database: database).run
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_app-0.7.0 lib/rails_app/cli.rb