mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 23:40:35 +01:00
Fix iris create, package's dependencies are downloaded automatically when a package is installed
This commit is contained in:
parent
49c1a595ec
commit
12d24f715d
|
@ -20,6 +20,8 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
packagesInstallDir = utils.AssetsDirectory + utils.PathSeparator + "iris-command-assets" + utils.PathSeparator
|
packagesInstallDir = utils.AssetsDirectory + utils.PathSeparator + "iris-command-assets" + utils.PathSeparator
|
||||||
|
// packages should install with go get before create the package
|
||||||
|
packagesDependencies = []string{"github.com/iris-contrib/middleware/logger"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func isValidInstallDir(targetDir string) bool {
|
func isValidInstallDir(targetDir string) bool {
|
||||||
|
@ -54,9 +56,27 @@ func create(flags cli.Flags) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !utils.DirectoryExists(packagesInstallDir) || !flags.Bool("offline") {
|
if !utils.DirectoryExists(packagesInstallDir) || !flags.Bool("offline") {
|
||||||
downloadPackages()
|
// install/update go dependencies at the same time downloading the zip from the github iris-contrib assets
|
||||||
|
finish := make(chan bool)
|
||||||
|
go func() {
|
||||||
|
go func() {
|
||||||
|
for _, source := range packagesDependencies {
|
||||||
|
gogetCmd := utils.CommandBuilder("go", "get", source)
|
||||||
|
if msg, err := gogetCmd.CombinedOutput(); err != nil {
|
||||||
|
panic("Unable to go get " + source + " please make sure you're connected to the internet.\nSolution: Remove your $GOPATH/src/github.com/iris-contrib/middleware folder and re-run the iris create\nReason:\n" + string(msg))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finish <- true
|
||||||
|
|
||||||
|
}()
|
||||||
|
|
||||||
|
downloadPackages()
|
||||||
|
<-finish
|
||||||
|
}()
|
||||||
|
|
||||||
|
<-finish
|
||||||
|
close(finish)
|
||||||
|
}
|
||||||
createPackage(flags.String("type"), targetDir)
|
createPackage(flags.String("type"), targetDir)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user