Commit 3ceda99d authored by Nicolas Joyard's avatar Nicolas Joyard Committed by Jamesie Pic

Use shell script to install client JS libs

parent 08c4694e
{
"directory": "static/libs"
}
......@@ -4,7 +4,6 @@ core/static/libs/*
# libs
static/libs
node_modules
# settings
memopol/config.json
......
......@@ -19,14 +19,6 @@ pip install -Ue ${OPENSHIFT_REPO_DIR}
python ${OPENSHIFT_REPO_DIR}manage.py migrate --noinput
pushd ${OPENSHIFT_DATA_DIR}
if ! [ -d node ]; then
wget https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz
tar xvzf node-v4.2.2-linux-x64.tar.gz
ln -sfn node-v4.2.2-linux-x64 node
fi
popd
pushd ${OPENSHIFT_REPO_DIR}
if [ -f ${OPENSHIFT_DATA_DIR}sentry ]; then
pip install raven
......@@ -38,9 +30,7 @@ fi
PATH="${OPENSHIFT_DATA_DIR}node/bin:$PATH"
HOME=$OPENSHIFT_DATA_DIR
CI=true
npm install bower
npm install
node_modules/.bin/bower install
bin/install_client_deps.sh
mkdir -p wsgi
./manage.py collectstatic --noinput
./manage.py compress
......
......@@ -8,11 +8,10 @@ install:
- pip install -e .
- pip install flake8 pep8
before_script:
- npm install -g bower
- bower install
- bin/install_client_deps.sh
script:
- pep8 . --exclude '*/migrations,docs' --ignore E128
- flake8 . --exclude '*/migrations,docs' --ignore E128
- pep8 . --exclude '*/migrations,docs,static' --ignore E128
- flake8 . --exclude '*/migrations,docs,static' --ignore E128
- django-admin migrate
- django-admin update_score
deploy:
......
......@@ -16,14 +16,8 @@
# Create the local db
python manage.py migrate
# Some static files
bower install
# Install node modules
npm install
# Build static files
node_modules/gulp/bin/gulp.js less
# Install browser libs
bin/install_client_deps.sh
# In another terminal (don't forget to activate the venv)
./manage.py runserver
#!/bin/bash
#
# This script downloads browser client libraries.
# Currently all scripts are downloaded from GitHub.
#
# Versions used may be changed by altering the lines
# starting with 'downloadFromGithub' at the bottom.
# The last argument is expected to be a git ref (ie
# a branch name, tag or commit-ish).
#
set -e
DEST=$(dirname $(dirname $0))/static/libs
# Github download helper
# $1 destination directory name under static/libs
# $2 github repo name (user-or-org/repo)
# $3 ref to use (branch or tag or commit)
function downloadFromGithub()
{
local dest=$DEST/$1
local repo=$2
local ref=$3
echo "* Downloading $repo ($ref) from Github..."
wget -O temp.zip -q https://github.com/${repo}/archive/${ref}.zip
unzip -q temp.zip
mv $(basename ${repo})* ${dest}
rm temp.zip
}
set -e
[ -d ${DEST} ] && rm -r ${DEST}
mkdir -p ${DEST}
downloadFromGithub jquery jquery/jquery 2.1.4
downloadFromGithub fontawesome FortAwesome/Font-Awesome v4.3.0
downloadFromGithub flag-icon-css lipis/flag-icon-css 0.7.1
downloadFromGithub bootstrap twbs/bootstrap v3.3.5
echo "* Done."
{
"name": "Memopol",
"version": "3.0.0",
"dependencies": {
"bootstrap": "~3.3.5",
"flag-icon-css": "~0.7.1"
},
"devDependencies": {
"fontawesome": "~4.3.0"
}
}
......@@ -67,39 +67,17 @@ Then, install the package for development::
Running setup.py develop for political-memory
Successfully installed django-1.9 django-coffeescript-0.7.2 django-debug-toolbar-1.4 django-extensions-1.5.9 django-pdb-0.4.2 hamlpy-0.82.2 ijson-2.2 markdown-2.6.5 political-memory pygments-2.0.2 python-dateutil-2.4.2 pytz-2015.7 six-1.10.0 south-1.0.2 sqlparse-0.1.18 werkzeug-0.11.2
Install NodeJS dependencies
Install client dependencies
===========================
We'll also need to install bower for the staticfiles::
We'll also need to download client libraries::
$ npm install bower
memopol@3.0.0 /tmp/political_memory
└── bower@1.7.0 extraneous
As well as all the requirements from :file:`package.json`::
$ npm install
memopol@3.0.0 /tmp/political_memory
├── bower@1.7.0 extraneous
├─┬ gulp@3.9.0
[output snipped for readability]
npm WARN In bower@1.7.0 replacing bundled version of configstore with configstore@0.3.2
npm WARN In bower@1.7.0 replacing bundled version of latest-version with latest-version@1.0.1
npm WARN In bower@1.7.0 replacing bundled version of update-notifier with update-notifier@0.3.2
Don't worry about the warnings, for they are non-critical (as all warnings).
Then, install the bower packages::
$ node_modules/.bin/bower install
bower bootstrap#~3.3.5 cached git://github.com/twbs/bootstrap.git#3.3.6
bootstrap#3.3.6 static/libs/bootstrap
└── jquery#2.1.4
[output snipped for readability]
jquery#2.1.4 static/libs/jquery
$ bin/install_client_deps.sh
* Downloading jquery/jquery (2.1.4) from Github...
* Downloading FortAwesome/Font-Awesome (v4.3.0) from Github...
* Downloading lipis/flag-icon-css (0.7.1) from Github...
* Downloading twbs/bootstrap (v3.3.5) from Github...
* Done
Activate ``DJANGO_DEBUG``
=========================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment