requirejs-rails 0.8.2 → 0.9.0
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 +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/app/helpers/requirejs_helper.rb +1 -10
- data/bin/r.js +6428 -3514
- data/lib/requirejs/rails/config.rb +2 -9
- data/lib/requirejs/rails/version.rb +2 -2
- data/test/requirejs-rails_test.rb +3 -23
- data/vendor/assets/javascripts/almond.js +84 -47
- data/vendor/assets/javascripts/require.js +1378 -1404
- metadata +10 -11
- data/vendor/assets/javascripts/order.js +0 -189
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.
|
4
|
+
version: 0.9.0
|
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-
|
12
|
+
date: 2012-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: &
|
16
|
+
requirement: &70104542590960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '3.3'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70104542590960
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rails
|
30
|
-
requirement: &
|
30
|
+
requirement: &70104542589900 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: '3.3'
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *70104542589900
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: sqlite3
|
44
|
-
requirement: &
|
44
|
+
requirement: &70104542588940 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ! '>='
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '0'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *70104542588940
|
53
53
|
description: This gem provides RequireJS support for your Rails 3 application.
|
54
54
|
email:
|
55
55
|
- whitley@bangpath.org
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- lib/tasks/requirejs-rails_tasks.rake
|
79
79
|
- requirejs-rails.gemspec
|
80
80
|
- vendor/assets/javascripts/almond.js
|
81
|
-
- vendor/assets/javascripts/order.js
|
82
81
|
- vendor/assets/javascripts/require.js
|
83
82
|
- test/dummy/.rvmrc
|
84
83
|
- test/dummy/Rakefile
|
@@ -129,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
128
|
version: '0'
|
130
129
|
segments:
|
131
130
|
- 0
|
132
|
-
hash:
|
131
|
+
hash: 1928609493095341088
|
133
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
133
|
none: false
|
135
134
|
requirements:
|
@@ -138,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
137
|
version: '0'
|
139
138
|
segments:
|
140
139
|
- 0
|
141
|
-
hash:
|
140
|
+
hash: 1928609493095341088
|
142
141
|
requirements:
|
143
142
|
- node.js is required for 'rake assets:precompile', used to run the r.js build
|
144
143
|
- If needed, jQuery should be v1.7 or greater (jquery-rails >= 1.0.17).
|
@@ -1,189 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license RequireJS order 1.0.5 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
3
|
-
* Available via the MIT or new BSD license.
|
4
|
-
* see: http://github.com/jrburke/requirejs for details
|
5
|
-
*/
|
6
|
-
/*jslint nomen: false, plusplus: false, strict: false */
|
7
|
-
/*global require: false, define: false, window: false, document: false,
|
8
|
-
setTimeout: false */
|
9
|
-
|
10
|
-
//Specify that requirejs optimizer should wrap this code in a closure that
|
11
|
-
//maps the namespaced requirejs API to non-namespaced local variables.
|
12
|
-
/*requirejs namespace: true */
|
13
|
-
|
14
|
-
(function () {
|
15
|
-
|
16
|
-
//Sadly necessary browser inference due to differences in the way
|
17
|
-
//that browsers load and execute dynamically inserted javascript
|
18
|
-
//and whether the script/cache method works when ordered execution is
|
19
|
-
//desired. Currently, Gecko and Opera do not load/fire onload for scripts with
|
20
|
-
//type="script/cache" but they execute injected scripts in order
|
21
|
-
//unless the 'async' flag is present.
|
22
|
-
//However, this is all changing in latest browsers implementing HTML5
|
23
|
-
//spec. With compliant browsers .async true by default, and
|
24
|
-
//if false, then it will execute in order. Favor that test first for forward
|
25
|
-
//compatibility.
|
26
|
-
var testScript = typeof document !== "undefined" &&
|
27
|
-
typeof window !== "undefined" &&
|
28
|
-
document.createElement("script"),
|
29
|
-
|
30
|
-
supportsInOrderExecution = testScript && (testScript.async ||
|
31
|
-
((window.opera &&
|
32
|
-
Object.prototype.toString.call(window.opera) === "[object Opera]") ||
|
33
|
-
//If Firefox 2 does not have to be supported, then
|
34
|
-
//a better check may be:
|
35
|
-
//('mozIsLocallyAvailable' in window.navigator)
|
36
|
-
("MozAppearance" in document.documentElement.style))),
|
37
|
-
|
38
|
-
//This test is true for IE browsers, which will load scripts but only
|
39
|
-
//execute them once the script is added to the DOM.
|
40
|
-
supportsLoadSeparateFromExecute = testScript &&
|
41
|
-
testScript.readyState === 'uninitialized',
|
42
|
-
|
43
|
-
readyRegExp = /^(complete|loaded)$/,
|
44
|
-
cacheWaiting = [],
|
45
|
-
cached = {},
|
46
|
-
scriptNodes = {},
|
47
|
-
scriptWaiting = [];
|
48
|
-
|
49
|
-
//Done with the test script.
|
50
|
-
testScript = null;
|
51
|
-
|
52
|
-
//Callback used by the type="script/cache" callback that indicates a script
|
53
|
-
//has finished downloading.
|
54
|
-
function scriptCacheCallback(evt) {
|
55
|
-
var node = evt.currentTarget || evt.srcElement, i,
|
56
|
-
moduleName, resource;
|
57
|
-
|
58
|
-
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
59
|
-
//Pull out the name of the module and the context.
|
60
|
-
moduleName = node.getAttribute("data-requiremodule");
|
61
|
-
|
62
|
-
//Mark this cache request as loaded
|
63
|
-
cached[moduleName] = true;
|
64
|
-
|
65
|
-
//Find out how many ordered modules have loaded
|
66
|
-
for (i = 0; (resource = cacheWaiting[i]); i++) {
|
67
|
-
if (cached[resource.name]) {
|
68
|
-
resource.req([resource.name], resource.onLoad);
|
69
|
-
} else {
|
70
|
-
//Something in the ordered list is not loaded,
|
71
|
-
//so wait.
|
72
|
-
break;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
//If just loaded some items, remove them from cacheWaiting.
|
77
|
-
if (i > 0) {
|
78
|
-
cacheWaiting.splice(0, i);
|
79
|
-
}
|
80
|
-
|
81
|
-
//Remove this script tag from the DOM
|
82
|
-
//Use a setTimeout for cleanup because some older IE versions vomit
|
83
|
-
//if removing a script node while it is being evaluated.
|
84
|
-
setTimeout(function () {
|
85
|
-
node.parentNode.removeChild(node);
|
86
|
-
}, 15);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
/**
|
91
|
-
* Used for the IE case, where fetching is done by creating script element
|
92
|
-
* but not attaching it to the DOM. This function will be called when that
|
93
|
-
* happens so it can be determined when the node can be attached to the
|
94
|
-
* DOM to trigger its execution.
|
95
|
-
*/
|
96
|
-
function onFetchOnly(node) {
|
97
|
-
var i, loadedNode, resourceName;
|
98
|
-
|
99
|
-
//Mark this script as loaded.
|
100
|
-
node.setAttribute('data-orderloaded', 'loaded');
|
101
|
-
|
102
|
-
//Cycle through waiting scripts. If the matching node for them
|
103
|
-
//is loaded, and is in the right order, add it to the DOM
|
104
|
-
//to execute the script.
|
105
|
-
for (i = 0; (resourceName = scriptWaiting[i]); i++) {
|
106
|
-
loadedNode = scriptNodes[resourceName];
|
107
|
-
if (loadedNode &&
|
108
|
-
loadedNode.getAttribute('data-orderloaded') === 'loaded') {
|
109
|
-
delete scriptNodes[resourceName];
|
110
|
-
require.addScriptToDom(loadedNode);
|
111
|
-
} else {
|
112
|
-
break;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
//If just loaded some items, remove them from waiting.
|
117
|
-
if (i > 0) {
|
118
|
-
scriptWaiting.splice(0, i);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
define({
|
123
|
-
version: '1.0.5',
|
124
|
-
|
125
|
-
load: function (name, req, onLoad, config) {
|
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);
|
137
|
-
|
138
|
-
//Make sure the async attribute is not set for any pathway involving
|
139
|
-
//this script.
|
140
|
-
require.s.skipAsync[url] = true;
|
141
|
-
if (supportsInOrderExecution || config.isBuild) {
|
142
|
-
//Just a normal script tag append, but without async attribute
|
143
|
-
//on the script.
|
144
|
-
req([name], onLoad);
|
145
|
-
} else if (supportsLoadSeparateFromExecute) {
|
146
|
-
//Just fetch the URL, but do not execute it yet. The
|
147
|
-
//non-standards IE case. Really not so nice because it is
|
148
|
-
//assuming and touching requrejs internals. OK though since
|
149
|
-
//ordered execution should go away after a long while.
|
150
|
-
context = require.s.contexts._;
|
151
|
-
|
152
|
-
if (!context.urlFetched[url] && !context.loaded[name]) {
|
153
|
-
//Indicate the script is being fetched.
|
154
|
-
context.urlFetched[url] = true;
|
155
|
-
|
156
|
-
//Stuff from require.load
|
157
|
-
require.resourcesReady(false);
|
158
|
-
context.scriptCount += 1;
|
159
|
-
|
160
|
-
//Fetch the script now, remember it.
|
161
|
-
node = require.attach(url, context, name, null, null, onFetchOnly);
|
162
|
-
scriptNodes[name] = node;
|
163
|
-
scriptWaiting.push(name);
|
164
|
-
}
|
165
|
-
|
166
|
-
//Do a normal require for it, once it loads, use it as return
|
167
|
-
//value.
|
168
|
-
req([name], onLoad);
|
169
|
-
} else {
|
170
|
-
//Credit to LABjs author Kyle Simpson for finding that scripts
|
171
|
-
//with type="script/cache" allow scripts to be downloaded into
|
172
|
-
//browser cache but not executed. Use that
|
173
|
-
//so that subsequent addition of a real type="text/javascript"
|
174
|
-
//tag will cause the scripts to be executed immediately in the
|
175
|
-
//correct order.
|
176
|
-
if (req.specified(name)) {
|
177
|
-
req([name], onLoad);
|
178
|
-
} else {
|
179
|
-
cacheWaiting.push({
|
180
|
-
name: name,
|
181
|
-
req: req,
|
182
|
-
onLoad: onLoad
|
183
|
-
});
|
184
|
-
require.attach(url, null, name, scriptCacheCallback, "script/cache");
|
185
|
-
}
|
186
|
-
}
|
187
|
-
}
|
188
|
-
});
|
189
|
-
}());
|