diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000000..93a8706d3e --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +mitx diff --git a/cms/envs/common.py b/cms/envs/common.py index 680d19ca34..8effc773e0 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -206,6 +206,8 @@ PIPELINE_CSS = { }, } +# test_order: Determines the position of this chunk of javascript on +# the jasmine test page PIPELINE_JS = { 'main': { 'source_filenames': sorted( @@ -213,6 +215,7 @@ PIPELINE_JS = { rooted_glob(PROJECT_ROOT / 'static/', 'coffee/src/**/*.js') ) + ['js/hesitate.js', 'js/base.js'], 'output_filename': 'js/cms-application.js', + 'test_order': 0 }, 'module-js': { 'source_filenames': ( @@ -220,11 +223,8 @@ PIPELINE_JS = { rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') ), 'output_filename': 'js/cms-modules.js', + 'test_order': 1 }, - 'spec': { - 'source_filenames': sorted(rooted_glob(PROJECT_ROOT / 'static/', 'coffee/spec/**/*.js')), - 'output_filename': 'js/cms-spec.js' - } } PIPELINE_CSS_COMPRESSOR = None diff --git a/cms/envs/jasmine.py b/cms/envs/jasmine.py index ac28f8fc9a..e046a6d37c 100644 --- a/cms/envs/jasmine.py +++ b/cms/envs/jasmine.py @@ -20,7 +20,7 @@ PIPELINE_JS['js-test-source'] = { 'source_filenames': sum([ pipeline_group['source_filenames'] for group_name, pipeline_group - in PIPELINE_JS.items() + in sorted(PIPELINE_JS.items(), key=lambda item: item[1].get('test_order', 1e100)) if group_name != 'spec' ], []), 'output_filename': 'js/cms-test-source.js' @@ -35,4 +35,10 @@ JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') +# Remove the localization middleware class because it requires the test database +# to be sync'd and migrated in order to run the jasmine tests interactively +# with a browser +MIDDLEWARE_CLASSES = tuple(e for e in MIDDLEWARE_CLASSES \ + if e != 'django.middleware.locale.LocaleMiddleware') + INSTALLED_APPS += ('django_jasmine', ) diff --git a/cms/envs/test.py b/cms/envs/test.py index 0c91999a74..63b5efc645 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -17,9 +17,6 @@ TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' TEST_ROOT = path('test_root') -# Makes the tests run much faster... -SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead - # Want static files in the same dir for running on jenkins. STATIC_ROOT = TEST_ROOT / "staticfiles" diff --git a/cms/static/coffee/files.json b/cms/static/coffee/files.json index e7a66b5bc0..c2e1a8acf6 100644 --- a/cms/static/coffee/files.json +++ b/cms/static/coffee/files.json @@ -7,6 +7,7 @@ "js/vendor/jquery.cookie.js", "js/vendor/json2.js", "js/vendor/underscore-min.js", - "js/vendor/backbone-min.js" + "js/vendor/backbone-min.js", + "js/vendor/jquery.leanModal.min.js" ] } diff --git a/cms/templates/base.html b/cms/templates/base.html index 3f286c2582..f1a87d6424 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -30,7 +30,7 @@ <%include file="courseware_vendor_js.html"/> - + diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index abcb9d988b..53d1c72cc4 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -76,8 +76,9 @@ def index(request, extra_context={}, user=None): ''' # The course selection work is done in courseware.courses. - domain = settings.MITX_FEATURES.get('FORCE_UNIVERSITY_DOMAIN') # normally False - if domain == False: # do explicit check, because domain=None is valid + domain = settings.MITX_FEATURES.get('FORCE_UNIVERSITY_DOMAIN') # normally False + # do explicit check, because domain=None is valid + if domain == False: domain = request.META.get('HTTP_HOST') courses = get_courses(None, domain=domain) diff --git a/common/static/coffee/spec/.gitignore b/common/static/coffee/spec/.gitignore new file mode 100644 index 0000000000..a6c7c2852d --- /dev/null +++ b/common/static/coffee/spec/.gitignore @@ -0,0 +1 @@ +*.js diff --git a/create-dev-env.sh b/create-dev-env.sh index f0ebca3ff7..d387465c49 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -26,12 +26,15 @@ EOL printf '\E[0m' } + error() { printf '\E[31m'; echo "$@"; printf '\E[0m' } + output() { printf '\E[36m'; echo "$@"; printf '\E[0m' } + usage() { cat< $HOME/.rvmrc +# 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 curl -sL get.rvm.io | bash -s -- --version 1.15.7 -source $RUBY_DIR/scripts/rvm + +# 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 + +# Ruby doesn't like to build with clang, which is the default on OS X, so +# use gcc instead. This may not work, since if your gcc was installed with +# XCode 4.2 or greater, you have an LLVM-based gcc, which also doesn't +# always play nicely with Ruby, though it seems to be better than clang. +# You may have to install apple-gcc42 using Homebrew if this doesn't work. +# See `rvm requirements` for more information. +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 + +# Current stable version of RVM (1.19.0) requires the following to build Ruby: +# +# 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 +# Create the "mitx" gemset +rvm use "$RUBY_VER@mitx" --create + output "Installing gem bundler" gem install bundler output "Installing ruby packages" -# hack :( -cd $BASE/mitx || true -bundle install +bundle install --gemfile $BASE/mitx/Gemfile # Install Python virtualenv @@ -274,16 +332,31 @@ case `uname -s` in ;; 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 - 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 # default behavior for virtualenv>1.7 is # --no-site-packages - virtualenv "$PYTHON_DIR" + mkvirtualenv -a "$BASE/mitx" mitx || { + error "mkvirtualenv exited with a non-zero error" + return 1 + } fi -# activate mitx python virtualenv -source $PYTHON_DIR/bin/activate # compile numpy and scipy if requested @@ -315,6 +388,8 @@ case `uname -s` in # 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 ;; @@ -344,14 +419,18 @@ cat< EdX Blog - 2013-04-03T14:00:12-07:00 + 2013-05-03T14:00:12-07:00 - tag:www.edx.org,2012:Post/17 + tag:www.edx.org,2013:Post/18 + 2013-05-02T14:00:00-07:00 + 2013-05-02T14:00:00-07:00 + + edX project at San Jose State featured in New York Times + <img src="${static.url('images/press/nytimes_240x180.png')}" /> + <p></p> + + + tag:www.edx.org,2013:Post/17 2012-12-19T14:00:00-07:00 2012-12-19T14:00:00-07:00 diff --git a/lms/templates/index.html b/lms/templates/index.html index f2fc34c8ec..109ab6fb2f 100644 --- a/lms/templates/index.html +++ b/lms/templates/index.html @@ -190,18 +190,11 @@ diff --git a/lms/templates/press.json b/lms/templates/press.json index 9cc79783ae..43c295b63e 100644 --- a/lms/templates/press.json +++ b/lms/templates/press.json @@ -1,4 +1,106 @@ [ + { + "title": "Adapting to Blended Courses, and Finding Early Benefits", + "url": "http://www.nytimes.com/2013/04/30/education/adapting-to-blended-courses-and-finding-early-benefits.html?ref=education", + "author": "Tamar Lewin", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "April 29, 2013" + }, + + { + "title": "Colleges Adapt Online Courses to Ease Burden", + "url": "http://www.nytimes.com/2013/04/30/education/colleges-adapt-online-courses-to-ease-burden.html?pagewanted=all", + "author": "Tamar Lewin", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "April 29, 2013" + }, + + { + "title": "Online Education Lifts Pass Rates at University", + "url": "http://online.wsj.com/article/SB10001424127887323741004578414861572832182.html?mod=googlenews_wsj", + "author": "Geoffrey Fowler", + "image": "wsj_logo_178x138.jpg", + "deck": null, + "publication": "The Wall Street Journal", + "publish_date": "April 10, 2013" + }, + + { + "title": "Software Seen Giving Grades on Essay Tests", + "url": "http://www.nytimes.com/2013/04/05/science/new-test-for-computers-grading-essays-at-college-level.html?pagewanted=all&_r=0", + "author": "John Markoff", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "April 4, 2013" + }, + + { + "title": "Stanford to help build edX MOOC platform", + "url": "http://www.washingtonpost.com/local/education/stanford-to-help-build-edx-mooc-platform/2013/04/02/5b53bb3e-9bbe-11e2-9a79-eb5280c81c63_story.html", + "author": "Nick Anderson", + "image": "wash_post_logo_178x138.jpg", + "deck": null, + "publication": "The Washington Post", + "publish_date": "April 3, 2013" + }, + + { + "title": "Could online ed end college as we know it?", + "url": "http://www.cbsnews.com/video/watch/?id=50143164n", + "author": "CBS This Morning", + "image": "cbsnews_178x138.jpg", + "deck": null, + "publication": "CBS Television Network", + "publish_date": "March 19, 2013" + }, + + { + "title": "The Professors’ Big Stage", + "url": "http://www.nytimes.com/2013/03/06/opinion/friedman-the-professors-big-stage.html?_r=1&#commentsContainer", + "author": "Thomas L. Friedman", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "March 6, 2013" + }, + + + { + "title": "Universities Abroad Join Partnerships On the Web", + "url": "http://www.nytimes.com/2013/02/21/education/universities-abroad-join-mooc-course-projects.html", + "author": "Tamar Lewin", + "image": "nyt_logo_178x138.jpeg", + "deck": null, + "publication": "The New York Times", + "publish_date": "February 20, 2013" + }, + + + { + "title": "Georgetown to offer free online courses", + "url": "http://www.washingtonpost.com/local/education/georgetown-to-offer-free-online-courses/2012/12/09/365c4612-3fd3-11e2-bca3-aadc9b7e29c5_story.html", + "author": "Nick Anderson", + "image": "wash_post_logo_178x138.jpg", + "deck": null, + "publication": "The Washington Post", + "publish_date": "December 9, 2012" + }, + + { + "title": "Wellesley College teams up with online provider edX", + "url": "http://bostonglobe.com/2012/12/04/edx/AqnQ808q4IEcaUa8KuZuBO/story.html", + "author": "Peter Schworm", + "image": "bostonglobe_logo_178x138.jpeg", + "deck": null, + "publication": "The Boston Globe", + "publish_date": "December 4, 2012" + }, + { "title": "The Year of the MOOC", "url": "http://www.nytimes.com/2012/11/04/education/edlife/massive-open-online-courses-are-multiplying-at-a-rapid-pace.html", diff --git a/rakefile b/rakefile index 798e1c28bf..32d92a0349 100644 --- a/rakefile +++ b/rakefile @@ -306,6 +306,7 @@ end desc "Open jasmine tests for #{system} in your default browser" task "browse_jasmine_#{system}" do + compile_assets() django_for_jasmine(system, true) do |jasmine_url| Launchy.open(jasmine_url) puts "Press ENTER to terminate".red @@ -315,6 +316,7 @@ end desc "Use phantomjs to run jasmine tests for #{system} from the console" task "phantomjs_jasmine_#{system}" do + compile_assets() phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' django_for_jasmine(system, false) do |jasmine_url| sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") diff --git a/test_root/db/.gitignore b/test_root/db/.gitignore new file mode 100644 index 0000000000..98e6ef67fa --- /dev/null +++ b/test_root/db/.gitignore @@ -0,0 +1 @@ +*.db