Sha256: 94e96764d2fab7924900f313dd47a2e3e39f7d97e20a1f0a3a2fcac4b1a1b0f0

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

require 'bundler'
require 'fileutils'
require 'open3'
require 'thor'

module Kaze::Commands
  class App < Thor
    include InstallsHotwireStack
    include InstallsInertiaStacks
    include Utils

    def self.exit_on_failure?() true end

    desc 'install [STACK]', 'Install the Kaze controllers and resources. Supported stacks: hotwire, react, vue.'
    def install(stack = 'hotwire')
      return say 'Kaze must be run in a new Rails application.', :red unless File.exist?("#{Dir.pwd}/bin/rails")

      return say "Invalid stack. Supported stacks are #{available_stacks.keys.map { |k| "[#{k}]" }.join(', ')}.", :red unless available_stacks.key?(stack.to_sym)

      send("install_#{available_stacks[stack.to_sym]}_stack")
    end

    desc 'version', 'Show Kaze version'
    def version
      puts Kaze::VERSION
    end

    private

    def available_stacks
      {
        hotwire: 'hotwire',
        react: 'inertia_react',
        vue: 'inertia_vue'
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaze-0.13.0 lib/kaze/commands.rb