diff --git a/README.md b/README.md index a1f2e2db5..f72182592 100644 --- a/README.md +++ b/README.md @@ -301,3 +301,4 @@ The project backlog is on [Pivotal Tracker](https://www.pivotaltracker.com/proje [Phalcon]:http://phalconphp.com/en/ [composer]:https://github.com/dmikusa-pivotal/cf-ex-composer [Proxy Support]:http://docs.cloudfoundry.org/buildpacks/proxy-usage.html +test diff --git a/scripts/integration.sh b/scripts/integration.sh index f4a732d97..df403f40c 100755 --- a/scripts/integration.sh +++ b/scripts/integration.sh @@ -161,14 +161,8 @@ function buildpack::package() { --stack "${stack}" \ "${cached_flag}" > /dev/null - # This is set by the ruby-written buildpack-packager - local output - if [[ "${cached}" == "true" ]]; then - output="${ROOTDIR}/php_buildpack-cached-${stack}-v${version}.zip" - else - output="${ROOTDIR}/php_buildpack-${stack}-v${version}.zip" - fi - printf "%s" "${output}" + # this is the default output location of the package.sh script + echo "${ROOTDIR}/build/buildpack.zip" } main "${@:-}" diff --git a/scripts/package.sh b/scripts/package.sh index 598acdd0c..bd1848db7 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -14,9 +14,11 @@ readonly ROOTDIR source "${ROOTDIR}/scripts/.util/print.sh" function main() { - local stack cached + local stack cached version stack="any" cached="false" + version="" + output="${ROOTDIR}/build/buildpack.zip" while [[ "${#}" != 0 ]]; do case "${1}" in @@ -25,6 +27,11 @@ function main() { shift 2 ;; + --version) + version="${2}" + shift 2 + ;; + --cached) cached="true" shift 1 @@ -35,6 +42,11 @@ function main() { shift 1 ;; + --output) + output="${2}" + shift 2 + ;; + --help|-h) shift 1 usage @@ -51,7 +63,7 @@ function main() { esac done - package::buildpack "${cached}" "${stack}" + package::buildpack "${version}" "${cached}" "${stack}" "${output}" } @@ -64,14 +76,21 @@ OPTIONS --cached packages the buildpack as a cached buildpack --uncached packages the buildpack as an uncached buildpack (default) --stack the stack to package the buildpack for (default: any) + --version -v specifies the version number to use when packaging the buildpack USAGE } function package::buildpack() { - local cached stack - cached="${1}" - stack="${2}" - + local version cached stack output + version="${1}" + cached="${2}" + stack="${3}" + output="${4}" + + if [[ -n "${version}" ]]; then + echo "writing version to VERSION file: ${version}" + echo "${version}" > "${ROOTDIR}/VERSION" + fi local stack_flag stack_flag="--any-stack" @@ -102,6 +121,15 @@ EOF popd &> /dev/null rm -f "${ROOTDIR}/Dockerfile" + + file="$(ls "${ROOTDIR}" | grep -i 'php.*zip' )" + if [[ -z "${file}" ]]; then + util::print::error "failed to find zip file in ${ROOTDIR}" + fi + + mkdir -p "$(dirname "${output}")" + echo "Moving ${file} to ${output}" + mv "${file}" "${output}" } main "${@:-}"