Skip to content

Commit

Permalink
fix pod regex
Browse files Browse the repository at this point in the history
  • Loading branch information
anuccio1 committed May 1, 2018
1 parent 81cb889 commit 9d75c3b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions builders/cocoapods.go
Expand Up @@ -18,6 +18,8 @@ import (

var cocoapodsLogger = logging.MustGetLogger("cocoapods")

const podNameRegex = `[\w/\.\-\\+]+`

// CocoapodsBuilder implements Builder for Cocoapods (podfile & podfile.lock) builds
type CocoapodsBuilder struct {
CocoapodsCmd string
Expand Down Expand Up @@ -72,7 +74,7 @@ func (p *PodFileLock) initLockFile(filePath string) error {
}

func extractModule(fullDepStr string) CocoapodsModule {
outputMatchRe := regexp.MustCompile(`([\w/\.-\\+]+)\s+\(([\w/\.-\\+]+)\)`)
outputMatchRe := regexp.MustCompile(`(` + podNameRegex + `)\s+\(([\w/\.\-\\+=\s]+)\)`)
match := outputMatchRe.FindStringSubmatch(fullDepStr)

return CocoapodsModule{
Expand All @@ -83,8 +85,9 @@ func extractModule(fullDepStr string) CocoapodsModule {

// used to grab the pod name from the line
func extractPodName(fullDepStr string) string {
outputMatchRe := regexp.MustCompile(`[\w/\.-\\+]+`)
outputMatchRe := regexp.MustCompile(podNameRegex)
match := outputMatchRe.FindStringSubmatch(fullDepStr)

return strings.Split(match[0], "/")[0]
}

Expand Down

0 comments on commit 9d75c3b

Please sign in to comment.