requirejs-rails 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.5.4
2
+
3
+ - Upgrade to RequireJS and r.js 1.0.5
4
+ - Pull request #31, closes #30. Thanks @karelim!
5
+
1
6
  # v0.5.3
2
7
 
3
8
  - Upgrade to RequireJS and r.js 1.0.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- requirejs-rails (0.5.3)
4
+ requirejs-rails (0.5.4)
5
5
  railties (~> 3.1.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -111,11 +111,15 @@ define ['jquery'], ($) ->
111
111
 
112
112
  ### Backbone.js
113
113
 
114
- Backbone AMD support is underway. See pull request documentcloud/backbone#710 for details. In the meantime, you can download [Backbone 0.5.3 with AMD support](https://github.com/jrburke/backbone/raw/optamd3/backbone.js) from [jrburke's optamd3 branch](https://github.com/jrburke/backbone/tree/optamd3). Backbone's module name is `backbone`.
114
+ **DO NOT USE vanilla Backbone 0.5.3 with require.js!**
115
+
116
+ Backbone with AMD support hasn't been released yet. In the meantime, you can download [Backbone 0.5.3 with AMD support](https://github.com/jrburke/backbone/raw/optamd3/backbone.js) from [jrburke's optamd3 branch](https://github.com/jrburke/backbone/tree/optamd3). See pull request [documentcloud/backbone#710](https://github.com/documentcloud/backbone/pull/710) for details. Backbone's module name is `backbone`.
115
117
 
116
118
  ### Underscore.js
117
119
 
118
- Underscore version 1.2.2 or later has integrated AMD support. Get it from [Underscore.js' homepage](http://documentcloud.github.com/underscore/). Underscore's module name is `underscore`.
120
+ Underscore version 1.2.x, 1.2.2 or later has integrated AMD support. Get it from [Underscore.js' homepage](http://documentcloud.github.com/underscore/). Underscore's module name is `underscore`.
121
+
122
+ **IMPORTANT:** Underscore has **removed** AMD support again in the 1.3.x series. Please consult the [requirejs mailing list](http://groups.google.com/group/requirejs/) for the current recommended solution.
119
123
 
120
124
  ## Changes
121
125
 
data/bin/r.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license r.js 1.0.4 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 1.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3
3
  * Available via the MIT or new BSD license.
4
4
  * see: http://github.com/jrburke/requirejs for details
5
5
  */
@@ -20,9 +20,10 @@ var requirejs, require, define;
20
20
 
21
21
  var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
22
22
  nodeDefine, exists, reqMain, loadedOptimizedLib,
23
- version = '1.0.4',
23
+ version = '1.0.5',
24
24
  jsSuffixRegExp = /\.js$/,
25
25
  commandOption = '',
26
+ useLibLoaded = {},
26
27
  //Used by jslib/rhino/args.js
27
28
  rhinoArgs = args,
28
29
  readFile = typeof readFileFunc !== 'undefined' ? readFileFunc : null;
@@ -101,19 +102,17 @@ var requirejs, require, define;
101
102
  }
102
103
 
103
104
  /** vim: et:ts=4:sw=4:sts=4
104
- * @license RequireJS 1.0.4 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
105
+ * @license RequireJS 1.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
105
106
  * Available via the MIT or new BSD license.
106
107
  * see: http://github.com/jrburke/requirejs for details
107
108
  */
108
109
  /*jslint strict: false, plusplus: false, sub: true */
109
- /*global window: false, navigator: false, document: false, importScripts: false,
110
- jQuery: false, clearInterval: false, setInterval: false, self: false,
111
- setTimeout: false, opera: false */
110
+ /*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
112
111
 
113
112
 
114
113
  (function () {
115
114
  //Change this version number for each release.
116
- var version = "1.0.4",
115
+ var version = "1.0.5",
117
116
  commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
118
117
  cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
119
118
  currDirRegExp = /^\.\//,
@@ -139,8 +138,13 @@ var requirejs, require, define;
139
138
  interactiveScript = null,
140
139
  checkLoadedDepth = 0,
141
140
  useInteractive = false,
141
+ reservedDependencies = {
142
+ require: true,
143
+ module: true,
144
+ exports: true
145
+ },
142
146
  req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
143
- src, subPath, mainScript, dataMain, i, ctx, jQueryCheck, checkLoadedTimeoutId;
147
+ src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
144
148
 
145
149
  function isFunction(it) {
146
150
  return ostring.call(it) === "[object Function]";
@@ -493,8 +497,8 @@ var requirejs, require, define;
493
497
  * per module because of the implication of path mappings that may
494
498
  * need to be relative to the module name.
495
499
  */
496
- function makeRequire(relModuleMap, enableBuildCallback) {
497
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
500
+ function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
501
+ var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
498
502
 
499
503
  mixin(modRequire, {
500
504
  nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
@@ -709,7 +713,22 @@ var requirejs, require, define;
709
713
  //Use parentName here since the plugin's name is not reliable,
710
714
  //could be some weird string with no path that actually wants to
711
715
  //reference the parentName's path.
712
- plugin.load(name, makeRequire(map.parentMap, true), load, config);
716
+ plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
717
+ var moduleDeps = [],
718
+ i, dep, depMap;
719
+ //Convert deps to full names and hold on to them
720
+ //for reference later, when figuring out if they
721
+ //are blocked by a circular dependency.
722
+ for (i = 0; (dep = deps[i]); i++) {
723
+ depMap = makeModuleMap(dep, map.parentMap);
724
+ deps[i] = depMap.fullName;
725
+ if (!depMap.prefix) {
726
+ moduleDeps.push(deps[i]);
727
+ }
728
+ }
729
+ depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
730
+ return context.require(deps, cb);
731
+ }), load, config);
713
732
  }
714
733
  }
715
734
 
@@ -976,15 +995,62 @@ var requirejs, require, define;
976
995
  }
977
996
  };
978
997
 
979
- function forceExec(manager, traced) {
980
- if (manager.isDone) {
981
- return undefined;
998
+ function findCycle(manager, traced) {
999
+ var fullName = manager.map.fullName,
1000
+ depArray = manager.depArray,
1001
+ fullyLoaded = true,
1002
+ i, depName, depManager, result;
1003
+
1004
+ if (manager.isDone || !fullName || !loaded[fullName]) {
1005
+ return result;
1006
+ }
1007
+
1008
+ //Found the cycle.
1009
+ if (traced[fullName]) {
1010
+ return manager;
1011
+ }
1012
+
1013
+ traced[fullName] = true;
1014
+
1015
+ //Trace through the dependencies.
1016
+ if (depArray) {
1017
+ for (i = 0; i < depArray.length; i++) {
1018
+ //Some array members may be null, like if a trailing comma
1019
+ //IE, so do the explicit [i] access and check if it has a value.
1020
+ depName = depArray[i];
1021
+ if (!loaded[depName] && !reservedDependencies[depName]) {
1022
+ fullyLoaded = false;
1023
+ break;
1024
+ }
1025
+ depManager = waiting[depName];
1026
+ if (depManager && !depManager.isDone && loaded[depName]) {
1027
+ result = findCycle(depManager, traced);
1028
+ if (result) {
1029
+ break;
1030
+ }
1031
+ }
1032
+ }
1033
+ if (!fullyLoaded) {
1034
+ //Discard the cycle that was found, since it cannot
1035
+ //be forced yet. Also clear this module from traced.
1036
+ result = undefined;
1037
+ delete traced[fullName];
1038
+ }
982
1039
  }
983
1040
 
1041
+ return result;
1042
+ }
1043
+
1044
+ function forceExec(manager, traced) {
984
1045
  var fullName = manager.map.fullName,
985
1046
  depArray = manager.depArray,
986
1047
  i, depName, depManager, prefix, prefixManager, value;
987
1048
 
1049
+
1050
+ if (manager.isDone || !fullName || !loaded[fullName]) {
1051
+ return undefined;
1052
+ }
1053
+
988
1054
  if (fullName) {
989
1055
  if (traced[fullName]) {
990
1056
  return defined[fullName];
@@ -1015,7 +1081,7 @@ var requirejs, require, define;
1015
1081
  }
1016
1082
  }
1017
1083
 
1018
- return fullName ? defined[fullName] : undefined;
1084
+ return defined[fullName];
1019
1085
  }
1020
1086
 
1021
1087
  /**
@@ -1028,8 +1094,9 @@ var requirejs, require, define;
1028
1094
  var waitInterval = config.waitSeconds * 1000,
1029
1095
  //It is possible to disable the wait interval by using waitSeconds of 0.
1030
1096
  expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
1031
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
1032
- err, manager;
1097
+ noLoads = "", hasLoadedProp = false, stillLoading = false,
1098
+ cycleDeps = [],
1099
+ i, prop, err, manager, cycleManager, moduleDeps;
1033
1100
 
1034
1101
  //If there are items still in the paused queue processing wait.
1035
1102
  //This is particularly important in the sync case where each paused
@@ -1059,7 +1126,20 @@ var requirejs, require, define;
1059
1126
  noLoads += prop + " ";
1060
1127
  } else {
1061
1128
  stillLoading = true;
1062
- break;
1129
+ if (prop.indexOf('!') === -1) {
1130
+ //No reason to keep looking for unfinished
1131
+ //loading. If the only stillLoading is a
1132
+ //plugin resource though, keep going,
1133
+ //because it may be that a plugin resource
1134
+ //is waiting on a non-plugin cycle.
1135
+ cycleDeps = [];
1136
+ break;
1137
+ } else {
1138
+ moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
1139
+ if (moduleDeps) {
1140
+ cycleDeps.push.apply(cycleDeps, moduleDeps);
1141
+ }
1142
+ }
1063
1143
  }
1064
1144
  }
1065
1145
  }
@@ -1078,7 +1158,23 @@ var requirejs, require, define;
1078
1158
  err.requireModules = noLoads;
1079
1159
  return req.onError(err);
1080
1160
  }
1081
- if (stillLoading || context.scriptCount) {
1161
+
1162
+ //If still loading but a plugin is waiting on a regular module cycle
1163
+ //break the cycle.
1164
+ if (stillLoading && cycleDeps.length) {
1165
+ for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
1166
+ if ((cycleManager = findCycle(manager, {}))) {
1167
+ forceExec(cycleManager, {});
1168
+ break;
1169
+ }
1170
+ }
1171
+
1172
+ }
1173
+
1174
+ //If still waiting on loads, and the waiting load is something
1175
+ //other than a plugin resource, or there are still outstanding
1176
+ //scripts, then just try back later.
1177
+ if (!expired && (stillLoading || context.scriptCount)) {
1082
1178
  //Something is still waiting to load. Wait for it, but only
1083
1179
  //if a timeout is not already in effect.
1084
1180
  if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
@@ -1136,6 +1232,9 @@ var requirejs, require, define;
1136
1232
  resume = function () {
1137
1233
  var manager, map, url, i, p, args, fullName;
1138
1234
 
1235
+ //Any defined modules in the global queue, intake them now.
1236
+ context.takeGlobalQueue();
1237
+
1139
1238
  resumeDepth += 1;
1140
1239
 
1141
1240
  if (context.scriptCount <= 0) {
@@ -1299,8 +1398,7 @@ var requirejs, require, define;
1299
1398
  context.requireWait = false;
1300
1399
  //But first, call resume to register any defined modules that may
1301
1400
  //be in a data-main built file before the priority config
1302
- //call. Also grab any waiting define calls for this context.
1303
- context.takeGlobalQueue();
1401
+ //call.
1304
1402
  resume();
1305
1403
 
1306
1404
  context.require(cfg.priority);
@@ -1377,10 +1475,6 @@ var requirejs, require, define;
1377
1475
  //then resume the dependency processing.
1378
1476
  if (!context.requireWait) {
1379
1477
  while (!context.scriptCount && context.paused.length) {
1380
- //For built layers, there can be some defined
1381
- //modules waiting for intake into the context,
1382
- //in particular module plugins. Take them.
1383
- context.takeGlobalQueue();
1384
1478
  resume();
1385
1479
  }
1386
1480
  }
@@ -1944,7 +2038,7 @@ var requirejs, require, define;
1944
2038
  //Figure out baseUrl. Get it from the script tag with require.js in it.
1945
2039
  scripts = document.getElementsByTagName("script");
1946
2040
 
1947
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
2041
+ for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {
1948
2042
  //Set the "head" where we can append children by
1949
2043
  //using the script's parent.
1950
2044
  if (!head) {
@@ -2052,10 +2146,6 @@ var requirejs, require, define;
2052
2146
  setTimeout(function () {
2053
2147
  ctx.requireWait = false;
2054
2148
 
2055
- //Any modules included with the require.js file will be in the
2056
- //global queue, assign them to this context.
2057
- ctx.takeGlobalQueue();
2058
-
2059
2149
  if (!ctx.scriptCount) {
2060
2150
  ctx.resume();
2061
2151
  }
@@ -2364,6 +2454,7 @@ if(env === 'node') {
2364
2454
  define('node/file', ['fs', 'path'], function (fs, path) {
2365
2455
 
2366
2456
  var isWindows = process.platform === 'win32',
2457
+ windowsDriveRegExp = /^[a-zA-Z]\:\/$/,
2367
2458
  file;
2368
2459
 
2369
2460
  function frontSlash(path) {
@@ -2385,7 +2476,7 @@ define('node/file', ['fs', 'path'], function (fs, path) {
2385
2476
  }
2386
2477
 
2387
2478
  function mkDir(dir) {
2388
- if (!exists(dir)) {
2479
+ if (!exists(dir) && (!isWindows || !windowsDriveRegExp.test(dir))) {
2389
2480
  fs.mkdirSync(dir, 511);
2390
2481
  }
2391
2482
  }
@@ -2897,6 +2988,14 @@ define('lang', function () {
2897
2988
  return lang.ostring.call(it) === "[object Array]";
2898
2989
  },
2899
2990
 
2991
+ isFunction: function(it) {
2992
+ return lang.ostring.call(it) === "[object Function]";
2993
+ },
2994
+
2995
+ isRegExp: function(it) {
2996
+ return it && it instanceof RegExp;
2997
+ },
2998
+
2900
2999
  /**
2901
3000
  * Simple function to mix in properties from source into target,
2902
3001
  * but only if target does not already have a property of the same name.
@@ -6726,11 +6825,15 @@ define('parse', ['uglifyjs/index'], function (uglify) {
6726
6825
  * @param {Function} onMatch function to call on a parse match.
6727
6826
  * @param {Object} [options] This is normally the build config options if
6728
6827
  * it is passed.
6828
+ * @param {Function} [recurseCallback] function to call on each valid
6829
+ * node, defaults to parse.parseNode.
6729
6830
  */
6730
- parse.recurse = function (parentNode, onMatch, options) {
6831
+ parse.recurse = function (parentNode, onMatch, options, recurseCallback) {
6731
6832
  var hasHas = options && options.has,
6732
6833
  i, node;
6733
6834
 
6835
+ recurseCallback = recurseCallback || this.parseNode;
6836
+
6734
6837
  if (isArray(parentNode)) {
6735
6838
  for (i = 0; i < parentNode.length; i++) {
6736
6839
  node = parentNode[i];
@@ -6750,17 +6853,17 @@ define('parse', ['uglifyjs/index'], function (uglify) {
6750
6853
  if (hasHas && node[0] === 'if' && node[1] && node[1][0] === 'name' &&
6751
6854
  (node[1][1] === 'true' || node[1][1] === 'false')) {
6752
6855
  if (node[1][1] === 'true') {
6753
- this.recurse([node[2]], onMatch, options);
6856
+ this.recurse([node[2]], onMatch, options, recurseCallback);
6754
6857
  } else {
6755
- this.recurse([node[3]], onMatch, options);
6858
+ this.recurse([node[3]], onMatch, options, recurseCallback);
6756
6859
  }
6757
6860
  } else {
6758
- if (this.parseNode(node, onMatch)) {
6861
+ if (recurseCallback(node, onMatch)) {
6759
6862
  //The onMatch indicated parsing should
6760
6863
  //stop for children of this node.
6761
6864
  continue;
6762
6865
  }
6763
- this.recurse(node, onMatch, options);
6866
+ this.recurse(node, onMatch, options, recurseCallback);
6764
6867
  }
6765
6868
  }
6766
6869
  }
@@ -6859,6 +6962,37 @@ define('parse', ['uglifyjs/index'], function (uglify) {
6859
6962
  return null;
6860
6963
  };
6861
6964
 
6965
+ /**
6966
+ * Finds any config that is passed to requirejs.
6967
+ * @param {String} fileName
6968
+ * @param {String} fileContents
6969
+ *
6970
+ * @returns {Object} a config object. Will be null if no config.
6971
+ * Can throw an error if the config in the file cannot be evaluated in
6972
+ * a build context to valid JavaScript.
6973
+ */
6974
+ parse.findConfig = function (fileName, fileContents) {
6975
+ /*jslint evil: true */
6976
+ //This is a litle bit inefficient, it ends up with two uglifyjs parser
6977
+ //calls. Can revisit later, but trying to build out larger functional
6978
+ //pieces first.
6979
+ var foundConfig = null,
6980
+ astRoot = parser.parse(fileContents);
6981
+
6982
+ parse.recurse(astRoot, function (configNode) {
6983
+ var jsConfig;
6984
+
6985
+ if (!foundConfig && configNode) {
6986
+ jsConfig = parse.nodeToString(configNode);
6987
+ foundConfig = eval('(' + jsConfig + ')');
6988
+ return foundConfig;
6989
+ }
6990
+ return undefined;
6991
+ }, null, parse.parseConfigNode);
6992
+
6993
+ return foundConfig;
6994
+ };
6995
+
6862
6996
  /**
6863
6997
  * Finds all dependencies specified in dependency arrays and inside
6864
6998
  * simplified commonjs wrappers.
@@ -6872,7 +7006,7 @@ define('parse', ['uglifyjs/index'], function (uglify) {
6872
7006
  //This is a litle bit inefficient, it ends up with two uglifyjs parser
6873
7007
  //calls. Can revisit later, but trying to build out larger functional
6874
7008
  //pieces first.
6875
- var dependencies = parse.getAnonDeps(fileName, fileContents),
7009
+ var dependencies = [],
6876
7010
  astRoot = parser.parse(fileContents);
6877
7011
 
6878
7012
  parse.recurse(astRoot, function (callName, config, name, deps) {
@@ -7047,6 +7181,56 @@ define('parse', ['uglifyjs/index'], function (uglify) {
7047
7181
  return false;
7048
7182
  };
7049
7183
 
7184
+
7185
+ /**
7186
+ * Determines if a specific node is a valid require/requirejs config
7187
+ * call. That includes calls to require/requirejs.config().
7188
+ * @param {Array} node
7189
+ * @param {Function} onMatch a function to call when a match is found.
7190
+ * It is passed the match name, and the config, name, deps possible args.
7191
+ * The config, name and deps args are not normalized.
7192
+ *
7193
+ * @returns {String} a JS source string with the valid require/define call.
7194
+ * Otherwise null.
7195
+ */
7196
+ parse.parseConfigNode = function (node, onMatch) {
7197
+ var call, configNode, args;
7198
+
7199
+ if (!isArray(node)) {
7200
+ return false;
7201
+ }
7202
+
7203
+ if (node[0] === 'call') {
7204
+ call = node[1];
7205
+ args = node[2];
7206
+
7207
+ if (call) {
7208
+ //A require.config() or requirejs.config() call.
7209
+ if ((call[0] === 'dot' &&
7210
+ (call[1] && call[1][0] === 'name' &&
7211
+ (call[1][1] === 'require' || call[1][1] === 'requirejs')) &&
7212
+ call[2] === 'config') ||
7213
+ //A require() or requirejs() config call.
7214
+
7215
+ (call[0] === 'name' &&
7216
+ (call[1] === 'require' || call[1] === 'requirejs'))
7217
+ ) {
7218
+ //It is a plain require() call.
7219
+ configNode = args[0];
7220
+
7221
+ if (configNode[0] !== 'object') {
7222
+ return null;
7223
+ }
7224
+
7225
+ return onMatch(configNode);
7226
+
7227
+ }
7228
+ }
7229
+ }
7230
+
7231
+ return false;
7232
+ };
7233
+
7050
7234
  /**
7051
7235
  * Converts an AST node into a JS source string. Does not maintain formatting
7052
7236
  * or even comments from original source, just returns valid JS source.
@@ -8669,6 +8853,104 @@ function (lang, logger, file, parse, optimize, pragma,
8669
8853
  return path.replace(lang.backSlashRegExp, '/');
8670
8854
  };
8671
8855
 
8856
+ build.makeAbsObject = function (props, obj, absFilePath) {
8857
+ var i, prop;
8858
+ if (obj) {
8859
+ for (i = 0; (prop = props[i]); i++) {
8860
+ if (obj.hasOwnProperty(prop)) {
8861
+ obj[prop] = build.makeAbsPath(obj[prop], absFilePath);
8862
+ }
8863
+ }
8864
+ }
8865
+ };
8866
+
8867
+ /**
8868
+ * For any path in a possible config, make it absolute relative
8869
+ * to the absFilePath passed in.
8870
+ */
8871
+ build.makeAbsConfig = function (config, absFilePath) {
8872
+ var props, prop, i, originalBaseUrl;
8873
+
8874
+ props = ["appDir", "dir", "baseUrl"];
8875
+ for (i = 0; (prop = props[i]); i++) {
8876
+ if (config[prop]) {
8877
+ //Add abspath if necessary, make sure these paths end in
8878
+ //slashes
8879
+ if (prop === "baseUrl") {
8880
+ originalBaseUrl = config.baseUrl;
8881
+ if (config.appDir) {
8882
+ //If baseUrl with an appDir, the baseUrl is relative to
8883
+ //the appDir, *not* the absFilePath. appDir and dir are
8884
+ //made absolute before baseUrl, so this will work.
8885
+ config.baseUrl = build.makeAbsPath(originalBaseUrl, config.appDir);
8886
+ //Set up dir output baseUrl.
8887
+ config.dirBaseUrl = build.makeAbsPath(originalBaseUrl, config.dir);
8888
+ } else {
8889
+ //The dir output baseUrl is same as regular baseUrl, both
8890
+ //relative to the absFilePath.
8891
+ config.baseUrl = build.makeAbsPath(config[prop], absFilePath);
8892
+ config.dirBaseUrl = config.dir || config.baseUrl;
8893
+ }
8894
+
8895
+ //Make sure dirBaseUrl ends in a slash, since it is
8896
+ //concatenated with other strings.
8897
+ config.dirBaseUrl = endsWithSlash(config.dirBaseUrl);
8898
+ } else {
8899
+ config[prop] = build.makeAbsPath(config[prop], absFilePath);
8900
+ }
8901
+
8902
+ config[prop] = endsWithSlash(config[prop]);
8903
+ }
8904
+ }
8905
+
8906
+ //Do not allow URLs for paths resources.
8907
+ if (config.paths) {
8908
+ for (prop in config.paths) {
8909
+ if (config.paths.hasOwnProperty(prop)) {
8910
+ config.paths[prop] = build.makeAbsPath(config.paths[prop],
8911
+ (config.baseUrl || absFilePath));
8912
+ }
8913
+ }
8914
+ }
8915
+
8916
+ build.makeAbsObject(["out", "cssIn"], config, absFilePath);
8917
+ build.makeAbsObject(["startFile", "endFile"], config.wrap, absFilePath);
8918
+ };
8919
+
8920
+ build.nestedMix = {
8921
+ paths: true,
8922
+ has: true,
8923
+ hasOnSave: true,
8924
+ pragmas: true,
8925
+ pragmasOnSave: true
8926
+ };
8927
+
8928
+ /**
8929
+ * Mixes additional source config into target config, and merges some
8930
+ * nested config, like paths, correctly.
8931
+ */
8932
+ function mixConfig(target, source) {
8933
+ var prop, value;
8934
+
8935
+ for (prop in source) {
8936
+ if (source.hasOwnProperty(prop)) {
8937
+ //If the value of the property is a plain object, then
8938
+ //allow a one-level-deep mixing of it.
8939
+ value = source[prop];
8940
+ if (typeof value === 'object' && value &&
8941
+ !lang.isArray(value) && !lang.isFunction(value) &&
8942
+ !lang.isRegExp(value)) {
8943
+ if (!target[prop]) {
8944
+ target[prop] = {};
8945
+ }
8946
+ lang.mixin(target[prop], source[prop], true);
8947
+ } else {
8948
+ target[prop] = source[prop];
8949
+ }
8950
+ }
8951
+ }
8952
+ }
8953
+
8672
8954
  /**
8673
8955
  * Creates a config object for an optimization build.
8674
8956
  * It will also read the build profile if it is available, to create
@@ -8682,13 +8964,15 @@ function (lang, logger, file, parse, optimize, pragma,
8682
8964
  */
8683
8965
  build.createConfig = function (cfg) {
8684
8966
  /*jslint evil: true */
8685
- var config = {}, buildFileContents, buildFileConfig,
8686
- paths, props, i, prop, buildFile, absFilePath, originalBaseUrl;
8967
+ var config = {}, buildFileContents, buildFileConfig, mainConfig,
8968
+ mainConfigFile, prop, buildFile, absFilePath;
8687
8969
 
8688
8970
  lang.mixin(config, buildBaseConfig);
8689
8971
  lang.mixin(config, cfg, true);
8690
8972
 
8973
+ //Make sure all paths are relative to current directory.
8691
8974
  absFilePath = file.absPath('.');
8975
+ build.makeAbsConfig(config, absFilePath);
8692
8976
 
8693
8977
  if (config.buildFile) {
8694
8978
  //A build file exists, load it to get more config.
@@ -8701,35 +8985,71 @@ function (lang, logger, file, parse, optimize, pragma,
8701
8985
  }
8702
8986
 
8703
8987
  absFilePath = config.baseUrl = file.absPath(file.parent(buildFile));
8704
- config.dir = config.baseUrl + "/build/";
8705
8988
 
8706
8989
  //Load build file options.
8707
8990
  buildFileContents = file.readFile(buildFile);
8708
8991
  try {
8709
8992
  buildFileConfig = eval("(" + buildFileContents + ")");
8993
+ build.makeAbsConfig(buildFileConfig, absFilePath);
8994
+
8995
+ if (!buildFileConfig.out && !buildFileConfig.dir) {
8996
+ buildFileConfig.dir = (buildFileConfig.baseUrl || config.baseUrl) + "/build/";
8997
+ }
8998
+
8710
8999
  } catch (e) {
8711
9000
  throw new Error("Build file " + buildFile + " is malformed: " + e);
8712
9001
  }
8713
- lang.mixin(config, buildFileConfig, true);
9002
+ }
8714
9003
 
8715
- //Re-apply the override config values, things like command line
8716
- //args should take precedence over build file values.
8717
- lang.mixin(config, cfg, true);
8718
- } else if (config.cssIn) {
8719
- if (!config.out) {
8720
- throw new Error("ERROR: 'out' option missing.");
8721
- } else {
8722
- config.out = config.out.replace(lang.backSlashRegExp, "/");
9004
+ mainConfigFile = config.mainConfigFile || (buildFileConfig && buildFileConfig.mainConfigFile);
9005
+ if (mainConfigFile) {
9006
+ mainConfigFile = build.makeAbsPath(mainConfigFile, absFilePath);
9007
+ try {
9008
+ mainConfig = parse.findConfig(mainConfigFile, file.readFile(mainConfigFile));
9009
+ } catch (configError) {
9010
+ throw new Error('The config in mainConfigFile ' +
9011
+ mainConfigFile +
9012
+ ' cannot be used because it cannot be evaluated' +
9013
+ ' correctly while running in the optimizer. Try only' +
9014
+ ' using a config that is also valid JSON, or do not use' +
9015
+ ' mainConfigFile and instead copy the config values needed' +
9016
+ ' into a build file or command line arguments given to the optimizer.');
9017
+ }
9018
+ if (mainConfig) {
9019
+ //If no baseUrl, then use the directory holding the main config.
9020
+ if (!mainConfig.baseUrl) {
9021
+ mainConfig.baseUrl = mainConfigFile.substring(0, mainConfigFile.lastIndexOf('/'));
9022
+ }
9023
+ build.makeAbsConfig(mainConfig, mainConfigFile);
9024
+ mixConfig(config, mainConfig);
8723
9025
  }
8724
9026
  }
8725
9027
 
9028
+ //Mix in build file config, but only after mainConfig has been mixed in.
9029
+ if (buildFileConfig) {
9030
+ mixConfig(config, buildFileConfig);
9031
+ }
9032
+
9033
+ //Re-apply the override config values. Command line
9034
+ //args should take precedence over build file values.
9035
+ mixConfig(config, cfg);
9036
+
9037
+ //Check for errors in config
9038
+ if (config.cssIn && !config.out) {
9039
+ throw new Error("ERROR: 'out' option missing.");
9040
+ }
8726
9041
  if (!config.cssIn && !config.baseUrl) {
8727
9042
  throw new Error("ERROR: 'baseUrl' option missing.");
8728
9043
  }
8729
-
8730
9044
  if (!config.out && !config.dir) {
8731
9045
  throw new Error('Missing either an "out" or "dir" config value.');
8732
9046
  }
9047
+ if (config.out && config.dir) {
9048
+ throw new Error('The "out" and "dir" options are incompatible.' +
9049
+ ' Use "out" if you are targeting a single file for' +
9050
+ ' for optimization, and "dir" if you want the appDir' +
9051
+ ' or baseUrl directories optimized.');
9052
+ }
8733
9053
 
8734
9054
  if (config.out && !config.cssIn) {
8735
9055
  //Just one file to optimize.
@@ -8754,60 +9074,15 @@ function (lang, logger, file, parse, optimize, pragma,
8754
9074
  }
8755
9075
  }
8756
9076
 
8757
- //Adjust the path properties as appropriate.
8758
- //First make sure build paths use front slashes and end in a slash,
8759
- //and make sure they are aboslute paths.
8760
- props = ["appDir", "dir", "baseUrl"];
8761
- for (i = 0; (prop = props[i]); i++) {
8762
- if (config[prop]) {
8763
- config[prop] = config[prop].replace(lang.backSlashRegExp, "/");
8764
-
8765
- //Add abspath if necessary.
8766
- if (prop === "baseUrl") {
8767
- originalBaseUrl = config.baseUrl;
8768
- if (config.appDir) {
8769
- //If baseUrl with an appDir, the baseUrl is relative to
8770
- //the appDir, *not* the absFilePath. appDir and dir are
8771
- //made absolute before baseUrl, so this will work.
8772
- config.baseUrl = build.makeAbsPath(originalBaseUrl, config.appDir);
8773
- //Set up dir output baseUrl.
8774
- config.dirBaseUrl = build.makeAbsPath(originalBaseUrl, config.dir);
8775
- } else {
8776
- //The dir output baseUrl is same as regular baseUrl, both
8777
- //relative to the absFilePath.
8778
- config.baseUrl = build.makeAbsPath(config[prop], absFilePath);
8779
- config.dirBaseUrl = config.dir || config.baseUrl;
8780
- }
8781
-
8782
- //Make sure dirBaseUrl ends in a slash, since it is
8783
- //concatenated with other strings.
8784
- config.dirBaseUrl = endsWithSlash(config.dirBaseUrl);
8785
- } else {
8786
- config[prop] = build.makeAbsPath(config[prop], absFilePath);
8787
- }
8788
-
8789
- config[prop] = endsWithSlash(config[prop]);
8790
- }
8791
- }
8792
-
8793
9077
  //Do not allow URLs for paths resources.
8794
9078
  if (config.paths) {
8795
9079
  for (prop in config.paths) {
8796
9080
  if (config.paths.hasOwnProperty(prop)) {
8797
- config.paths[prop] = config.paths[prop].replace(lang.backSlashRegExp, "/");
8798
9081
  disallowUrls(config.paths[prop]);
8799
9082
  }
8800
9083
  }
8801
9084
  }
8802
9085
 
8803
- //Make sure some other paths are absolute.
8804
- props = ["out", "cssIn"];
8805
- for (i = 0; (prop = props[i]); i++) {
8806
- if (config[prop]) {
8807
- config[prop] = build.makeAbsPath(config[prop], absFilePath);
8808
- }
8809
- }
8810
-
8811
9086
  //Get any wrap text.
8812
9087
  try {
8813
9088
  if (config.wrap) {
@@ -9070,7 +9345,7 @@ function (lang, logger, file, parse, optimize, pragma,
9070
9345
  //define(\n//begin v1.x content
9071
9346
  //for a comment.
9072
9347
  return new RegExp('(^|[^\\.])(' + (namespace || '').replace(/\./g, '\\.') +
9073
- 'define|define)\\s*\\(\\s*(\\/\\/[^\\n\\r]*[\\r\\n])?(\\[|f|\\{|["\']([^"\']+)["\'])(\\s*,\\s*f)?');
9348
+ 'define|define)\\s*\\(\\s*(\\/\\/[^\\n\\r]*[\\r\\n])?(\\[|function|[\\w\\d_\\$]+\\s*\\)|\\{|["\']([^"\']+)["\'])(\\s*,\\s*f)?');
9074
9349
  };
9075
9350
 
9076
9351
  build.leadingCommaRegExp = /^\s*,/;
@@ -9181,6 +9456,28 @@ function (lang, logger, file, parse, optimize, pragma,
9181
9456
  }, ['build', 'logger'], runBuild);
9182
9457
  };
9183
9458
 
9459
+ requirejs.tools = {
9460
+ useLib: function (contextName, callback) {
9461
+ if (!callback) {
9462
+ callback = contextName;
9463
+ contextName = 'uselib';
9464
+ }
9465
+
9466
+ if (!useLibLoaded[contextName]) {
9467
+ loadLib();
9468
+ useLibLoaded[contextName] = true;
9469
+ }
9470
+
9471
+ var req = requirejs({
9472
+ context: contextName
9473
+ });
9474
+
9475
+ req(['build'], function () {
9476
+ callback(req);
9477
+ });
9478
+ }
9479
+ };
9480
+
9184
9481
  requirejs.define = define;
9185
9482
 
9186
9483
  module.exports = requirejs;
@@ -18,9 +18,13 @@ var module_specs = [
18
18
  <% build_config['modules'].each do |m| %>
19
19
  {
20
20
  name: "<%= m['name'] %>",
21
- <% if m['includes'] %>
22
- include: [<%= m['includes'].map {|i| "'#{i}'" }.join(", ") %>],
23
- <% end %>
21
+ <% if m['include'] %>
22
+ include: [<%= m['include'].map {|i| "'#{i}'" }.join(", ") %>],
23
+ <% end %>
24
+ <% if m['exclude'] %>
25
+ exclude: [<%= m['exclude'].map {|i| "'#{i}'" }.join(", ") %>],
26
+ <% end %>
27
+
24
28
  out: '<%= module_path_for m['name'] %>'
25
29
  },
26
30
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module Requirejs
2
2
  module Rails
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ class RequirejsRailsTest < ActiveSupport::TestCase
13
13
  test "require.js version" do
14
14
  require_js = Pathname.new(__FILE__+'/../../vendor/assets/javascripts/require.js').cleanpath.read
15
15
  context = ExecJS.compile(require_js)
16
- assert_equal "1.0.4", context.eval("require.version")
16
+ assert_equal "1.0.5", context.eval("require.version")
17
17
  end
18
18
  end
19
19
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license RequireJS order 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2
+ * @license RequireJS order 1.0.5 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
3
3
  * Available via the MIT or new BSD license.
4
4
  * see: http://github.com/jrburke/requirejs for details
5
5
  */
@@ -120,11 +120,20 @@
120
120
  }
121
121
 
122
122
  define({
123
- version: '1.0.0',
123
+ version: '1.0.5',
124
124
 
125
125
  load: function (name, req, onLoad, config) {
126
- var url = req.nameToUrl(name, null),
127
- node, context;
126
+ var hasToUrl = !!req.nameToUrl,
127
+ url, node, context;
128
+
129
+ //If no nameToUrl, then probably a build with a loader that
130
+ //does not support it, and all modules are inlined.
131
+ if (!hasToUrl) {
132
+ req([name], onLoad);
133
+ return;
134
+ }
135
+
136
+ url = req.nameToUrl(name, null);
128
137
 
129
138
  //Make sure the async attribute is not set for any pathway involving
130
139
  //this script.
@@ -1,17 +1,15 @@
1
1
  /** vim: et:ts=4:sw=4:sts=4
2
- * @license RequireJS 1.0.4 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2
+ * @license RequireJS 1.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3
3
  * Available via the MIT or new BSD license.
4
4
  * see: http://github.com/jrburke/requirejs for details
5
5
  */
6
6
  /*jslint strict: false, plusplus: false, sub: true */
7
- /*global window: false, navigator: false, document: false, importScripts: false,
8
- jQuery: false, clearInterval: false, setInterval: false, self: false,
9
- setTimeout: false, opera: false */
7
+ /*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
10
8
 
11
9
  var requirejs, require, define;
12
10
  (function () {
13
11
  //Change this version number for each release.
14
- var version = "1.0.4",
12
+ var version = "1.0.5",
15
13
  commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
16
14
  cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
17
15
  currDirRegExp = /^\.\//,
@@ -37,8 +35,13 @@ var requirejs, require, define;
37
35
  interactiveScript = null,
38
36
  checkLoadedDepth = 0,
39
37
  useInteractive = false,
38
+ reservedDependencies = {
39
+ require: true,
40
+ module: true,
41
+ exports: true
42
+ },
40
43
  req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
41
- src, subPath, mainScript, dataMain, i, ctx, jQueryCheck, checkLoadedTimeoutId;
44
+ src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
42
45
 
43
46
  function isFunction(it) {
44
47
  return ostring.call(it) === "[object Function]";
@@ -391,8 +394,8 @@ var requirejs, require, define;
391
394
  * per module because of the implication of path mappings that may
392
395
  * need to be relative to the module name.
393
396
  */
394
- function makeRequire(relModuleMap, enableBuildCallback) {
395
- var modRequire = makeContextModuleFunc(context.require, relModuleMap, enableBuildCallback);
397
+ function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
398
+ var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
396
399
 
397
400
  mixin(modRequire, {
398
401
  nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
@@ -607,7 +610,22 @@ var requirejs, require, define;
607
610
  //Use parentName here since the plugin's name is not reliable,
608
611
  //could be some weird string with no path that actually wants to
609
612
  //reference the parentName's path.
610
- plugin.load(name, makeRequire(map.parentMap, true), load, config);
613
+ plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
614
+ var moduleDeps = [],
615
+ i, dep, depMap;
616
+ //Convert deps to full names and hold on to them
617
+ //for reference later, when figuring out if they
618
+ //are blocked by a circular dependency.
619
+ for (i = 0; (dep = deps[i]); i++) {
620
+ depMap = makeModuleMap(dep, map.parentMap);
621
+ deps[i] = depMap.fullName;
622
+ if (!depMap.prefix) {
623
+ moduleDeps.push(deps[i]);
624
+ }
625
+ }
626
+ depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
627
+ return context.require(deps, cb);
628
+ }), load, config);
611
629
  }
612
630
  }
613
631
 
@@ -874,15 +892,62 @@ var requirejs, require, define;
874
892
  }
875
893
  };
876
894
 
877
- function forceExec(manager, traced) {
878
- if (manager.isDone) {
879
- return undefined;
895
+ function findCycle(manager, traced) {
896
+ var fullName = manager.map.fullName,
897
+ depArray = manager.depArray,
898
+ fullyLoaded = true,
899
+ i, depName, depManager, result;
900
+
901
+ if (manager.isDone || !fullName || !loaded[fullName]) {
902
+ return result;
903
+ }
904
+
905
+ //Found the cycle.
906
+ if (traced[fullName]) {
907
+ return manager;
908
+ }
909
+
910
+ traced[fullName] = true;
911
+
912
+ //Trace through the dependencies.
913
+ if (depArray) {
914
+ for (i = 0; i < depArray.length; i++) {
915
+ //Some array members may be null, like if a trailing comma
916
+ //IE, so do the explicit [i] access and check if it has a value.
917
+ depName = depArray[i];
918
+ if (!loaded[depName] && !reservedDependencies[depName]) {
919
+ fullyLoaded = false;
920
+ break;
921
+ }
922
+ depManager = waiting[depName];
923
+ if (depManager && !depManager.isDone && loaded[depName]) {
924
+ result = findCycle(depManager, traced);
925
+ if (result) {
926
+ break;
927
+ }
928
+ }
929
+ }
930
+ if (!fullyLoaded) {
931
+ //Discard the cycle that was found, since it cannot
932
+ //be forced yet. Also clear this module from traced.
933
+ result = undefined;
934
+ delete traced[fullName];
935
+ }
880
936
  }
881
937
 
938
+ return result;
939
+ }
940
+
941
+ function forceExec(manager, traced) {
882
942
  var fullName = manager.map.fullName,
883
943
  depArray = manager.depArray,
884
944
  i, depName, depManager, prefix, prefixManager, value;
885
945
 
946
+
947
+ if (manager.isDone || !fullName || !loaded[fullName]) {
948
+ return undefined;
949
+ }
950
+
886
951
  if (fullName) {
887
952
  if (traced[fullName]) {
888
953
  return defined[fullName];
@@ -913,7 +978,7 @@ var requirejs, require, define;
913
978
  }
914
979
  }
915
980
 
916
- return fullName ? defined[fullName] : undefined;
981
+ return defined[fullName];
917
982
  }
918
983
 
919
984
  /**
@@ -926,8 +991,9 @@ var requirejs, require, define;
926
991
  var waitInterval = config.waitSeconds * 1000,
927
992
  //It is possible to disable the wait interval by using waitSeconds of 0.
928
993
  expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
929
- noLoads = "", hasLoadedProp = false, stillLoading = false, prop,
930
- err, manager;
994
+ noLoads = "", hasLoadedProp = false, stillLoading = false,
995
+ cycleDeps = [],
996
+ i, prop, err, manager, cycleManager, moduleDeps;
931
997
 
932
998
  //If there are items still in the paused queue processing wait.
933
999
  //This is particularly important in the sync case where each paused
@@ -957,7 +1023,20 @@ var requirejs, require, define;
957
1023
  noLoads += prop + " ";
958
1024
  } else {
959
1025
  stillLoading = true;
960
- break;
1026
+ if (prop.indexOf('!') === -1) {
1027
+ //No reason to keep looking for unfinished
1028
+ //loading. If the only stillLoading is a
1029
+ //plugin resource though, keep going,
1030
+ //because it may be that a plugin resource
1031
+ //is waiting on a non-plugin cycle.
1032
+ cycleDeps = [];
1033
+ break;
1034
+ } else {
1035
+ moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
1036
+ if (moduleDeps) {
1037
+ cycleDeps.push.apply(cycleDeps, moduleDeps);
1038
+ }
1039
+ }
961
1040
  }
962
1041
  }
963
1042
  }
@@ -976,7 +1055,23 @@ var requirejs, require, define;
976
1055
  err.requireModules = noLoads;
977
1056
  return req.onError(err);
978
1057
  }
979
- if (stillLoading || context.scriptCount) {
1058
+
1059
+ //If still loading but a plugin is waiting on a regular module cycle
1060
+ //break the cycle.
1061
+ if (stillLoading && cycleDeps.length) {
1062
+ for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
1063
+ if ((cycleManager = findCycle(manager, {}))) {
1064
+ forceExec(cycleManager, {});
1065
+ break;
1066
+ }
1067
+ }
1068
+
1069
+ }
1070
+
1071
+ //If still waiting on loads, and the waiting load is something
1072
+ //other than a plugin resource, or there are still outstanding
1073
+ //scripts, then just try back later.
1074
+ if (!expired && (stillLoading || context.scriptCount)) {
980
1075
  //Something is still waiting to load. Wait for it, but only
981
1076
  //if a timeout is not already in effect.
982
1077
  if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
@@ -1034,6 +1129,9 @@ var requirejs, require, define;
1034
1129
  resume = function () {
1035
1130
  var manager, map, url, i, p, args, fullName;
1036
1131
 
1132
+ //Any defined modules in the global queue, intake them now.
1133
+ context.takeGlobalQueue();
1134
+
1037
1135
  resumeDepth += 1;
1038
1136
 
1039
1137
  if (context.scriptCount <= 0) {
@@ -1197,8 +1295,7 @@ var requirejs, require, define;
1197
1295
  context.requireWait = false;
1198
1296
  //But first, call resume to register any defined modules that may
1199
1297
  //be in a data-main built file before the priority config
1200
- //call. Also grab any waiting define calls for this context.
1201
- context.takeGlobalQueue();
1298
+ //call.
1202
1299
  resume();
1203
1300
 
1204
1301
  context.require(cfg.priority);
@@ -1275,10 +1372,6 @@ var requirejs, require, define;
1275
1372
  //then resume the dependency processing.
1276
1373
  if (!context.requireWait) {
1277
1374
  while (!context.scriptCount && context.paused.length) {
1278
- //For built layers, there can be some defined
1279
- //modules waiting for intake into the context,
1280
- //in particular module plugins. Take them.
1281
- context.takeGlobalQueue();
1282
1375
  resume();
1283
1376
  }
1284
1377
  }
@@ -1842,7 +1935,7 @@ var requirejs, require, define;
1842
1935
  //Figure out baseUrl. Get it from the script tag with require.js in it.
1843
1936
  scripts = document.getElementsByTagName("script");
1844
1937
 
1845
- for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
1938
+ for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {
1846
1939
  //Set the "head" where we can append children by
1847
1940
  //using the script's parent.
1848
1941
  if (!head) {
@@ -1950,10 +2043,6 @@ var requirejs, require, define;
1950
2043
  setTimeout(function () {
1951
2044
  ctx.requireWait = false;
1952
2045
 
1953
- //Any modules included with the require.js file will be in the
1954
- //global queue, assign them to this context.
1955
- ctx.takeGlobalQueue();
1956
-
1957
2046
  if (!ctx.scriptCount) {
1958
2047
  ctx.resume();
1959
2048
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: requirejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-06 00:00:00.000000000 Z
12
+ date: 2012-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70255892536860 !ruby/object:Gem::Requirement
16
+ requirement: &70147562051000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70255892536860
24
+ version_requirements: *70147562051000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70255892536240 !ruby/object:Gem::Requirement
27
+ requirement: &70147562050400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.1
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70255892536240
35
+ version_requirements: *70147562050400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &70255892535640 !ruby/object:Gem::Requirement
38
+ requirement: &70147562049780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70255892535640
46
+ version_requirements: *70147562049780
47
47
  description: This gem provides RequireJS support for your Rails 3 application.
48
48
  email:
49
49
  - whitley@bangpath.org
@@ -122,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  segments:
124
124
  - 0
125
- hash: 4295797509367259253
125
+ hash: 926621835689614088
126
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  segments:
133
133
  - 0
134
- hash: 4295797509367259253
134
+ hash: 926621835689614088
135
135
  requirements:
136
136
  - node.js is required for 'rake assets:precompile', used to run the r.js build
137
137
  - If needed, jQuery should be v1.7 or greater (jquery-rails >= 1.0.17).