Skip to content

Commit

Permalink
Update activestate.yaml with any buildscript checkout info changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Sep 11, 2024
1 parent cc93e58 commit 4259078
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/runbits/buildscript/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ func ScriptFromFile(path string) (*buildscript.BuildScript, error) {
}
return nil, errs.Wrap(err, "Could not read build script from file")
}
return buildscript.Unmarshal(data)

script, err := buildscript.Unmarshal(data)
if err != nil {
return nil, errs.Wrap(err, "Could not unmarshal build script")
}

err = checkoutinfo.UpdateProject(script, path)
if err != nil {
return nil, errs.Wrap(err, "Could not update project file")
}

return script, nil
}

func Initialize(path, owner, project, branch string, auth *authentication.Auth) error {
Expand Down
15 changes: 15 additions & 0 deletions pkg/checkoutinfo/checkoutinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,18 @@ func updateBuildScript() error {

return nil
}

func UpdateProject(script *buildscript.BuildScript, dir string) error {
err := setupProject(dir)
if err != nil {
return errs.Wrap(err, "Could not setup project")
}

proj.Source().Project = script.ProjectURL()
err = proj.Source().Save(nil)
if err != nil {
return errs.Wrap(err, "Could not update project")
}

return nil
}

0 comments on commit 4259078

Please sign in to comment.