Skip to content

Commit

Permalink
Improve logs (#101)
Browse files Browse the repository at this point in the history
* Improve logs

* dep update

* Use v2 ruby environment

* Updated sample app
  • Loading branch information
lpusok authored Oct 6, 2023
1 parent edd1038 commit 597db75
Show file tree
Hide file tree
Showing 54 changed files with 2,146 additions and 1,370 deletions.
8 changes: 3 additions & 5 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ workflows:
- work_dir: ./
- verbose_log: "yes"
- connection: apple_id
- flutter-installer:
inputs:
- flutter_version: 3.13.6
- manage-ios-code-signing:
run_if: "true"
inputs:
- project_path: ./ios/Runner.xcworkspace
- scheme: $XCODE_SCHEME
- configuration: Release
- distribution_method: development
- flutter-installer:
run_if: "true"
title: Install Flutter
inputs:
- installation_bundle_url: https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.2.3-stable.zip
- path::./:
title: Test building a Flutter project
inputs:
Expand Down
24 changes: 0 additions & 24 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package main
import (
"fmt"
"net/http"
"os"
"strings"

"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/retryhttp"
"github.com/bitrise-io/go-xcode/appleauth"
"github.com/bitrise-io/go-xcode/devportalservice"
Expand Down Expand Up @@ -76,8 +74,6 @@ func (f FastlaneRunner) ProcessConfig() (Config, error) {
}
config.WorkDir = workDir

f.checkForRbenv(workDir)

// Select and fetch Apple authenication source
authConfig, err := f.selectAppleAuthSource(config, authSources, authInputs)
if err != nil {
Expand Down Expand Up @@ -180,26 +176,6 @@ func (f FastlaneRunner) getWorkDir(config Config) (string, error) {
return workDir, nil
}

func (f FastlaneRunner) checkForRbenv(workDir string) {
f.logger.Println()
f.logger.Infof("Checking rbenv version")
if _, err := f.cmdLocator.LookPath("rbenv"); err == nil {

cmd := f.rbyFactory.Create("rbenv", []string{"versions"}, &command.Opts{
Stderr: os.Stderr,
Stdout: os.Stdout,
Dir: workDir,
})

f.logger.Donef("$ %s", cmd.PrintableCommandArgs())
if err := cmd.Run(); err != nil {
f.logger.Warnf(err.Error())
}
} else {
f.logger.Warnf("rbenv not found: %s", err)
}
}

func (f FastlaneRunner) selectAppleAuthSource(config Config, authSources []appleauth.Source, authInputs appleauth.Inputs) (appleauth.Credentials, error) {
f.logger.Println()
f.logger.Infof("Reading Apple Developer Portal authentication data")
Expand Down
35 changes: 35 additions & 0 deletions dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"strings"

"github.com/bitrise-io/go-steputils/v2/ruby"
"github.com/bitrise-io/go-utils/v2/command"
)

Expand Down Expand Up @@ -104,6 +105,40 @@ func (f FastlaneRunner) InstallDependencies(opts EnsureDependenciesOpts) error {
}

func (f FastlaneRunner) reportRubyVersion(useBundler bool, bundlerVersion string, workDir string) {
if f.rubyEnvironment.RubyInstallType() == ruby.ASDFRuby {
f.logger.Println()
f.logger.Infof("Checking selected Ruby version")

cmd := f.rbyFactory.Create("asdf", []string{"current", "ruby"}, &command.Opts{
Stderr: os.Stderr,
Stdout: os.Stdout,
Dir: workDir,
})

f.logger.Donef("$ %s", cmd.PrintableCommandArgs())
if err := cmd.Run(); err != nil {
f.logger.Warnf("Failed to print selected Ruby version: %s", err)
}
} else if f.rubyEnvironment.RubyInstallType() == ruby.RbenvRuby {
f.logger.Println()
f.logger.Infof("Checking selected Ruby version")
if _, err := f.cmdLocator.LookPath("rbenv"); err == nil {

cmd := f.rbyFactory.Create("rbenv", []string{"versions"}, &command.Opts{
Stderr: os.Stderr,
Stdout: os.Stdout,
Dir: workDir,
})

f.logger.Donef("$ %s", cmd.PrintableCommandArgs())
if err := cmd.Run(); err != nil {
f.logger.Warnf(err.Error())
}
} else {
f.logger.Warnf("rbenv not found: %s", err)
}
}

var versionCmd command.Command
options := &command.Opts{
Dir: workDir,
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ module github.com/bitrise-io/steps-fastlane
go 1.20

require (
github.com/bitrise-io/bitrise-init v0.0.0-20220504131857-f00a24c7c8ba
github.com/bitrise-io/go-android/v2 v2.0.0-alpha.3
github.com/bitrise-io/go-steputils v1.0.5
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.17
github.com/bitrise-io/bitrise-init v0.0.0-20230901074816-efe492d99277
github.com/bitrise-io/go-android/v2 v2.0.0-alpha.5
github.com/bitrise-io/go-steputils v1.0.6
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.20
github.com/bitrise-io/go-utils v1.0.9
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.16
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19
github.com/bitrise-io/go-xcode v1.0.16
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/stretchr/testify v1.8.4
)

require (
github.com/beevik/etree v1.1.0 // indirect
github.com/bitrise-io/bitrise v0.0.0-20220719135434-7f794d69d858 // indirect
github.com/bitrise-io/envman v0.0.0-20220512153504-166d59151b78 // indirect
github.com/bitrise-io/stepman v0.0.0-20220718172049-e5ae0a09c2f2 // indirect
github.com/beevik/etree v1.2.0 // indirect
github.com/bitrise-io/bitrise v0.0.0-20230920132712-a20cb0493953 // indirect
github.com/bitrise-io/envman v0.0.0-20230802102824-1300c57d49c4 // indirect
github.com/bitrise-io/stepman v0.0.0-20230728094915-939f0fe5c19a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gofrs/uuid v4.3.1+incompatible // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 597db75

Please sign in to comment.