Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
include/cedarish.txt
include/buildpacks.txt
bindata.go
.idea/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions include/buildpack.bash
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ _select-buildpack() {
fi
}

buildpack-detect() {
declare desc="Detect suitable buildpack for an application"
ensure-paths
[[ "$USER" ]] || randomize-unprivileged
buildpack-setup >/dev/null
_select-buildpack
}

buildpack-build() {
declare desc="Build an application using installed buildpacks"
ensure-paths
Expand Down
1 change: 1 addition & 0 deletions include/herokuish.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions tests/functional/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
"
}