Class: Sublayer::Commands::NewProject

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/sublayer/cli/commands/new_project.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



20
21
22
# File 'lib/sublayer/cli/commands/new_project.rb', line 20

def self.banner
  "sublayer new PROJECT_NAME"
end

.source_rootObject



16
17
18
# File 'lib/sublayer/cli/commands/new_project.rb', line 16

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_projectObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sublayer/cli/commands/new_project.rb', line 24

def create_project
  @project_template = options[:template] || ask("Select a project template:", default: "CLI", limited_to: %w[CLI GithubAction QuickScript])

  case @project_template.downcase
  when 'cli'
    invoke Commands::CLIProject, [project_name], options
  when 'githubaction', 'github_action'
    invoke Commands::GithubActionProject, [project_name], options
  when 'quickscript', 'quick_script'
    invoke Commands::QuickScriptProject, [project_name], options
  else
    say "Unknown project template: #{@project_template}", :red
    exit 1
  end
end

#sublayer_versionObject



12
13
14
# File 'lib/sublayer/cli/commands/new_project.rb', line 12

def sublayer_version
  Sublayer::VERSION
end