diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9a61a..9d8dec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ #Fer + +## [v1.7.0] - 2020-07-28 +### New Features +- add modd installer + + ## [v1.6.0] - 2020-04-16 ### New Features @@ -99,7 +105,8 @@ - db migrationfile generator ([#3](https://github.com/kumparan/fer/issues/3)) -[Unreleased]: https://github.com/kumparan/fer/compare/v1.6.0...HEAD +[Unreleased]: https://github.com/kumparan/fer/compare/v1.7.0...HEAD +[v1.7.0]: https://github.com/kumparan/fer/compare/v1.6.0...v1.7.0 [v1.6.0]: https://github.com/kumparan/fer/compare/v1.5.4...v1.6.0 [v1.5.4]: https://github.com/kumparan/fer/compare/v1.5.3...v1.5.4 [v1.5.3]: https://github.com/kumparan/fer/compare/v1.5.2...v1.5.3 diff --git a/config/version.go b/config/version.go index 915eeb0..2b04f45 100644 --- a/config/version.go +++ b/config/version.go @@ -1,4 +1,4 @@ package config // Version define version of fer -const Version = "v1.6.0" +const Version = "v1.7.0" diff --git a/console/install.go b/console/install.go index 9882b12..12045cf 100644 --- a/console/install.go +++ b/console/install.go @@ -9,12 +9,12 @@ import ( ) var installCmd = &cobra.Command{ - Use: "install", + Use: "install", Short: "install dependencies for your project", - Long: "install what do you need for backend contributed", + Long: "install what do you need for backend contributed", } -func init(){ +func init() { installCmd.AddCommand(installAllCmd) installCmd.AddCommand(goUtilsCmd) installCmd.AddCommand(protocGenCmd) @@ -24,10 +24,11 @@ func init(){ installCmd.AddCommand(chglogCmd) installCmd.AddCommand(watchmedoCmd) installCmd.AddCommand(protobufCmd) + installCmd.AddCommand(moddCmd) } var installAllCmd = &cobra.Command{ - Use: "all", + Use: "all", Short: "This subcommand to install all dependencies", Long: "install all dependencies for contributing to backend projects", Run: installAll, @@ -41,8 +42,8 @@ func installAll(_ *cobra.Command, _ []string) { installer.InstallGoUtils("richgo", config.RichgoInstallerURL) installer.InstallGoUtils("golint", config.GolintInstallerURL) installer.InstallGoUtils("git-chglog", config.ChangeLogInstallerURL) - installer.InstallWatchmedo() installer.ProtobufInstaller() + installer.InstallModd() os.Exit(0) } @@ -67,7 +68,7 @@ func installGoUtilsCmd(_ *cobra.Command, _ []string) { var protocGenCmd = &cobra.Command{ Use: "protoc-gen", Short: "This subcommand to install protoc generator", - Long: "Go version must be " +config.GoVersion+ " or latest", + Long: "Go version must be " + config.GoVersion + " or latest", Run: installProtocGenCmd, } @@ -134,18 +135,6 @@ func installChglogCmd(_ *cobra.Command, _ []string) { os.Exit(0) } -var watchmedoCmd = &cobra.Command{ - Use: "watchmedo", - Short: "This subcommand to install watchmedo", - Long: "Watchdog comes with an optional utility script called watchmedo.", - Run: installWatchmedoCmd, -} - -func installWatchmedoCmd(cmd *cobra.Command, args []string) { - installer.InstallWatchmedo() - os.Exit(0) -} - var protobufCmd = &cobra.Command{ Use: "protobuf", Short: "This subcommand to install protobuf", @@ -156,4 +145,16 @@ var protobufCmd = &cobra.Command{ func installProtobufCmd(cmd *cobra.Command, args []string) { installer.ProtobufInstaller() os.Exit(0) -} \ No newline at end of file +} + +var moddCmd = &cobra.Command{ + Use: "modd", + Short: "This subcommand to install modd", + Long: "Modd is a developer tool that triggers commands and manages daemons in response to filesystem changes. https://github.com/cortesi/modd", + Run: installModdCmd, +} + +func installModdCmd(cmd *cobra.Command, args []string) { + installer.InstallModd() + os.Exit(0) +} diff --git a/installer/modd_installer.go b/installer/modd_installer.go new file mode 100644 index 0000000..d1a2a25 --- /dev/null +++ b/installer/modd_installer.go @@ -0,0 +1,27 @@ +package installer + +import ( + "fmt" + "os" + "os/exec" +) + +// InstallModd :nodoc: +func InstallModd() { + installModdCommand := exec.Command("go", "get", "github.com/cortesi/modd/cmd/modd@latest") + installModdCommand.Env = append(os.Environ(), + "GO111MODULE=on", + ) + fmt.Println("installing modd") + err := installModdCommand.Run() + if err != nil { + ProgressBar(1) + fmt.Println("Failed installing mod") + fmt.Println(err) + os.Exit(1) + } + + ProgressBar(100) + + fmt.Println("Success install modd!") +} diff --git a/installer/watchmedo_installer.go b/installer/watchmedo_installer.go deleted file mode 100644 index a344b29..0000000 --- a/installer/watchmedo_installer.go +++ /dev/null @@ -1,41 +0,0 @@ -package installer - -import ( - "fmt" - "os" - "os/exec" -) - -type ( - // WatchmedoInstaller :nodoc: - WatchmedoInstaller interface { - InstallWatchmedo() - } -) - -// InstallWatchmedo :nodoc: -func InstallWatchmedo() { - pipCmd := "pip3" - cmdGetPip3Location := exec.Command("which", pipCmd) - err := cmdGetPip3Location.Run() - if err != nil { - pipCmd = "pip" - cmdGetPipLocation := exec.Command("which", pipCmd) - err = cmdGetPipLocation.Run() - if err != nil { - fmt.Println("you must install python-pip first") - os.Exit(1) - } - - } - cmdInstallWachmedoByPip := exec.Command(pipCmd, "install", "watchdog") - err = cmdInstallWachmedoByPip.Run() - if err != nil { - ProgressBar(1) - fmt.Println(err) - fmt.Println("fail installed watchmedo") - } - ProgressBar(100) - message := CheckedInstallerPath("watchmedo") - fmt.Println(message) -}