Skip to content

Commit

Permalink
Moved cmdlets into runbits.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Nov 2, 2023
1 parent 4fbc1e3 commit 301fe30
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 36 deletions.
3 changes: 1 addition & 2 deletions architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ from use by external code.
#### internal/runbits/

Packages that are made available for use by "runner" packages. In essence,
`internal/runners/internal/runbits`. A synonymous and deprecated directory
exists at `pkg/cmdlets/`.
`internal/runners/internal/runbits`.

#### internal/runners/

Expand Down
2 changes: 1 addition & 1 deletion cmd/state-installer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/rollbar"
"github.com/ActiveState/cli/internal/runbits/errors"
"github.com/ActiveState/cli/internal/runbits/panics"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/internal/subshell/bash"
"github.com/ActiveState/cli/pkg/cmdlets/errors"
"github.com/ActiveState/cli/pkg/project"
"github.com/ActiveState/cli/pkg/sysinfo"
"golang.org/x/crypto/ssh/terminal"
Expand Down
2 changes: 1 addition & 1 deletion cmd/state-remote-installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/ActiveState/cli/internal/prompt"
"github.com/ActiveState/cli/internal/rollbar"
"github.com/ActiveState/cli/internal/rtutils/ptr"
"github.com/ActiveState/cli/internal/runbits/errors"
"github.com/ActiveState/cli/internal/runbits/panics"
"github.com/ActiveState/cli/internal/updater"
"github.com/ActiveState/cli/pkg/cmdlets/errors"
)

type Params struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/state/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (
"github.com/ActiveState/cli/internal/prompt"
_ "github.com/ActiveState/cli/internal/prompt" // Sets up survey defaults
"github.com/ActiveState/cli/internal/rollbar"
"github.com/ActiveState/cli/internal/runbits/errors"
"github.com/ActiveState/cli/internal/runbits/legacy/projectmigration"
"github.com/ActiveState/cli/internal/runbits/panics"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/internal/svcctl"
cmdletErrors "github.com/ActiveState/cli/pkg/cmdlets/errors"
secretsapi "github.com/ActiveState/cli/pkg/platform/api/secrets"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
Expand Down Expand Up @@ -101,7 +101,7 @@ func main() {
// Run our main command logic, which is logic that defers to the error handling logic below
err = run(os.Args, isInteractive, cfg, out)
if err != nil {
exitCode, err = cmdletErrors.ParseUserFacing(err)
exitCode, err = errors.ParseUserFacing(err)
if err != nil {
out.Error(err)
}
Expand Down Expand Up @@ -252,7 +252,7 @@ func run(args []string, isInteractive bool, cfg *config.Instance, out output.Out
cmdName = childCmd.JoinedSubCommandNames() + " "
}
err = errs.AddTips(err, locale.Tl("err_tip_run_help", "Run → [ACTIONABLE]`state {{.V0}}--help`[/RESET] for general help", cmdName))
cmdletErrors.ReportError(err, cmds.Command(), an)
errors.ReportError(err, cmds.Command(), an)
}

return err
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ActiveState/cli/internal/fileutils"
"github.com/ActiveState/cli/internal/language"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/pkg/cmdlets/git"
"github.com/ActiveState/cli/internal/runbits/git"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/project"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/fileutils"
"github.com/ActiveState/cli/internal/locale"
runbitsGit "github.com/ActiveState/cli/internal/runbits/git"
"github.com/ActiveState/cli/internal/testhelpers/outputhelper"
gitlet "github.com/ActiveState/cli/pkg/cmdlets/git"
"github.com/ActiveState/cli/pkg/project"
)

Expand Down Expand Up @@ -79,7 +79,7 @@ func (suite *GitTestSuite) AfterTest(suiteName, testName string) {
}

func (suite *GitTestSuite) TestEnsureCorrectProject() {
err := gitlet.EnsureCorrectProject("test-owner", "test-project", filepath.Join(suite.dir, constants.ConfigFileName), "test-repo", outputhelper.NewCatcher(), blackhole.New())
err := runbitsGit.EnsureCorrectProject("test-owner", "test-project", filepath.Join(suite.dir, constants.ConfigFileName), "test-repo", outputhelper.NewCatcher(), blackhole.New())
suite.NoError(err, "projectfile URL should contain owner and name")
}

Expand All @@ -88,7 +88,7 @@ func (suite *GitTestSuite) TestEnsureCorrectProject_Missmatch() {
name := "bad-project"
projectPath := filepath.Join(suite.dir, constants.ConfigFileName)
actualCatcher := outputhelper.NewCatcher()
err := gitlet.EnsureCorrectProject(owner, name, projectPath, "test-repo", actualCatcher, blackhole.New())
err := runbitsGit.EnsureCorrectProject(owner, name, projectPath, "test-repo", actualCatcher, blackhole.New())
suite.NoError(err)

proj, err := project.Parse(projectPath)
Expand All @@ -104,7 +104,7 @@ func (suite *GitTestSuite) TestEnsureCorrectProject_Missmatch() {

func (suite *GitTestSuite) TestMoveFiles() {
anotherDir := filepath.Join(suite.anotherDir, "anotherDir")
err := gitlet.MoveFiles(suite.dir, anotherDir)
err := runbitsGit.MoveFiles(suite.dir, anotherDir)
suite.NoError(err, "should be able to move files wihout error")

_, err = os.Stat(filepath.Join(anotherDir, constants.ConfigFileName))
Expand All @@ -122,7 +122,7 @@ func (suite *GitTestSuite) TestMoveFilesDirNoEmpty() {
err = fileutils.Touch(filepath.Join(anotherDir, "file.txt"))
suite.Require().NoError(err)

err = gitlet.MoveFiles(suite.dir, anotherDir)
err = runbitsGit.MoveFiles(suite.dir, anotherDir)
expected := locale.WrapError(err, "err_git_verify_dir", "Could not verify destination directory")
suite.EqualError(err, expected.Error())
}
Expand Down
6 changes: 3 additions & 3 deletions internal/runners/activate/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (
"github.com/ActiveState/cli/internal/process"
"github.com/ActiveState/cli/internal/prompt"
"github.com/ActiveState/cli/internal/runbits/activation"
"github.com/ActiveState/cli/internal/runbits/checker"
"github.com/ActiveState/cli/internal/runbits/checkout"
"github.com/ActiveState/cli/internal/runbits/commitmediator"
"github.com/ActiveState/cli/internal/runbits/findproject"
"github.com/ActiveState/cli/internal/runbits/git"
"github.com/ActiveState/cli/internal/runbits/runtime"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/internal/virtualenvironment"
"github.com/ActiveState/cli/pkg/cmdlets/checker"
"github.com/ActiveState/cli/pkg/cmdlets/checkout"
"github.com/ActiveState/cli/pkg/cmdlets/git"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/platform/runtime/target"
Expand Down
8 changes: 4 additions & 4 deletions internal/runners/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/prompt"
authlet "github.com/ActiveState/cli/pkg/cmdlets/auth"
"github.com/ActiveState/cli/internal/runbits/auth"
"github.com/ActiveState/cli/pkg/platform/authentication"
)

Expand Down Expand Up @@ -84,18 +84,18 @@ func (a *Auth) Run(params *AuthParams) error {

func (a *Auth) authenticate(params *AuthParams) error {
if params.Prompt || params.Username != "" {
return authlet.AuthenticateWithInput(params.Username, params.Password, params.Totp, params.NonInteractive, a.Cfg, a.Outputer, a.Prompter, a.Auth)
return auth.AuthenticateWithInput(params.Username, params.Password, params.Totp, params.NonInteractive, a.Cfg, a.Outputer, a.Prompter, a.Auth)
}

if params.Token != "" {
return authlet.AuthenticateWithToken(params.Token, a.Auth)
return auth.AuthenticateWithToken(params.Token, a.Auth)
}

if params.NonInteractive {
return locale.NewInputError("err_auth_needinput")
}

return authlet.AuthenticateWithBrowser(a.Outputer, a.Auth, a.Prompter)
return auth.AuthenticateWithBrowser(a.Outputer, a.Auth, a.Prompter)
}

func (a *Auth) verifyAuthentication() error {
Expand Down
4 changes: 2 additions & 2 deletions internal/runners/auth/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/prompt"
authlet "github.com/ActiveState/cli/pkg/cmdlets/auth"
"github.com/ActiveState/cli/internal/runbits/auth"
"github.com/ActiveState/cli/pkg/platform/authentication"
)

Expand All @@ -29,5 +29,5 @@ func (s *Signup) Run(params *SignupParams) error {
return locale.NewInputError("err_auth_authenticated", "You are already authenticated as: {{.V0}}. You can log out by running `state auth logout`.", s.Auth.WhoAmI())
}

return authlet.SignupWithBrowser(s.Outputer, s.Auth, s.Prompter)
return auth.SignupWithBrowser(s.Outputer, s.Auth, s.Prompter)
}
6 changes: 3 additions & 3 deletions internal/runners/checkout/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"github.com/ActiveState/cli/internal/logging"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/runbits/checker"
"github.com/ActiveState/cli/internal/runbits/checkout"
"github.com/ActiveState/cli/internal/runbits/git"
"github.com/ActiveState/cli/internal/runbits/runtime"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/pkg/cmdlets/checker"
"github.com/ActiveState/cli/pkg/cmdlets/checkout"
"github.com/ActiveState/cli/pkg/cmdlets/git"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/platform/runtime/setup"
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/runbits/commit"
"github.com/ActiveState/cli/internal/runbits/commitmediator"
"github.com/ActiveState/cli/pkg/cmdlets/commit"
"github.com/ActiveState/cli/pkg/platform/api/mono/mono_models"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/project"
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/ActiveState/cli/internal/prompt"
"github.com/ActiveState/cli/internal/runbits"
buildscriptRunbits "github.com/ActiveState/cli/internal/runbits/buildscript"
"github.com/ActiveState/cli/internal/runbits/commit"
"github.com/ActiveState/cli/internal/runbits/commitmediator"
"github.com/ActiveState/cli/pkg/cmdlets/commit"
"github.com/ActiveState/cli/pkg/platform/api/mono/mono_models"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/revert/revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/prompt"
"github.com/ActiveState/cli/internal/runbits"
"github.com/ActiveState/cli/internal/runbits/commit"
"github.com/ActiveState/cli/internal/runbits/commitmediator"
"github.com/ActiveState/cli/pkg/cmdlets/commit"
gqlmodel "github.com/ActiveState/cli/pkg/platform/api/graphql/model"
"github.com/ActiveState/cli/pkg/platform/api/mono/mono_models"
"github.com/ActiveState/cli/pkg/platform/authentication"
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/ActiveState/cli/internal/logging"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/runbits/checker"
"github.com/ActiveState/cli/internal/scriptrun"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/pkg/cmdlets/checker"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/project"
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/profile"
"github.com/ActiveState/cli/pkg/cmdlets/checker"
"github.com/ActiveState/cli/internal/runbits/checker"
"github.com/ActiveState/cli/pkg/platform/model"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/runners/use/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/prompt"
"github.com/ActiveState/cli/internal/runbits/checker"
"github.com/ActiveState/cli/internal/runbits/checkout"
"github.com/ActiveState/cli/internal/runbits/commitmediator"
"github.com/ActiveState/cli/internal/runbits/findproject"
"github.com/ActiveState/cli/internal/runbits/git"
"github.com/ActiveState/cli/internal/runbits/runtime"
"github.com/ActiveState/cli/internal/subshell"
"github.com/ActiveState/cli/pkg/cmdlets/checker"
"github.com/ActiveState/cli/pkg/cmdlets/checkout"
"github.com/ActiveState/cli/pkg/cmdlets/git"
"github.com/ActiveState/cli/pkg/platform/authentication"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/platform/runtime/setup"
Expand Down
3 changes: 0 additions & 3 deletions pkg/cmdlets/README.md

This file was deleted.

0 comments on commit 301fe30

Please sign in to comment.