forked from paketo-buildpacks/composer-install
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_composer_files.go
More file actions
24 lines (20 loc) · 949 Bytes
/
find_composer_files.go
File metadata and controls
24 lines (20 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package composer
import (
"os"
"path/filepath"
)
// FindComposerFiles exists to determine where the composer.json and composer.lock files are
// Note that a composer.lock file is not required to exist, but must be a sibling of composer.json
//
// Because it can be helpful during the Detect phase to log why this buildpack will not participate,
// this function will also indicate whether the COMPOSER env var was set.
func FindComposerFiles(workingDir string) (composerJsonPath string, composerLockPath string, composerVar string, composerVarFound bool) {
composerJsonPath = filepath.Join(workingDir, DefaultComposerJsonPath)
composerLockPath = filepath.Join(workingDir, DefaultComposerLockPath)
composerVar, composerVarFound = os.LookupEnv(Composer)
if composerVarFound {
composerJsonPath = filepath.Join(workingDir, composerVar)
composerLockPath = filepath.Join(filepath.Dir(composerJsonPath), DefaultComposerLockPath)
}
return
}