• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang cmdex.RunCommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/bitrise-io/go-utils/cmdex.RunCommand函数的典型用法代码示例。如果您正苦于以下问题:Golang RunCommand函数的具体用法?Golang RunCommand怎么用?Golang RunCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RunCommand函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: performRunOrTriggerWithCmdBridge

func performRunOrTriggerWithCmdBridge(bitriseCommandToUse, inventoryBase64, configBase64, runParamJSONBase64, workflowNameOrTriggerPattern, workdirPath string) error {
	bitriseCallArgs := createBitriseCallArgs(bitriseCommandToUse, inventoryBase64, configBase64, runParamJSONBase64, workflowNameOrTriggerPattern)
	log.Debugf("=> (debug) bitriseCallArgs: %s", bitriseCallArgs)

	bitriseCmdStr := fmt.Sprintf("bitrise %s", strings.Join(bitriseCallArgs, " "))
	args := []string{"-workdir", workdirPath, "-do", bitriseCmdStr}

	if err := cmdex.RunCommand("cmd-bridge", args...); err != nil {
		log.Debugf("cmd: `%s` failed, error: %s", bitriseCmdStr)
		return err
	}

	return nil
}
开发者ID:bitrise-tools,项目名称:bitrise-bridge,代码行数:14,代码来源:run.go


示例2: performRunOrTriggerWithDocker

func performRunOrTriggerWithDocker(bridgeConfig config.Model, bitriseCommandToUse, inventoryBase64, configBase64, runParamJSONBase64, workflowNameOrTriggerPattern, workdirPath string) error {
	dockerParamImageToUse := bridgeConfig.Docker.Image
	if dockerParamImageToUse == "" {
		return errors.New("No docker-image-id specified")
	}
	dockerParamIsAllowAccessToDockerInContainer := bridgeConfig.Docker.IsAllowAccessToDockerInContainer

	bitriseCallArgs := createBitriseCallArgs(bitriseCommandToUse, inventoryBase64, configBase64, runParamJSONBase64, workflowNameOrTriggerPattern)
	log.Debugf("=> (debug) bitriseCallArgs: %s", bitriseCallArgs)

	fullDockerArgs := []string{
		"run", "--rm",
	}
	if dockerParamIsAllowAccessToDockerInContainer {
		// mount the docker.sock socker & the docker binary as volumes, to make it
		//  accessible inside the container
		dockerPth, err := cmdex.RunCommandAndReturnStdout("which", "docker")
		if err != nil || dockerPth == "" {
			return errors.New("Failed to determin docker binary path; required for the 'docker-allow-access-to-docker-in-container' option")
		}
		fullDockerArgs = append(fullDockerArgs,
			"-v", "/var/run/docker.sock:/var/run/docker.sock",
			"-v", fmt.Sprintf("%s:%s", dockerPth, "/bin/docker"),
		)
	}
	if len(bridgeConfig.Docker.Volumes) > 0 {
		for _, aVolDef := range bridgeConfig.Docker.Volumes {
			fullDockerArgs = append(fullDockerArgs, "-v", aVolDef)
		}
	}
	if len(bridgeConfig.Docker.AdditionalRunArguments) > 0 {
		fullDockerArgs = append(fullDockerArgs, bridgeConfig.Docker.AdditionalRunArguments...)
	}
	// these are the docker specific params
	fullDockerArgs = append(fullDockerArgs, dockerParamImageToUse)
	// append Bitrise specific params
	fullDockerArgs = append(fullDockerArgs, "bitrise")
	fullDockerArgs = append(fullDockerArgs, bitriseCallArgs...)

	log.Debugf("fullDockerArgs: %#v", fullDockerArgs)

	if err := cmdex.RunCommand("docker", fullDockerArgs...); err != nil {
		log.Debugf("cmd: `docker %s` failed, error: %s", fullDockerArgs)
		return err
	}

	return nil
}
开发者ID:bitrise-tools,项目名称:bitrise-bridge,代码行数:48,代码来源:run.go


示例3: exportProvisioningProfiles

func exportProvisioningProfiles(provProfileFileInfos []provprofile.ProvisioningProfileFileInfoModel,
	exportTargetDirPath string) error {

	for idx, aProvProfileFileInfo := range provProfileFileInfos {
		if idx != 0 {
			fmt.Println()
		}
		provProfileInfo := aProvProfileFileInfo.ProvisioningProfileInfo
		log.Infoln("   "+colorstring.Green("Exporting Provisioning Profile:"), provProfileInfo.Name)
		log.Infoln("                      App ID Name:", provProfileInfo.AppIDName)
		log.Infoln("                           App ID:", provProfileInfo.Entitlements.AppID)
		log.Infoln("                  Expiration Date:", provProfileInfo.ExpirationDate)
		log.Infoln("                             UUID:", provProfileInfo.UUID)
		log.Infoln("                         TeamName:", provProfileInfo.TeamName)
		log.Infoln("                          Team ID:", provProfileInfo.Entitlements.TeamID)
		exportFileName := provProfileExportFileName(aProvProfileFileInfo)
		exportPth := filepath.Join(exportTargetDirPath, exportFileName)
		if err := cmdex.RunCommand("cp", aProvProfileFileInfo.Path, exportPth); err != nil {
			return fmt.Errorf("Failed to copy Provisioning Profile (from: %s) (to: %s), error: %s",
				aProvProfileFileInfo.Path, exportPth, err)
		}
	}
	return nil
}
开发者ID:bitrise-tools,项目名称:codesigndoc,代码行数:24,代码来源:common.go


示例4: EnvmanInitAtPath

// EnvmanInitAtPath ...
func EnvmanInitAtPath(pth string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "--path", pth, "init", "--clear"}
	return cmdex.RunCommand("envman", args...)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:6,代码来源:run.go


示例5: EnvmanInit

// EnvmanInit ...
func EnvmanInit() error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "init"}
	return cmdex.RunCommand("envman", args...)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:6,代码来源:run.go


示例6: StepmanUpdate

// StepmanUpdate ...
func StepmanUpdate(collection string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--debug", "--loglevel", logLevel, "update", "--collection", collection}
	return cmdex.RunCommand("stepman", args...)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:6,代码来源:run.go


示例7: StepmanActivate

// StepmanActivate ...
func StepmanActivate(collection, stepID, stepVersion, dir, ymlPth string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--debug", "--loglevel", logLevel, "activate", "--collection", collection,
		"--id", stepID, "--version", stepVersion, "--path", dir, "--copyyml", ymlPth}
	return cmdex.RunCommand("stepman", args...)
}
开发者ID:bazscsa,项目名称:bitrise-cli,代码行数:7,代码来源:run.go


示例8: StepmanShareStart

// StepmanShareStart ...
func StepmanShareStart(collection string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "share", "start", "--collection", collection, "--toolmode"}
	return cmdex.RunCommand("stepman", args...)
}
开发者ID:andrewhavens,项目名称:bitrise,代码行数:6,代码来源:run.go


示例9: StepmanShareFinish

// StepmanShareFinish ...
func StepmanShareFinish() error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "share", "finish", "--toolmode"}
	return cmdex.RunCommand("stepman", args...)
}
开发者ID:andrewhavens,项目名称:bitrise,代码行数:6,代码来源:run.go


示例10: StepmanShareCreate

// StepmanShareCreate ...
func StepmanShareCreate(tag, git, stepID string) error {
	logLevel := log.GetLevel().String()
	args := []string{"--loglevel", logLevel, "share", "create", "--tag", tag, "--git", git, "stepid", stepID, "--toolmode"}
	return cmdex.RunCommand("stepman", args...)
}
开发者ID:andrewhavens,项目名称:bitrise,代码行数:6,代码来源:run.go


示例11: exportCodeSigningFiles

func exportCodeSigningFiles(toolName, absExportOutputDirPath string, codeSigningSettings common.CodeSigningSettings) error {
	fmt.Println()
	fmt.Println()
	utils.Printlnf("=== Required Identities/Certificates (%d) ===", len(codeSigningSettings.Identities))
	for idx, anIdentity := range codeSigningSettings.Identities {
		utils.Printlnf(" * (%d): %s", idx+1, anIdentity.Title)
	}
	fmt.Println("============================================")

	fmt.Println()
	utils.Printlnf("=== Required Provisioning Profiles (%d) ===", len(codeSigningSettings.ProvProfiles))
	for idx, aProvProfile := range codeSigningSettings.ProvProfiles {
		utils.Printlnf(" * (%d): %s (UUID: %s)", idx+1, aProvProfile.Title, aProvProfile.UUID)
	}
	fmt.Println("==========================================")

	fmt.Println()
	utils.Printlnf("=== Team IDs (%d) ===", len(codeSigningSettings.TeamIDs))
	for idx, aTeamID := range codeSigningSettings.TeamIDs {
		utils.Printlnf(" * (%d): %s", idx+1, aTeamID)
	}
	fmt.Println("==========================================")

	fmt.Println()
	utils.Printlnf("=== App/Bundle IDs (%d) ===", len(codeSigningSettings.AppIDs))
	for idx, anAppBundleID := range codeSigningSettings.AppIDs {
		utils.Printlnf(" * (%d): %s", idx+1, anAppBundleID)
	}
	fmt.Println("==========================================")
	fmt.Println()

	//
	// --- Code Signing issue checks / report
	//

	if len(codeSigningSettings.Identities) < 1 {
		return printFinishedWithError(toolName, "No Code Signing Identity detected!")
	}
	if len(codeSigningSettings.Identities) > 1 {
		log.Warning(colorstring.Yellow("More than one Code Signing Identity (certificate) is required to sign your app!"))
		log.Warning("You should check your settings and make sure a single Identity/Certificate can be used")
		log.Warning(" for Archiving your app!")
	}

	if len(codeSigningSettings.ProvProfiles) < 1 {
		return printFinishedWithError(toolName, "No Provisioning Profiles detected!")
	}

	//
	// --- Export
	//

	if !isAllowExport {
		isShouldExport, err := goinp.AskForBoolWithDefault("Do you want to export these files?", true)
		if err != nil {
			return printFinishedWithError(toolName, "Failed to process your input: %s", err)
		}
		if !isShouldExport {
			printFinished()
			return nil
		}
	} else {
		log.Debug("Allow Export flag was set - doing export without asking")
	}

	exportedProvProfiles, err := collectAndExportProvisioningProfiles(codeSigningSettings, absExportOutputDirPath)
	if err != nil {
		return printFinishedWithError(toolName, "Failed to export Provisioning Profiles, error: %s", err)
	}

	if err := collectAndExportIdentities(codeSigningSettings, exportedProvProfiles.CollectTeamIDs(), absExportOutputDirPath); err != nil {
		return printFinishedWithError(toolName, "Failed to export identities, error: %s", err)
	}

	fmt.Println()
	fmt.Printf(colorstring.Green("Exports finished")+" you can find the exported files at: %s\n", absExportOutputDirPath)
	if err := cmdex.RunCommand("open", absExportOutputDirPath); err != nil {
		log.Errorf("Failed to open the export directory in Finder: %s", absExportOutputDirPath)
	}
	fmt.Println("Opened the directory in Finder.")
	fmt.Println()

	printFinished()
	return nil
}
开发者ID:bitrise-tools,项目名称:codesigndoc,代码行数:85,代码来源:common.go



注:本文中的github.com/bitrise-io/go-utils/cmdex.RunCommand函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang cmdex.RunCommandAndReturnCombinedStdoutAndStderr函数代码示例发布时间:2022-05-24
下一篇:
Golang cmdex.NewCommand函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap