diff --git a/plugin/install/install.go b/plugin/install/install.go index e0b7cc355..feeca921b 100644 --- a/plugin/install/install.go +++ b/plugin/install/install.go @@ -262,7 +262,6 @@ func installPluginVersion(installDesc *installDescription, versionInstallDescrip tempDir := common.GetTempDir() defer common.Remove(tempDir) - logger.Debugf(true, "Downloading %s", filepath.Base(downloadLink)) pluginZip, err := util.Download(downloadLink, tempDir, "", silent) if err != nil { return installError(fmt.Errorf("Failed to download the plugin. %s", err.Error())) @@ -422,11 +421,11 @@ func constructPluginInstallJSONURL(p string) (string, InstallResult) { if repoURL == "" { return "", installError(fmt.Errorf("Could not find gauge repository url from configuration.")) } - JSONURL := fmt.Sprintf("%s/%s", repoURL, p) + jsonURL := fmt.Sprintf("%s/%s", repoURL, p) if qp := plugin.QueryParams(); qp != "" { - JSONURL += qp + jsonURL += qp } - return JSONURL, installSuccess("") + return jsonURL, installSuccess("") } func (installDesc *installDescription) getVersion(version string) (*versionInstallDescription, error) { @@ -518,8 +517,8 @@ func HandleInstallResult(result InstallResult, pluginName string, exitIfFailure return true } if !result.Success { - if (result.Version != "") { - logger.Errorf(true, "Failed to install plugin '%s' version %s.\nReason: %s", pluginName, result.Version, result.getMessage()) + if result.Version != "" { + logger.Errorf(true, "Failed to install plugin '%s' version %s.\nReason: %s", pluginName, result.Version, result.getMessage()) } else { logger.Errorf(true, "Failed to install plugin '%s'.\nReason: %s", pluginName, result.getMessage()) } @@ -528,7 +527,7 @@ func HandleInstallResult(result InstallResult, pluginName string, exitIfFailure } return false } - if (result.Version != "") { + if result.Version != "" { logger.Infof(true, "Successfully installed plugin '%s' version %s", pluginName, result.Version) } else { logger.Infof(true, "Successfully installed plugin '%s'", pluginName) diff --git a/projectInit/init.go b/projectInit/init.go index a420219fe..2e637ea7c 100644 --- a/projectInit/init.go +++ b/projectInit/init.go @@ -38,7 +38,9 @@ type templateMetadata struct { func initializeTemplate(templateName string) error { tempDir := common.GetTempDir() defer util.Remove(tempDir) - unzippedTemplate, err := util.DownloadAndUnzip(getTemplateURL(templateName), tempDir) + templateURL := getTemplateURL(templateName) + logger.Debugf(true, "Initializing template from %s", templateURL) + unzippedTemplate, err := util.DownloadAndUnzip(templateURL, tempDir) if err != nil { return err } @@ -71,6 +73,7 @@ func initializeTemplate(templateName string) error { } if metadata.PostInstallCmd != "" { + logger.Debugf(true, "Running post install command %s", metadata.PostInstallCmd) command := strings.Fields(metadata.PostInstallCmd) cmd, err := common.ExecuteSystemCommand(command, wd, os.Stdout, os.Stderr) if err != nil { @@ -84,7 +87,7 @@ func initializeTemplate(templateName string) error { return err } } - fmt.Printf("Successfully initialized the project. %s\n", metadata.PostInstallMsg) + logger.Infof(true, "Successfully initialized the project. %s\n", metadata.PostInstallMsg) util.Remove(metadataFile) return nil diff --git a/projectInit/template.go b/projectInit/template.go index 5bbb10988..0ab572e7d 100644 --- a/projectInit/template.go +++ b/projectInit/template.go @@ -24,11 +24,11 @@ func ListTemplates() { templatesURL := config.GaugeTemplatesUrl() _, err := common.UrlExists(templatesURL) if err != nil { - logger.Fatalf(true, "Gauge templates URL is not reachable: %s", err.Error()) + logger.Fatalf(true, "Gauge templates URL %s is not reachable: %s", templatesURL, err.Error()) } res, err := http.Get(templatesURL) if err != nil { - logger.Fatalf(true, "Error occurred while downloading templates list: %s", err.Error()) + logger.Fatalf(true, "Error occurred while downloading templates list from %s: %s", templatesURL, err.Error()) } defer res.Body.Close() if res.StatusCode >= 400 { diff --git a/runner/runner.go b/runner/runner.go index c7d4663d1..c334ffe2d 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -177,6 +177,7 @@ func ExecuteInitHookForRunner(language string) error { languageJSONFilePath, err := plugin.GetLanguageJSONFilePath(language) runnerDir := filepath.Dir(languageJSONFilePath) + logger.Debugf(true, "Running init hook command => %s", command) cmd, err := common.ExecuteCommand(command, runnerDir, os.Stdout, os.Stderr) if err != nil { diff --git a/util/httpUtils.go b/util/httpUtils.go index f8a33e37a..43ada58e9 100644 --- a/util/httpUtils.go +++ b/util/httpUtils.go @@ -24,6 +24,8 @@ import ( "os" "path/filepath" + "github.com/getgauge/gauge/logger" + "github.com/getgauge/common" ) @@ -63,6 +65,7 @@ func Download(url, targetDir, fileName string, silent bool) (string, error) { } targetFile := filepath.Join(targetDir, fileName) + logger.Debugf(true, "Downloading %s", url) resp, err := http.Get(url) if err != nil { return "", err