Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kcmvp committed Aug 16, 2024
1 parent 66281dd commit f4ed1cc
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 978 deletions.
71 changes: 0 additions & 71 deletions boot/application.go

This file was deleted.

86 changes: 0 additions & 86 deletions boot/db.go

This file was deleted.

42 changes: 0 additions & 42 deletions boot/db_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/gbc/artifact/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestBasic(t *testing.T) {

func (suite *ProjectTestSuite) TestDeps() {
deps := CurProject().Dependencies()
assert.Equal(suite.T(), 49, len(deps))
assert.Equal(suite.T(), 44, len(deps))
assert.True(suite.T(), lo.ContainsBy(deps, func(require *modfile.Require) bool {
return require.Mod.Path == "github.com/spf13/viper"
}))
Expand Down
30 changes: 15 additions & 15 deletions cmd/gbc/command/initialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ func (suite *RootTestSuit) TestParseDeps() {
}

func (suite *InitializeTestSuite) TestInitialization() {
gopath := artifact.GoPath()
//gopath := artifact.GoPath()
target := artifact.CurProject().Target()
rootCmd.SetArgs([]string{"init"})
rootCmd.Execute()
plugins := artifact.CurProject().Plugins()
assert.Equal(suite.T(), 3, len(plugins))
_, ok := lo.Find(plugins, func(plugin artifact.Plugin) bool {
return strings.HasPrefix(plugin.Url, golangCiLinter)
})
assert.True(suite.T(), ok)
_, ok = lo.Find(plugins, func(plugin artifact.Plugin) bool {
return strings.HasPrefix(plugin.Url, testsum)
})
assert.True(suite.T(), ok)
lo.ForEach(plugins, func(plugin artifact.Plugin, _ int) {
_, err := os.Stat(filepath.Join(gopath, plugin.Binary()))
assert.NoError(suite.T(), err)
})
//plugins := artifact.CurProject().Plugins()
//assert.Equal(suite.T(), 3, len(plugins))
//_, ok := lo.Find(plugins, func(plugin artifact.Plugin) bool {
// return strings.HasPrefix(plugin.Url, golangCiLinter)
//})
//assert.True(suite.T(), ok)
//_, ok = lo.Find(plugins, func(plugin artifact.Plugin) bool {
// return strings.HasPrefix(plugin.Url, testsum)
//})
//assert.True(suite.T(), ok)
//lo.ForEach(plugins, func(plugin artifact.Plugin, _ int) {
// _, err := os.Stat(filepath.Join(gopath, plugin.Binary()))
// assert.NoError(suite.T(), err)
//})
_, err1 := os.Stat(filepath.Join(target, "gob.yaml"))
assert.NoError(suite.T(), err1)
assert.True(suite.T(), lo.Every([]string{"build", "clean", "test", "depth", "lint"}, validBuilderArgs()))
Expand Down
14 changes: 7 additions & 7 deletions cmd/gbc/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ var rootCmd = &cobra.Command{
if artifact.CurProject().Root() != currentDir {
return fmt.Errorf(color.RedString("Please execute the command in the project root dir"))
}
if err := installPlugins(cmd, args); err != nil {
return err
}
if err := installDeps(cmd, args); err != nil {
return err
}
//if err := installPlugins(cmd, args); err != nil {
// return err
//}
//if err := installDeps(cmd, args); err != nil {
// return err
//}
return artifact.CurProject().SetupHooks(false)
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -169,7 +169,7 @@ func Execute() error {
}

func init() {
rootCmd.Example = rootExample()
// rootCmd.Example = rootExample()
rootCmd.SetUsageTemplate(usageTemplate())
rootCmd.SetErrPrefix(color.RedString("Error:"))
rootCmd.SetFlagErrorFunc(func(command *cobra.Command, err error) error {
Expand Down
108 changes: 0 additions & 108 deletions dbx/clause.go

This file was deleted.

Loading

0 comments on commit f4ed1cc

Please sign in to comment.