Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for umbrella project. #22

Merged
merged 1 commit into from
Mar 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ If you don't specify a config option, then the default option from the buildpack
__Here's a full config file with all available options:__

```bash
# We can set the path to phoenix app. E.g. apps/phoenix_app when in umbrella.
phoenix_relative_path=.

# We can set the version of Node to use for the app here
node_version=5.3.0

Expand Down
10 changes: 5 additions & 5 deletions lib/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ install_npm() {

install_and_cache_npm_deps() {
info "Installing and caching node modules"
cd $build_dir
cd $phoenix_dir
if [ -d $cache_dir/node_modules ]; then
mkdir -p node_modules
cp -r $cache_dir/node_modules/* node_modules/
Expand All @@ -60,12 +60,12 @@ install_and_cache_npm_deps() {
npm rebuild 2>&1 | indent
npm --unsafe-perm prune 2>&1 | indent
cp -r node_modules $cache_dir
PATH=$build_dir/node_modules/.bin:$PATH
PATH=$phoenix_dir/node_modules/.bin:$PATH
install_bower_deps
}

install_bower_deps() {
cd $build_dir
cd $phoenix_dir
local bower_json=bower.json

if [ -f $bower_json ]; then
Expand All @@ -81,7 +81,7 @@ install_bower_deps() {
}

compile() {
cd $build_dir
cd $phoenix_dir
PATH=$build_dir/.platform_tools/erlang/bin:$PATH
PATH=$build_dir/.platform_tools/elixir/bin:$PATH

Expand Down Expand Up @@ -109,7 +109,7 @@ cache_versions() {
write_profile() {
info "Creating runtime environment"
mkdir -p $build_dir/.profile.d
local export_line="export PATH=\"\$HOME/.heroku/node/bin:\$HOME/bin:\$HOME/node_modules/.bin:\$PATH\"
local export_line="export PATH=\"\$HOME/.heroku/node/bin:\$HOME/bin:\$HOME/$phoenix_relative_path/node_modules/.bin:\$PATH\"
export MIX_ENV=${MIX_ENV}"
echo $export_line >> $build_dir/.profile.d/phoenix_static_buildpack_paths.sh
}
2 changes: 2 additions & 0 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ load_config() {
info "WARNING: phoenix_static_buildpack.config wasn't found in the app"
info "Using default config from Phoenix static buildpack"
fi

phoenix_dir=$build_dir/$phoenix_relative_path

info "Will use the following versions:"
info "* Node ${node_version}"
Expand Down
1 change: 1 addition & 0 deletions phoenix_static_buildpack.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
phoenix_relative_path=.
node_version=5.3.0
config_vars_to_export=(DATABASE_URL)
compile="compile"