-
Notifications
You must be signed in to change notification settings - Fork 19
/
gemfile_lock.go
45 lines (38 loc) · 1.13 KB
/
gemfile_lock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"github.com/bitrise-io/go-steputils/command/gems"
"github.com/bitrise-io/go-utils/log"
)
type gemVersions struct {
fastlane, bundler gems.Version
}
func (f FastlaneRunner) parseGemfileLock(searchDir string) (gemVersions, error) {
content, err := gems.GemFileLockContent(searchDir)
if err != nil {
if err == gems.ErrGemLockNotFound {
f.logger.Printf("Gem lockfile does not exist")
return gemVersions{}, nil
}
return gemVersions{}, err
}
var gemVersions gemVersions
gemVersions.fastlane, err = gems.ParseVersionFromBundle("fastlane", content)
if err != nil {
return gemVersions, err
}
if gemVersions.fastlane.Found {
log.Printf("Gem lockfile defined Fastlane version: %s", gemVersions.fastlane.Version)
} else {
log.Printf("No Fastlane version defined in gem lockfile")
}
gemVersions.bundler, err = gems.ParseBundlerVersion(content)
if err != nil {
return gemVersions, err
}
if gemVersions.bundler.Found {
log.Printf("Gem lockfile defined bundler version: %s", gemVersions.bundler.Version)
} else {
log.Printf("No bundler version defined in gem lockfile")
}
return gemVersions, nil
}