You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user I want to be able to pass a git repository instead of a template.yml file so that I can maintain my own templates and make use of community templates.
It should allow for http || https || git protocols
It should download to a common folder
// replace the standard path call with one that checks the string and does some work
// let templatePath = Path(self.templatePath.value).absolute()
lettemplatePath=determinePath(from:self.templatePath.value)
/**
This method allows for the use of git repositories to hold templates in addition to passing in a flat template file.
- Parameter from: The string passed in from the command line
- Returns: Returns the Path of the template file
## Important Notes ##
1. template.yml file should be top level of the git repository
2. template repositories will be downloaded to a .genesis folder in users home (~) directory
3. Each download replaces prior versions of the template
*/
func determinePath(from:String)->Path{
if
from.contains("http") ||
from.contains("https") ||
from.contains("git"){do{letproject=URL(string: from)!.lastPathComponent.components(separatedBy:".")[0]letmkdirCommand=tryshellOut(to:"ls .genesis 2>/dev/null || mkdir .genesis", at:"~")print("removing existing template")letdeleteCommand=tryshellOut(to:"rm -rf .genesis/\(project)", at:"~")print("cloning repository")letcloneCommand=tryshellOut(to:"git clone --verbose \(from)", at:"~/.genesis")returnPath("~/.genesis/\(project)/template.yml").absolute()}catch{print(error)exit(1)}}else{returnPath(from).absolute()}}
The text was updated successfully, but these errors were encountered:
As a user I want to be able to pass a git repository instead of a template.yml file so that I can maintain my own templates and make use of community templates.
use:
The text was updated successfully, but these errors were encountered: