From b4ec725ed74b56d022ce0e815c49893f02945287 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Wed, 24 Sep 2025 23:30:00 +0300 Subject: [PATCH 1/9] Add .idea/ to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index eff4fa885..15aef64c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build include/cedarish.txt include/buildpacks.txt bindata.go +.idea/ From 771391aa922827bd02c283546fab98bd14e841b3 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Wed, 24 Sep 2025 23:31:04 +0300 Subject: [PATCH 2/9] Add buildpack-detect function in include/buildpack.bash --- include/buildpack.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/buildpack.bash b/include/buildpack.bash index 6368085f6..9e1ce5219 100644 --- a/include/buildpack.bash +++ b/include/buildpack.bash @@ -70,6 +70,12 @@ _select-buildpack() { fi } +buildpack-detect() { + declare desc="Detect suitable buildpack for an application" + ensure-paths + _select-buildpack +} + buildpack-build() { declare desc="Build an application using installed buildpacks" ensure-paths From 749578b4900a376d5d4d642faa7292cc4a053a9e Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Thu, 25 Sep 2025 00:51:48 +0300 Subject: [PATCH 3/9] Add cmd-export buildpack-detect in include/herokuish.bash --- include/herokuish.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/include/herokuish.bash b/include/herokuish.bash index f8bc06bdd..4e19af7c7 100644 --- a/include/herokuish.bash +++ b/include/herokuish.bash @@ -133,6 +133,7 @@ main() { cmd-export buildpack-install cmd-export buildpack-list cmd-export buildpack-test + cmd-export buildpack-detect cmd-export-ns slug "Manage application slugs" cmd-export slug-import From 3e3aeec6caad12666beca75df9135055c1f48aa0 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Thu, 25 Sep 2025 18:24:27 +0300 Subject: [PATCH 4/9] Run buildpack-setup before calling _select-buildpack --- include/buildpack.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/buildpack.bash b/include/buildpack.bash index 9e1ce5219..ef79f2c22 100644 --- a/include/buildpack.bash +++ b/include/buildpack.bash @@ -73,6 +73,8 @@ _select-buildpack() { buildpack-detect() { declare desc="Detect suitable buildpack for an application" ensure-paths + [[ "$USER" ]] || randomize-unprivileged + buildpack-setup >/dev/null _select-buildpack } From ffcf4edb352d232e723393f0a1fdff3eaca6a8fe Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sat, 27 Sep 2025 00:54:01 +0300 Subject: [PATCH 5/9] Fix lint errors --- include/buildpack.bash | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/buildpack.bash b/include/buildpack.bash index ef79f2c22..01e043845 100644 --- a/include/buildpack.bash +++ b/include/buildpack.bash @@ -71,11 +71,11 @@ _select-buildpack() { } buildpack-detect() { - declare desc="Detect suitable buildpack for an application" - ensure-paths - [[ "$USER" ]] || randomize-unprivileged - buildpack-setup >/dev/null - _select-buildpack + declare desc="Detect suitable buildpack for an application" + ensure-paths + [[ "$USER" ]] || randomize-unprivileged + buildpack-setup >/dev/null + _select-buildpack } buildpack-build() { From ca5af2f0f2dcc8e3972229d5400785868b650b84 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Sat, 27 Sep 2025 19:09:22 +0300 Subject: [PATCH 6/9] Update .editorconfig so expected (by lint checks) indent_style and size is used by default --- .editorconfig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8439b05fe..05e406bc4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,11 +7,9 @@ end_of_line = lf insert_final_newline = true charset = utf-8 trim_trailing_whitespace = true +indent_style = space +indent_size = 2 [*.go] indent_style = tab indent_size = 4 - -[contrib/post-install] -indent_size = 2 -indent_style = space From 3a94afd20726aa1e7325c141902b1d9a71b14feb Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Tue, 30 Sep 2025 16:53:21 +0300 Subject: [PATCH 7/9] List detect command in available commands section in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae057619f..6630b5c3b 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ $ herokuish Available commands: buildpack Use and install buildpacks build Build an application using installed buildpacks + detect Detect buildpack to use for an application install Install buildpack from Git URL and optional committish list List installed buildpacks test Build and run tests for an application using installed buildpacks From c2d41c99657541d6d00282a4956bb0c4d39594ff Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Mon, 6 Oct 2025 00:24:39 +0300 Subject: [PATCH 8/9] Add tests for buildpack-detect --- tests/functional/tests.sh | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/functional/tests.sh b/tests/functional/tests.sh index a61b2a582..18413d4ac 100644 --- a/tests/functional/tests.sh +++ b/tests/functional/tests.sh @@ -48,3 +48,48 @@ T_generate-slug() { herokuish slug generate tar tzf /tmp/slug.tgz" } + +T_buildpack-detect-default() { + herokuish-test "buildpack-detect-default" " + set -e + unset BUILDPACK_URL + export buildpack_path=/tmp/buildpacks + export build_path=/tmp/app + export unprivileged_user=\$(whoami) + export unprivileged_group=\$(id -gn) + + rm -rf \$buildpack_path && mkdir -p \$buildpack_path + + mkdir -p \$buildpack_path/00_buildpack-ruby/bin + { + echo '#!/usr/bin/env bash' + echo 'echo Ruby' + echo 'exit 0' + } > \$buildpack_path/00_buildpack-ruby/bin/detect + chmod +x \$buildpack_path/00_buildpack-ruby/bin/detect + + herokuish buildpack detect | grep 'Ruby app detected' + " +} + +T_buildpack-detect-fail() { + herokuish-test "buildpack-detect-fail" " + set -e + unset BUILDPACK_URL + export buildpack_path=/tmp/buildpacks + export build_path=/tmp/app + export unprivileged_user=\$(whoami) + export unprivileged_group=\$(id -gn) + + rm -rf \$buildpack_path && mkdir -p \$buildpack_path + + mkdir -p \$buildpack_path/00_buildpack-fail/bin + { + echo '#!/usr/bin/env bash' + echo 'exit 1' + } > \$buildpack_path/00_buildpack-fail/bin/detect + chmod +x \$buildpack_path/00_buildpack-fail/bin/detect + + herokuish buildpack detect 2>&1 | grep 'Unable to select a buildpack' + " +} From bbe1288a09dbcd986f0442669937584be2d367a0 Mon Sep 17 00:00:00 2001 From: Tasos Maschalidis Date: Mon, 6 Oct 2025 00:29:00 +0300 Subject: [PATCH 9/9] Update make deps to call 'go install' as instructed by relevant deprecation message: https://golang.org/doc/go-get-install-deprecation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4301e390c..45e59a143 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ clean: deps: bindata.go docker pull heroku/heroku:24-build - cd / && go get -u github.com/progrium/basht/... + cd / && go install github.com/progrium/basht/... $(MAKE) bindata.go go get || true