Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
1e21526d
Commit
1e21526d
authored
May 01, 2013
by
Nate Hardison
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1853 from MITx/feature/nate/updated-dev-env-setup
Feature/nate/updated dev env setup
parents
f2fd90bc
2b17904c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
32 deletions
+112
-32
.ruby-gemset
+1
-0
create-dev-env.sh
+111
-32
No files found.
.ruby-gemset
0 → 100644
View file @
1e21526d
mitx
create-dev-env.sh
View file @
1e21526d
...
@@ -26,12 +26,15 @@ EOL
...
@@ -26,12 +26,15 @@ EOL
printf
'\E[0m'
printf
'\E[0m'
}
}
error
()
{
error
()
{
printf
'\E[31m'
;
echo
"
$@
"
;
printf
'\E[0m'
printf
'\E[31m'
;
echo
"
$@
"
;
printf
'\E[0m'
}
}
output
()
{
output
()
{
printf
'\E[36m'
;
echo
"
$@
"
;
printf
'\E[0m'
printf
'\E[36m'
;
echo
"
$@
"
;
printf
'\E[0m'
}
}
usage
()
{
usage
()
{
cat
<<
EO
cat
<<
EO
...
@@ -47,11 +50,10 @@ EO
...
@@ -47,11 +50,10 @@ EO
}
}
info
()
{
info
()
{
cat
<<
EO
cat
<<
EO
MITx base dir :
$BASE
MITx base dir :
$BASE
Python dir :
$PYTHON_DIR
Python
virtualenv
dir :
$PYTHON_DIR
Ruby dir :
$RUBY_DIR
Ruby
RVM
dir :
$RUBY_DIR
Ruby ver :
$RUBY_VER
Ruby ver :
$RUBY_VER
EO
EO
...
@@ -85,28 +87,46 @@ clone_repos() {
...
@@ -85,28 +87,46 @@ clone_repos() {
if
[[
-d
"
$BASE
/data/
$REPO
"
]]
;
then
if
[[
-d
"
$BASE
/data/
$REPO
"
]]
;
then
mv
"
$BASE
/data/
$REPO
"
"
${
BASE
}
/data/
$REPO
.bak.
$$
"
mv
"
$BASE
/data/
$REPO
"
"
${
BASE
}
/data/
$REPO
.bak.
$$
"
fi
fi
cd
"
$BASE
/data"
cd
"
$BASE
/data"
git clone git@github.com:MITx/
$REPO
git clone git@github.com:MITx/
$REPO
fi
fi
}
}
### START
### START
PROG
=
${
0
##*/
}
PROG
=
${
0
##*/
}
BASE
=
"
$HOME
/mitx_all"
PYTHON_DIR
=
"
$BASE
/python"
RUBY_DIR
=
"
$BASE
/ruby"
RUBY_VER
=
"1.9.3"
LOG
=
"/var/tmp/install-
$(
date +%Y%m%d-%H%M%S
)
.log"
# Adjust this to wherever you'd like to place the codebase
BASE
=
"
${
PROJECT_HOME
:-
$HOME
}
/mitx_all"
# Read arguments
# 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"
}
# RVM defaults its install to ~/.rvm, but use the overridden rvm_path
# if that's what's preferred.
RUBY_DIR
=
${
rvm_path
:-
"
$HOME
/.rvm"
}
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
if
[[
$EUID
-eq
0
]]
;
then
error
"This script should not be run using sudo or as the root user"
error
"This script should not be run using sudo or as the root user"
usage
usage
exit
1
exit
1
fi
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
"cvhs"
"
$*
"
)
ARGS
=
$(
getopt
"cvhs"
"
$*
"
)
if
[[
$?
!=
0
]]
;
then
if
[[
$?
!=
0
]]
;
then
usage
usage
...
@@ -236,31 +256,69 @@ clone_repos
...
@@ -236,31 +256,69 @@ clone_repos
bash
$BASE
/mitx/install-system-req.sh
bash
$BASE
/mitx/install-system-req.sh
output
"Installing RVM, Ruby, and required gems"
# If we're not installing RVM in the default location, then we'll do some
# funky stuff to make sure that we load in the RVM stuff properly on login.
if
[
"
$HOME
/.rvm"
!=
$RUBY_DIR
]
;
then
if
!
grep
-q
"export rvm_path=
$RUBY_DIR
"
~/.rvmrc
;
then
if
[[
-f
$HOME
/.rvmrc
]]
;
then
output
"Copying existing .rvmrc to .rvmrc.bak"
cp
$HOME
/.rvmrc
$HOME
/.rvmrc.bak
fi
output
"Creating
$HOME
/.rvmrc so rvm uses
$RUBY_DIR
"
echo
"export rvm_path=
$RUBY_DIR
"
>
$HOME
/.rvmrc
fi
fi
# Install Ruby RVM
curl
-sL
get.rvm.io | bash
-s
--
--version
1.15.7
output
"Installing rvm and ruby"
# Ensure we have RVM available as a shell function so that it can mess
# with the environment and set everything up properly. The RVM install
# process adds this line to login scripts, so this shouldn't be necessary
# for the user to do each time.
if
[[
`
type
-t
rvm
`
!=
"function"
]]
;
then
source
$RUBY_DIR
/scripts/rvm
fi
if
!
grep
-q
"export rvm_path=
$RUBY_DIR
"
~/.rvmrc
;
then
# Ruby doesn't like to build with clang, which is the default on OS X, so
if
[[
-f
$HOME
/.rvmrc
]]
;
then
# use gcc instead. This may not work, since if your gcc was installed with
output
"Copying existing .rvmrc to .rvmrc.bak"
# XCode 4.2 or greater, you have an LLVM-based gcc, which also doesn't
cp
$HOME
/.rvmrc
$HOME
/.rvmrc.bak
# always play nicely with Ruby, though it seems to be better than clang.
fi
# You may have to install apple-gcc42 using Homebrew if this doesn't work.
output
"Creating
$HOME
/.rvmrc so rvm uses
$RUBY_DIR
"
# See `rvm requirements` for more information.
echo
"export rvm_path=
$RUBY_DIR
"
>
$HOME
/.rvmrc
case
`
uname
-s
`
in
Darwin
)
export
CC
=
gcc
;;
esac
# Let the repo override the version of Ruby to install
if
[[
-r
$BASE
/mitx/.ruby-version
]]
;
then
RUBY_VER
=
`
cat
$BASE
/mitx/.ruby-version
`
fi
fi
curl
-sL
get.rvm.io | bash
-s
--
--version
1.15.7
# Current stable version of RVM (1.19.0) requires the following to build Ruby:
source
$RUBY_DIR
/scripts/rvm
#
# autoconf automake libtool pkg-config libyaml libxml2 libxslt libksba openssl
#
# If we decide to upgrade from the current version (1.15.7), can run
#
# LESS="-E" rvm install $RUBY_VER --autolibs=3 --with-readline
#
# to have RVM look for a package manager like Homebrew and install any missing
# libs automatically. RVM's --autolibs flag defaults to 2, which will fail if
# any required libs are missing.
LESS
=
"-E"
rvm install
$RUBY_VER
--with-readline
LESS
=
"-E"
rvm install
$RUBY_VER
--with-readline
# Create the "mitx" gemset
rvm use
"
$RUBY_VER
@mitx"
--create
output
"Installing gem bundler"
output
"Installing gem bundler"
gem install bundler
gem install bundler
output
"Installing ruby packages"
output
"Installing ruby packages"
# hack :(
bundle install
--gemfile
$BASE
/mitx/Gemfile
cd
$BASE
/mitx
||
true
bundle install
# Install Python virtualenv
# Install Python virtualenv
...
@@ -274,16 +332,31 @@ case `uname -s` in
...
@@ -274,16 +332,31 @@ case `uname -s` in
;;
;;
esac
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
source
`
which virtualenvwrapper.sh
`
fi
# Create MITx virtualenv and link it to repo
# virtualenvwrapper automatically sources the activation script
if
[[
$systempkgs
]]
;
then
if
[[
$systempkgs
]]
;
then
virtualenv
--system-site-packages
"
$PYTHON_DIR
"
mkvirtualenv
-a
"
$BASE
/mitx"
--system-site-packages
mitx
||
{
error
"mkvirtualenv exited with a non-zero error"
return
1
}
else
else
# default behavior for virtualenv>1.7 is
# default behavior for virtualenv>1.7 is
# --no-site-packages
# --no-site-packages
virtualenv
"
$PYTHON_DIR
"
mkvirtualenv
-a
"
$BASE
/mitx"
mitx
||
{
error
"mkvirtualenv exited with a non-zero error"
return
1
}
fi
fi
# activate mitx python virtualenv
source
$PYTHON_DIR
/bin/activate
# compile numpy and scipy if requested
# compile numpy and scipy if requested
...
@@ -315,6 +388,8 @@ case `uname -s` in
...
@@ -315,6 +388,8 @@ case `uname -s` in
# need latest pytz before compiling numpy and scipy
# need latest pytz before compiling numpy and scipy
pip install
-U
pytz
pip install
-U
pytz
pip install numpy
pip install numpy
# scipy needs cython
pip install cython
# fixes problem with scipy on 10.8
# fixes problem with scipy on 10.8
pip install
-e
git+https://github.com/scipy/scipy#egg
=
scipy-dev
pip install
-e
git+https://github.com/scipy/scipy#egg
=
scipy-dev
;;
;;
...
@@ -344,14 +419,18 @@ cat<<END
...
@@ -344,14 +419,18 @@ cat<<END
Success!!
Success!!
To start using Django you will need to activate the local Python
To start using Django you will need to activate the local Python
and Ruby environment (at this time rvm only supports bash) :
and Ruby environments. Ensure the following lines are added to your
login script, and source your login script if needed:
source `which virtualenvwrapper.sh`
source
$RUBY_DIR
/scripts/rvm
Then, every time you're ready to work on the project, just run
$
source
$RUBY_DIR
/scripts/rvm
$
workon mitx
$
source
$PYTHON_DIR
/bin/activate
To initialize Django
To initialize Django
$
cd
$BASE
/mitx
$
rake django-admin[syncdb]
$
rake django-admin[syncdb]
$
rake django-admin[migrate]
$
rake django-admin[migrate]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment