本文整理匯總了Golang中github.com/getgauge/gauge/logger.Info函數的典型用法代碼示例。如果您正苦於以下問題:Golang Info函數的具體用法?Golang Info怎麽用?Golang Info使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Info函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: printExecutionStatus
func printExecutionStatus(suiteResult *result.SuiteResult, errMap *validationErrMaps) int {
nSkippedScenarios := len(errMap.scenarioErrs)
nSkippedSpecs := len(errMap.specErrs)
nExecutedSpecs := len(suiteResult.SpecResults) - nSkippedSpecs
nFailedSpecs := suiteResult.SpecsFailedCount
nPassedSpecs := nExecutedSpecs - nFailedSpecs
nExecutedScenarios := 0
nFailedScenarios := 0
nPassedScenarios := 0
for _, specResult := range suiteResult.SpecResults {
nExecutedScenarios += specResult.ScenarioCount
nFailedScenarios += specResult.ScenarioFailedCount
}
nExecutedScenarios -= nSkippedScenarios
nPassedScenarios = nExecutedScenarios - nFailedScenarios
logger.Info("Specifications:\t%d executed\t%d passed\t%d failed\t%d skipped", nExecutedSpecs, nPassedSpecs, nFailedSpecs, nSkippedSpecs)
logger.Info("Scenarios:\t%d executed\t%d passed\t%d failed\t%d skipped", nExecutedScenarios, nPassedScenarios, nFailedScenarios, nSkippedScenarios)
logger.Info("\nTotal time taken: %s", time.Millisecond*time.Duration(suiteResult.ExecutionTime))
for _, unhandledErr := range suiteResult.UnhandledErrors {
logger.Error(unhandledErr.Error())
}
exitCode := 0
if suiteResult.IsFailed || (nSkippedSpecs+nSkippedScenarios) > 0 {
exitCode = 1
}
return exitCode
}
示例2: addPluginToTheProject
func addPluginToTheProject(pluginName string, pluginArgs map[string]string, manifest *manifest.Manifest) error {
if !plugin.IsPluginInstalled(pluginName, pluginArgs["version"]) {
logger.Info("Plugin %s %s is not installed. Downloading the plugin.... \n", pluginName, pluginArgs["version"])
result := InstallPlugin(pluginName, pluginArgs["version"])
if !result.Success {
logger.Error(result.getMessage())
}
}
pd, err := plugin.GetPluginDescriptor(pluginName, pluginArgs["version"])
if err != nil {
return err
}
if plugin.IsPluginAdded(manifest, pd) {
logger.Info("Plugin " + pd.Name + " is already added.")
return nil
}
action := setupScope
if err := plugin.SetEnvForPlugin(action, pd, manifest, pluginArgs); err != nil {
return err
}
if _, err := plugin.StartPlugin(pd, action, true); err != nil {
return err
}
manifest.Plugins = append(manifest.Plugins, pd.Id)
return manifest.Save()
}
示例3: InitializeProject
// InitializeProject initializes a Gauge project with specified template
func InitializeProject(templateName string) {
wd, err := os.Getwd()
if err != nil {
logger.Fatalf("Failed to find working directory. %s", err.Error())
}
config.ProjectRoot = wd
exists, _ := common.UrlExists(getTemplateURL(templateName))
if exists {
err = initializeTemplate(templateName)
} else {
err = createProjectTemplate(templateName)
}
if err != nil {
logger.Fatalf("Failed to initialize project. %s", err.Error())
}
logger.Info("Successfully initialized the project. Run specifications with \"gauge specs/\"\n")
language := getTemplateLangauge(templateName)
if !install.IsCompatiblePluginInstalled(language, true) {
logger.Info("Compatible langauge plugin %s is not installed. Installing plugin...", language)
install.HandleInstallResult(install.InstallPlugin(language, ""), language, true)
}
}
示例4: ListTemplates
// ListTemplates lists all the Gauge templates available in GaugeTemplatesURL
func ListTemplates() {
templatesURL := config.GaugeTemplatesUrl()
_, err := common.UrlExists(templatesURL)
if err != nil {
logger.Fatalf("Gauge templates URL is not reachable: %s", err.Error())
}
tempDir := common.GetTempDir()
defer util.Remove(tempDir)
templatesPage, err := util.Download(templatesURL, tempDir, "", true)
if err != nil {
util.Remove(tempDir)
logger.Fatalf("Error occurred while downloading templates list: %s", err.Error())
}
templatePageContents, err := common.ReadFileContents(templatesPage)
if err != nil {
util.Remove(tempDir)
logger.Fatalf("Failed to read contents of file %s: %s", templatesPage, err.Error())
}
templates := getTemplateNames(templatePageContents)
for _, template := range templates {
logger.Info(template)
}
logger.Info("\nRun `gauge --init <template_name>` to create a new Gauge project.")
}
示例5: GetPluginsInfo
func GetPluginsInfo() []PluginInfo {
allPluginsWithVersion, err := GetAllInstalledPluginsWithVersion()
if err != nil {
logger.Info("No plugins found")
logger.Info("Plugins can be installed with `gauge --install {plugin-name}`")
os.Exit(0)
}
return allPluginsWithVersion
}
示例6: PrintUpdateInfoWithDetails
func PrintUpdateInfoWithDetails() {
updates := checkUpdates()
if len(updates) > 0 {
for _, update := range updates {
logger.Info(fmt.Sprintf("%-10s\t\t%-10s\t%s", update.Name, update.CompatibleVersion, update.Message))
}
} else {
logger.Info("No Updates available.")
}
}
示例7: UpdatePlugins
// UpdatePlugins updates all the currently installed plugins to its latest version
func UpdatePlugins() {
var failedPlugin []string
for _, pluginInfo := range plugin.GetPluginsInfo() {
logger.Info("Updating plugin '%s'", pluginInfo.Name)
passed := HandleUpdateResult(InstallPlugin(pluginInfo.Name, ""), pluginInfo.Name, false)
if !passed {
failedPlugin = append(failedPlugin, pluginInfo.Name)
}
fmt.Println()
}
if len(failedPlugin) > 0 {
logger.Fatalf("Failed to update '%s' plugins.", strings.Join(failedPlugin, ", "))
}
logger.Info("Successfully updated all the plugins.")
}
示例8: InstallPluginZip
func InstallPluginZip(zipFile string, pluginName string) {
if err := installPluginFromZip(zipFile, pluginName); err != nil {
logger.Warning("Failed to install plugin. Invalid zip file : %s\n", err)
} else {
logger.Info("Successfully installed plugin from file.")
}
}
示例9: printRefactoringSummary
func printRefactoringSummary(refactoringResult *refactoringResult) {
exitCode := 0
if !refactoringResult.Success {
exitCode = 1
for _, err := range refactoringResult.Errors {
logger.Errorf("%s \n", err)
}
}
for _, warning := range refactoringResult.warnings {
logger.Warning("%s \n", warning)
}
logger.Info("%d specifications changed.\n", len(refactoringResult.specsChanged))
logger.Info("%d concepts changed.\n", len(refactoringResult.conceptsChanged))
logger.Info("%d files in code changed.\n", len(refactoringResult.runnerFilesChanged))
os.Exit(exitCode)
}
示例10: installPluginsFromManifest
func installPluginsFromManifest(manifest *manifest.Manifest) {
pluginsMap := make(map[string]bool, 0)
pluginsMap[manifest.Language] = true
for _, plugin := range manifest.Plugins {
pluginsMap[plugin] = false
}
for pluginName, isRunner := range pluginsMap {
if !IsCompatiblePluginInstalled(pluginName, isRunner) {
logger.Info("Compatible version of plugin %s not found. Installing plugin %s...", pluginName, pluginName)
HandleInstallResult(InstallPlugin(pluginName, ""), pluginName, true)
} else {
logger.Info("Plugin %s is already installed.", pluginName)
}
}
}
示例11: installPluginVersion
func installPluginVersion(installDesc *installDescription, versionInstallDescription *versionInstallDescription) installResult {
if common.IsPluginInstalled(installDesc.Name, versionInstallDescription.Version) {
return installSuccess(fmt.Sprintf("Plugin %s %s is already installed.", installDesc.Name, versionInstallDescription.Version))
}
logger.Info("Installing Plugin => %s %s\n", installDesc.Name, versionInstallDescription.Version)
downloadLink, err := getDownloadLink(versionInstallDescription.DownloadUrls)
if err != nil {
return installError(fmt.Sprintf("Could not get download link: %s", err.Error()))
}
tempDir := common.GetTempDir()
defer common.Remove(tempDir)
unzippedPluginDir, err := util.DownloadAndUnzip(downloadLink, tempDir)
if err != nil {
return installError(err.Error())
}
if err := runInstallCommands(versionInstallDescription.Install, unzippedPluginDir); err != nil {
return installError(fmt.Sprintf("Failed to Run install command. %s.", err.Error()))
}
err = copyPluginFilesToGauge(installDesc, versionInstallDescription, unzippedPluginDir)
if err != nil {
installError(err.Error())
}
return installSuccess("")
}
示例12: 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("")
}
示例13: runInstallCommands
func runInstallCommands(installCommands platformSpecificCommand, workingDir string) error {
command := []string{}
switch runtime.GOOS {
case "windows":
command = installCommands.Windows
break
case "darwin":
command = installCommands.Darwin
break
default:
command = installCommands.Linux
break
}
if len(command) == 0 {
return nil
}
logger.Info("Running plugin install command => %s\n", command)
cmd, err := common.ExecuteCommand(command, workingDir, os.Stdout, os.Stderr)
if err != nil {
return err
}
return cmd.Wait()
}
示例14: InstallPluginZip
func InstallPluginZip(zipFile string, pluginName string) {
if err := installPluginFromZip(zipFile, pluginName); err != nil {
logger.Fatal("Failed to install plugin. %s\n", err.Error())
} else {
logger.Info("Successfully installed plugin from file.")
}
}
示例15: InstallPlugin
// InstallPlugin download and install the latest plugin(if version not specified) of given plugin name
func InstallPlugin(pluginName, version string) InstallResult {
logger.Info("Gathering metadata for %s", pluginName)
installDescription, result := getInstallDescription(pluginName, false)
defer util.RemoveTempDir()
if !result.Success {
return result
}
return installPluginWithDescription(installDescription, version)
}