Skip to content

Commit

Permalink
feature: add modd installer (#20)
Browse files Browse the repository at this point in the history
* feature: add modd installer

* remove watchmedo installer

* bump: changelog
  • Loading branch information
fajrifernanda authored Jul 28, 2020
1 parent 1270dad commit 7eb982e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 62 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#Fer

<a name="v1.7.0"></a>
## [v1.7.0] - 2020-07-28
### New Features
- add modd installer


<a name="v1.6.0"></a>
## [v1.6.0] - 2020-04-16
### New Features
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config

// Version define version of fer
const Version = "v1.6.0"
const Version = "v1.7.0"
39 changes: 20 additions & 19 deletions console/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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)
}

Expand All @@ -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,
}

Expand Down Expand Up @@ -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",
Expand All @@ -156,4 +145,16 @@ var protobufCmd = &cobra.Command{
func installProtobufCmd(cmd *cobra.Command, args []string) {
installer.ProtobufInstaller()
os.Exit(0)
}
}

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)
}
27 changes: 27 additions & 0 deletions installer/modd_installer.go
Original file line number Diff line number Diff line change
@@ -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!")
}
41 changes: 0 additions & 41 deletions installer/watchmedo_installer.go

This file was deleted.

0 comments on commit 7eb982e

Please sign in to comment.