diff --git a/scripts/create-dev-env.sh b/scripts/create-dev-env.sh deleted file mode 100755 index 75b32feacc..0000000000 --- a/scripts/create-dev-env.sh +++ /dev/null @@ -1,528 +0,0 @@ -#!/usr/bin/env bash - -#Exit if any commands return a non-zero status -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() { - printf '\E[31m' - - cat</dev/null) 2>/dev/null) || - echo -n "" - - if [[ "x$this_repo" = "xedx-platform.git" ]]; then - # We are in the edx repo and already have git installed. Let git do the - # work of finding base dir: - echo "$(dirname $(git rev-parse --show-toplevel))" - else - echo "$HOME/edx_all" - fi -} - - -### START - -PROG=${0##*/} - -# Adjust this to wherever you'd like to place the codebase -BASE="${PROJECT_HOME:-$(set_base_default)}" - -# Use a sensible default (~/.virtualenvs) for your Python virtualenvs -# unless you've already got one set up with virtualenvwrapper. -PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenvs"} - -# Find rbenv root (~/.rbenv by default) -if [ -z "${RBENV_ROOT}" ]; then - RBENV_ROOT="${HOME}/.rbenv" -else - RBENV_ROOT="${RBENV_ROOT%/}" -fi -# Let the repo override the version of Ruby to install -if [[ -r $BASE/edx-platform/.ruby-version ]]; then - RUBY_VER=`cat $BASE/edx-platform/.ruby-version` -fi - -LOG="/var/tmp/install-$(date +%Y%m%d-%H%M%S).log" - -# Make sure the user's not about to do anything dumb -if [[ $EUID -eq 0 ]]; then - error "This script should not be run using sudo or as the root user" - usage - exit 1 -fi - -# If in an existing virtualenv, bail -if [[ "x$VIRTUAL_ENV" != "x" ]]; then - envname=`basename $VIRTUAL_ENV` - error "Looks like you're already in the \"$envname\" virtual env." - error "Run \`deactivate\` and then re-run this script." - usage - exit 1 -fi - -# Read arguments -ARGS=$(getopt "cvhsynq" "$*") -if [[ $? != 0 ]]; then - usage - exit 1 -fi -eval set -- "$ARGS" -while true; do - case $1 in - -c) - compile=true - shift - ;; - -s) - systempkgs=true - shift - ;; - -v) - set -x - verbose=true - shift - ;; - -y) - noninteractive=true - shift - ;; - -q) - quiet=true - shift - ;; - -n) - nopull=true - shift - ;; - -h) - usage - exit 0 - ;; - --) - shift - break - ;; - esac -done - -if [[ ! $quiet ]]; then - cat< >(tee $LOG) -exec 2>&1 - - -# Install basic system requirements - -mkdir -p $BASE -case `uname -s` in - [Ll]inux) - command -v lsb_release &>/dev/null || { - error "Please install lsb-release." - exit 1 - } - - distro=`lsb_release -cs` - case $distro in - wheezy|jessie|maya|olivia|nadia|precise|quantal) - if [[ ! $noninteractive ]]; then - warning " - Debian support is not fully debugged. Assuming you have standard - development packages already working like scipy, the - installation should go fine, but this is still a work in progress. - - Please report issues you have and let us know if you are able to figure - out any workarounds or solutions - - Press return to continue or control-C to abort" - - read dummy - fi - sudo apt-get install -yq git ;; - squeeze|lisa|katya|oneiric|natty|raring) - if [[ ! $noninteractive ]]; then - warning " - It seems like you're using $distro which has been deprecated. - While we don't technically support this release, the install - script will probably still work. - - Press return to continue or control-C to abort" - read dummy - fi - sudo apt-get install -yq git - ;; - - *) - error "Unsupported distribution - $distro" - exit 1 - ;; - esac - ;; - - Darwin) - if [[ ! -w /usr/local ]]; then - cat</dev/null || { - output "Installing brew" - /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" - } - command -v git &>/dev/null || { - output "Installing git" - brew install git - } - - ;; - *) - error "Unsupported platform. Try switching to either Mac or a Debian-based linux distribution (Ubuntu, Debian, or Mint)" - exit 1 - ;; -esac - - -# Clone edx repositories - -clone_repos - -# Sanity check to make sure the repo layout hasn't changed -if [[ -d $BASE/edx-platform/scripts ]]; then - output "Installing system-level dependencies" - bash $BASE/edx-platform/scripts/install-system-req.sh -else - error "It appears that our directory structure has changed and somebody failed to update this script. - raise an issue on Github and someone should fix it." - exit 1 -fi - -# Install system-level dependencies -if [[ ! -d $RBENV_ROOT ]]; then - output "Installing rbenv" - git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT -fi -if [[ ! -d $RBENV_ROOT/plugins/ruby-build ]]; then - output "Installing ruby-build" - git clone https://github.com/sstephenson/ruby-build.git $RBENV_ROOT/plugins/ruby-build -fi -shelltype=$(basename $SHELL) -if ! hash rbenv 2>/dev/null; then - output "Adding rbenv to \$PATH in ~/.${shelltype}rc" - echo "export PATH=\"$RBENV_ROOT/bin:\$PATH\"" >> $HOME/.${shelltype}rc - echo 'eval "$(rbenv init -)"' >> $HOME/.${shelltype}rc - export PATH="$RBENV_ROOT/bin:$PATH" - eval "$(rbenv init -)" -fi - -if [[ ! -d $RBENV_ROOT/versions/$RUBY_VER ]]; then - output "Installing Ruby $RUBY_VER" - rbenv install $RUBY_VER - rbenv global $RUBY_VER -fi - -if ! hash bundle 2>/dev/null; then - output "Installing gem bundler" - gem install bundler -fi -rbenv rehash - -output "Installing ruby packages" -bundle install --gemfile $BASE/edx-platform/Gemfile - -# Install Python virtualenv -output "Installing python virtualenv" - -case `uname -s` in - Darwin) - # Add brew's path - PATH=/usr/local/share/python:/usr/local/bin:$PATH - ;; -esac - -# virtualenvwrapper uses the $WORKON_HOME env var to determine where to place -# virtualenv directories. Make sure it matches the selected $PYTHON_DIR. -export WORKON_HOME=$PYTHON_DIR - -# Load in the mkvirtualenv function if needed -if [[ `type -t mkvirtualenv` != "function" ]]; then - case `uname -s` in - Darwin) - VEWRAPPER=`which virtualenvwrapper.sh` - ;; - - [Ll]inux) - if [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then - VEWRAPPER=/etc/bash_completion.d/virtualenvwrapper - else - error "Could not find virtualenvwrapper" - exit 1 - fi - ;; - esac -fi - -source $VEWRAPPER -# Create edX virtualenv and link it to repo -# virtualenvwrapper automatically sources the activation script -if [[ $systempkgs ]]; then - mkvirtualenv -q -a "$WORKON_HOME" --system-site-packages edx-platform || { - error "mkvirtualenv exited with a non-zero error" - return 1 - } -else - # default behavior for virtualenv>1.7 is - # --no-site-packages - mkvirtualenv -q -a "$WORKON_HOME" edx-platform || { - error "mkvirtualenv exited with a non-zero error" - return 1 - } -fi - - -# compile numpy and scipy if requested - -NUMPY_VER="1.6.2" -SCIPY_VER="0.10.1" - -if [[ -n $compile ]]; then - output "Downloading numpy and scipy" - curl -sSL -o numpy.tar.gz http://downloads.sourceforge.net/project/numpy/NumPy/${NUMPY_VER}/numpy-${NUMPY_VER}.tar.gz - curl -sSL -o scipy.tar.gz http://downloads.sourceforge.net/project/scipy/scipy/${SCIPY_VER}/scipy-${SCIPY_VER}.tar.gz - tar xf numpy.tar.gz - tar xf scipy.tar.gz - rm -f numpy.tar.gz scipy.tar.gz - output "Compiling numpy" - cd "$BASE/numpy-${NUMPY_VER}" - python setup.py install - output "Compiling scipy" - cd "$BASE/scipy-${SCIPY_VER}" - python setup.py install - cd "$BASE" - rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER} -fi - -case `uname -s` in - Darwin) - # on mac os x get the latest distribute and pip - pip install -U pip - # need latest pytz before compiling numpy and scipy - pip install -U pytz - pip install numpy - # scipy needs cython - pip install cython - # fixes problem with scipy on 10.8 - pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev - ;; -esac - -output "Installing edX pre-requirements" -pip install -r $BASE/edx-platform/requirements/edx/pre.txt - -output "Installing edX paver-requirements" -pip install -r $BASE/edx-platform/requirements/edx/paver.txt - - -output "Installing edX requirements" -# Install prereqs -cd $BASE/edx-platform -paver install_prereqs - -# Final dependecy -output "Finishing Touches" -cd $BASE -pip install argcomplete -cd $BASE/edx-platform -bundle install -paver install_prereqs - -mkdir -p "$BASE/log" -mkdir -p "$BASE/db" -mkdir -p "$BASE/data" - -./manage.py lms syncdb --noinput --migrate -./manage.py cms syncdb --noinput --migrate - -# Configure Git - -output "Fixing your git default settings" -git config --global push.default current - - -### DONE - -if [[ ! $quiet ]]; then - cat< - - $ ./manage.py lms runserver - - 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 -fi - -exit 0 diff --git a/scripts/install-system-req.sh b/scripts/install-system-req.sh deleted file mode 100755 index b4e5bb04e8..0000000000 --- a/scripts/install-system-req.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash - -# posix compliant sanity check -if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then - echo "Please use the bash interpreter to run this script" - exit 1 -fi - -error() { - printf '\E[31m'; echo "$@"; printf '\E[0m' -} -output() { - printf '\E[36m'; echo "$@"; printf '\E[0m' -} - - -### START - -SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REQUIREMENTS_DIR="$SELF_DIR/../requirements/system" -APT_REPOS_FILE=$REQUIREMENTS_DIR/"ubuntu/apt-repos.txt" -APT_PKGS_FILE=$REQUIREMENTS_DIR/"ubuntu/apt-packages.txt" - -case `uname -s` in - [Ll]inux) - command -v lsb_release &>/dev/null || { - error "Please install lsb-release." - exit 1 - } - - distro=`lsb_release -cs` - case $distro in - #Tries to install the same - squeeze|wheezy|jessie|maya|lisa|olivia|nadia|natty|oneiric|precise|quantal|raring) - output "Installing Debian family requirements" - - # add repositories - cat $APT_REPOS_FILE | xargs -n 1 sudo add-apt-repository -y - sudo apt-get -yq update - sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install gfortran graphviz \ - libgraphviz-dev graphviz-dev libatlas-dev libblas-dev - # install packages listed in APT_PKGS_FILE - cat $APT_PKGS_FILE | xargs sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install - ;; - *) - error "Unsupported distribution - $distro" - exit 1 - ;; - esac - ;; - Darwin) - - if [[ ! -w /usr/local ]]; then - cat</dev/null || { - output "Installing pip" - easy_install pip - } - - if ! grep -Eq ^1.7 <(virtualenv --version 2>/dev/null); then - output "Installing virtualenv >1.7" - pip install 'virtualenv>1.7' virtualenvwrapper - fi - - command -v coffee &>/dev/null || { - output "Installing coffee script" - curl --insecure https://npmjs.org/install.sh | sh - npm install -g coffee-script - } - ;; - *) - error "Unsupported platform" - exit 1 - ;; -esac