├── LICENSE ├── README.md └── bin ├── compile └── detect /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015 GunpowderLabs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Heroku buildpack for running arbitrary rake tasks on deploy 2 | 3 | This buildpack is intended for use after the regular [ruby-buildpack]. 4 | 5 | # UPDATE 6 | 7 | Heroku's [Release Phase](https://devcenter.heroku.com/articles/release-phase) (in beta) is their own replacement for this. This project will be deprecated once Release Phase is out of beta and supports all of the use cases. 8 | 9 | # Usage 10 | 11 | If you are using the default buildpack, manually set your buildpack to Heroku's default Ruby buildpack 12 | 13 | ``` 14 | heroku buildpacks:set https://github.com/heroku/heroku-buildpack-ruby 15 | ``` 16 | 17 | Append the buildpack-ruby-rake-deploy-tasks to your buildpack list: 18 | 19 | ``` 20 | heroku buildpacks:add https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks 21 | ``` 22 | 23 | Configure DEPLOY_TASKS environment variable with the tasks you want to run: 24 | 25 | ``` 26 | heroku config:set DEPLOY_TASKS='db:migrate cache:clear' 27 | ``` 28 | 29 | # License 30 | 31 | MIT, see the LICENSE file. 32 | 33 | [ruby-buildpack]:https://github.com/heroku/heroku-buildpack-ruby 34 | -------------------------------------------------------------------------------- /bin/compile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e # fail fast 4 | set -o pipefail # don't ignore exit codes when piping output 5 | 6 | # Configure directories 7 | build_dir=$1 8 | cache_dir=$2 9 | env_dir=$3 10 | 11 | blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'} 12 | if [ -d "$env_dir" ]; then 13 | for e in $(ls $env_dir); do 14 | echo "$e" | grep -qvE "$blacklist_regex" && 15 | export "$e=$(cat $env_dir/$e)" 16 | : 17 | done 18 | fi 19 | 20 | if [ -z "$DEPLOY_TASKS" ]; then 21 | echo "DEPLOY_TASKS has not been set" 22 | echo "You can set it with:" 23 | echo 'heroku config:set DEPLOY_TASKS="tasks to run"' 24 | exit 0 25 | fi 26 | 27 | tasks=(`echo ${DEPLOY_TASKS}`) 28 | cd $build_dir 29 | for task in ${tasks[@]}; do 30 | rake $task 31 | done 32 | -------------------------------------------------------------------------------- /bin/detect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # bin/detect 3 | 4 | if (test -f $1/Rakefile) then 5 | echo "Rake" 6 | exit 0 7 | else 8 | echo "no" 9 | exit 1 10 | fi 11 | --------------------------------------------------------------------------------