Skip to content

Commit 9ef5943

Browse files
authored
Merge pull request #51 from SOCR/performance-refactor
v0.3.0
2 parents 221eb88 + 59876b8 commit 9ef5943

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1114
-1048
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.DS_Store
2+
build/
3+
dist/
14
node_modules
25
npm-debug.log
36
test/npm-debug.log

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
language: node_js
22
node_js:
3-
- 4.0.0
3+
- 7.1.0
44
install: npm install
5-
before_script: ./node_modules/grunt-cli/bin/grunt build

Gruntfile.coffee

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ module.exports = (grunt) ->
77
coffee:
88
compile:
99
files:
10-
"js/appController.js": "js/appController.coffee"
11-
"js/appModel.js": "js/appModel.coffee"
12-
"js/appView.js": "js/appView.coffee"
13-
"js/appData.js": "js/appData.coffee"
14-
1510
"test/spec/modelSpec.js": "test/spec/modelSpec.coffee"
1611
"test/spec/dataSpec.js": "test/spec/dataSpec.coffee"
12+
glob_to_multipe:
13+
# options:
14+
# sourceMap: true
15+
expand: true
16+
src: ['src/*.coffee']
17+
dest: 'build/'
18+
ext: '.js'
1719

1820
concat:
1921
css:
@@ -35,27 +37,92 @@ module.exports = (grunt) ->
3537
"bower_components/please-wait/build/please-wait.css"
3638
]
3739
dest:"dist/app.css"
38-
40+
js:
41+
src:[
42+
"src/init.js"
43+
"src/lib/jquery.min.js"
44+
"src/lib/async.js"
45+
"src/bootstrap/bootstrap.min.js"
46+
"src/exp/core.js"
47+
"src/exp/binomialCoin.js"
48+
"src/exp/ballAndUrn.js"
49+
"src/exp/cardExp.js"
50+
"src/exp/betaBinomial.js"
51+
"src/input/inputtable.js"
52+
"build/src/appModel.js"
53+
"build/src/appView.js"
54+
"build/src/appController.js"
55+
"build/src/appData.js"
56+
"src/lib/jquery-ui.min.js"
57+
"src/vis/d3.v2.min.js"
58+
"src/vis/vis.js"
59+
"src/jquery.paginate.js"
60+
"src/update.js"
61+
"src/lib/jtweet/jquery.jtweetsanywhere-1.3.1.min.js"
62+
"src/lib/jquery.transit.min.js"
63+
"src/lib/jquery.easing.1.3.js"
64+
"src/lib/jquery.pubsub.js"
65+
"src/lib/jquery.handsontable.full.js"
66+
"src/input/data.js"
67+
"src/input/worldbank.js"
68+
"src/vis/tooltip.js"
69+
"src/tools/FCal.js"
70+
"src/tools/ZCal.js"
71+
"src/lib/mustache/mustache.js"
72+
"src/lib/chardinjs/chardinjs.min.js"
73+
"src/tutorial/tutorial.js"
74+
"src/utils.js"
75+
"src/bootstrap/bootstrapSwitch.js"
76+
"src/config.js"
77+
"src/bootstrap/bootstrap.min.js"
78+
]
79+
dest:"dist/bundle.js"
80+
copy:
81+
main:
82+
files:[
83+
{
84+
expand: true
85+
cwd: 'src'
86+
src: ['exp/*']
87+
dest: 'dist/'
88+
filter: 'isFile'
89+
}
90+
{
91+
expand: true
92+
cwd: 'src'
93+
src:'tutorial/tutorial-data.json'
94+
dest:'dist/'
95+
filter: 'isFile'
96+
}
97+
{
98+
expand: true
99+
cwd: 'src'
100+
src:'partials/**/*'
101+
dest:'dist/'
102+
filter: 'isFile'
103+
}
104+
]
39105

40106
jasmine:
41107
#ideally the src should concatenated files.
42-
src: ["js/init.js","js/lib/jquery.min.js","js/utils.js","js/lib/jquery.pubsub.js","js/tools/Fcal.js","js/tools/Zcal.js","js/exp/core.js","js/appModel.js","js/appData.js"]
108+
src: ["src/init.js","src/lib/jquery.min.js","src/utils.js","src/lib/jquery.pubsub.js","src/tools/Fcal.js","src/tools/Zcal.js","src/exp/core.js","dist/bundle.js"]
43109
options:
44110
specs: "test/spec/*Spec.js"
45111

46112
jshint:
47-
files:"js/appController.js"
113+
files:"dist/bundle.js"
48114

49115

50116
# Load the plugin that provides the "uglify" task.
51117
grunt.loadNpmTasks "grunt-contrib-jasmine"
52118
grunt.loadNpmTasks "grunt-contrib-jshint"
53119
grunt.loadNpmTasks "grunt-contrib-coffee"
54120
grunt.loadNpmTasks "grunt-contrib-concat"
121+
grunt.loadNpmTasks "grunt-contrib-copy"
55122

56123
# Default task(s).
57-
grunt.registerTask "build" , ["coffee","concat"]
124+
grunt.registerTask "build", ["coffee","concat"]
58125
grunt.registerTask "compile", ["coffee"]
59-
grunt.registerTask "test", ["coffee","jasmine"]
60-
grunt.registerTask "default", ["coffee","concat"]
126+
grunt.registerTask "test", ["coffee","concat","copy","jasmine"]
127+
grunt.registerTask "default", ["coffee","concat","copy"]
61128

index.html

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
<meta name="author" content="selvam,ashwini,ivo">
1010
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8;" />
1111

12-
<!-- head.js ... its a javascript loader tool -->
13-
<script src="js/lib/head.min.js"></script>
12+
<script src="dist/bundle.js"></script>
1413
<script type="text/javascript" src="bower_components/please-wait/build/please-wait.min.js"></script>
1514

1615
<!-- Le styles -->
@@ -77,7 +76,7 @@ <h2 class="font">Processing...</h2>
7776
<div class="row-fluid">
7877
<div class='span8'>
7978
<div id='accordion'>
80-
<h3><a href="#">Data Driven</a></h3>
79+
<h3><a href="#">Input</a></h3>
8180
<div>
8281
<section id = "datadriven-splash">
8382
<div class="page-header">
@@ -482,45 +481,7 @@ <h4>How to install my own experiment into SOCR webapp?</h4>
482481
console.error = console.error || function(){};
483482
console.info = console.info || function(){};
484483

485-
head.js("js/init.js",
486-
"js/lib/jquery.min.js",
487-
"js/lib/async.js",
488-
"js/bootstrap/bootstrap.min.js",
489-
{coreFunctions:"js/exp/core.js"},
490-
{binomialCoin:"js/exp/binomialCoin.js"},
491-
{ballAndUrn:"js/exp/ballAndUrn.js"},
492-
{cardExp:"js/exp/cardExp.js"},
493-
{betaBinomial:"js/exp/betaBinomial.js"},
494-
{inputTile:"js/input/inputtable.js"},
495-
{Model:"js/appModel.js"},
496-
{View:"js/appView.js"},
497-
{Controller:"js/appController.js"},
498-
"js/lib/jquery-ui.min.js",
499-
{D3:"js/vis/d3.v2.min.js"},
500-
"js/vis/vis.js",
501-
"js/jquery.paginate.js",
502-
"js/update.js",
503-
"js/lib/jtweet/jquery.jtweetsanywhere-1.3.1.min.js",
504-
"js/lib/jquery.transit.min.js",
505-
"js/lib/jquery.easing.1.3.js",
506-
"js/lib/jquery.pubsub.js",
507-
"js/lib/jquery.handsontable.full.js",
508-
"js/input/data.js",
509-
"js/input/worldbank.js",
510-
"js/vis/tooltip.js",
511-
"js/tools/FCal.js",
512-
"js/tools/ZCal.js",
513-
"js/lib/mustache/mustache.js",
514-
"js/lib/chardinjs/chardinjs.min.js",
515-
"js/tutorial/tutorial.js",
516-
"js/utils.js",
517-
"js/appData.js",
518-
"js/bootstrap/bootstrapSwitch.js",
519-
"js/config.js",
520-
"js/bootstrap/bootstrap.min.js"
521-
);
522-
523-
head.ready(function () {
484+
$(document).ready(function () {
524485

525486
var url = window.location.href;
526487
var baseUrl = url.substring(0, url.indexOf('index.html'));

js/appData.coffee

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)