class Generamba::LocalInstaller
Incapsulates the logic of verifying and installing local templates
Public Instance Methods
install_template(template_declaration)
click to toggle source
# File lib/generamba/template/installer/local_installer.rb, line 8 def install_template(template_declaration) template_name = template_declaration.name puts("Installing #{template_name}...") local_path = template_declaration.local rambaspec_exist = Generamba::RambaspecValidator.validate_spec_existance(template_name, local_path) unless rambaspec_exist error_description = "Cannot find #{template_name + RAMBASPEC_EXTENSION} in the specified directory. Try another path or name.".red raise StandardError.new(error_description) end rambaspec_valid = Generamba::RambaspecValidator.validate_spec(template_name, local_path) unless rambaspec_valid error_description = "#{template_name + RAMBASPEC_EXTENSION} is not valid.".red raise StandardError.new(error_description) end install_path = Pathname.new(TEMPLATES_FOLDER) .join(template_name) FileUtils.mkdir_p install_path FileUtils.copy_entry(local_path, install_path) end