jazz-jss 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. data/dist/handlebars/handlebars.js +1493 -0
  2. data/dist/hashchange/{jquery.ba-hashchange.js → hashchange.js} +0 -0
  3. data/dist/jazz/lib/controller.js +1 -1
  4. data/dist/jazz/lib/core.js +3 -0
  5. data/dist/jazz/lib/db.js +1 -1
  6. data/dist/jazz/lib/helper.js +2 -1
  7. data/dist/jazz/lib/model.js +11 -4
  8. data/dist/jazz/lib/view.js +1 -1
  9. data/dist/jazz/module.js +15 -0
  10. data/dist/jquery/jquery.js +0 -0
  11. data/dist/require/require.js +0 -0
  12. data/dist/require/template.js +98 -0
  13. data/dist/underscore/underscore.js +0 -0
  14. data/lib/jazz/app_detector.rb +6 -3
  15. data/lib/jazz/app_generator.rb +12 -8
  16. data/lib/jazz/helper_generator.rb +30 -0
  17. data/lib/jazz/scaffold_generator.rb +4 -0
  18. data/templates/app_root/Rakefile +11 -0
  19. data/templates/app_root/{app → development/app}/assets/javascripts/application.js +0 -0
  20. data/templates/app_root/{app → development/app}/assets/stylesheets/application.css +0 -0
  21. data/templates/app_root/development/app/controllers/application_controller.js +11 -0
  22. data/templates/app_root/development/app/helpers/application_helper.js +7 -0
  23. data/templates/app_root/development/config/glue.js +9 -0
  24. data/templates/app_root/development/config/routes.js +5 -0
  25. data/templates/app_root/scripts/build.js +30 -0
  26. data/templates/app_root/scripts/r.js/LICENSE +58 -0
  27. data/templates/app_root/scripts/r.js/README.md +177 -0
  28. data/templates/app_root/scripts/r.js/build/build.js +26 -0
  29. data/templates/app_root/scripts/r.js/build/buildebug.sh +4 -0
  30. data/templates/app_root/scripts/r.js/build/example.build.js +296 -0
  31. data/templates/app_root/scripts/r.js/build/jslib/blank.js +4 -0
  32. data/templates/app_root/scripts/r.js/build/jslib/build.js +952 -0
  33. data/templates/app_root/scripts/r.js/build/jslib/commandLine.js +23 -0
  34. data/templates/app_root/scripts/r.js/build/jslib/commonJs.js +152 -0
  35. data/templates/app_root/scripts/r.js/build/jslib/env.js +47 -0
  36. data/templates/app_root/scripts/r.js/build/jslib/lang.js +49 -0
  37. data/templates/app_root/scripts/r.js/build/jslib/logger.js +58 -0
  38. data/templates/app_root/scripts/r.js/build/jslib/node.js +106 -0
  39. data/templates/app_root/scripts/r.js/build/jslib/node/args.js +20 -0
  40. data/templates/app_root/scripts/r.js/build/jslib/node/file.js +263 -0
  41. data/templates/app_root/scripts/r.js/build/jslib/node/load.js +17 -0
  42. data/templates/app_root/scripts/r.js/build/jslib/node/optimize.js +10 -0
  43. data/templates/app_root/scripts/r.js/build/jslib/node/print.js +16 -0
  44. data/templates/app_root/scripts/r.js/build/jslib/optimize.js +279 -0
  45. data/templates/app_root/scripts/r.js/build/jslib/opto.build.js +11 -0
  46. data/templates/app_root/scripts/r.js/build/jslib/parse.js +590 -0
  47. data/templates/app_root/scripts/r.js/build/jslib/pragma.js +251 -0
  48. data/templates/app_root/scripts/r.js/build/jslib/requirePatch.js +286 -0
  49. data/templates/app_root/scripts/r.js/build/jslib/rhino.js +22 -0
  50. data/templates/app_root/scripts/r.js/build/jslib/rhino/args.js +21 -0
  51. data/templates/app_root/scripts/r.js/build/jslib/rhino/file.js +244 -0
  52. data/templates/app_root/scripts/r.js/build/jslib/rhino/load.js +12 -0
  53. data/templates/app_root/scripts/r.js/build/jslib/rhino/optimize.js +100 -0
  54. data/templates/app_root/scripts/r.js/build/jslib/rhino/print.js +12 -0
  55. data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/README.md +16 -0
  56. data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/index.js +21 -0
  57. data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/parse-js.js +1342 -0
  58. data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/process.js +2005 -0
  59. data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/squeeze-more.js +55 -0
  60. data/templates/app_root/scripts/r.js/build/jslib/x.js +243 -0
  61. data/templates/app_root/scripts/r.js/build/tests/all.js +47 -0
  62. data/templates/app_root/scripts/r.js/build/tests/allj.sh +3 -0
  63. data/templates/app_root/scripts/r.js/build/tests/alln.sh +18 -0
  64. data/templates/app_root/scripts/r.js/build/tests/anonSimple.build.js +7 -0
  65. data/templates/app_root/scripts/r.js/build/tests/buildUtils.js +19 -0
  66. data/templates/app_root/scripts/r.js/build/tests/builds.js +489 -0
  67. data/templates/app_root/scripts/r.js/build/tests/circular.build.js +18 -0
  68. data/templates/app_root/scripts/r.js/build/tests/convert.js +18 -0
  69. data/templates/app_root/scripts/r.js/build/tests/css.build.js +6 -0
  70. data/templates/app_root/scripts/r.js/build/tests/css/common/common.css +4 -0
  71. data/templates/app_root/scripts/r.js/build/tests/css/master.css +10 -0
  72. data/templates/app_root/scripts/r.js/build/tests/css/sub/sub1.css +7 -0
  73. data/templates/app_root/scripts/r.js/build/tests/cssTestCompare.css +13 -0
  74. data/templates/app_root/scripts/r.js/build/tests/end.frag +3 -0
  75. data/templates/app_root/scripts/r.js/build/tests/expected/unoExcludeShallow.js +23 -0
  76. data/templates/app_root/scripts/r.js/build/tests/exports.build.js +12 -0
  77. data/templates/app_root/scripts/r.js/build/tests/hasTestModule.build.js +10 -0
  78. data/templates/app_root/scripts/r.js/build/tests/hasTestModule.js +30 -0
  79. data/templates/app_root/scripts/r.js/build/tests/http/httpBuild.js +70 -0
  80. data/templates/app_root/scripts/r.js/build/tests/http/main.html +28 -0
  81. data/templates/app_root/scripts/r.js/build/tests/http/scripts/main.js +18 -0
  82. data/templates/app_root/scripts/r.js/build/tests/http/scripts/one.js +3 -0
  83. data/templates/app_root/scripts/r.js/build/tests/http/scripts/three.js +5 -0
  84. data/templates/app_root/scripts/r.js/build/tests/http/scripts/two.js +7 -0
  85. data/templates/app_root/scripts/r.js/build/tests/i18n.build.js +17 -0
  86. data/templates/app_root/scripts/r.js/build/tests/indexBuilder.build.js +8 -0
  87. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/a.js +17 -0
  88. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/b.js +8 -0
  89. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/build.js +6 -0
  90. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/c.js +7 -0
  91. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/d.js +5 -0
  92. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/expected.js +36 -0
  93. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/LICENSE +58 -0
  94. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/amdefine.js +188 -0
  95. data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/package.json +21 -0
  96. data/templates/app_root/scripts/r.js/build/tests/lib/comments/bang.js +10 -0
  97. data/templates/app_root/scripts/r.js/build/tests/lib/comments/build.js +6 -0
  98. data/templates/app_root/scripts/r.js/build/tests/lib/comments/expected.js +9 -0
  99. data/templates/app_root/scripts/r.js/build/tests/lib/comments/license.js +13 -0
  100. data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/app.build.js +15 -0
  101. data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/main-expected.js +13 -0
  102. data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/main.js +7 -0
  103. data/templates/app_root/scripts/r.js/build/tests/lib/empty/build.js +13 -0
  104. data/templates/app_root/scripts/r.js/build/tests/lib/empty/expected.js +8 -0
  105. data/templates/app_root/scripts/r.js/build/tests/lib/empty/main.js +1 -0
  106. data/templates/app_root/scripts/r.js/build/tests/lib/empty/sub1.js +1 -0
  107. data/templates/app_root/scripts/r.js/build/tests/lib/empty/sub2.js +1 -0
  108. data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/build.js +6 -0
  109. data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/expected.js +12 -0
  110. data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/main.js +9 -0
  111. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/build.js +8 -0
  112. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/expected.js +47 -0
  113. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/main.js +6 -0
  114. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/four.js +7 -0
  115. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/one.js +9 -0
  116. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/three.js +14 -0
  117. data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/two.js +5 -0
  118. data/templates/app_root/scripts/r.js/build/tests/lib/nested/a.js +12 -0
  119. data/templates/app_root/scripts/r.js/build/tests/lib/nested/b.js +3 -0
  120. data/templates/app_root/scripts/r.js/build/tests/lib/nested/build.js +6 -0
  121. data/templates/app_root/scripts/r.js/build/tests/lib/nested/buildWithCE.js +7 -0
  122. data/templates/app_root/scripts/r.js/build/tests/lib/nested/c.js +3 -0
  123. data/templates/app_root/scripts/r.js/build/tests/lib/nested/d.js +3 -0
  124. data/templates/app_root/scripts/r.js/build/tests/lib/nested/e.js +3 -0
  125. data/templates/app_root/scripts/r.js/build/tests/lib/nested/expected-built.js +36 -0
  126. data/templates/app_root/scripts/r.js/build/tests/lib/nested/expected-builtWithCE.js +42 -0
  127. data/templates/app_root/scripts/r.js/build/tests/lib/nested/main.js +3 -0
  128. data/templates/app_root/scripts/r.js/build/tests/lib/nested/top.js +10 -0
  129. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/a.js +3 -0
  130. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/b.js +3 -0
  131. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/build.js +6 -0
  132. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedAll.js +9 -0
  133. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedB.js +11 -0
  134. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedC.js +11 -0
  135. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedD.js +11 -0
  136. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNested.js +7 -0
  137. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/c.js +3 -0
  138. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/d.js +3 -0
  139. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-built.js +21 -0
  140. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedAll.js +31 -0
  141. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedB.js +24 -0
  142. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedC.js +24 -0
  143. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedD.js +25 -0
  144. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNested.js +31 -0
  145. data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/main.js +17 -0
  146. data/templates/app_root/scripts/r.js/build/tests/lib/plugins/build.js +6 -0
  147. data/templates/app_root/scripts/r.js/build/tests/lib/plugins/converter.js +11 -0
  148. data/templates/app_root/scripts/r.js/build/tests/lib/plugins/main.js +6 -0
  149. data/templates/app_root/scripts/r.js/build/tests/lib/plugins/plug.js +29 -0
  150. data/templates/app_root/scripts/r.js/build/tests/lib/plugins/util.js +7 -0
  151. data/templates/app_root/scripts/r.js/build/tests/nameOnly.build.js +10 -0
  152. data/templates/app_root/scripts/r.js/build/tests/nodeAll.js +3 -0
  153. data/templates/app_root/scripts/r.js/build/tests/nodeOptimize.js +12 -0
  154. data/templates/app_root/scripts/r.js/build/tests/nodeOptimizeNoCallback.js +10 -0
  155. data/templates/app_root/scripts/r.js/build/tests/order.build.js +16 -0
  156. data/templates/app_root/scripts/r.js/build/tests/override/override.js +36 -0
  157. data/templates/app_root/scripts/r.js/build/tests/packages.build.js +59 -0
  158. data/templates/app_root/scripts/r.js/build/tests/parse.js +103 -0
  159. data/templates/app_root/scripts/r.js/build/tests/simple.build.js +13 -0
  160. data/templates/app_root/scripts/r.js/build/tests/simpleNamespace.build.js +17 -0
  161. data/templates/app_root/scripts/r.js/build/tests/start.frag +4 -0
  162. data/templates/app_root/scripts/r.js/build/tests/text.build.js +16 -0
  163. data/templates/app_root/scripts/r.js/build/tests/textExclude.build.js +16 -0
  164. data/templates/app_root/scripts/r.js/dist.js +95 -0
  165. data/templates/app_root/scripts/r.js/dist/README.md +6 -0
  166. data/templates/app_root/scripts/r.js/dist/r-1.0.0.js +9042 -0
  167. data/templates/app_root/scripts/r.js/dist/r-edge.js +9191 -0
  168. data/templates/app_root/scripts/r.js/dist/r.js +9099 -0
  169. data/templates/app_root/scripts/r.js/lib/closure/COPYING +202 -0
  170. data/templates/app_root/scripts/r.js/lib/closure/README +292 -0
  171. data/templates/app_root/scripts/r.js/lib/closure/compiler.jar +0 -0
  172. data/templates/app_root/scripts/r.js/lib/rhino/LICENSE +4 -0
  173. data/templates/app_root/scripts/r.js/lib/rhino/js.jar +0 -0
  174. data/templates/app_root/scripts/r.js/require.js +1952 -0
  175. data/templates/app_root/scripts/r.js/tasks.txt +2 -0
  176. data/templates/app_root/scripts/r.js/tests/all.js +49 -0
  177. data/templates/app_root/scripts/r.js/tests/allNode.js +3 -0
  178. data/templates/app_root/scripts/r.js/tests/allj.sh +1 -0
  179. data/templates/app_root/scripts/r.js/tests/alln.sh +2 -0
  180. data/templates/app_root/scripts/r.js/tests/alpha.js +3 -0
  181. data/templates/app_root/scripts/r.js/tests/beta.js +6 -0
  182. data/templates/app_root/scripts/r.js/tests/doh/LICENSE +195 -0
  183. data/templates/app_root/scripts/r.js/tests/doh/README +12 -0
  184. data/templates/app_root/scripts/r.js/tests/doh/_browserRunner.js +855 -0
  185. data/templates/app_root/scripts/r.js/tests/doh/_nodeRunner.js +20 -0
  186. data/templates/app_root/scripts/r.js/tests/doh/_rhinoRunner.js +17 -0
  187. data/templates/app_root/scripts/r.js/tests/doh/_sounds/LICENSE +10 -0
  188. data/templates/app_root/scripts/r.js/tests/doh/_sounds/doh.wav +0 -0
  189. data/templates/app_root/scripts/r.js/tests/doh/_sounds/dohaaa.wav +0 -0
  190. data/templates/app_root/scripts/r.js/tests/doh/_sounds/woohoo.wav +0 -0
  191. data/templates/app_root/scripts/r.js/tests/doh/runner.html +316 -0
  192. data/templates/app_root/scripts/r.js/tests/doh/runner.js +1499 -0
  193. data/templates/app_root/scripts/r.js/tests/doh/runner.sh +3 -0
  194. data/templates/app_root/scripts/r.js/tests/doh/small_logo.png +0 -0
  195. data/templates/app_root/scripts/r.js/tests/node/canvasTest.js +39 -0
  196. data/templates/app_root/scripts/r.js/tests/node/embedded/README.md +15 -0
  197. data/templates/app_root/scripts/r.js/tests/node/embedded/coffee/foo.coffee +1 -0
  198. data/templates/app_root/scripts/r.js/tests/node/embedded/main.js +13 -0
  199. data/templates/app_root/scripts/r.js/tests/node/embedded/scripts/bar.js +13 -0
  200. data/templates/app_root/scripts/r.js/tests/node/index.js +11 -0
  201. data/templates/app_root/scripts/r.js/tests/node/tests/alpha/foo.js +6 -0
  202. data/templates/app_root/scripts/r.js/tests/node/tests/alpha/hello.html +9 -0
  203. data/templates/app_root/scripts/r.js/tests/node/tests/foo.js +3 -0
  204. data/templates/app_root/scripts/r.js/tests/node/tests/server.js +11 -0
  205. data/templates/app_root/scripts/r.js/tests/relative.js +10 -0
  206. data/templates/app_root/scripts/r.js/tests/sub/betaSub.js +3 -0
  207. data/templates/application.js +6 -5
  208. data/templates/boot.js +42 -0
  209. data/templates/helper.js +9 -0
  210. data/templates/index.html +1 -1
  211. metadata +201 -11
  212. data/dist/jazz/main.js +0 -65
  213. data/dist/mustache/mustache.js +0 -324
  214. data/templates/app_root/config/routes.js +0 -4
  215. data/templates/glue.js +0 -4
@@ -0,0 +1,188 @@
1
+ /** vim: et:ts=4:sw=4:sts=4
2
+ * @license amdefine 0.0.1 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
3
+ * Available via the MIT or new BSD license.
4
+ * see: http://github.com/jrburke/amdefine for details
5
+ */
6
+
7
+ /*jslint strict: false, nomen: false, plusplus: false */
8
+ /*global module, process, require: true */
9
+
10
+ var path = require('path'),
11
+ loaderCache = {},
12
+ makeRequire;
13
+
14
+ // Null out require for this file so that it is not accidentally used
15
+ // below, where module.require should be used instead.
16
+ require = null;
17
+
18
+ /**
19
+ * Given a relative module name, like ./something, normalize it to
20
+ * a real name that can be mapped to a path.
21
+ * @param {String} name the relative name
22
+ * @param {String} baseName a real name that the name arg is relative
23
+ * to.
24
+ * @returns {String} normalized name
25
+ */
26
+ function normalize(name, baseName) {
27
+ return path.normalize(path.join(baseName, name));
28
+ }
29
+
30
+ /**
31
+ * Create the normalize() function passed to a loader plugin's
32
+ * normalize method.
33
+ */
34
+ function makeNormalize(relName) {
35
+ return function (name) {
36
+ return normalize(name, relName);
37
+ };
38
+ }
39
+
40
+ function makeLoad(id) {
41
+ function load(value) {
42
+ loaderCache[id] = value;
43
+ }
44
+
45
+ load.fromText = function (id, text) {
46
+ //This one is difficult because the text can/probably uses
47
+ //define, and any relative paths and requires should be relative
48
+ //to that id was it would be found on disk. But this would require
49
+ //bootstrapping a module/require fairly deeply from node core.
50
+ //Not sure how best to go about that yet.
51
+ throw new Error('amdefine does not implement load.fromText');
52
+ };
53
+
54
+ return load;
55
+ }
56
+
57
+ function stringRequire(module, id) {
58
+ //Split the ID by a ! so that
59
+ var index = id.indexOf('!'),
60
+ relId = path.dirname(module.filename),
61
+ prefix, plugin;
62
+
63
+ if (index === -1) {
64
+ //Straight module lookup. If it is one of the special dependencies,
65
+ //deal with it, otherwise, delegate to node.
66
+ if (id === 'require') {
67
+ return makeRequire(module);
68
+ } else if (id === 'exports') {
69
+ return module.exports;
70
+ } else if (id === 'module') {
71
+ return module;
72
+ } else {
73
+ return module.require(id);
74
+ }
75
+ } else {
76
+ //There is a plugin in play.
77
+ prefix = id.substring(0, index);
78
+ id = id.substring(index + 1, id.length);
79
+
80
+ plugin = module.require(prefix);
81
+
82
+ if (plugin.normalize) {
83
+ id = plugin.normalize(id, makeNormalize(relId));
84
+ } else {
85
+ //Normalize the ID normally.
86
+ id = normalize(id, relId);
87
+ }
88
+
89
+ if (loaderCache[id]) {
90
+ return loaderCache[id];
91
+ } else {
92
+ plugin.load(id, makeRequire(module), makeLoad(id), {});
93
+
94
+ return loaderCache[id];
95
+ }
96
+ }
97
+ }
98
+
99
+ makeRequire = function (module) {
100
+ function amdRequire(deps, callback) {
101
+ if (typeof deps === 'string') {
102
+ //Synchronous, single module require('')
103
+ return stringRequire(module, deps);
104
+ } else {
105
+ //Array of dependencies with a callback.
106
+
107
+ //Convert the dependencies to modules.
108
+ deps = deps.map(function (depName) {
109
+ return stringRequire(module, depName);
110
+ });
111
+
112
+ //Wait for next tick to call back the require call.
113
+ process.nextTick(function () {
114
+ callback.apply(null, deps);
115
+ });
116
+
117
+ //Keeps strict checking in komodo happy.
118
+ return undefined;
119
+ }
120
+ }
121
+
122
+ amdRequire.toUrl = function (filePath) {
123
+ if (filePath.indexOf('.') === 0) {
124
+ return normalize(filePath, path.dirname(module.filename));
125
+ } else {
126
+ return filePath;
127
+ }
128
+ };
129
+
130
+ return amdRequire;
131
+ };
132
+
133
+ function amdefine(module) {
134
+ var alreadyCalled = false;
135
+
136
+ //Create a define function specific to the module asking for amdefine.
137
+ function define() {
138
+
139
+ var args = arguments,
140
+ factory = args[args.length - 1],
141
+ isFactoryFunction = (typeof factory === 'function'),
142
+ deps, result;
143
+
144
+ //Only support one define call per file
145
+ if (alreadyCalled) {
146
+ throw new Error('amdefine cannot be called more than once per file.');
147
+ }
148
+ alreadyCalled = true;
149
+
150
+ //Grab array of dependencies if it is there.
151
+ if (args.length > 1) {
152
+ deps = args[args.length - 2];
153
+ if (!Array.isArray(deps)) {
154
+ //deps is not an array, may be an ID. Discard it.
155
+ deps = null;
156
+ }
157
+ }
158
+
159
+ //If there are dependencies, they are strings, so need
160
+ //to convert them to dependency values.
161
+ if (deps) {
162
+ deps = deps.map(function (depName) {
163
+ return stringRequire(module, depName);
164
+ });
165
+ } else if (isFactoryFunction) {
166
+ //Pass in the standard require, exports, module
167
+ deps = [makeRequire(module), module.exports, module];
168
+ }
169
+
170
+ if (!isFactoryFunction) {
171
+ //Factory is an object that should just be used for the define call.
172
+ module.exports = factory;
173
+ } else {
174
+ //Call the factory with the right dependencies.
175
+ result = factory.apply(module.exports, deps);
176
+
177
+ if (result !== undefined) {
178
+ module.exports = result;
179
+ }
180
+ }
181
+ }
182
+
183
+ define.amd = {};
184
+
185
+ return define;
186
+ }
187
+
188
+ module.exports = amdefine;
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "amdefine",
3
+ "description": "Provide AMD's define() API for declaring modules in the AMD format",
4
+ "version": "0.0.1",
5
+ "homepage": "http://github.com/jrburke/amdefine.js",
6
+ "author": "James Burke <jrburke@gmail.com> (http://github.com/jrburke)",
7
+ "licenses": [
8
+ {
9
+ "type": "BSD",
10
+ "url": "https://github.com/jrburke/amdefine/blob/master/LICENSE"
11
+ },
12
+ {
13
+ "type": "MIT",
14
+ "url": "https://github.com/jrburke/amdefine/blob/master/LICENSE"
15
+ }
16
+ ],
17
+ "main": "./amdefine.js",
18
+ "engines": {
19
+ "node": ">=0.6.0"
20
+ }
21
+ }
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * this is a BANG LICENSE COMMENT
3
+ */
4
+
5
+ define(function () {
6
+ /* This comment should be IGNORED */
7
+ return {
8
+ name: 'bang'
9
+ };
10
+ });
@@ -0,0 +1,6 @@
1
+ ({
2
+ baseUrl: '.',
3
+ name: 'bang',
4
+ include: ['license'],
5
+ out: 'built.js'
6
+ })
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * this is a BANG LICENSE COMMENT
3
+ */
4
+ /** vim: et:ts=4:sw=4:sts=4
5
+ * @license This is a LICENSE COMMENT that should be preserved.
6
+ * Available via the MIT or new BSD license.
7
+ * see: http://example.com/license for details
8
+ */
9
+ define("bang",[],function(){return{name:"bang"}}),define("license",{name:"license"})
@@ -0,0 +1,13 @@
1
+ /** vim: et:ts=4:sw=4:sts=4
2
+ * @license This is a LICENSE COMMENT that should be preserved.
3
+ * Available via the MIT or new BSD license.
4
+ * see: http://example.com/license for details
5
+ */
6
+
7
+ define({
8
+ //@license comment to be IGNORED
9
+ name: 'license'
10
+ /**
11
+ * A license fake-out, should be IGNORED
12
+ */
13
+ });
@@ -0,0 +1,15 @@
1
+ ({
2
+ appDir: '..',
3
+ baseUrl: 'scripts',
4
+ dir: '../built',
5
+ optimize: 'none',
6
+ dirExclusionRegExp: null,
7
+ packagePaths: {
8
+ '.packages': ['sample']
9
+ },
10
+ modules: [
11
+ {
12
+ name: 'main'
13
+ }
14
+ ]
15
+ })
@@ -0,0 +1,13 @@
1
+
2
+ define('sample',{
3
+ name: 'sample'
4
+ });
5
+
6
+
7
+ define('main',['sample'], function (sample) {
8
+ return {
9
+ name: 'main',
10
+ sampleName: sample.name
11
+ };
12
+ });
13
+
@@ -0,0 +1,7 @@
1
+ define(['sample'], function (sample) {
2
+ return {
3
+ name: 'main',
4
+ sampleName: sample.name
5
+ };
6
+ });
7
+
@@ -0,0 +1,13 @@
1
+ ({
2
+ baseUrl: '.',
3
+ dir: 'built',
4
+ optimize: 'none',
5
+ paths: {
6
+ 'empty1': 'empty:',
7
+ 'empty2': 'empty:'
8
+ },
9
+ modules: [{
10
+ name: 'main',
11
+ include: ['sub2']
12
+ }]
13
+ })
@@ -0,0 +1,8 @@
1
+
2
+ define('sub1',['empty1'], function () {});
3
+
4
+ require(['sub1'], function () {});
5
+
6
+ define("main", function(){});
7
+
8
+ define('sub2',['empty2'], function () {});
@@ -0,0 +1 @@
1
+ require(['sub1'], function () {});
@@ -0,0 +1 @@
1
+ define(['empty1'], function () {});
@@ -0,0 +1 @@
1
+ define(['empty2'], function () {});
@@ -0,0 +1,6 @@
1
+ ({
2
+ baseUrl: '.',
3
+ name: 'main',
4
+ out: 'built.js',
5
+ optimize: 'none'
6
+ })
@@ -0,0 +1,12 @@
1
+
2
+
3
+ define('foo',[], function () {
4
+
5
+ });
6
+
7
+ require(['foo'], function () {
8
+
9
+ });
10
+
11
+
12
+ define("main", function(){});
@@ -0,0 +1,9 @@
1
+
2
+ define('foo', function () {
3
+
4
+ });
5
+
6
+ require(['foo'], function () {
7
+
8
+ });
9
+
@@ -0,0 +1,8 @@
1
+ ({
2
+ baseUrl: '.',
3
+ optimize: 'none',
4
+ namespace: 'foo',
5
+ name: 'main',
6
+ out: 'foo.js'
7
+ })
8
+
@@ -0,0 +1,47 @@
1
+
2
+ (function (define) {
3
+ foo.define('modules/one',[],function ( ){
4
+ return { name: 'one' };
5
+ });
6
+
7
+ }(typeof foo.define === 'function' && foo.define.amd ? foo.define : function () {
8
+
9
+
10
+ }));
11
+
12
+ if (typeof foo.define === 'function' && foo.define.amd && foo.define.jQuery) {
13
+ foo.define('modules/two',[],function () {
14
+ return { name: 'two' };
15
+ });
16
+ }
17
+ ;
18
+ if(false){
19
+
20
+ }else if(typeof foo.define === 'function' && typeof foo.define.amd === 'object' && foo.define.amd){
21
+ foo.define('modules/four',{
22
+ name: 'four'
23
+ });
24
+ };
25
+ (function (define) {
26
+ foo.define('modules/three',[], function (require) {
27
+ //If have dependencies, get them here
28
+ var four = foo.require('./four');
29
+
30
+ //Return the module definition.
31
+ return {
32
+ name: 'three',
33
+ fourName: four.name
34
+ };
35
+ });
36
+ }(typeof foo.define === 'function' && foo.define.amd ? foo.define : function (id, factory) {
37
+
38
+ }));
39
+
40
+ foo.require(['modules/one', 'modules/two', 'modules/three'], function (one, two, three) {
41
+ console.log("One's name is: " + one.name);
42
+ console.log("Two's name is: " + two.name);
43
+ console.log("Two's name is: " + three.name);
44
+ console.log("Three's fourName is: " + three.fourName);
45
+ });
46
+
47
+ foo.define("main", function(){});
@@ -0,0 +1,6 @@
1
+ require(['modules/one', 'modules/two', 'modules/three'], function (one, two, three) {
2
+ console.log("One's name is: " + one.name);
3
+ console.log("Two's name is: " + two.name);
4
+ console.log("Two's name is: " + three.name);
5
+ console.log("Three's fourName is: " + three.fourName);
6
+ });
@@ -0,0 +1,7 @@
1
+ if(false){
2
+
3
+ }else if(typeof define == "function" && typeof define.amd == "object" && define.amd){
4
+ define({
5
+ name: 'four'
6
+ });
7
+ }
@@ -0,0 +1,9 @@
1
+ (function (define) {
2
+ define( function ( ){
3
+ return { name: 'one' };
4
+ });
5
+
6
+ }(typeof define === 'function' && define.amd ? define : function () {
7
+
8
+
9
+ }));