本文整理匯總了Golang中github.com/marmelab/gaudi/gaudi.Gaudi.Run方法的典型用法代碼示例。如果您正苦於以下問題:Golang Gaudi.Run方法的具體用法?Golang Gaudi.Run怎麽用?Golang Gaudi.Run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/marmelab/gaudi/gaudi.Gaudi
的用法示例。
在下文中一共展示了Gaudi.Run方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
flag.Parse()
if *flagVersion {
fmt.Println(gaudi.VERSION)
return
}
rebuild := len(flag.Args()) > 0 && flag.Args()[0] == "rebuild"
g := gaudi.Gaudi{}
g.InitFromFile(retrieveConfigPath(*config))
if len(flag.Args()) == 0 || rebuild {
// Start all applications
g.StartApplications(rebuild)
} else {
switch os.Args[1] {
case "run":
// Run a specific command
g.Run(os.Args[2], os.Args[3:])
break
case "enter":
// Enter in a specific container
g.Enter(os.Args[2])
break
case "stop":
// Stop all applications
g.StopApplications()
break
case "check":
// Check if all applications are running
g.Check()
break
case "clean":
// Clean application containers
g.Clean()
break
default:
util.LogError("Argument " + os.Args[1] + " was not found")
break
}
}
}
示例2: TestStartBinariesShouldCleanAndBuildThem
func (s *GaudiTestSuite) TestStartBinariesShouldCleanAndBuildThem(c *C) {
os.RemoveAll("/var/tmp/gaudi/")
// Create a gomock controller, and arrange for it's finish to be called
ctrl := gomock.NewController(c)
defer ctrl.Finish()
// Setup the docker mock package
docker.MOCK().SetController(ctrl)
// Setup the util mock package
util.MOCK().SetController(ctrl)
// Disable the util package mock
util.MOCK().DisableMock("IsDir")
util.MOCK().DisableMock("IsFile")
util.EXPECT().PrintGreen("Retrieving templates ...")
docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
docker.EXPECT().HasDocker().Return(true).Times(1)
docker.EXPECT().ShouldRebuild(gomock.Any()).Return(true).Times(1)
util.EXPECT().PrintGreen("Building", "gaudi/npm", "...")
docker.EXPECT().Build(gomock.Any(), gomock.Any()).Times(1)
util.EXPECT().PrintGreen("Running", "npm", "update", "...")
docker.EXPECT().Run(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return().Times(1)
g := gaudi.Gaudi{}
g.Init(`
binaries:
npm:
type: npm
`)
c.Assert(len(g.Applications), Equals, 0)
c.Assert(len(g.Binaries), Equals, 1)
g.Run("npm", []string{"update"})
}