upgrade

package
v1.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmakeCmd = &cobra.Command{
	Use:   "cmake",
	Short: "Auto upgrade CMakeLists.txt",
	Long: `Auto upgrade CMakeLists.txt. Example:
tarsgo upgrade cmake`,
	Run: func(cmd *cobra.Command, args []string) {
		wd, err := os.Getwd()
		if err != nil {
			panic(err)
		}
		cmakeListsTxt := path.Join(wd, "CMakeLists.txt")
		err = base.CopyFile(cmakeListsTxt, cmakeListsTxt, []string{
			"${GOPATH}/src/github.com/TarsCloud/TarsGo/", "${CMAKE_CURRENT_SOURCE_DIR}/",
		})
		if err != nil {
			panic(err)
		}
		err = bindata.RestoreAssets(wd, "cmake")
		if err != nil {
			panic(err)
		}
		fmt.Println(color.GreenString("upgrade success"))
	},
}

CmakeCmd represents the new command.

View Source
var CmdNew = &cobra.Command{
	Use:   "upgrade",
	Short: "Auto upgrade tarsgo and tars2go",
	Long: `Auto upgrade tarsgo and tars2go. Example:
tarsgo upgrade`,
	Run: run,
}

CmdNew UpgradeCmd represents the new command.

View Source
var MakeCmd = &cobra.Command{
	Use:   "make",
	Short: "Auto upgrade makefile",
	Long: `Auto upgrade makefile. Example: 
tarsgo upgrade make`,
	Run: func(cmd *cobra.Command, args []string) {
		wd, err := os.Getwd()
		if err != nil {
			panic(err)
		}
		makefile := path.Join(wd, "makefile")
		err = base.CopyFile(makefile, makefile, []string{
			`
libpath=${subst :, ,$(GOPATH)}`, "",
			"$(foreach path,$(libpath),$(eval -include $(path)/src/github.com/TarsCloud/TarsGo/tars/makefile.tars))", "-include " + consts.IncludeMakefile,
			"$(foreach path,$(libpath),$(eval -include $(path)/src/github.com/TarsCloud/TarsGo/tars/makefile.tars.gomod))", "-include " + consts.IncludeMakefile,
		})
		if err != nil {
			panic(err)
		}
		err = bindata.RestoreAsset(wd, consts.IncludeMakefile)
		if err != nil {
			panic(err)
		}
		fmt.Println(color.GreenString("upgrade success"))
	},
}

MakeCmd represents the new command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL