ensure we have newlines around our config. closes #1025
This commit is contained in:
@@ -11,22 +11,24 @@ APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
|
|||||||
|
|
||||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||||
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
||||||
|
BUILD_ENV+=$'\n'
|
||||||
fi
|
fi
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||||
BUILD_ENV+=" "
|
BUILD_ENV+=$'\n'
|
||||||
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
|
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
|
||||||
|
BUILD_ENV+=$'\n'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$BUILD_ENV" ]]; then
|
if [[ ! -z "$BUILD_ENV" ]]; then
|
||||||
dokku_log_info1 "Adding BUILD_ENV to build environment..."
|
dokku_log_info1 "Adding BUILD_ENV to build environment..."
|
||||||
# create build env files for use in buildpacks like this:
|
# create build env files for use in buildpacks like this:
|
||||||
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
|
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
|
||||||
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
id=$(echo $BUILD_ENV |sed -e 's@export @@g' -e 's@\\n@ @g' | docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
||||||
test "$(docker wait $id)" -eq 0
|
test "$(docker wait $id)" -eq 0
|
||||||
docker commit $id $IMAGE > /dev/null
|
docker commit $id $IMAGE > /dev/null
|
||||||
|
|
||||||
# create build env for 'old style' buildpacks and dokku plugins
|
# create build env for 'old style' buildpacks and dokku plugins
|
||||||
id=$(echo "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
id=$(echo -e "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
||||||
test "$(docker wait $id)" -eq 0
|
test "$(docker wait $id)" -eq 0
|
||||||
docker commit $id $IMAGE > /dev/null
|
docker commit $id $IMAGE > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|||||||
4
tests.mk
4
tests.mk
@@ -107,6 +107,10 @@ deploy-test-python-flask:
|
|||||||
@echo deploying python-flask app...
|
@echo deploying python-flask app...
|
||||||
cd tests && ./test_deploy ./apps/python-flask dokku.me
|
cd tests && ./test_deploy ./apps/python-flask dokku.me
|
||||||
|
|
||||||
|
deploy-test-ruby:
|
||||||
|
@echo deploying ruby app...
|
||||||
|
cd tests && ./test_deploy ./apps/ruby dokku.me
|
||||||
|
|
||||||
deploy-test-scala:
|
deploy-test-scala:
|
||||||
@echo deploying scala app...
|
@echo deploying scala app...
|
||||||
cd tests && ./test_deploy ./apps/scala dokku.me
|
cd tests && ./test_deploy ./apps/scala dokku.me
|
||||||
|
|||||||
1
tests/apps/ruby/CHECKS
Normal file
1
tests/apps/ruby/CHECKS
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/ Hello, world
|
||||||
5
tests/apps/ruby/Gemfile
Normal file
5
tests/apps/ruby/Gemfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
source 'https://rubygems.org'
|
||||||
|
ruby '2.1.5'
|
||||||
|
|
||||||
|
gem 'sinatra', '~>1.4.4'
|
||||||
|
gem 'thin'
|
||||||
24
tests/apps/ruby/Gemfile.lock
Normal file
24
tests/apps/ruby/Gemfile.lock
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
daemons (1.1.9)
|
||||||
|
eventmachine (1.0.3)
|
||||||
|
rack (1.5.2)
|
||||||
|
rack-protection (1.5.2)
|
||||||
|
rack
|
||||||
|
sinatra (1.4.4)
|
||||||
|
rack (~> 1.4)
|
||||||
|
rack-protection (~> 1.4)
|
||||||
|
tilt (~> 1.3, >= 1.3.4)
|
||||||
|
thin (1.6.1)
|
||||||
|
daemons (>= 1.0.9)
|
||||||
|
eventmachine (>= 1.0.0)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
tilt (1.4.1)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
sinatra (~> 1.4.4)
|
||||||
|
thin
|
||||||
1
tests/apps/ruby/Procfile
Normal file
1
tests/apps/ruby/Procfile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web: bundle exec ruby web.rb -p $PORT
|
||||||
33
tests/apps/ruby/README.md
Normal file
33
tests/apps/ruby/README.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# ruby-sample
|
||||||
|
|
||||||
|
This is a barebones Ruby app using the [Sinatra](http://www.sinatrarb.com) framework.
|
||||||
|
|
||||||
|
## Running Locally
|
||||||
|
|
||||||
|
Asumming you have [Ruby](https://www.ruby-lang.org), [Bundler](http://bundler.io) and [Heroku Toolbelt](https://toolbelt.heroku.com) installed on your machine:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone git@github.com:heroku/ruby-sample.git # or clone your own fork
|
||||||
|
cd ruby-sample
|
||||||
|
bundle
|
||||||
|
foreman start
|
||||||
|
```
|
||||||
|
|
||||||
|
Your app should now be running on [localhost:5000](http://localhost:5000/).
|
||||||
|
|
||||||
|
## Deploying to Heroku
|
||||||
|
|
||||||
|
```
|
||||||
|
heroku create
|
||||||
|
git push heroku master
|
||||||
|
heroku open
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
For more information about using Ruby on Heroku, see these Dev Center articles:
|
||||||
|
|
||||||
|
- [Ruby on Heroku](https://devcenter.heroku.com/categories/ruby)
|
||||||
|
- [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/getting-started-with-ruby)
|
||||||
|
- [Getting Started with Rails 4.x on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4)
|
||||||
|
- [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support)
|
||||||
2
tests/apps/ruby/check_deploy
Executable file
2
tests/apps/ruby/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "Hello, world"
|
||||||
5
tests/apps/ruby/web.rb
Normal file
5
tests/apps/ruby/web.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'sinatra'
|
||||||
|
|
||||||
|
get '/' do
|
||||||
|
"Hello, world"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user