diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da24ccb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/asdf/ diff --git a/.travis.yml b/.travis.yml index 09564a5..0a6d930 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: c -script: asdf plugin test golang . --asdf-plugin-gitref $TRAVIS_COMMIT go version +script: asdf plugin test golang $TRAVIS_BUILD_DIR --asdf-plugin-gitref $TRAVIS_COMMIT go version before_script: - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get install -y bsdmainutils; fi - git clone https://github.com/asdf-vm/asdf.git @@ -11,6 +11,6 @@ matrix: - os: linux arch: ppc64le - os: linux - arch: arm64 + arch: arm64 - os: osx - arch: amd64 \ No newline at end of file + arch: amd64 diff --git a/bin/list-legacy-filenames b/bin/list-legacy-filenames index a57800e..553f6ce 100755 --- a/bin/list-legacy-filenames +++ b/bin/list-legacy-filenames @@ -1,3 +1,3 @@ #!/usr/bin/env bash -echo ".go-version" +echo ".go-version go.mod" diff --git a/bin/parse-legacy-file b/bin/parse-legacy-file new file mode 100755 index 0000000..ef60682 --- /dev/null +++ b/bin/parse-legacy-file @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +get_legacy_version() { + current_file="$1" + basename=$(basename -- "$current_file") + + if [ "$basename" == "go.mod" ]; then + GOLANG_VERSION=$(grep 'go\s*[0-9]' "$current_file" | + sed -e 's/.*heroku goVersion //' \ + -e 's/[[:space:]]//' \ + -e 's/go\(.*\)/\1/' | + head -1 + ) + else + GOLANG_VERSION=$(cat "$current_file") + fi + + echo "$GOLANG_VERSION" +} + +get_legacy_version "$1"