Class: Lono::Sequence

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/lono/sequence.rb

Direct Known Subclasses

New, Upgrade::Upgrade42

Class Method Summary collapse

Class Method Details

.source_rootObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lono/sequence.rb', line 14

def self.source_root
  starter_projects = File.expand_path("../starter_projects", File.dirname(__FILE__))
  template_folder = "#{starter_projects}/#{template_name}"
  unless File.exist?(template_folder)
    templates = Dir.glob("#{starter_projects}/*")
      .select { |f| File.directory?(f) }
      .map { |f| "  #{File.basename(f)}" }
      .sort
    puts "The TEMPLATE=#{ENV['TEMPLATE']} you specified does not exist.".colorize(:red)
    puts "The available templates are:\n#{templates.join("\n")}"
    exit
  end
  template_folder
end

.template_nameObject



10
11
12
# File 'lib/lono/sequence.rb', line 10

def self.template_name
  ENV['TEMPLATE'] || 'skeleton'
end