本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api.NewRepositoryLocator函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRepositoryLocator函数的具体用法?Golang NewRepositoryLocator怎么用?Golang NewRepositoryLocator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewRepositoryLocator函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewDependency
func NewDependency() Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter()
deps.Ui = terminal.NewUI(os.Stdin, deps.TeePrinter)
deps.ManifestRepo = manifest.NewManifestDiskRepository()
errorHandler := func(err error) {
if err != nil {
deps.Ui.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.Config = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.PluginConfig = plugin_config.NewPluginConfig(errorHandler)
deps.Detector = &detection.JibberJabberDetector{}
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.Config.Trace())
}
deps.Gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.Config, deps.Ui),
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.Ui),
"uaa": net.NewUAAGateway(deps.Config, deps.Ui),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways)
deps.PluginModels = &pluginModels{Application: nil}
return deps
}
示例2: setupDependencies
func setupDependencies() (deps *cliDependencies) {
deps = new(cliDependencies)
deps.termUI = terminal.NewUI(os.Stdin)
deps.manifestRepo = manifest.NewManifestDiskRepository()
deps.configRepo = configuration.NewRepositoryFromFilepath(configuration.DefaultFilePath(), func(err error) {
if err != nil {
deps.termUI.Failed(fmt.Sprintf("Config error: %s", err))
}
})
i18n.T = i18n.Init(deps.configRepo)
terminal.UserAskedForColors = deps.configRepo.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.configRepo.Trace())
}
deps.gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.configRepo),
"cloud-controller": net.NewCloudControllerGateway(deps.configRepo, time.Now),
"uaa": net.NewUAAGateway(deps.configRepo),
}
deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, deps.gateways)
return
}
示例3: findCommand
func findCommand(cmdName string) (cmd cli.Command) {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
requirementsFactory := &testreq.FakeReqFactory{}
cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory, fakeUI)
myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
for _, cmd := range myApp.Commands {
if cmd.Name == cmdName {
return cmd
}
}
panic(fmt.Sprintf("command %s does not exist", cmdName))
return
}
示例4: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now),
"uaa": net.NewUAAGateway(configRepo),
})
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
示例5: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil)
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
}
示例6: setupDependencies
func setupDependencies() (deps *cliDependencies) {
deps = new(cliDependencies)
deps.teePrinter = terminal.NewTeePrinter()
deps.termUI = terminal.NewUI(os.Stdin, deps.teePrinter)
deps.manifestRepo = manifest.NewManifestDiskRepository()
errorHandler := func(err error) {
if err != nil {
deps.termUI.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.configRepo = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.pluginConfig = plugin_config.NewPluginConfig(errorHandler)
deps.detector = &detection.JibberJabberDetector{}
T = Init(deps.configRepo, deps.detector)
terminal.UserAskedForColors = deps.configRepo.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.configRepo.Trace())
}
deps.gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.configRepo, deps.termUI),
"cloud-controller": net.NewCloudControllerGateway(deps.configRepo, time.Now, deps.termUI),
"uaa": net.NewUAAGateway(deps.configRepo, deps.termUI),
}
deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, deps.gateways)
return
}
示例7:
var _ = Describe("App", func() {
var (
app *cli.App
cmdRunner *FakeRunner
)
JustBeforeEach(func() {
ui := &testterm.FakeUI{}
config := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := &testmanifest.FakeManifestRepository{}
repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
"auth": net.NewUAAGateway(config, ui),
"cloud-controller": net.NewCloudControllerGateway(config, time.Now, &testterm.FakeUI{}),
"uaa": net.NewUAAGateway(config, ui),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(ui, config, manifestRepo, repoLocator, pluginConfig, rpcService)
cmdRunner = &FakeRunner{cmdFactory: cmdFactory}
app = NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
})
Describe("trace file integration", func() {
var (
output *bytes.Buffer
)
BeforeEach(func() {
示例8: NewDependency
func NewDependency(logger trace.Printer) Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter()
deps.Ui = terminal.NewUI(os.Stdin, deps.TeePrinter, logger)
errorHandler := func(err error) {
if err != nil {
deps.Ui.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.Config = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.ManifestRepo = manifest.NewManifestDiskRepository()
deps.AppManifest = manifest.NewGenerator()
deps.PluginConfig = plugin_config.NewPluginConfig(errorHandler)
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
deps.Gateways = map[string]net.Gateway{
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.Ui, logger),
"uaa": net.NewUAAGateway(deps.Config, deps.Ui, logger),
"routing-api": net.NewRoutingApiGateway(deps.Config, time.Now, deps.Ui, logger),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways, logger)
deps.PluginModels = &PluginModels{Application: nil}
deps.PlanBuilder = plan_builder.NewBuilder(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
)
deps.ServiceBuilder = service_builder.NewBuilder(
deps.RepoLocator.GetServiceRepository(),
deps.PlanBuilder,
)
deps.BrokerBuilder = broker_builder.NewBuilder(
deps.RepoLocator.GetServiceBrokerRepository(),
deps.ServiceBuilder,
)
deps.PluginRepo = plugin_repo.NewPluginRepo()
deps.ServiceHandler = actors.NewServiceHandler(
deps.RepoLocator.GetOrganizationRepository(),
deps.BrokerBuilder,
deps.ServiceBuilder,
)
deps.ServicePlanHandler = actors.NewServicePlanHandler(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
deps.PlanBuilder,
deps.ServiceBuilder,
)
deps.WordGenerator = generator.NewWordGenerator()
deps.AppZipper = app_files.ApplicationZipper{}
deps.AppFiles = app_files.ApplicationFiles{}
deps.PushActor = actors.NewPushActor(deps.RepoLocator.GetApplicationBitsRepository(), deps.AppZipper, deps.AppFiles)
deps.ChecksumUtil = utils.NewSha1Checksum("")
deps.Logger = logger
return deps
}
示例9: NewDependency
func NewDependency(writer io.Writer, logger trace.Printer) Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter(writer)
deps.UI = terminal.NewUI(os.Stdin, writer, deps.TeePrinter, logger)
errorHandler := func(err error) {
if err != nil {
deps.UI.Failed(fmt.Sprintf("Config error: %s", err))
}
}
configPath, err := confighelpers.DefaultFilePath()
if err != nil {
errorHandler(err)
}
deps.Config = coreconfig.NewRepositoryFromFilepath(configPath, errorHandler)
deps.ManifestRepo = manifest.NewDiskRepository()
deps.AppManifest = manifest.NewGenerator()
pluginPath := filepath.Join(confighelpers.PluginRepoDir(), ".cf", "plugins")
deps.PluginConfig = pluginconfig.NewPluginConfig(
errorHandler,
configuration.NewDiskPersistor(filepath.Join(pluginPath, "config.json")),
pluginPath,
)
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
deps.Gateways = map[string]net.Gateway{
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.UI, logger),
"uaa": net.NewUAAGateway(deps.Config, deps.UI, logger),
"routing-api": net.NewRoutingAPIGateway(deps.Config, time.Now, deps.UI, logger),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways, logger)
deps.PluginModels = &PluginModels{Application: nil}
deps.PlanBuilder = planbuilder.NewBuilder(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
)
deps.ServiceBuilder = servicebuilder.NewBuilder(
deps.RepoLocator.GetServiceRepository(),
deps.PlanBuilder,
)
deps.BrokerBuilder = brokerbuilder.NewBuilder(
deps.RepoLocator.GetServiceBrokerRepository(),
deps.ServiceBuilder,
)
deps.PluginRepo = pluginrepo.NewPluginRepo()
deps.ServiceHandler = actors.NewServiceHandler(
deps.RepoLocator.GetOrganizationRepository(),
deps.BrokerBuilder,
deps.ServiceBuilder,
)
deps.ServicePlanHandler = actors.NewServicePlanHandler(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
deps.PlanBuilder,
deps.ServiceBuilder,
)
deps.WordGenerator = generator.NewWordGenerator()
deps.AppZipper = appfiles.ApplicationZipper{}
deps.AppFiles = appfiles.ApplicationFiles{}
deps.PushActor = actors.NewPushActor(deps.RepoLocator.GetApplicationBitsRepository(), deps.AppZipper, deps.AppFiles)
deps.ChecksumUtil = utils.NewSha1Checksum("")
deps.Logger = logger
return deps
}