forked from toolshed/abra
fix: auto-config ssh urls and push to them
This commit is contained in:
@ -56,6 +56,7 @@ type RecipeMeta struct {
|
||||
Icon string `json:"icon"`
|
||||
Name string `json:"name"`
|
||||
Repository string `json:"repository"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
Versions RecipeVersions `json:"versions"`
|
||||
Website string `json:"website"`
|
||||
}
|
||||
@ -128,6 +129,25 @@ type Recipe struct {
|
||||
Meta RecipeMeta
|
||||
}
|
||||
|
||||
// Push pushes the latest changes to a SSH URL remote. You need to have your
|
||||
// local SSH configuration for git.coopcloud.tech working for this to work
|
||||
func (r Recipe) Push(dryRun bool) error {
|
||||
repo, err := git.PlainOpen(r.Dir())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gitPkg.CreateRemote(repo, "origin-ssh", r.Meta.SSHURL, dryRun); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gitPkg.Push(r.Dir(), "origin-ssh", true, dryRun); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Dir retrieves the recipe repository path
|
||||
func (r Recipe) Dir() string {
|
||||
return path.Join(config.RECIPES_DIR, r.Name)
|
||||
|
Reference in New Issue
Block a user