Permalink
Browse files

change up main.js moved app init script to index.html, use main.js fo…

…r spec runners
  • Loading branch information...
pixelhandler committed Jun 5, 2012
1 parent 207387f commit 701d7be71393045acc1f3e40bdc7438decfd9a45
View
2 app.js
@@ -1,7 +1,7 @@
var application_root = __dirname,
express = require("express"),
path = require("path"),
- docroot = path.join(application_root, "src"), // or use "public" for built version
+ docroot = path.join(application_root, "src"), // "src" for dev, or "public" for built version
indexdoc = path.join(docroot,"index.html"),
fs = require('fs'),
app = express.createServer(),
View
@@ -10,6 +10,23 @@
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-iphone4.png" />
<script data-main="/main" src="/vendor/require.js"></script>
+ <script>
+ require(['facade', 'application', 'utils'], function (facade, App, utils) {
+
+ var $ = facade.$,
+ Backbone = facade.Backbone,
+ debug = utils.debug;
+
+ $(function () { // doc ready
+ var app;
+
+ // run the application, it all starts here.
+ app = new App();
+ Backbone.history.start({pushState: true});
+ debug.log("app initialized.");
+ });
+ });
+ </script>
</head>
<body>
<div id="wrapper"></div>
View
@@ -73,20 +73,4 @@ require.config({
priority: ['text', 'use', 'modernizr', 'json2', 'vendor', 'utils'],
jquery: '1.7.2',
waitSeconds: 30
-});
-
-require(['facade', 'application', 'utils'], function (facade, App, utils) {
-
- var $ = facade.$,
- Backbone = facade.Backbone,
- debug = utils.debug;
-
- $(function () { // doc ready
- var app;
-
- // run the application, it all starts here.
- app = new App();
- Backbone.history.start({pushState: true});
- debug.log("app initialized.");
- });
});
@@ -10,7 +10,8 @@
HL.AddScriptElem('/test/lib/jasmine-html.js');
HL.AddScriptElem('/test/lib/jasmine-jquery.js');
HL.AddScriptElem('/test/lib/sinon-1.3.1.js');
- HL.AddRJSScriptElem('/test/applicationstates/spec', '/vendor/require.js');
+ HL.AddRJSScriptElem('/main', '/vendor/require.js');
+ HL.AddScriptElem('/test/applicationstates/spec.js');
</script>
<script type="text/javascript">
@@ -14,80 +14,6 @@
// https://github.com/pivotal/jasmine/wiki
// http://sinonjs.org/ | http://sinonjs.org/docs/
-
-// copy config from main.js for any scripts to use during unit tests
-require.config({
- baseUrl: './',
- locale: 'en-us',
- paths: {
-
- // Libraries
-
- 'json2' : '/vendor/json2',
- 'modernizr' : '/vendor/modernizr',
- 'jquery' : '/vendor/jquery-1.7.2.min',
- 'zepto' : '/vendor/zepto',
- 'underscore' : '/vendor/underscore',
- 'mustache' : '/vendor/mustache',
- 'backbone' : '/vendor/backbone',
-
- // Plugins
-
- // RequireJS
- 'use' : '/vendor/plugins/use',
- 'domready' : '/vendor/plugins/domReady',
- 'order' : '/vendor/plugins/order',
- 'text' : '/vendor/plugins/text',
-
- // Touch events
- 'touch' : '/vendor/plugins/touch',
-
- // Vendor libs, packaged group of common dependencies
- 'vendor' : '/vendor',
-
- // Facade references to vendor / library methods
- 'facade' : '/facade',
-
- // Utilities and libraries
- 'utils' : '/utils',
-
- // Backbone syncs depend on both vendor and utils
- 'syncs' : '/syncs',
-
- // Should be used as required dependencies with use of `define`,
- 'models' : '/models',
- 'views' : '/views',
- 'collections' : '/collections',
- 'controller' : '/controller',
-
- // Packages
-
- 'packages' : '/packages',
- 'chrome' : '/packages/chrome',
- 'products' : '/packages/products',
- 'hello' : '/packages/hello',
- 'todos' : '/packages/todos',
-
- // Application - bootstrap for frontend app
- 'application' : '/application'
-
- },
- use: {
- "underscore": {
- attach: "_"
- },
- "backbone": {
- deps: ["use!underscore", "jquery"],
- attach: function(_, $) {
- return Backbone;
- }
- }
- },
- priority: ['text', 'use', 'modernizr', 'json2', 'vendor', 'utils'],
- jquery: '1.7.2',
- waitSeconds: 30
-});
-
require(['facade', 'models', 'collections', 'views', 'utils'],
function (facade, models, collections, views, utils) {
@@ -10,7 +10,8 @@
HL.AddScriptElem('/test/lib/jasmine-html.js');
HL.AddScriptElem('/test/lib/jasmine-jquery.js');
HL.AddScriptElem('/test/lib/sinon-1.3.1.js');
- HL.AddRJSScriptElem('/test/controller/spec', '/vendor/require.js');
+ HL.AddRJSScriptElem('/main', '/vendor/require.js');
+ HL.AddScriptElem('/test/controller/spec.js');
</script>
<script type="text/javascript">
@@ -13,79 +13,6 @@
// https://github.com/pivotal/jasmine/wiki
// http://sinonjs.org/ | http://sinonjs.org/docs/
-
-require.config({
- baseUrl: './',
- locale: 'en-us',
- paths: {
-
- // Libraries
-
- 'json2' : '/vendor/json2',
- 'modernizr' : '/vendor/modernizr',
- 'jquery' : '/vendor/jquery-1.7.2.min',
- 'zepto' : '/vendor/zepto',
- 'underscore' : '/vendor/underscore',
- 'mustache' : '/vendor/mustache',
- 'backbone' : '/vendor/backbone',
-
- // Plugins
-
- // RequireJS
- 'use' : '/vendor/plugins/use',
- 'domready' : '/vendor/plugins/domReady',
- 'order' : '/vendor/plugins/order',
- 'text' : '/vendor/plugins/text',
-
- // Touch events
- 'touch' : '/vendor/plugins/touch',
-
- // Vendor libs, packaged group of common dependencies
- 'vendor' : '/vendor',
-
- // Facade references to vendor / library methods
- 'facade' : '/facade',
-
- // Utilities and libraries
- 'utils' : '/utils',
-
- // Backbone syncs depend on both vendor and utils
- 'syncs' : '/syncs',
-
- // Should be used as required dependencies with use of `define`,
- 'models' : '/models',
- 'views' : '/views',
- 'collections' : '/collections',
- 'controller' : '/controller',
-
- // Packages
-
- 'packages' : '/packages',
- 'chrome' : '/packages/chrome',
- 'products' : '/packages/products',
- 'hello' : '/packages/hello',
- 'todos' : '/packages/todos',
-
- // Application - bootstrap for frontend app
- 'application' : '/application'
-
- },
- use: {
- "underscore": {
- attach: "_"
- },
- "backbone": {
- deps: ["use!underscore", "jquery"],
- attach: function(_, $) {
- return Backbone;
- }
- }
- },
- priority: ['text', 'use', 'modernizr', 'json2', 'vendor', 'utils'],
- jquery: '1.7.2',
- waitSeconds: 30
-});
-
require(['facade', 'models', 'collections', 'controller', 'views', 'utils'],
function (facade, models, collections, Controller, views, utils) {
@@ -10,7 +10,8 @@
HL.AddScriptElem('/test/lib/jasmine-html.js');
HL.AddScriptElem('/test/lib/jasmine-jquery.js');
HL.AddScriptElem('/test/lib/sinon-1.3.1.js');
- HL.AddRJSScriptElem('/test/layout/spec', '/vendor/require.js');
+ HL.AddRJSScriptElem('/main', '/vendor/require.js');
+ HL.AddScriptElem('/test/layout/spec.js');
</script>
<script type="text/javascript">
View
@@ -16,80 +16,6 @@
// https://github.com/pivotal/jasmine/wiki
// http://sinonjs.org/ | http://sinonjs.org/docs/
-
-// copy config from main.js for any scripts to use during unit tests
-require.config({
- baseUrl: './',
- locale: 'en-us',
- paths: {
-
- // Libraries
-
- 'json2' : '/vendor/json2',
- 'modernizr' : '/vendor/modernizr',
- 'jquery' : '/vendor/jquery-1.7.2.min',
- 'zepto' : '/vendor/zepto',
- 'underscore' : '/vendor/underscore',
- 'mustache' : '/vendor/mustache',
- 'backbone' : '/vendor/backbone',
-
- // Plugins
-
- // RequireJS
- 'use' : '/vendor/plugins/use',
- 'domready' : '/vendor/plugins/domReady',
- 'order' : '/vendor/plugins/order',
- 'text' : '/vendor/plugins/text',
-
- // Touch events
- 'touch' : '/vendor/plugins/touch',
-
- // Vendor libs, packaged group of common dependencies
- 'vendor' : '/vendor',
-
- // Facade references to vendor / library methods
- 'facade' : '/facade',
-
- // Utilities and libraries
- 'utils' : '/utils',
-
- // Backbone syncs depend on both vendor and utils
- 'syncs' : '/syncs',
-
- // Should be used as required dependencies with use of `define`,
- 'models' : '/models',
- 'views' : '/views',
- 'collections' : '/collections',
- 'controller' : '/controller',
-
- // Packages
-
- 'packages' : '/packages',
- 'chrome' : '/packages/chrome',
- 'products' : '/packages/products',
- 'hello' : '/packages/hello',
- 'todos' : '/packages/todos',
-
- // Application - bootstrap for frontend app
- 'application' : '/application'
-
- },
- use: {
- "underscore": {
- attach: "_"
- },
- "backbone": {
- deps: ["use!underscore", "jquery"],
- attach: function(_, $) {
- return Backbone;
- }
- }
- },
- priority: ['text', 'use', 'modernizr', 'json2', 'vendor', 'utils'],
- jquery: '1.7.2',
- waitSeconds: 30
-});
-
require(['facade', 'models', 'views', 'utils'],
function (facade, models, views, utils) {

0 comments on commit 701d7be

Please sign in to comment.