Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Managing Front-End Dependencies with Bower #158

Merged
merged 3 commits into from
Oct 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"directory": "analytics_dashboard/static/bower_components",
"scripts": {
"postinstall": "./node_modules/cldr-data-downloader/bin/download.js -i analytics_dashboard/static/bower_components/cldr-data/index.json -o analytics_dashboard/static/bower_components/cldr-data/"
"postinstall": "./bower-post-install.sh"
}
}
2 changes: 1 addition & 1 deletion .pep8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pep8]
ignore=E501
max_line_length=119
exclude=settings,migrations
exclude=settings,migrations,analytics_dashboard/static
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ ROOT = $(shell echo "$$PWD")
COVERAGE = $(ROOT)/build/coverage
PACKAGES = analytics_dashboard courses

requirements:
requirements: requirements.js
pip install -q -r requirements/base.txt --exists-action w

requirements.js:
npm install
bower install

Expand Down Expand Up @@ -45,8 +47,7 @@ quality:

validate_python: test.requirements test_python quality

validate_js:
npm install
validate_js: requirements.js
gulp test
gulp lint

Expand Down
31 changes: 18 additions & 13 deletions analytics_dashboard/static/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
* This defines our libraries across the application. Each page
* should load this file.
*/
var require = {

var require_config = {
baseUrl: '/static/',
waitSeconds: 60,
paths: {
jquery: 'vendor/jquery-1.11.1.min',
underscore: 'vendor/underscore-min',
backbone: 'vendor/backbone-min',
bootstrap: 'vendor/bootstrap/javascripts/bootstrap.min',
bootstrap_accessibility: 'vendor/bootstrap-accessibility-plugin/js/bootstrap-accessibility.min',
jquery: 'bower_components/jquery/dist/jquery.min',
underscore: 'bower_components/underscore/underscore-min',
backbone: 'bower_components/backbone/backbone',
bootstrap: 'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap',
bootstrap_accessibility: 'bower_components/bootstrapaccessibilityplugin/plugins/js/bootstrap-accessibility.min',
models: 'js/models',
views: 'js/views',
utils: 'js/utils',
load: 'js/load',
holder: 'vendor/holder',
dataTables: 'vendor/dataTables/jquery.dataTables.min',
dataTables: 'bower_components/datatables/media/js/jquery.dataTables.min',
dataTablesBootstrap: 'vendor/dataTables/dataTables.bootstrap',
d3: 'vendor/d3/d3',
nvd3: 'vendor/nvd3/nv.d3',
topojson: 'vendor/topojson/topojson',
datamaps: 'vendor/datamaps/datamaps.world.min',
moment: 'vendor/moment/moment-with-locales',
d3: 'bower_components/d3/d3.min',
nvd3: 'bower_components/nvd3/nv.d3.min',
topojson: 'bower_components/topojson/topojson',
datamaps: 'bower_components/datamaps/dist/datamaps.world.min',
moment: 'bower_components/moment/min/moment-with-locales.min',
text: 'bower_components/requirejs-plugins/lib/text',
json: 'bower_components/requirejs-plugins/src/json',
cldr: 'bower_components/cldrjs/dist/cldr',
Expand Down Expand Up @@ -52,6 +52,9 @@ var require = {
dataTablesBootstrap: {
deps: ['jquery', 'dataTables']
},
d3: {
exports: 'd3'
},
nvd3: {
deps: ['d3'],
exports: 'nv'
Expand All @@ -78,3 +81,5 @@ var require = {
// load jquery automatically
deps: ['jquery']
};

requirejs.config(require_config);
6 changes: 3 additions & 3 deletions analytics_dashboard/static/js/test/spec-runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>edX Analaytics JS Tests</title>
<title>edX Analytics JS Tests</title>

<link rel="stylesheet" type="text/css" href="/static/vendor/jasmine/lib/jasmine-2.0.0/jasmine.css">
<link rel="stylesheet" type="text/css" href="/static/bower_components/jasmine/lib/jasmine-core/jasmine.css">

<script src="/static/vendor/require.js" data-main="/static/js/test/spec-runner"></script>
<script src="/static/bower_components/requirejs/require.js" data-main="/static/js/test/spec-runner"></script>

</head>

Expand Down
74 changes: 4 additions & 70 deletions analytics_dashboard/static/js/test/spec-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,9 @@

var isBrowser = window.__karma__ === undefined;
var specs = [];
var config = {
// this is default location for the browser
baseUrl: '/static/',
paths: {
jquery: 'vendor/jquery-1.11.1.min',
bootstrap: 'vendor/bootstrap/javascripts/bootstrap',
underscore: 'vendor/underscore-min',
backbone: 'vendor/backbone-min',
models: 'js/models',
views: 'js/views',
utils: 'js/utils',
jasmine: 'vendor/jasmine/lib/jasmine-2.0.0/jasmine',
'jasmine-html': 'vendor/jasmine/lib/jasmine-2.0.0/jasmine-html',
boot: 'vendor/jasmine/lib/jasmine-2.0.0/boot',
d3: 'vendor/d3/d3',
nvd3: 'vendor/nvd3/nv.d3',
topojson: 'vendor/topojson/topojson',
datamaps: 'vendor/datamaps/datamaps.world.min',
moment: 'vendor/moment/moment-with-locales',
text: 'bower_components/requirejs-plugins/lib/text',
json: 'bower_components/requirejs-plugins/src/json',
cldr: 'bower_components/cldrjs/dist/cldr',
'cldr-data': 'bower_components/cldr-data',
globalize: 'bower_components/globalize/dist/globalize',
globalization: 'js/utils/globalization'
},
shim: {
bootstrap: {
deps: ['jquery']
},
underscore: {
exports: '_'
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
jasmine: {
exports: 'jasmine'
},
'jasmine-html': {
deps: ['jasmine'],
exports: 'jasmine'
},
boot: {
deps: ['jasmine', 'jasmine-html'],
exports: 'window.jasmineRequire'
},
nvd3: {
deps: ['d3'],
exports: 'nv'
},
datamaps: {
deps: ['topojson', 'd3'],
exports: 'datamap'
},
json: {
deps: ['text']
},
globalize: {
deps: ['jquery', 'cldr'],
exports: 'Globalize'
},
globalization: {
deps: ['globalize'],
exports: 'Globalize'
}
}
};

// Loaded from js/common.js
var config = require_config;

// Two execution paths: browser or gulp
if(isBrowser) {
Expand Down Expand Up @@ -103,7 +37,7 @@ if(isBrowser) {
config.callback = window.__karma__.start;
}

require.config(config);
requirejs.config(config);

// the browser needs to kick off jasmine. The gulp task does it through
// node
Expand Down
6 changes: 3 additions & 3 deletions analytics_dashboard/static/sass/style-application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

// vendor
// --------------------
@import "../vendor/bootstrap/stylesheets/bootstrap";
@import "../vendor/bootstrap-accessibility-plugin/css/bootstrap-accessibility";
@import "../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap";
@import "../bower_components/bootstrapaccessibilityplugin/plugins/css/bootstrap-accessibility";
@import "../vendor/font-awesome/scss/font-awesome";
@import "../vendor/dataTables/dataTables.bootstrap";
@import "../vendor/dataTables/dataTables.fontAwesome";
@import "../vendor/nvd3/nv.d3";
@import "../bower_components/nvd3/nv.d3";

// app styling
// --------------------
Expand Down
3 changes: 0 additions & 3 deletions analytics_dashboard/static/vendor/backbone-min.js

This file was deleted.

This file was deleted.

This file was deleted.

Loading