Skip to content

Commit 8550d6b

Browse files
authored
Merge pull request ActiveState#3507 from ActiveState/mitchell/dx-3073
If buildscripts are enabled, `state refresh` without a buildscript should error.
2 parents bc69a84 + f9f94b5 commit 8550d6b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/runners/refresh/refresh.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import (
55

66
"github.com/ActiveState/cli/internal/analytics"
77
"github.com/ActiveState/cli/internal/config"
8+
"github.com/ActiveState/cli/internal/constants"
89
"github.com/ActiveState/cli/internal/errs"
910
"github.com/ActiveState/cli/internal/locale"
1011
"github.com/ActiveState/cli/internal/logging"
1112
"github.com/ActiveState/cli/internal/output"
1213
"github.com/ActiveState/cli/internal/primer"
1314
"github.com/ActiveState/cli/internal/prompt"
15+
"github.com/ActiveState/cli/internal/runbits/buildscript"
1416
"github.com/ActiveState/cli/internal/runbits/findproject"
1517
"github.com/ActiveState/cli/internal/runbits/rationalize"
1618
"github.com/ActiveState/cli/internal/runbits/runtime"
@@ -82,6 +84,13 @@ func (r *Refresh) Run(params *Params) error {
8284
return errs.Wrap(err, "could not determine if runtime needs update")
8385
}
8486

87+
if r.config.GetBool(constants.OptinBuildscriptsConfig) {
88+
_, err := buildscript_runbit.ScriptFromProject(proj)
89+
if errors.Is(err, buildscript_runbit.ErrBuildscriptNotExist) {
90+
return locale.WrapInputError(err, locale.T("notice_needs_buildscript_reset"))
91+
}
92+
}
93+
8594
if !needsUpdate {
8695
return locale.NewInputError("refresh_runtime_uptodate")
8796
}

0 commit comments

Comments
 (0)