mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Removed version update
Version control is maintained through go.mod file Modified harness to only kill the application if not responded after 60 seconds in windows
This commit is contained in:
@@ -135,10 +135,8 @@ func (cmd AppCmd) Kill() {
|
|||||||
// Send an interrupt signal to allow for a graceful shutdown
|
// Send an interrupt signal to allow for a graceful shutdown
|
||||||
utils.Logger.Info("Killing revel server pid", "pid", cmd.Process.Pid)
|
utils.Logger.Info("Killing revel server pid", "pid", cmd.Process.Pid)
|
||||||
var err error
|
var err error
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
// os.Interrupt is not available on windows
|
// os.Interrupt is not available on windows
|
||||||
err = cmd.Process.Signal(os.Kill)
|
|
||||||
} else {
|
|
||||||
err = cmd.Process.Signal(os.Interrupt)
|
err = cmd.Process.Signal(os.Interrupt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,11 +332,11 @@ func (h *Harness) Run() {
|
|||||||
// Make a new channel to listen for the interrupt event
|
// Make a new channel to listen for the interrupt event
|
||||||
ch := make(chan os.Signal)
|
ch := make(chan os.Signal)
|
||||||
signal.Notify(ch, os.Interrupt, os.Kill)
|
signal.Notify(ch, os.Interrupt, os.Kill)
|
||||||
|
<-ch
|
||||||
// Kill the app and exit
|
// Kill the app and exit
|
||||||
if h.app != nil {
|
if h.app != nil {
|
||||||
h.app.Kill()
|
h.app.Kill()
|
||||||
}
|
}
|
||||||
<-ch
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,5 @@ package command
|
|||||||
type (
|
type (
|
||||||
Version struct {
|
Version struct {
|
||||||
ImportCommand
|
ImportCommand
|
||||||
Update bool `short:"u" long:"update" description:"Update the framework and modules" required:"false"`
|
|
||||||
UpdateVersion string `long:"update-version" description:"Specify the version the revel and app will be switched to" required:"false"`
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ type (
|
|||||||
Vendored bool // True if the application is vendored
|
Vendored bool // True if the application is vendored
|
||||||
PackageResolver func(pkgName string) error // a package resolver for the config
|
PackageResolver func(pkgName string) error // a package resolver for the config
|
||||||
BuildFlags []string `short:"X" long:"build-flags" description:"These flags will be used when building the application. May be specified multiple times, only applicable for Build, Run, Package, Test commands"`
|
BuildFlags []string `short:"X" long:"build-flags" description:"These flags will be used when building the application. May be specified multiple times, only applicable for Build, Run, Package, Test commands"`
|
||||||
GoModFlags []string `long:"gomod-flags" description:"These flags will execut go mod commands for each flag, this happens during the build process"`
|
GoModFlags []string `long:"gomod-flags" description:"These flags will execute go mod commands for each flag, this happens during the build process"`
|
||||||
New command.New `command:"new"`
|
New command.New `command:"new"`
|
||||||
Build command.Build `command:"build"`
|
Build command.Build `command:"build"`
|
||||||
Run command.Run `command:"run"`
|
Run command.Run `command:"run"`
|
||||||
|
|||||||
@@ -110,16 +110,6 @@ func (v *VersionCommand) doRepoCheck(updateLibs bool) (versionInfo string, needs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only do an update on the first loop, and if specified to update
|
// Only do an update on the first loop, and if specified to update
|
||||||
shouldUpdate := updateLibs && v.Command.Version.Update
|
|
||||||
if v.Command.Version.Update {
|
|
||||||
if localVersion == nil || (versonFromRepo != nil && versonFromRepo.Newer(localVersion)) {
|
|
||||||
needsUpdate = true
|
|
||||||
if shouldUpdate {
|
|
||||||
v.doUpdate(title, repo, localVersion, versonFromRepo)
|
|
||||||
v.updateLocalVersions()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
versionInfo = versionInfo + v.outputVersion(title, repo, localVersion, versonFromRepo)
|
versionInfo = versionInfo + v.outputVersion(title, repo, localVersion, versonFromRepo)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -234,6 +224,10 @@ func (v *VersionCommand) updateLocalVersions() {
|
|||||||
v.cmdVersion.BuildDate = cmd.BuildDate
|
v.cmdVersion.BuildDate = cmd.BuildDate
|
||||||
v.cmdVersion.MinGoVersion = cmd.MinimumGoVersion
|
v.cmdVersion.MinGoVersion = cmd.MinimumGoVersion
|
||||||
|
|
||||||
|
if v.Command.Version.ImportPath=="" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pathMap, err := utils.FindSrcPaths(v.Command.AppPath, []string{model.RevelImportPath, model.RevelModulesImportPath}, v.Command.PackageResolver)
|
pathMap, err := utils.FindSrcPaths(v.Command.AppPath, []string{model.RevelImportPath, model.RevelModulesImportPath}, v.Command.PackageResolver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Logger.Warn("Unable to extract version information from Revel library", "path", pathMap[model.RevelImportPath], "error", err)
|
utils.Logger.Warn("Unable to extract version information from Revel library", "path", pathMap[model.RevelImportPath], "error", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user