Skip to content

Commit

Permalink
Better logs when running implicit setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai committed Sep 9, 2024
1 parent f751db3 commit b5facc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions bitrise/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ var PluginDependencyMap = map[string]PluginDependency{
}

func RunSetupIfNeeded(logger log.Logger) error {
if !configs.CheckIsSetupWasDoneForVersion(version.VERSION) {
log.Warnf("Setup was not performed for this version of bitrise, doing it now...")
versionMatch, setupVersion := configs.CheckIsSetupWasDoneForVersion(version.VERSION)
if setupVersion == "" {
log.Warnf("No setup was done yet, running setup now...")
return RunSetup(logger, version.VERSION, SetupModeDefault, false)
}
if !versionMatch {
log.Warnf("Setup was last performed for version %s, current version is %s. Re-running setup now...", setupVersion, version.VERSION)
return RunSetup(logger, version.VERSION, SetupModeDefault, false)
}
return nil
Expand Down
6 changes: 3 additions & 3 deletions configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ func SavePluginUpdateCheck(plugin string) error {
return saveBitriseConfig(config)
}

func CheckIsSetupWasDoneForVersion(ver string) bool {
func CheckIsSetupWasDoneForVersion(ver string) (bool, string) {
config, err := loadBitriseConfig()
if err != nil {
return false
return false, ""
}
return (config.SetupVersion == ver)
return config.SetupVersion == ver, config.SetupVersion
}

func SaveSetupSuccessForVersion(ver string) error {
Expand Down

0 comments on commit b5facc1

Please sign in to comment.