class Skeletor::CLI
The CLI class provides an interface for the command line functions
Public Instance Methods
build(template)
click to toggle source
Creates a new Builder instance and builds the skeleton in the specified directory
# File lib/skeletor/cli.rb, line 18 def build(template) path = options[:directory] || Dir.pwd project = options[:project] || File.basename(path) skeleton = Builder.new(project,template,path) skeleton.build end
clean()
click to toggle source
Cleans out the specified directory
# File lib/skeletor/cli.rb, line 32 def clean print 'Are you sure you want to clean this project directory? (Y|n): ' confirm = $stdin.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)
click to toggle source
Loads a template, creates a new Validator and validates the template
# File lib/skeletor/cli.rb, line 46 def validate(template) skeleton = Skeletons::Loader.load_template(template) validator = Grayskull::Validator.new(skeleton,Skeletons::Skeleton::SCHEMA_FILE) results = validator.validate if !results['result'] puts 'Validation Failed with ' + @errors.count.to_s + ' errors'; puts '' results["errors"].each{ |error| puts error } else puts 'Validated Successfully!' end end