Class: DatacraftsIoSkeleton::Composer

Inherits:
Thor
  • Object
show all
Defined in:
lib/datacrafts_io_skeleton/composer.rb

Overview

Defines all CLI commands, their descriptions, params and aliases.

Constant Summary collapse

FRONTEND_CREATORS =
{
  "react" => ->(app_name, options) { ReactCreator.new(app_name, options).call },
  "vue" => ->(app_name, options) { VueCreator.new(app_name, options).call },
  nil => proc { |app_name| puts("The frontend is not specified for #{app_name}") }
}.freeze
ALLOWED_FRONTEND =
FRONTEND_CREATORS.keys.freeze

Instance Method Summary collapse

Instance Method Details

#create(app_name) ⇒ Object

Creates new app.

Parameters:

  • app_name (String)

    The name of app you are going to create.



40
41
42
43
44
45
# File 'lib/datacrafts_io_skeleton/composer.rb', line 40

def create(app_name)
  say("The specified frontend is not allowed", :red) && return unless specified_frontend_valid?

  DatacraftsIoSkeleton::RailsCreator.new(app_name).call
  FRONTEND_CREATORS[options[:frontend]].call(app_name, options)
end

#versionObject

Informs user about gem version.



50
51
52
# File 'lib/datacrafts_io_skeleton/composer.rb', line 50

def version
  say("datacrafts-io-skeleton #{DatacraftsIoSkeleton::VERSION}")
end