From 44f0ed34a7bf1f2d4592fc49a8dca238f7fcaed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 29 Jul 2016 17:10:57 +0200 Subject: [PATCH 1/2] depman update --- deplock.json | 2 +- .../bitrise-core/bitrise-init/CHANGELOG.md | 10 ++- .../bitrise-init/Godeps/Godeps.json | 2 +- .../bitrise-core/bitrise-init/bitrise.yml | 24 +++---- .../bitrise-init/scanners/android/android.go | 29 ++++---- .../scanners/fastlane/fastlane.go | 19 +++--- .../bitrise-init/scanners/ios/ios.go | 66 +++++++++++------- .../bitrise-init/scanners/xamarin/xamarin.go | 37 +++++----- .../bitrise-core/bitrise-init/steps/steps.go | 4 +- .../bitrise-core/bitrise-init/utility/log.go | 56 +++++++--------- .../bitrise-init/utility/podfile_util.go | 10 +-- .../bitrise-init/utility/utility.go | 7 +- .../xcode-utils/xcodeproj/xcodeproj.go | 67 ++++++++++++++++--- .../bitrise-init/version/version.go | 2 +- 14 files changed, 206 insertions(+), 129 deletions(-) diff --git a/deplock.json b/deplock.json index ac8e379f..2c22b4a8 100644 --- a/deplock.json +++ b/deplock.json @@ -2,7 +2,7 @@ "dep_locks": [ { "url": "https://github.com/bitrise-core/bitrise-init.git", - "revision": "6ea3593dd0ffb50b69518e684af98ae87a28caf6" + "revision": "cda32880c9aa2bd20f31d94534e6c0ee8a0b599e" } ] } \ No newline at end of file diff --git a/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md index 90a46026..8785be84 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md +++ b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md @@ -1,7 +1,13 @@ -## Changelog (Current version: 0.9.9) +## Changelog (Current version: 0.9.10) ----------------- +### 0.9.10 (2016 Jul 29) + +* [ca94c8c] prepare for 0.9.10 +* [f541e09] fastalne test, logging updates (#37) +* [0253f44] logging updates, godep update (#36) + ### 0.9.9 (2016 Jul 28) * [e68da49] prepare for 0.9.9 @@ -98,4 +104,4 @@ ----------------- -Updated: 2016 Jul 28 \ No newline at end of file +Updated: 2016 Jul 29 \ No newline at end of file diff --git a/go/src/github.com/bitrise-core/bitrise-init/Godeps/Godeps.json b/go/src/github.com/bitrise-core/bitrise-init/Godeps/Godeps.json index 63407b02..40c215ff 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/Godeps/Godeps.json +++ b/go/src/github.com/bitrise-core/bitrise-init/Godeps/Godeps.json @@ -60,7 +60,7 @@ }, { "ImportPath": "github.com/bitrise-io/xcode-utils/xcodeproj", - "Rev": "5635e4f1887be5b0ff593bb7b3fd4fe8a24c3be4" + "Rev": "fe27904d6d8e569bd481c1a1115bd93585489c6d" }, { "ImportPath": "github.com/davecgh/go-spew/spew", diff --git a/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml b/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml index 01c7e064..de39ac35 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml +++ b/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml @@ -132,17 +132,17 @@ workflows: SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-watchkit.git git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo $SCANNER_BIN --ci config --dir ./_tmp/sample-repo --output-dir ./_tmp/output --format json - # - script: - # title: "Scanner test: android-sdk22-no-gradlew" - # inputs: - # - content: |- - # #!/bin/bash - # set -x - # - # rm -rf ./_tmp - # SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-sdk22-no-gradlew.git - # git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - # $SCANNER_BIN --ci config --dir ./_tmp/sample-repo --output-dir ./_tmp/output --format json + - script: + title: "Scanner test: fastlane" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/fastlane.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + $SCANNER_BIN --ci config --dir ./_tmp/sample-repo --output-dir ./_tmp/output --format json - script: title: "Scanner test: sample-apps-xamarin-ios" inputs: @@ -212,7 +212,7 @@ workflows: 2, Export RELEASE_VERSION 3, Create binaries envs: - - RELEASE_VERSION: 0.9.9 + - RELEASE_VERSION: 0.9.10 after_run: - _export_release_version - create_binaries diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android.go index 74ea8023..ab5d3371 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android.go @@ -157,17 +157,17 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { } scanner.GradleFiles = gradleFiles - log.InfofDetails("%d build.gradle file(s) detected:", len(gradleFiles)) + log.Details("%d build.gradle file(s) detected", len(gradleFiles)) for _, file := range gradleFiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } if len(gradleFiles) == 0 { - log.InfofDetails("platform not detected") + log.Details("platform not detected") return false, nil } - log.InfofReceipt("platform detected") + log.Done("Platform detected") return true, nil } @@ -175,14 +175,14 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { // Options ... func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { // Search for gradlew_path input - log.InfoSection("Searching for gradlew files") + log.Info("Searching for gradlew files") warnings := models.Warnings{} gradlewFiles := filterGradlewFiles(scanner.FileList) - log.InfofDetails("%d gradlew file(s) detected:", len(gradlewFiles)) + log.Details("%d gradlew file(s) detected", len(gradlewFiles)) for _, file := range gradlewFiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } rootGradlewPath := "" @@ -190,15 +190,15 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { rootGradlewPath = gradlewFiles[0] scanner.HasGradlewFile = true - log.InfofDetails("root gradlew path: %s", rootGradlewPath) + log.Details("root gradlew path: %s", rootGradlewPath) } else { - log.Warnf("No gradlew file found") + log.Warn("No gradlew file found") warnings = append(warnings, "no gradlew file found") } gradleBin := "gradle" if scanner.HasGradlewFile { - log.InfofDetails("adding executable permission to gradlew file") + log.Details("adding executable permission to gradlew file") err := os.Chmod(rootGradlewPath, 0770) if err != nil { @@ -208,17 +208,20 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { gradleBin = rootGradlewPath } - log.InfofReceipt("gradle bin to use by inspect: %s", gradleBin) + log.Details("gradle bin to use: %s", gradleBin) // Inspect Gradle files gradleFileOption := models.NewOptionModel(gradleFileTitle, gradleFileEnvKey) for _, gradleFile := range scanner.GradleFiles { - log.InfofSection("Gradle file: %s", gradleFile) + log.Info("Inspecting gradle file: %s", gradleFile) configs := defaultGradleTasks - log.InfofReceipt("gradle tasks: %v", configs) + log.Details("%d gradle task(s) found", len(configs)) + for _, config := range configs { + log.Details("- %s", config) + } gradleTaskOption := models.NewOptionModel(gradleTaskTitle, gradleTaskEnvKey) for _, config := range configs { diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go index 311948aa..4a7b9fb2 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go @@ -133,17 +133,17 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { fastfiles := filterFastfiles(fileList) scanner.Fastfiles = fastfiles - log.InfofDetails("%d Fastfile(s) detected:", len(fastfiles)) + log.Details("%d Fastfile(s) detected", len(fastfiles)) for _, file := range fastfiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } if len(fastfiles) == 0 { - log.InfofDetails("platform not detected") + log.Details("platform not detected") return false, nil } - log.InfofReceipt("platform detected") + log.Done("Platform detected") return true, nil } @@ -157,17 +157,20 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { // Inspect Fastfiles for _, fastfile := range scanner.Fastfiles { - log.InfofSection("Inspecting Fastfile: %s", fastfile) + log.Info("Inspecting Fastfile: %s", fastfile) lanes, err := inspectFastfile(fastfile) if err != nil { return models.OptionModel{}, models.Warnings{}, err } - log.InfofReceipt("found lanes: %v", lanes) + log.Details("%d lane(s) found") + for _, lane := range lanes { + log.Details("- %s", lane) + } if len(lanes) == 0 { - log.Warnf("No lanes found") + log.Warn("No lanes found") warnings = append(warnings, fmt.Sprintf("no lanes found for Fastfile: %s", fastfile)) continue } @@ -176,7 +179,7 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { workDir := fastlaneWorkDir(fastfile) - log.InfofReceipt("fastlane work dir: %s", workDir) + log.Details("fastlane work dir: %s", workDir) configOption := models.NewEmptyOptionModel() configOption.Config = configName() diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go index bc9e9750..2945d858 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go @@ -241,23 +241,23 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { scanner.FileList = fileList // Search for xcodeproj file - log.Info("Searching for xcodeproj files") + log.Info("Searching for .xcodeproj & .xcworkspace files") xcodeProjectFiles := filterXcodeprojectFiles(fileList) scanner.XcodeProjectAndWorkspaceFiles = xcodeProjectFiles - log.InfofDetails("%d xcodeproj file(s) detected:", len(xcodeProjectFiles)) + log.Details("%d project file(s) detected", len(xcodeProjectFiles)) for _, file := range xcodeProjectFiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } if len(xcodeProjectFiles) == 0 { - log.InfofDetails("platform not detected") + log.Details("platform not detected") return false, nil } - log.InfofReceipt("platform detected") + log.Done("Platform detected") return true, nil } @@ -265,26 +265,26 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { // Options ... func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { // Check for Podfiles - log.InfoSection("Searching for Podfiles") + log.Info("Searching for Podfiles") warnings := models.Warnings{} podFiles := filterPodFiles(scanner.FileList) - log.InfofDetails("%d Podfile(s) detected:", len(podFiles)) + log.Details("%d Podfile(s) detected", len(podFiles)) for _, file := range podFiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } podfileWorkspaceProjectMap := map[string]string{} for _, podFile := range podFiles { - log.InfofSection("Inspecting Podfile: %s", podFile) + log.Info("Inspecting Podfile: %s", podFile) var err error podfileWorkspaceProjectMap, err = utility.GetRelativeWorkspaceProjectPathMap(podFile, scanner.SearchDir) if err != nil { - log.Warnf("Analyze Podfile (%s) failed", podFile) + log.Warn("Analyze Podfile (%s) failed", podFile) if podfileContent, err := fileutil.ReadStringFromFile(podFile); err != nil { - log.Warnf("Failed to read Podfile (%s)", podFile) + log.Warn("Failed to read Podfile (%s)", podFile) } else { fmt.Println(podfileContent) fmt.Println("") @@ -292,9 +292,9 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.InfoDetails("workspace mapping:") + log.Details("workspace mapping:") for workspace, linkedProject := range podfileWorkspaceProjectMap { - log.InfofDetails(" - %s -> %s", workspace, linkedProject) + log.Details("- %s -> %s", workspace, linkedProject) } } @@ -316,9 +316,9 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { isWorkspace := xcodeproj.IsXCWorkspace(project) if isWorkspace { - log.InfofSection("Inspecting workspace file: %s", project) + log.Info("Inspecting workspace file: %s", project) } else { - log.InfofSection("Inspecting project file: %s", project) + log.Info("Inspecting project file: %s", project) } validProjectMap := map[string]bool{} @@ -335,10 +335,17 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.InfofDetails("workspace shared schemes: %v", workspaceSchemeXCTestMap) + log.Details("%d workspace shared scheme(s) detected", len(workspaceSchemeXCTestMap)) + for scheme := range workspaceSchemeXCTestMap { + log.Details("- %s", scheme) + } if len(workspaceSchemeXCTestMap) == 0 { - log.Warnf("No shared schemes found, adding recreate-user-schemes step...") + log.Details("") + log.Error("No shared schemes found, adding recreate-user-schemes step...") + log.Error("The newly generated schemes, may differs from the ones in your project.") + log.Error("Make sure to share your schemes, to have the expected behaviour.") + log.Details("") warnings = append(warnings, fmt.Sprintf("no shared scheme found for project: %s", project)) missingSharedSchemes = true @@ -348,7 +355,10 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.InfofDetails("workspace user schemes: %v", targetXCTestMap) + log.Warn("%d user scheme(s) will be generated", len(targetXCTestMap)) + for target := range targetXCTestMap { + log.Warn("- %s", target) + } workspaceSchemeXCTestMap = targetXCTestMap } @@ -363,7 +373,7 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { for workspace, linkedProject := range podfileWorkspaceProjectMap { if linkedProject == project { - log.InfofDetails("workspace will be generated by CocoaPods: %s", workspace) + log.Details("workspace (%s) will be generated by CocoaPods", workspace) // We should use the generated workspace instead of the project validProjectMap[workspace] = true } @@ -378,10 +388,17 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.InfofDetails("project shared schemes: %v", projectSchemeXCtestMap) + log.Details("%d project shared scheme(s) detected", len(projectSchemeXCtestMap)) + for scheme := range projectSchemeXCtestMap { + log.Details("- %s", scheme) + } if len(projectSchemeXCtestMap) == 0 { - log.Warnf("No shared schemes found, adding recreate-user-schemes step...") + log.Details("") + log.Error("No shared schemes found, adding recreate-user-schemes step...") + log.Error("The newly generated schemes, may differs from the ones in your project.") + log.Error("Make sure to share your schemes, to have the expected behaviour.") + log.Details("") warnings = append(warnings, fmt.Sprintf("no shared scheme found for project: %s", project)) missingSharedSchemes = true @@ -391,7 +408,10 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.InfofDetails("project user schemes: %v", targetXCTestMap) + log.Warn("%d user scheme(s) will be generated", len(targetXCTestMap)) + for target := range targetXCTestMap { + log.Warn("- %s", target) + } projectSchemeXCtestMap = targetXCTestMap } @@ -400,8 +420,6 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { } // --- - log.InfofReceipt("found schemes: %v", schemeXCTestMap) - if len(schemeXCTestMap) == 0 { return models.OptionModel{}, models.Warnings{}, errors.New("No shared schemes found, or failed to create user schemes") } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go index 4361ddd2..e9efac4c 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go @@ -328,24 +328,24 @@ func (scanner *Scanner) DetectPlatform() (bool, error) { solutionFiles := filterSolutionFiles(fileList) scanner.SolutionFiles = solutionFiles - log.InfofDetails("%d solution file(s) detected:", len(solutionFiles)) + log.Details("%d solution file(s) detected", len(solutionFiles)) for _, file := range solutionFiles { - log.InfofDetails(" - %s", file) + log.Details("- %s", file) } if len(solutionFiles) == 0 { - log.InfofDetails("platform not detected") + log.Details("platform not detected") return false, nil } - log.InfofReceipt("platform detected") + log.Done("Platform detected") return true, nil } // Options ... func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { - log.InfoSection("Searching for NuGet packages & Xamarin Components") + log.Info("Searching for NuGet packages & Xamarin Components") warnings := models.Warnings{} @@ -375,21 +375,21 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { } if scanner.HasNugetPackages { - log.InfofReceipt("Nuget packages found") + log.Details("Nuget packages found") } else { - log.InfofDetails("NO Nuget packages found") + log.Details("NO Nuget packages found") } if scanner.HasXamarinComponents { - log.InfofReceipt("Xamarin Components found") + log.Details("Xamarin Components found") } else { - log.InfofDetails("NO Xamarin Components found") + log.Details("NO Xamarin Components found") } // Check for solution configs validSolutionMap := map[string]map[string][]string{} for _, solutionFile := range scanner.SolutionFiles { - log.InfofSection("Inspecting solution file: %s", solutionFile) + log.Info("Inspecting solution file: %s", solutionFile) configs, err := getSolutionConfigs(solutionFile) if err != nil { @@ -397,11 +397,14 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { } if len(configs) > 0 { - log.InfofReceipt("found configs: %v", configs) + log.Details("%d configuration(s) found", len(configs)) + for config, platforms := range configs { + log.Details("- %s with platform(s): %v", config, platforms) + } validSolutionMap[solutionFile] = configs } else { - log.Warnf("No config found for %s", solutionFile) + log.Warn("No config found for %s", solutionFile) } } @@ -420,7 +423,7 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { // Inspect projects for _, project := range projects { - log.InfofSection(" Inspecting project file: %s", project) + log.Info(" Inspecting project file: %s", project) guids, err := getProjectGUIDs(project) if err != nil { @@ -435,12 +438,12 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { } if testType != "" { - log.InfofReceipt(" test project type: %s", testType) + log.Details(" test project type: %s", testType) continue } if projectType == "" { - log.Warnf(" No platform api or test framework found") + log.Warn(" No platform api or test framework found") continue } @@ -453,11 +456,11 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { } else if projectType == "Xamarin.tvOS" { scanner.HasTVOSProject = true } else { - log.Warnf(" Unknow project type for GUIDs: %v", guids) + log.Warn(" Unknow project type for GUIDs: %v", guids) continue } - log.InfofReceipt(" project type: %s", projectType) + log.Details(" project type: %s", projectType) } xamarinConfigurationOption := models.NewOptionModel(xamarinConfigurationTitle, xamarinConfigurationEnvKey) diff --git a/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go b/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go index 578f0ad0..65fbaa7d 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go +++ b/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go @@ -13,7 +13,7 @@ const ( activateSSHKeyVersion = "3.1.0" gitCloneID = "git-clone" - gitCloneVersion = "3.2.0" + gitCloneVersion = "3.3.0" certificateAndProfileInstallerID = "certificate-and-profile-installer" certificateAndProfileInstallerVersion = "1.6.0" @@ -37,7 +37,7 @@ const ( cocoapodsInstallVersion = "1.5.4" recreateUserSchemesID = "recreate-user-schemes" - recreateUserSchemesVersion = "0.9.0" + recreateUserSchemesVersion = "0.9.1" xcodeArchiveID = "xcode-archive" xcodeArchiveVersion = "1.8.5" diff --git a/go/src/github.com/bitrise-core/bitrise-init/utility/log.go b/go/src/github.com/bitrise-core/bitrise-init/utility/log.go index ab7228b4..02e82719 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/utility/log.go +++ b/go/src/github.com/bitrise-core/bitrise-init/utility/log.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/Sirupsen/logrus" - "github.com/bitrise-io/go-utils/colorstring" ) // LoggerModel ... @@ -25,44 +24,39 @@ func NewLogger() LoggerModel { } } -// Info ... -func (logger *LoggerModel) Info(args ...interface{}) { - logger.Logger.Info(colorstring.Blue(args...)) -} - -// Infof ... -func (logger *LoggerModel) Infof(format string, args ...interface{}) { - logger.Logger.Info(colorstring.Bluef(format, args...)) +// Fail ... +func (logger *LoggerModel) Fail(format string, v ...interface{}) { + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Fatalf("\x1b[31;1m%s\x1b[0m", errorMsg) } -// Warnf ... -func (logger *LoggerModel) Warnf(format string, args ...interface{}) { - logger.Logger.Info(colorstring.Yellowf(format, args...)) +// Error ... +func (logger *LoggerModel) Error(format string, v ...interface{}) { + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Errorf("\x1b[31;1m%s\x1b[0m", errorMsg) } -// InfoSection ... -func (logger *LoggerModel) InfoSection(args ...interface{}) { - logger.Logger.Info() - logger.Logger.Info(colorstring.Blue(args...)) +// Warn ... +func (logger *LoggerModel) Warn(format string, v ...interface{}) { + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Warnf("\x1b[33;1m%s\x1b[0m", errorMsg) } -// InfofSection ... -func (logger *LoggerModel) InfofSection(format string, args ...interface{}) { - logger.Logger.Info() - logger.Logger.Info(colorstring.Bluef(format, args...)) -} - -// InfofDetails ... -func (logger *LoggerModel) InfofDetails(format string, args ...interface{}) { - logger.Logger.Infof(" " + fmt.Sprintf(format, args...)) +// Info ... +func (logger *LoggerModel) Info(format string, v ...interface{}) { + logger.Logger.Info("") + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Infof("\x1b[34;1m%s\x1b[0m", errorMsg) } -// InfoDetails ... -func (logger *LoggerModel) InfoDetails(args ...interface{}) { - logger.Logger.Info(" " + fmt.Sprint(args...)) +// Details ... +func (logger *LoggerModel) Details(format string, v ...interface{}) { + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Infof(" %s", errorMsg) } -// InfofReceipt ... -func (logger *LoggerModel) InfofReceipt(format string, args ...interface{}) { - logger.Logger.Info(colorstring.Green(" " + fmt.Sprintf(format, args...))) +// Done ... +func (logger *LoggerModel) Done(format string, v ...interface{}) { + errorMsg := fmt.Sprintf(format, v...) + logger.Logger.Infof("\x1b[32;1m%s\x1b[0m", errorMsg) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/utility/podfile_util.go b/go/src/github.com/bitrise-core/bitrise-init/utility/podfile_util.go index 88926e6f..713450ef 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/utility/podfile_util.go +++ b/go/src/github.com/bitrise-core/bitrise-init/utility/podfile_util.go @@ -198,7 +198,7 @@ puts workspaces.to_json ` var ( - logger = NewLogger() + log = NewLogger() ) func isWorkspaceSpecified(podfileContent string) bool { @@ -221,7 +221,7 @@ func getWorkspaceProjectMap(podfilePth string) (map[string]string, error) { } if !isWorkspaceSpecified(podfileContent) { - logger.InfofDetails("workspace not specified in podfile (%s)", podfilePth) + log.Details("workspace not specified in podfile") // If no explicit Xcode workspace is specified and // only one project exists in the same directory as the Podfile, // then the name of that project is used as the workspace’s name. @@ -248,8 +248,8 @@ func getWorkspaceProjectMap(podfilePth string) (map[string]string, error) { } } - logger.Warnf("Workspace specified in podfile (%s)", podfilePth) - logger.Warnf("Running extended podfile analyzer") + log.Warn("Workspace specified in podfile (%s)", podfilePth) + log.Warn("Running extended podfile analyzer") // Analyze Podfile as a ruby file if err := os.Setenv("pod_file_path", podfilePth); err != nil { @@ -273,7 +273,7 @@ func getWorkspaceProjectMap(podfilePth string) (map[string]string, error) { out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("ruby", getWorkspacesRubyFilePath) if err != nil { - logger.Warnf("Extended analyzer failed against podfile:") + log.Warn("Extended analyzer failed against podfile:") fmt.Println(podfileContent) if errorutil.IsExitStatusError(err) { diff --git a/go/src/github.com/bitrise-core/bitrise-init/utility/utility.go b/go/src/github.com/bitrise-core/bitrise-init/utility/utility.go index 5a1d0d13..9e20202f 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/utility/utility.go +++ b/go/src/github.com/bitrise-core/bitrise-init/utility/utility.go @@ -5,7 +5,6 @@ import ( "path/filepath" "strings" - log "github.com/Sirupsen/logrus" "github.com/bitrise-io/go-utils/pathutil" ) @@ -123,18 +122,20 @@ func (s ByComponents) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s ByComponents) Less(i, j int) bool { + log := NewLogger() + path1 := s[i] path2 := s[j] d1, err := PathDept(path1) if err != nil { - log.Warnf("failed to calculate path depth (%s), error: %s", path1, err) + log.Warn("failed to calculate path depth (%s), error: %s", path1, err) return false } d2, err := PathDept(path2) if err != nil { - log.Warnf("failed to calculate path depth (%s), error: %s", path1, err) + log.Warn("failed to calculate path depth (%s), error: %s", path1, err) return false } diff --git a/go/src/github.com/bitrise-core/bitrise-init/vendor/github.com/bitrise-io/xcode-utils/xcodeproj/xcodeproj.go b/go/src/github.com/bitrise-core/bitrise-init/vendor/github.com/bitrise-io/xcode-utils/xcodeproj/xcodeproj.go index 1bdb072f..7169a0c8 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/vendor/github.com/bitrise-io/xcode-utils/xcodeproj/xcodeproj.go +++ b/go/src/github.com/bitrise-core/bitrise-init/vendor/github.com/bitrise-io/xcode-utils/xcodeproj/xcodeproj.go @@ -2,6 +2,7 @@ package xcodeproj import ( "bufio" + "bytes" "errors" "fmt" "os" @@ -186,11 +187,9 @@ func ReCreateProjectUserSchemes(projectPth string) error { return err } - projectDir := filepath.Dir(projectPth) - // Write Gemfile to file and install gemfileContent := `source 'https://rubygems.org' - + gem 'xcodeproj'` gemfilePth := path.Join(tmpDir, "Gemfile") @@ -198,10 +197,37 @@ gem 'xcodeproj'` return err } + cmd := cmdex.NewCommand("bundle", "install") + + projectDir := filepath.Dir(projectPth) + cmd.SetDir(projectDir) + envs := append(os.Environ(), "BUNDLE_GEMFILE="+gemfilePth) + cmd.SetEnvs(envs) - out, err := cmdex.NewCommand("bundle", "install").SetDir(projectDir).SetEnvs(envs).RunAndReturnTrimmedCombinedOutput() - if err != nil { + var outBuffer bytes.Buffer + outWriter := bufio.NewWriter(&outBuffer) + cmd.SetStdout(outWriter) + + var errBuffer bytes.Buffer + errWriter := bufio.NewWriter(&errBuffer) + cmd.SetStderr(errWriter) + + if err := cmd.Run(); err != nil { + if errorutil.IsExitStatusError(err) { + errMsg := "" + if errBuffer.String() != "" { + errMsg += fmt.Sprintf("error: %s\n", errBuffer.String()) + } + if outBuffer.String() != "" { + errMsg += fmt.Sprintf("output: %s", outBuffer.String()) + } + if errMsg == "" { + return err + } + + return errors.New(errMsg) + } return err } @@ -229,13 +255,36 @@ end return err } + cmd = cmdex.NewCommand("bundle", "exec", "ruby", rubyScriptPth) + + cmd.SetDir(projectDir) + projectBase := filepath.Base(projectPth) envs = append(os.Environ(), "project_path="+projectBase, "LC_ALL=en_US.UTF-8", "BUNDLE_GEMFILE="+gemfilePth) + cmd.SetEnvs(envs) - out, err = cmdex.NewCommand("bundle", "exec", "ruby", rubyScriptPth).SetDir(projectDir).SetEnvs(envs).RunAndReturnTrimmedCombinedOutput() - if err != nil { - if errorutil.IsExitStatusError(err) && out != "" { - return errors.New(out) + outBuffer.Reset() + outWriter = bufio.NewWriter(&outBuffer) + cmd.SetStdout(outWriter) + + errBuffer.Reset() + errWriter = bufio.NewWriter(&errBuffer) + cmd.SetStderr(errWriter) + + if err := cmd.Run(); err != nil { + if errorutil.IsExitStatusError(err) { + errMsg := "" + if errBuffer.String() != "" { + errMsg += fmt.Sprintf("error: %s\n", errBuffer.String()) + } + if outBuffer.String() != "" { + errMsg += fmt.Sprintf("output: %s", outBuffer.String()) + } + if errMsg == "" { + return err + } + + return errors.New(errMsg) } return err } diff --git a/go/src/github.com/bitrise-core/bitrise-init/version/version.go b/go/src/github.com/bitrise-core/bitrise-init/version/version.go index be5d858b..53c0d91e 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/version/version.go +++ b/go/src/github.com/bitrise-core/bitrise-init/version/version.go @@ -1,4 +1,4 @@ package version // VERSION ... -const VERSION = "0.9.9" +const VERSION = "0.9.10" From 7da037873e596e980a8c8b13891a0b82073c1577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Fri, 29 Jul 2016 17:20:30 +0200 Subject: [PATCH 2/2] depman update --- bitrise.yml | 118 ++++++------------ deplock.json | 2 +- .../bitrise-core/bitrise-init/CHANGELOG.md | 7 +- .../bitrise-core/bitrise-init/bitrise.yml | 2 +- .../scanners/fastlane/fastlane.go | 2 +- .../bitrise-init/version/version.go | 2 +- 6 files changed, 49 insertions(+), 84 deletions(-) diff --git a/bitrise.yml b/bitrise.yml index 4e73b5cf..e71c034f 100755 --- a/bitrise.yml +++ b/bitrise.yml @@ -13,6 +13,8 @@ workflows: test: title: Bitrise Init Test description: Bitrise Init Test + envs: + - CLONE_INTO_DIR: _tmp steps: - script: title: "Scann test: ios-no-shared-schemes" @@ -23,17 +25,11 @@ workflows: rm -rf ./_tmp SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/ios-no-shared-schemes.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -44,19 +40,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-simple-objc.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -67,19 +57,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/sample-apps-android-sdk22.git git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -90,19 +74,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/xamarin-sample-app.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -113,33 +91,33 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-watchkit.git git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true + - path::./: + title: Step Test + inputs: + - scan_dir: $CLONE_INTO_DIR + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scanner test: fastlane" inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + - content: |- + #!/bin/bash + set -x + + rm -rf $CLONE_INTO_DIR + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/fastlane.git + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN - # - script: - # title: "Scann test: android-sdk22-no-gradlew" - # inputs: - # - content: |- - # #!/bin/bash - # set -x - # - # rm -rf ./_tmp - # SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-sdk22-no-gradlew.git - # git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - # $SCANNER_BIN --ci config --dir ./_tmp/sample-repo --output-dir ./_tmp/output --format json - script: title: "Scann test: sample-apps-xamarin-ios" inputs: @@ -147,19 +125,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-xamarin-ios.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -170,19 +142,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-non-executable-gradlew.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN @@ -193,19 +159,13 @@ workflows: #!/bin/bash set -x - rm -rf ./_tmp + rm -rf $CLONE_INTO_DIR SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-xamarin-android.git - git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - - change-workdir: - title: Switch working dir to ./_tmp - run_if: true - inputs: - - path: ./_tmp/sample-repo - - is_create_path: true + git clone $SAMPLE_APP_REPOSITORY_URL $CLONE_INTO_DIR - path::./: title: Step Test inputs: - - scan_dir: ./ + - scan_dir: $CLONE_INTO_DIR - output_dir: ../result - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN diff --git a/deplock.json b/deplock.json index 2c22b4a8..6fe77b0e 100644 --- a/deplock.json +++ b/deplock.json @@ -2,7 +2,7 @@ "dep_locks": [ { "url": "https://github.com/bitrise-core/bitrise-init.git", - "revision": "cda32880c9aa2bd20f31d94534e6c0ee8a0b599e" + "revision": "fd5850437e18db75178693eabe0b489e35fa0ac5" } ] } \ No newline at end of file diff --git a/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md index 8785be84..ae8b75b6 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md +++ b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md @@ -1,7 +1,12 @@ -## Changelog (Current version: 0.9.10) +## Changelog (Current version: 0.9.11) ----------------- +### 0.9.11 (2016 Jul 29) + +* [1bad745] prepare for 0.9.11 +* [1d56f71] typo fix + ### 0.9.10 (2016 Jul 29) * [ca94c8c] prepare for 0.9.10 diff --git a/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml b/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml index de39ac35..420853c3 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml +++ b/go/src/github.com/bitrise-core/bitrise-init/bitrise.yml @@ -212,7 +212,7 @@ workflows: 2, Export RELEASE_VERSION 3, Create binaries envs: - - RELEASE_VERSION: 0.9.10 + - RELEASE_VERSION: 0.9.11 after_run: - _export_release_version - create_binaries diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go index 4a7b9fb2..ece62a1f 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go @@ -164,7 +164,7 @@ func (scanner *Scanner) Options() (models.OptionModel, models.Warnings, error) { return models.OptionModel{}, models.Warnings{}, err } - log.Details("%d lane(s) found") + log.Details("%d lane(s) found", len(lanes)) for _, lane := range lanes { log.Details("- %s", lane) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/version/version.go b/go/src/github.com/bitrise-core/bitrise-init/version/version.go index 53c0d91e..4e34a18e 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/version/version.go +++ b/go/src/github.com/bitrise-core/bitrise-init/version/version.go @@ -1,4 +1,4 @@ package version // VERSION ... -const VERSION = "0.9.10" +const VERSION = "0.9.11"