Skip to content

Commit

Permalink
move vendor to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielle Adams committed Mar 30, 2020
1 parent 26912ea commit df5452f
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ BP_DIR=$(cd "$(dirname "${0:-}")"; cd ..; pwd)

### Load dependencies

# shellcheck source=etc/vendor/stdlib_v7.sh
source "$BP_DIR/etc/vendor/stdlib_v7.sh"
# shellcheck source=lib/vendor/stdlib_v7.sh
source "$BP_DIR/lib/vendor/stdlib_v7.sh"
# shellcheck source=lib/output.sh
source "$BP_DIR/lib/output.sh"
# shellcheck source=lib/monitor.sh
Expand Down
4 changes: 2 additions & 2 deletions bin/report
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ BP_DIR=$(cd "$(dirname "${0:-}")"; cd ..; pwd)

### Load dependencies

# shellcheck source=etc/vendor/stdlib_v7.sh
source "$BP_DIR/etc/vendor/stdlib_v7.sh"
# shellcheck source=lib/vendor/stdlib_v7.sh
source "$BP_DIR/lib/vendor/stdlib_v7.sh"
# shellcheck source=lib/output.sh
source "$BP_DIR/lib/output.sh"
# shellcheck source=lib/monitor.sh
Expand Down
3 changes: 2 additions & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ name = "Node.js"
files = [
"etc/",
"test/",
"spec/",
".github/",
".travis.yml",
"makefile"
]
]
2 changes: 1 addition & 1 deletion lib/binaries.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

RESOLVE="$BP_DIR/etc/vendor/resolve-version-$(get_os)"
RESOLVE="$BP_DIR/lib/vendor/resolve-version-$(get_os)"

resolve() {
local binary="$1"
Expand Down
4 changes: 2 additions & 2 deletions lib/json.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

JQ="$BP_DIR/etc/vendor/jq-$(get_os)"
JQ="$BP_DIR/lib/vendor/jq-$(get_os)"

read_json() {
local file="$1"
Expand All @@ -9,7 +9,7 @@ read_json() {
if test -f "$file"; then
# -c = print on only one line
# -M = strip any color
# --raw-output = if the filter’s result is a string then it will be written directly
# --raw-output = if the filter’s result is a string then it will be written directly
# to stdout rather than being formatted as a JSON string with quotes
# shellcheck disable=SC2002
cat "$file" | $JQ -c -M --raw-output "$key // \"\"" || return 1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/yarn2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

YQ="$BP_DIR/etc/vendor/yq-$(get_os)"
YQ="$BP_DIR/lib/vendor/yq-$(get_os)"

detect_yarn2() {
local uses_yarn="$1"
Expand Down
12 changes: 6 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
test: heroku-18 heroku-16 cedar-14

build:
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./etc/vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./etc/vendor/resolve-version-linux ./cmd/resolve-version
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./lib/vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./lib/vendor/resolve-version-linux ./cmd/resolve-version

build-production:
# build go binaries and then compress them
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./etc/vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./etc/vendor/resolve-version-linux ./cmd/resolve-version
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./lib/vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./lib/vendor/resolve-version-linux ./cmd/resolve-version
# https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/
upx --brute etc/vendor/resolve-version-linux
upx --brute etc/vendor/resolve-version-darwin
upx --brute lib/vendor/resolve-version-linux
upx --brute lib/vendor/resolve-version-darwin

test-binary:
go test -v ./cmd/... -tags=integration
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run!(cmd)
end

def resolve_binary_path
RUBY_PLATFORM.match(/darwin/) ? './etc/vendor/resolve-version-darwin' : './etc/vendor/resolve-version-linux'
RUBY_PLATFORM.match(/darwin/) ? './lib/vendor/resolve-version-darwin' : './lib/vendor/resolve-version-linux'
end

def resolve_node_version(requirements, options = {})
Expand Down
14 changes: 7 additions & 7 deletions test/unit
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use_memory() {

# print each argument to a separate line on stdout
print_args() {
while (( "$#" )); do
echo $1
shift
while (( "$#" )); do
echo $1
shift
done
}

Expand Down Expand Up @@ -115,7 +115,7 @@ testKeyValueNoNewLine() {
store="$(pwd)/test/unit-fixtures/kvstore/no-new-line"

assertEquals "$(printf "%s\n" a=b b=c)" "$(kv_list $store)"
assertEquals "$(printf "%s\n" a b)" "$(kv_keys $store)"
assertEquals "$(printf "%s\n" a b)" "$(kv_keys $store)"
}

testKeyValueEmptyLine() {
Expand All @@ -125,7 +125,7 @@ testKeyValueEmptyLine() {
store="$(pwd)/test/unit-fixtures/kvstore/empty-line"

assertEquals "$(printf "%s\n" a=b b=c)" "$(kv_list $store)"
assertEquals "$(printf "%s\n" a b)" "$(kv_keys $store)"
assertEquals "$(printf "%s\n" a b)" "$(kv_keys $store)"
}

testKeyValueEscaping() {
Expand Down Expand Up @@ -276,7 +276,7 @@ testBuildDataPreviousBuild() {
meta_init "$cache_dir"
meta_setup
assertFileExists "$BUILD_DATA_FILE"
assertFileExists "$PREVIOUS_BUILD_DATA_FILE"
assertFileExists "$PREVIOUS_BUILD_DATA_FILE"
assertEquals "$(meta_prev_get test)" "bar"
assertEquals "$(meta_get test)" ""
}
Expand Down Expand Up @@ -436,7 +436,7 @@ BP_DIR="$(pwd)"

# the modules to be tested

source "$(pwd)"/etc/vendor/stdlib_v7.sh
source "$(pwd)"/lib/vendor/stdlib_v7.sh
source "$(pwd)"/lib/uuid.sh
source "$(pwd)"/lib/environment.sh
source "$(pwd)"/lib/json.sh
Expand Down

0 comments on commit df5452f

Please sign in to comment.