當前位置: 首頁>>代碼示例>>Golang>>正文


Golang common.MirrorDir函數代碼示例

本文整理匯總了Golang中github.com/getgauge/common.MirrorDir函數的典型用法代碼示例。如果您正苦於以下問題:Golang MirrorDir函數的具體用法?Golang MirrorDir怎麽用?Golang MirrorDir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了MirrorDir函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: installGauge

func installGauge() {
	updateGaugeInstallPrefix()
	copyGaugeFiles(deployDir)
	if _, err := common.MirrorDir(deployDir, *gaugeInstallPrefix); err != nil {
		panic(fmt.Sprintf("Could not install gauge : %s", err))
	}
}
開發者ID:universsky,項目名稱:gauge,代碼行數:7,代碼來源:make.go

示例2: InstallPluginFromZipFile

// InstallPluginFromZipFile installs plugin from given zip file
func InstallPluginFromZipFile(zipFile string, pluginName string) InstallResult {
	tempDir := common.GetTempDir()
	defer common.Remove(tempDir)
	unzippedPluginDir, err := common.UnzipArchive(zipFile, tempDir)
	if err != nil {
		return installError(err)
	}

	gp, err := parsePluginJSON(unzippedPluginDir, pluginName)
	if err != nil {
		return installError(err)
	}

	if err = runPlatformCommands(gp.PreInstall, unzippedPluginDir); err != nil {
		return installError(err)
	}

	pluginInstallDir, err := getPluginInstallDir(gp.ID, getVersionedPluginDirName(zipFile))
	if err != nil {
		return installError(err)
	}

	// copy files to gauge plugin install location
	logger.Info("Installing plugin %s %s", gp.ID, filepath.Base(pluginInstallDir))
	if _, err = common.MirrorDir(unzippedPluginDir, pluginInstallDir); err != nil {
		return installError(err)
	}

	if err = runPlatformCommands(gp.PostInstall, pluginInstallDir); err != nil {
		return installError(err)
	}
	return installSuccess("")
}
開發者ID:mattdotmatt,項目名稱:gauge,代碼行數:34,代碼來源:install.go

示例3: installGaugeGo

func installGaugeGo(installPrefix string) {
	defer os.RemoveAll(deploy)
	copyGaugeGoFiles(deployDir)
	goRunnerInstallPath := filepath.Join(installPrefix, "go", getGaugeGoVersion())
	log.Printf("Copying %s -> %s\n", deployDir, goRunnerInstallPath)
	common.MirrorDir(deployDir, goRunnerInstallPath)
}
開發者ID:manuviswam,項目名稱:gauge-go,代碼行數:7,代碼來源:make.go

示例4: copyPluginFilesToGauge

func copyPluginFilesToGauge(installDesc *installDescription, versionInstallDesc *versionInstallDescription, pluginContents string) error {
	pluginsDir, err := common.GetPrimaryPluginsInstallDir()
	if err != nil {
		return err
	}
	versionedPluginDir := path.Join(pluginsDir, installDesc.Name, versionInstallDesc.Version)
	if common.DirExists(versionedPluginDir) {
		return errors.New(fmt.Sprintf("Plugin %s %s already installed at %s", installDesc.Name, versionInstallDesc.Version, versionedPluginDir))
	}
	return common.MirrorDir(pluginContents, versionedPluginDir)
}
開發者ID:krwhitney,項目名稱:gauge,代碼行數:11,代碼來源:install.go

示例5: copyPluginFilesToGaugeInstallDir

func copyPluginFilesToGaugeInstallDir(unzippedPluginDir string, pluginId string, version string) error {
	logger.Log.Info("Installing Plugin => %s %s\n", pluginId, version)

	pluginsDir, err := common.GetPrimaryPluginsInstallDir()
	if err != nil {
		return err
	}
	versionedPluginDir := path.Join(pluginsDir, pluginId, version)
	if common.DirExists(versionedPluginDir) {
		return errors.New(fmt.Sprintf("Plugin %s %s already installed at %s", pluginId, version, versionedPluginDir))
	}
	return common.MirrorDir(unzippedPluginDir, versionedPluginDir)
}
開發者ID:krwhitney,項目名稱:gauge,代碼行數:13,代碼來源:install.go

示例6: initializeTemplate

func initializeTemplate(templateName string) error {
	tempDir := common.GetTempDir()
	defer util.Remove(tempDir)
	unzippedTemplate, err := util.DownloadAndUnzip(getTemplateURL(templateName), tempDir)
	if err != nil {
		return err
	}

	wd := config.ProjectRoot

	logger.Info("Copying Gauge template %s to current directory ...", templateName)
	filesAdded, err := common.MirrorDir(filepath.Join(unzippedTemplate, templateName), wd)
	if err != nil {
		return fmt.Errorf("Failed to copy Gauge template: %s", err.Error())
	}

	metadataFile := filepath.Join(wd, metadataFileName)
	metadataContents, err := common.ReadFileContents(metadataFile)
	if err != nil {
		return fmt.Errorf("Failed to read file contents of %s: %s", metadataFile, err.Error())
	}

	metadata := &templateMetadata{}
	err = json.Unmarshal([]byte(metadataContents), metadata)
	if err != nil {
		return err
	}

	if metadata.PostInstallCmd != "" {
		command := strings.Split(metadata.PostInstallCmd, " ")
		cmd, err := common.ExecuteSystemCommand(command, wd, os.Stdout, os.Stderr)
		cmd.Wait()
		if err != nil {
			for _, file := range filesAdded {
				pathSegments := strings.Split(file, string(filepath.Separator))
				util.Remove(filepath.Join(wd, pathSegments[0]))
			}
			return fmt.Errorf("Failed to run post install commands: %s", err.Error())
		}
	}

	util.Remove(metadataFile)
	return nil
}
開發者ID:0-T-0,項目名稱:gauge,代碼行數:44,代碼來源:init.go

示例7: installFiles

// key will be the source file and value will be the target
func installFiles(files map[string]string, installDir string) {
	for src, dst := range files {
		base := filepath.Base(src)
		installDst := filepath.Join(installDir, dst)
		log.Printf("Install %s -> %s\n", src, installDst)
		stat, err := os.Stat(src)
		if err != nil {
			panic(err)
		}
		if stat.IsDir() {
			_, err = common.MirrorDir(src, installDst)
		} else {
			err = common.MirrorFile(src, filepath.Join(installDst, base))
		}
		if err != nil {
			panic(err)
		}
	}
}
開發者ID:universsky,項目名稱:gauge,代碼行數:20,代碼來源:make.go

示例8: copyReportTemplateFiles

func copyReportTemplateFiles(reportDir string) error {
	reportTemplateDir := filepath.Join(pluginDir, reportTemplateDir)
	_, err := common.MirrorDir(reportTemplateDir, reportDir)
	return err
}
開發者ID:jean,項目名稱:html-report,代碼行數:5,代碼來源:htmlReport.go


注:本文中的github.com/getgauge/common.MirrorDir函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。