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,18 @@
1
+ //A simple build file using the circular tests for requirejs
2
+ ({
3
+ baseUrl: "../../../requirejs/tests",
4
+ optimize: "none",
5
+ dir: "builds/circular",
6
+
7
+ modules: [
8
+ {
9
+ name: "two"
10
+ },
11
+ {
12
+ name: "funcTwo"
13
+ },
14
+ {
15
+ name: "funcThree"
16
+ }
17
+ ]
18
+ })
@@ -0,0 +1,18 @@
1
+ /*jslint plusplus: false, strict: false */
2
+ /*global doh: false, define: false */
3
+
4
+ define(['commonJs'], function (commonJs) {
5
+ doh.register(
6
+ "convert",
7
+ [
8
+ function commonJsConvert(t) {
9
+ var source1 = 'define("fake", {lol: "you guise"});',
10
+ source2 = 'define("fake", [],\nfunction(){\nreturn{lol : \'you guise\'};\n});';
11
+
12
+ t.is(source1, commonJs.convert('fake.js', source1));
13
+ t.is(source2, commonJs.convert('fake.js', source2));
14
+ }
15
+ ]
16
+ );
17
+ doh.run();
18
+ });
@@ -0,0 +1,6 @@
1
+ //A simple build file for testing css optimizations.
2
+ ({
3
+ appDir: "./css",
4
+ dir: "builds/css",
5
+ optimize: "none"
6
+ })
@@ -0,0 +1,4 @@
1
+ /* These are common styles */
2
+ body {
3
+ background: blue url(img/body.png) bottom center;
4
+ }
@@ -0,0 +1,10 @@
1
+ @import url('common/common.css');
2
+ /**
3
+ *
4
+ * This is the master css file.
5
+ *
6
+ */
7
+ nav {
8
+ color: red;
9
+ background-image: url("nav.png");
10
+ }
@@ -0,0 +1,7 @@
1
+ @import url("../master.css");
2
+
3
+ .sub {
4
+ background: transparent url(../../img/sub.png);
5
+ /*Some comment in here*/
6
+ position: relative;
7
+ }
@@ -0,0 +1,13 @@
1
+
2
+ body {
3
+ background: blue url(../common/img/body.png) bottom center;
4
+ }
5
+ nav {
6
+ color: red;
7
+ background-image: url(../nav.png);
8
+ }
9
+ .sub {
10
+ background: transparent url(../../img/sub.png);
11
+
12
+ position: relative;
13
+ }
@@ -0,0 +1,3 @@
1
+
2
+ window.one = requirejs("one");
3
+ }());
@@ -0,0 +1,23 @@
1
+
2
+ define('tres',[],
3
+ function() {
4
+ return {
5
+ name: "tres"
6
+ };
7
+ }
8
+ );
9
+
10
+ define("uno",
11
+ ["dos", "tres"],
12
+ function(dos, tres) {
13
+ return {
14
+ name: "uno",
15
+ doSomething: function() {
16
+ return {
17
+ dosName: dos.name,
18
+ tresName: tres.name
19
+ };
20
+ }
21
+ };
22
+ }
23
+ );
@@ -0,0 +1,12 @@
1
+ //A simple build file using the tests directory for requirejs
2
+ {
3
+ baseUrl: "../../../requirejs/tests/exports",
4
+ inlineText: false,
5
+ dir: "builds/exports",
6
+ optimize: "none",
7
+ modules: [
8
+ {
9
+ name: "simpleReturn"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,10 @@
1
+ ({
2
+ baseUrl: "./",
3
+ optimize: "none",
4
+ name: "hasTestModule",
5
+ out: "builds/hasTestModule.js",
6
+ has: {
7
+ aTrueValue: true,
8
+ aFalseValue: false
9
+ }
10
+ })
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Just a test module that tests has replacements. Not usable on its own.
3
+ */
4
+ define(function (require) {
5
+ var foo, bar, baz, blurp, bat, blip;
6
+
7
+ if (has("aTrueValue")) {
8
+ foo = "is true";
9
+ } else {
10
+ foo = "is false";
11
+ }
12
+
13
+ if (has("aFalseValue")) {
14
+ bar = "is true";
15
+ } else {
16
+ bar = "is false";
17
+ }
18
+
19
+ if (has("some skipped value")) {
20
+ baz = "what";
21
+ } else {
22
+ baz = "ever";
23
+ }
24
+
25
+ blurp = has("aTrueValue") ? "OK" : "FAIL";
26
+ bat = has ('aFalseValue') ? "FAIL" : "OK";
27
+ blip = has("some skipped value") ? "what" : "ever";
28
+
29
+ return foo + bar + baz + blurp + bat + blip;
30
+ });
@@ -0,0 +1,70 @@
1
+ /*jslint strict: false*/
2
+ /*global require: false, console: false */
3
+
4
+ //If you install requirejs via npm, replace this line with require('requirejs')
5
+ var requirejs = require('../../../r.js'),
6
+ http = require('http'),
7
+ fs = require('fs'),
8
+ host = '127.0.0.1',
9
+ port = 4304,
10
+ config;
11
+
12
+ //Set up the config passed to the optimizer
13
+ config = {
14
+ baseUrl: 'scripts',
15
+ paths: {
16
+ //Put path to require.js in here, leaving off .js
17
+ //since it is a module ID path mapping. For final deployment,
18
+ //if a smaller AMD loader is desired, no dynamic
19
+ //loading needs to be done, and loader plugins are not
20
+ //in use, change this path to that file. One possibility
21
+ //could be the one at:
22
+ //https://github.com/ajaxorg/ace/blob/master/build_support/mini_require.js
23
+ requireLib: '../../../../../requirejs/require'
24
+ },
25
+ //Uncomment this line if uglify minification is not wanted.
26
+ //optimize: 'none',
27
+ //Specify the optimization target. Choose the requireLib,
28
+ //so that it is first in the output, then include the main.js
29
+ //for this project.
30
+ name: 'requireLib',
31
+ include: ['main'],
32
+ //Uncomment this if you want to debug three.js by itself
33
+ //excludeShallow: ['three'],
34
+ out: 'scripts/main-built.js'
35
+ };
36
+
37
+ function respond(res, code, contents) {
38
+ res.writeHead(code, {
39
+ 'Content-Type': (code === 200 ? 'application/javascript;charset=UTF-8' : 'text/plain'),
40
+ 'Content-Length': contents.length
41
+ });
42
+
43
+ res.write(contents, 'utf8');
44
+ res.end();
45
+ }
46
+
47
+ http.createServer(function (req, res) {
48
+
49
+ req.on('close', function (err) {
50
+ res.end();
51
+ });
52
+
53
+ req.on('end', function () {
54
+ //Does not matter what the request is,
55
+ //the answer is always OPTIMIZED JS!
56
+ try {
57
+ requirejs.optimize(config, function (buildResponse) {
58
+ //buildResponse is just a text output of the modules
59
+ //included. Load the built file for the contents.
60
+ var contents = fs.readFileSync(config.out, 'utf8');
61
+ respond(res, 200, contents);
62
+ });
63
+ } catch (e) {
64
+ respond(res, 500, e.toString());
65
+ }
66
+ });
67
+
68
+ }).listen(port, host);
69
+
70
+ console.log('Server running at http://' + host + ':' + port + '/');
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title></title>
5
+ </head>
6
+ <body>
7
+ <h1>One script via RequireJS optimizer</h1>
8
+
9
+ <p><strong>Be sure to start up the server: node httpBuild.js</strong></p>
10
+
11
+ <p>Demonstrates how to use the RequireJS optimizer to only load
12
+ one script in the page using Node as the server to serve the optimized
13
+ script. Using the "excludeShallow" build config option inside httpBuild.js
14
+ allows debugging one script separate from the rest of the optimized file.</p>
15
+
16
+ <p>See httpBuild.js in the same directory as this file for more information.</p>
17
+
18
+ <hr>
19
+
20
+ <!-- Successful load will print something after the hr tag -->
21
+
22
+ <!-- httpBuild.js will return optimized content no matter what the URL
23
+ is below. For deployment, replace this script tag to one that
24
+ loads main-built.js, or whatever the config.out name value is
25
+ inside httpBuild.js -->
26
+ <script src="http://127.0.0.1:4304/main.js"></script>
27
+ </body>
28
+ </html>
@@ -0,0 +1,18 @@
1
+
2
+ //Set the baseUrl for scripts, for use
3
+ //if individually debuggin files via
4
+ //excludeShallow in httpBuild.js
5
+ require.config({
6
+ baseUrl: 'scripts'
7
+ });
8
+
9
+ require(['one', 'two'], function (one, two) {
10
+ var html = "<b>Success!</b> One's name is: " + one.name +
11
+ ", two's name is: " + two.name +
12
+ ", three's name is: " + two.threeName,
13
+ node = document.createElement('div');
14
+
15
+ node.innerHTML = html;
16
+
17
+ document.getElementsByTagName('body')[0].appendChild(node);
18
+ });
@@ -0,0 +1,3 @@
1
+ define({
2
+ name: 'one'
3
+ });
@@ -0,0 +1,5 @@
1
+ define(function () {
2
+ return {
3
+ name: 'three'
4
+ };
5
+ });
@@ -0,0 +1,7 @@
1
+ define(function (require) {
2
+ var three = require('three');
3
+ return {
4
+ name: 'two',
5
+ threeName: three.name
6
+ };
7
+ });
@@ -0,0 +1,17 @@
1
+ //A simple build file using the tests directory for requirejs
2
+ {
3
+ appDir: "../../../requirejs",
4
+ baseUrl: "tests/i18n",
5
+ inlineText: false,
6
+ dir: "builds/i18n",
7
+ locale: "en-us-surfer",
8
+ optimize: "none",
9
+ paths: {
10
+ "i18n": "../../i18n"
11
+ },
12
+ modules: [
13
+ {
14
+ name: "testModule"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,8 @@
1
+ //A simple build file using the tests directory for requirejs
2
+ ({
3
+ baseUrl: "../../../requirejs/tests/plugins/",
4
+ optimize: "none",
5
+ name: "earth",
6
+ include: ["prime/earth"],
7
+ out: "builds/indexPlugin.js"
8
+ })
@@ -0,0 +1,17 @@
1
+ if(typeof define !== 'function'){
2
+ var define = (require('amdefine'))(module);
3
+ }
4
+
5
+ define(function (require) {
6
+ var b = require('./b'),
7
+ c = require('./c');
8
+
9
+
10
+ console.log('got b name: ' + b.name);
11
+ console.log('got c name: ' + c.name);
12
+ console.log('and I am a');
13
+
14
+ return {
15
+ name: 'a'
16
+ };
17
+ });
@@ -0,0 +1,8 @@
1
+ if (typeof define !== 'function') { var define = (require('amdefine'))(module); }
2
+
3
+ define(['./d'], function (d) {
4
+ console.log('got d name: ' + d.name);
5
+ return {
6
+ name: 'b'
7
+ };
8
+ });
@@ -0,0 +1,6 @@
1
+ ({
2
+ baseUrl: '.',
3
+ optimize: 'none',
4
+ name: 'a',
5
+ out: 'built.js'
6
+ })
@@ -0,0 +1,7 @@
1
+ if ( typeof define !== 'function' ) {
2
+ var define = ( require( './node_modules/amdefine/amdefine' ) )( module );
3
+ }
4
+
5
+ define({
6
+ name: 'c'
7
+ });
@@ -0,0 +1,5 @@
1
+ if (typeof define !== 'function') { var define = (require('../amdefine/node_modules/amdefine/amdefine'))(module); }
2
+
3
+ define({
4
+ name: 'd'
5
+ })
@@ -0,0 +1,36 @@
1
+
2
+
3
+
4
+ define('d',{
5
+ name: 'd'
6
+ });
7
+
8
+
9
+ define('b',['./d'], function (d) {
10
+ console.log('got d name: ' + d.name);
11
+ return {
12
+ name: 'b'
13
+ };
14
+ });
15
+
16
+
17
+
18
+ define('c',{
19
+ name: 'c'
20
+ });
21
+
22
+
23
+
24
+ define('a',['require','./b','./c'],function (require) {
25
+ var b = require('./b'),
26
+ c = require('./c');
27
+
28
+
29
+ console.log('got b name: ' + b.name);
30
+ console.log('got c name: ' + c.name);
31
+ console.log('and I am a');
32
+
33
+ return {
34
+ name: 'a'
35
+ };
36
+ });
@@ -0,0 +1,58 @@
1
+ amdefine is released under two licenses: new BSD, and MIT. You may pick the
2
+ license that best suits your development needs. The text of both licenses are
3
+ provided below.
4
+
5
+
6
+ The "New" BSD License:
7
+ ----------------------
8
+
9
+ Copyright (c) 2011, The Dojo Foundation
10
+ All rights reserved.
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are met:
14
+
15
+ * Redistributions of source code must retain the above copyright notice, this
16
+ list of conditions and the following disclaimer.
17
+ * Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+ * Neither the name of the Dojo Foundation nor the names of its contributors
21
+ may be used to endorse or promote products derived from this software
22
+ without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+
36
+
37
+ MIT License
38
+ -----------
39
+
40
+ Copyright (c) 2011, The Dojo Foundation
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ of this software and associated documentation files (the "Software"), to deal
44
+ in the Software without restriction, including without limitation the rights
45
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ copies of the Software, and to permit persons to whom the Software is
47
+ furnished to do so, subject to the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be included in
50
+ all copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58
+ THE SOFTWARE.