Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

devops: add some deployment/provisioning fixes

 - fix project root detection from runcommands.sh
 - add the sandalstrap project bootstrapper as sandalstrap.sh
 - explicitly check for CoffeeScript and JRE
 - remove readline from requirements
    Shouldn't be there in the first place, it's just a sad artifact of
    development on OSX.
  • Loading branch information...
commit dfedfdf367dd3bf78c855a3fc121ab49e6e63140 1 parent 219b1df
@yaniv-aknin yaniv-aknin authored
Showing with 46 additions and 2 deletions.
  1. +0 −1  requirements.txt
  2. +7 −1 runcommands.sh
  3. +39 −0 sandalstrap.sh
View
1  requirements.txt
@@ -16,7 +16,6 @@ gunicorn==0.17.2
ipython==0.13.1
pyScss==1.1.4
pycrypto==2.6
-readline==6.2.4.1
webassets==0.8
wsgiref==0.1.2
yuicompressor==2.4.7
View
8 runcommands.sh
@@ -1,5 +1,5 @@
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
-root="$( cd "$( dirname "$0" )" && pwd )"
+root="$( cd "$( dirname -- "$0" )" && pwd )"
# provision directories for dev environment
export VAR_DIR="${root}/.venv/var"
@@ -39,4 +39,10 @@ EOF
)
}
+# provisioning
+function whence() { which $1 > /dev/null; }
+whence coffee || echo '`coffee` missing from path; make sure CoffeeScript is installed (coffeescript.org)'
+whence java || echo '`java` missing from path; make sure some JRE is installed'
+unset whence
+
unset root
View
39 sandalstrap.sh
@@ -0,0 +1,39 @@
+# sandalstrap: a barebones Python project bootstrapper
+# written by Yaniv Aknin, @aknin, licensed under 2 clause BSD
+# http://sandalstrap.aknin.name/
+
+_ns() {
+ if [ -n "$VIRTUAL_ENV" ]; then
+ echo 'active venv found; refusing to create another'
+ return 1
+ fi
+ [ -z "$SND_VIRTUALENV_DIR" ] && SND_VIRTUALENV_DIR='.venv'
+
+ if ! curl -Lfs https://raw.github.com/pypa/virtualenv/1.7/virtualenv.py | python2.7 - "$SND_VIRTUALENV_DIR"; then
+ echo 'failed creating virtualenv'
+ return 1
+ fi
+
+ if [ -f runcommands.sh ]; then
+ echo 'source $(dirname $VIRTUAL_ENV)/runcommands.sh' >> "$SND_VIRTUALENV_DIR"/bin/activate
+ fi
+
+ source "$SND_VIRTUALENV_DIR"/bin/activate
+
+ if [ -f requirements.txt ]; then
+ if ! pip install -r requirements.txt; then
+ echo 'failed installing requirements'
+ return 1
+ fi
+ fi
+
+ if [ "$(uname)" = "Darwin" ]; then
+ if grep -q readline requirements.txt; then
+ pip uninstall -y readline
+ easy_install $(grep readline requirements.txt)
+ else
+ easy_install readline
+ fi
+ fi
+}
+_ns
Please sign in to comment.
Something went wrong with that request. Please try again.