Skip to content

Commit c8068a9

Browse files
pjcdawkinsclaude
andcommitted
fix(discovery): fix bugs and clean up in discovery package
- Add missing trailing space in nodeExecPrefix() for yarn, which caused "yarn execnext build" instead of "yarn exec next build". - Add missing Rails detection via config.ru, which was dropped during the refactor from question/stack.go to discovery/stack.go. - Add Rails case to discoverType() to return "ruby". - Change pipenv build step from "pipenv install" to "pipenv sync" to match the original behavior (installs from lock file only). - Remove redundant zero-value map initialization in discoverType(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 73c15f0 commit c8068a9

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

discovery/build_steps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (d *Discoverer) discoverBuildSteps() ([]string, error) {
6868
"# Install Pipenv as a global tool",
6969
"python -m venv /app/.global",
7070
"pip install pipenv==$PIPENV_TOOL_VERSION",
71-
"pipenv install",
71+
"pipenv sync",
7272
)
7373
case "pip":
7474
buildSteps = append(

discovery/dependency_managers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (d *Discoverer) nodeExecPrefix() string {
9494
}
9595

9696
if slices.Contains(dependencyManagers, "yarn") {
97-
return "yarn exec"
97+
return "yarn exec "
9898
}
9999

100100
if slices.Contains(dependencyManagers, "npm") {

discovery/discovery.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const (
1010
composerJSONFile = "composer.json"
1111
packageJSONFile = "package.json"
1212
symfonyLockFile = "symfony.lock"
13+
rackFile = "config.ru"
1314
)
1415

1516
// Discoverer detects project characteristics from the filesystem.

discovery/runtime.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func (d *Discoverer) discoverType() (string, error) {
5151
return "php", nil
5252
case platformifier.Django, platformifier.Flask:
5353
return "python", nil
54+
case platformifier.Rails:
55+
return "ruby", nil
5456
case platformifier.Express, platformifier.NextJS, platformifier.Strapi:
5557
return "nodejs", nil
5658
}
@@ -63,9 +65,6 @@ func (d *Discoverer) discoverType() (string, error) {
6365
langCount := make(map[string]int)
6466
for ext, count := range extCount {
6567
if lang, ok := languageMap[ext]; ok {
66-
if _, _ok := langCount[lang]; !_ok {
67-
langCount[lang] = 0
68-
}
6968
langCount[lang] += count
7069
}
7170
}

discovery/stack.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ func (d *Discoverer) discoverStack() (platformifier.Stack, error) {
3030
return platformifier.Django, nil
3131
}
3232

33+
rackPath := utils.FindFile(d.fileSystem, "", rackFile)
34+
if rackPath != "" {
35+
f, err := d.fileSystem.Open(rackPath)
36+
if err == nil {
37+
defer f.Close()
38+
if ok, _ := utils.ContainsStringInFile(f, "Rails.application.load_server", true); ok {
39+
return platformifier.Rails, nil
40+
}
41+
}
42+
}
43+
3344
requirementsPath := utils.FindFile(d.fileSystem, "", "requirements.txt")
3445
if requirementsPath != "" {
3546
f, err := d.fileSystem.Open(requirementsPath)

0 commit comments

Comments
 (0)