From 195fa158cc25ad98722f3bbd375e54c9ccf83b95 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 1 Jun 2012 16:03:30 -0400 Subject: [PATCH 1/4] Changed setup script to pull instead of clone if the repo already exists. --- create-dev-env.sh | 54 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/create-dev-env.sh b/create-dev-env.sh index a45fc0dba0..c0a052ba04 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -48,21 +48,45 @@ EO clone_repos() { cd "$BASE" - output "Cloning mitx" - if [[ -d "$BASE/mitx" ]]; then - mv "$BASE/mitx" "${BASE}/mitx.bak.$$" - fi - git clone git@github.com:MITx/mitx.git >>$LOG - output "Cloning askbot-devel" - if [[ -d "$BASE/askbot-devel" ]]; then - mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" - fi - git clone git@github.com:MITx/askbot-devel >>$LOG - output "Cloning data" - if [[ -d "$BASE/data" ]]; then - mv "$BASE/data" "${BASE}/data.bak.$$" - fi - hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG + + if [[ -d "$BASE/mitx/.git" ]]; then + output "Pulling mitx" + cd "$BASE/mitx" + git pull >>$LOG + else + output "Cloning mitx" + if [[ -d "$BASE/mitx" ]]; then + mv "$BASE/mitx" "${BASE}/mitx.bak.$$" + fi + git clone git@github.com:MITx/mitx.git >>$LOG + fi + + cd "$BASE" + if [[ -d "$BASE/askbot-devel/.git" ]]; then + output "Pulling askbot-devel" + cd "$BASE/askbot-devel" + git pull >>$LOG + else + output "Cloning askbot-devel" + if [[ -d "$BASE/askbot-devel" ]]; then + mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" + fi + git clone git@github.com:MITx/askbot-devel >>$LOG + fi + + cd "$BASE" + if [[ -d "$BASE/data/.hg" ]]; then + output "Pulling data" + cd "$BASE/data" + hg pull >>$LOG + hg update >>$LOG + else + output "Cloning data" + if [[ -d "$BASE/data" ]]; then + mv "$BASE/data" "${BASE}/data.bak.$$" + fi + hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG + fi } PROG=${0##*/} From a8940fc71e1a2656f863302be2e6595662120d5e Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Fri, 8 Jun 2012 11:30:13 -0400 Subject: [PATCH 2/4] adding less option to skip the intro screen for ruby install --- create-dev-env.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/create-dev-env.sh b/create-dev-env.sh index c0a052ba04..2fdfd183f7 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -14,6 +14,7 @@ ouch() { script again with the -v flag. EOL + printf '\E[0m' } error() { @@ -235,7 +236,10 @@ esac output "Installing rvm and ruby" curl -sL get.rvm.io | bash -s stable source $RUBY_DIR/scripts/rvm +# skip the intro +export LESS="-E" rvm install $RUBY_VER +unset LESS virtualenv "$PYTHON_DIR" source $PYTHON_DIR/bin/activate output "Installing gem bundler" From eb4272e38670d930cb3ded0f8596bdd0f623e245 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Fri, 8 Jun 2012 11:50:57 -0400 Subject: [PATCH 3/4] converted tabs to spaces, updated LESS cmdline override --- create-dev-env.sh | 78 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/create-dev-env.sh b/create-dev-env.sh index 2fdfd183f7..9e644fe046 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -49,45 +49,45 @@ EO clone_repos() { cd "$BASE" - + if [[ -d "$BASE/mitx/.git" ]]; then - output "Pulling mitx" - cd "$BASE/mitx" - git pull >>$LOG - else - output "Cloning mitx" - if [[ -d "$BASE/mitx" ]]; then - mv "$BASE/mitx" "${BASE}/mitx.bak.$$" - fi - git clone git@github.com:MITx/mitx.git >>$LOG - fi - - cd "$BASE" - if [[ -d "$BASE/askbot-devel/.git" ]]; then - output "Pulling askbot-devel" - cd "$BASE/askbot-devel" - git pull >>$LOG - else - output "Cloning askbot-devel" - if [[ -d "$BASE/askbot-devel" ]]; then - mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" - fi - git clone git@github.com:MITx/askbot-devel >>$LOG - fi - - cd "$BASE" + output "Pulling mitx" + cd "$BASE/mitx" + git pull >>$LOG + else + output "Cloning mitx" + if [[ -d "$BASE/mitx" ]]; then + mv "$BASE/mitx" "${BASE}/mitx.bak.$$" + fi + git clone git@github.com:MITx/mitx.git >>$LOG + fi + + cd "$BASE" + if [[ -d "$BASE/askbot-devel/.git" ]]; then + output "Pulling askbot-devel" + cd "$BASE/askbot-devel" + git pull >>$LOG + else + output "Cloning askbot-devel" + if [[ -d "$BASE/askbot-devel" ]]; then + mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" + fi + git clone git@github.com:MITx/askbot-devel >>$LOG + fi + + cd "$BASE" if [[ -d "$BASE/data/.hg" ]]; then - output "Pulling data" - cd "$BASE/data" - hg pull >>$LOG - hg update >>$LOG - else - output "Cloning data" - if [[ -d "$BASE/data" ]]; then - mv "$BASE/data" "${BASE}/data.bak.$$" - fi - hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG - fi + output "Pulling data" + cd "$BASE/data" + hg pull >>$LOG + hg update >>$LOG + else + output "Cloning data" + if [[ -d "$BASE/data" ]]; then + mv "$BASE/data" "${BASE}/data.bak.$$" + fi + hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG + fi } PROG=${0##*/} @@ -237,9 +237,7 @@ output "Installing rvm and ruby" curl -sL get.rvm.io | bash -s stable source $RUBY_DIR/scripts/rvm # skip the intro -export LESS="-E" -rvm install $RUBY_VER -unset LESS +LESS="-E" rvm install $RUBY_VER virtualenv "$PYTHON_DIR" source $PYTHON_DIR/bin/activate output "Installing gem bundler" From b46b7daf0f8aae5454f1496cf88b8531cdb473cc Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Fri, 8 Jun 2012 14:59:21 -0400 Subject: [PATCH 4/4] added a posix compliant check to make sure you are using bash to run the script, added option to use --system-site-packages for virtualenv, updated the ending instructions on how to start the server --- create-dev-env.sh | 57 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/create-dev-env.sh b/create-dev-env.sh index 9e644fe046..7b798c5b8c 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -1,5 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash set -e + +# posix compliant sanity check +if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then + echo "Please use the bash interpreter to run this script" + exit 1 +fi + trap "ouch" ERR ouch() { @@ -29,6 +36,7 @@ usage() { Usage: $PROG [-c] [-v] [-h] -c compile scipy and numpy + -s --system-site-packages for virtualenv -v set -x + spew -h this @@ -106,7 +114,7 @@ if [[ $EUID -eq 0 ]]; then usage exit 1 fi -ARGS=$(getopt "cvh" "$*") +ARGS=$(getopt "cvhs" "$*") if [[ $? != 0 ]]; then usage exit 1 @@ -118,6 +126,10 @@ while true; do compile=true shift ;; + -s) + systempkgs=true + shift + ;; -v) set -x verbose=true @@ -148,7 +160,7 @@ cat< + + $ rake django-admin[runserver,lms,dev,] + + If the Django development server starts properly you + should see: + + Development server is running at http://127.0.0.1:/ + Quit the server with CONTROL-C. + + Connect your browser to http://127.0.0.1: to + view the Django site. + + END exit 0