Class: Skeletor::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/skeletor/cli.rb

Instance Method Summary collapse

Instance Method Details

#build(template) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/skeletor/cli.rb', line 14

def build(template)
  path = options[:directory] || Dir.pwd
  project = options[:project] || File.basename(path)
  
  skeleton = Builder.new(project,template,path)
  skeleton.build
end

#cleanObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/skeletor/cli.rb', line 26

def clean
  print 'Are you sure you want to clean this project directory? (Y|n): '
  confirm = gets.chomp
  if confirm != 'Y' && confirm != 'n'
    puts 'Please enter Y or n'
  elsif confirm == 'Y'
    path = options[:directory] || Dir.pwd
    Builder.clean path
  end
  
end

#validate(template) ⇒ Object



39
40
41
42
43
# File 'lib/skeletor/cli.rb', line 39

def validate(template)
  skeleton = Skeletons::Loader.loadTemplate(template)
  validator = Skeletons::Validator.new(skeleton)
  validator.validate()
end