module Create::Crystal::App

Extended Modules

Defined in:

create-crystal-app.cr

Constant Summary

ProjectNameValidator = Proc(Term::Prompt::Question, String | ::Nil, Bool).new do |question, value| if value.nil? || value.blank? question.errors << "Project Name must not be empty." next false end if value.size > 50 question.errors << "Project Name must not be longer than 50 characters." end if !value[0].ascii_letter? question.errors << "Project Name must start with a letter." end if !value.each_char.all? do |c| ((c.alphanumeric? || (c == '-')) || (c == '_')) || (c == ' ') end question.errors << "Project Name must only contain alphanumerical characters, spaces, _ or -" end if question.errors.size > 0 next false end true end

Match the crystal init validation requirements

Instance Method Summary

Instance Method Detail

def clean_project_name(unclean_name : String) : String #

Makes string module-and-others-name-compatible


[View source]
def create_file(content : String, path : String, project_dir : Path, type : String | Nil = "") #

Creates the template


[View source]
def print_console(msg : String, type : String | Nil = "simple", stop : Bool | Nil = false) #

Prints to console using colors and STDOUT/STDERR for better handling It also exits if requested to


[View source]
def run_cmd(cmd, args) #

Runs a command in shell Used for fetching the git aurhor and email from git


[View source]