Skip to content

Instantly share code, notes, and snippets.

@devigned
Last active May 31, 2017 14:48
Show Gist options
  • Save devigned/9fa3053d306d1855e81fd373533fae30 to your computer and use it in GitHub Desktop.
Save devigned/9fa3053d306d1855e81fd373533fae30 to your computer and use it in GitHub Desktop.
Habitat plan for building a Rails application
pkg_origin=devigned
pkg_name=rails-todo
pkg_version=0.1.0
pkg_maintainer="David Justice"
pkg_license=('MIT')
pkg_upstream_url=https://github.com/devigned/hab-rails-todo
pkg_source=nosuchfile.tar.gz
pkg_deps=(
core/ruby/2.4.1
core/cacerts
core/bundler
core/coreutils
core/openssl
)
pkg_build_deps=(
core/gcc-libs
core/gcc
core/make
core/patch
core/node
)
pkg_exports=( [port]=rails_port )
pkg_exposes=(port)
# return 0 since we are using local source
do_download() {
return 0
}
# return 0 since we are using local source
do_verify() {
return 0
}
# return 0 since we are using local source
do_unpack() {
return 0
}
# install bundled dependencies
do_build() {
cp -R $PLAN_CONTEXT/../src/* $HAB_CACHE_SRC_PATH/$pkg_dirname
bundle install --deployment --jobs 2 --retry 5
}
# stage files from the build cache into the artifact directory
do_install() {
cp -R . "${pkg_prefix}/static"
for binstub in ${pkg_prefix}/static/bin/*; do
[[ -f $binstub ]] && sed -e "s#/usr/bin/env ruby#$(pkg_path_for core/ruby)/bin/ruby#" -i "$binstub"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment