Feature -- allow for git repositories
Open
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 201
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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:
$ mkdir HappyDance && cd HappyDance
$ genesis generate https://github.com/thecb4/GenesisTemplate
- 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()
let templatePath = 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 {
let project = URL(string: from)!.lastPathComponent.components(separatedBy: ".")[0]
let mkdirCommand = try shellOut(to: "ls .genesis 2>/dev/null || mkdir .genesis", at: "~")
print("removing existing template")
let deleteCommand = try shellOut(to: "rm -rf .genesis/\(project)", at: "~")
print("cloning repository")
let cloneCommand = try shellOut(to: "git clone --verbose \(from)", at: "~/.genesis")
return Path("~/.genesis/\(project)/template.yml").absolute()
} catch {
print(error)
exit(1)
}
} else {
return Path(from).absolute()
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the CLI's templatePath handling and the determinePath(from:) entry point shown in the issue. Exercise genesis generate with a flat template path and HTTP, HTTPS, or Git repository, checking that a top-level template.yml is resolved from ~/.genesis and that replacement behavior works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, swift
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100