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,22 @@
1
+ /**
2
+ * @license RequireJS rhino 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
+
7
+ /*jslint strict: false */
8
+ /*global require: false, java: false, load: false */
9
+
10
+ (function () {
11
+
12
+ require.load = function (context, moduleName, url) {
13
+ //Indicate a the module is in process of loading.
14
+ context.scriptCount += 1;
15
+
16
+ load(url);
17
+
18
+ //Support anonymous modules.
19
+ context.completeLoad(moduleName);
20
+ };
21
+
22
+ }());
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license 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
+
7
+ /*jslint strict: false */
8
+ /*global define: false, process: false */
9
+
10
+ var jsLibRhinoArgs = (typeof rhinoArgs !== 'undefined' && rhinoArgs) || [].concat(Array.prototype.slice.call(arguments, 0));
11
+
12
+ define(function () {
13
+ var args = jsLibRhinoArgs;
14
+
15
+ //Ignore any command option used for rq.js
16
+ if (args[0] && args[0].indexOf('-' === 0)) {
17
+ args = args.slice(1);
18
+ }
19
+
20
+ return args;
21
+ });
@@ -0,0 +1,244 @@
1
+ /**
2
+ * @license RequireJS 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
+ //Helper functions to deal with file I/O.
7
+
8
+ /*jslint plusplus: false, strict: false */
9
+ /*global java: false, define: false */
10
+
11
+ define(function () {
12
+ var file = {
13
+ backSlashRegExp: /\\/g,
14
+
15
+ exclusionRegExp: /^\./,
16
+
17
+ getLineSeparator: function () {
18
+ return file.lineSeparator;
19
+ },
20
+
21
+ lineSeparator: java.lang.System.getProperty("line.separator"), //Java String
22
+
23
+ exists: function (fileName) {
24
+ return (new java.io.File(fileName)).exists();
25
+ },
26
+
27
+ parent: function (fileName) {
28
+ return file.absPath((new java.io.File(fileName)).getParentFile());
29
+ },
30
+
31
+ normalize: function (fileName) {
32
+ return file.absPath(fileName);
33
+ },
34
+
35
+ isFile: function (path) {
36
+ return (new java.io.File(path)).isFile();
37
+ },
38
+
39
+ isDirectory: function (path) {
40
+ return (new java.io.File(path)).isDirectory();
41
+ },
42
+
43
+ /**
44
+ * Gets the absolute file path as a string, normalized
45
+ * to using front slashes for path separators.
46
+ * @param {java.io.File||String} file
47
+ */
48
+ absPath: function (fileObj) {
49
+ if (typeof fileObj === "string") {
50
+ fileObj = new java.io.File(fileObj);
51
+ }
52
+ return (fileObj.getAbsolutePath() + "").replace(file.backSlashRegExp, "/");
53
+ },
54
+
55
+ getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths, /*boolean?*/startDirIsJavaObject) {
56
+ //summary: Recurses startDir and finds matches to the files that match regExpFilters.include
57
+ //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters,
58
+ //and it will be treated as the "include" case.
59
+ //Ignores files/directories that start with a period (.) unless exclusionRegExp
60
+ //is set to another value.
61
+ var files = [], topDir, regExpInclude, regExpExclude, dirFileArray,
62
+ i, fileObj, filePath, ok, dirFiles;
63
+
64
+ topDir = startDir;
65
+ if (!startDirIsJavaObject) {
66
+ topDir = new java.io.File(startDir);
67
+ }
68
+
69
+ regExpInclude = regExpFilters.include || regExpFilters;
70
+ regExpExclude = regExpFilters.exclude || null;
71
+
72
+ if (topDir.exists()) {
73
+ dirFileArray = topDir.listFiles();
74
+ for (i = 0; i < dirFileArray.length; i++) {
75
+ fileObj = dirFileArray[i];
76
+ if (fileObj.isFile()) {
77
+ filePath = fileObj.getPath();
78
+ if (makeUnixPaths) {
79
+ //Make sure we have a JS string.
80
+ filePath = String(filePath);
81
+ if (filePath.indexOf("/") === -1) {
82
+ filePath = filePath.replace(/\\/g, "/");
83
+ }
84
+ }
85
+
86
+ ok = true;
87
+ if (regExpInclude) {
88
+ ok = filePath.match(regExpInclude);
89
+ }
90
+ if (ok && regExpExclude) {
91
+ ok = !filePath.match(regExpExclude);
92
+ }
93
+
94
+ if (ok && (!file.exclusionRegExp ||
95
+ !file.exclusionRegExp.test(fileObj.getName()))) {
96
+ files.push(filePath);
97
+ }
98
+ } else if (fileObj.isDirectory() &&
99
+ (!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.getName()))) {
100
+ dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true);
101
+ files.push.apply(files, dirFiles);
102
+ }
103
+ }
104
+ }
105
+
106
+ return files; //Array
107
+ },
108
+
109
+ copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) {
110
+ //summary: copies files from srcDir to destDir using the regExpFilter to determine if the
111
+ //file should be copied. Returns a list file name strings of the destinations that were copied.
112
+ regExpFilter = regExpFilter || /\w/;
113
+
114
+ var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true),
115
+ copiedFiles = [], i, srcFileName, destFileName;
116
+
117
+ for (i = 0; i < fileNames.length; i++) {
118
+ srcFileName = fileNames[i];
119
+ destFileName = srcFileName.replace(srcDir, destDir);
120
+
121
+ if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) {
122
+ copiedFiles.push(destFileName);
123
+ }
124
+ }
125
+
126
+ return copiedFiles.length ? copiedFiles : null; //Array or null
127
+ },
128
+
129
+ copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) {
130
+ //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if
131
+ //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred.
132
+ var destFile = new java.io.File(destFileName), srcFile, parentDir,
133
+ srcChannel, destChannel;
134
+
135
+ //logger.trace("Src filename: " + srcFileName);
136
+ //logger.trace("Dest filename: " + destFileName);
137
+
138
+ //If onlyCopyNew is true, then compare dates and only copy if the src is newer
139
+ //than dest.
140
+ if (onlyCopyNew) {
141
+ srcFile = new java.io.File(srcFileName);
142
+ if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified()) {
143
+ return false; //Boolean
144
+ }
145
+ }
146
+
147
+ //Make sure destination dir exists.
148
+ parentDir = destFile.getParentFile();
149
+ if (!parentDir.exists()) {
150
+ if (!parentDir.mkdirs()) {
151
+ throw "Could not create directory: " + parentDir.getAbsolutePath();
152
+ }
153
+ }
154
+
155
+ //Java's version of copy file.
156
+ srcChannel = new java.io.FileInputStream(srcFileName).getChannel();
157
+ destChannel = new java.io.FileOutputStream(destFileName).getChannel();
158
+ destChannel.transferFrom(srcChannel, 0, srcChannel.size());
159
+ srcChannel.close();
160
+ destChannel.close();
161
+
162
+ return true; //Boolean
163
+ },
164
+
165
+ readFile: function (/*String*/path, /*String?*/encoding) {
166
+ //A file read function that can deal with BOMs
167
+ encoding = encoding || "utf-8";
168
+ var fileObj = new java.io.File(path),
169
+ input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(fileObj), encoding)),
170
+ stringBuffer, line;
171
+ try {
172
+ stringBuffer = new java.lang.StringBuffer();
173
+ line = input.readLine();
174
+
175
+ // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
176
+ // http://www.unicode.org/faq/utf_bom.html
177
+
178
+ // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
179
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
180
+ if (line && line.length() && line.charAt(0) === 0xfeff) {
181
+ // Eat the BOM, since we've already found the encoding on this file,
182
+ // and we plan to concatenating this buffer with others; the BOM should
183
+ // only appear at the top of a file.
184
+ line = line.substring(1);
185
+ }
186
+ while (line !== null) {
187
+ stringBuffer.append(line);
188
+ stringBuffer.append(file.lineSeparator);
189
+ line = input.readLine();
190
+ }
191
+ //Make sure we return a JavaScript string and not a Java string.
192
+ return String(stringBuffer.toString()); //String
193
+ } finally {
194
+ input.close();
195
+ }
196
+ },
197
+
198
+ saveUtf8File: function (/*String*/fileName, /*String*/fileContents) {
199
+ //summary: saves a file using UTF-8 encoding.
200
+ file.saveFile(fileName, fileContents, "utf-8");
201
+ },
202
+
203
+ saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) {
204
+ //summary: saves a file.
205
+ var outFile = new java.io.File(fileName), outWriter, parentDir, os;
206
+
207
+ parentDir = outFile.getAbsoluteFile().getParentFile();
208
+ if (!parentDir.exists()) {
209
+ if (!parentDir.mkdirs()) {
210
+ throw "Could not create directory: " + parentDir.getAbsolutePath();
211
+ }
212
+ }
213
+
214
+ if (encoding) {
215
+ outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile), encoding);
216
+ } else {
217
+ outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile));
218
+ }
219
+
220
+ os = new java.io.BufferedWriter(outWriter);
221
+ try {
222
+ os.write(fileContents);
223
+ } finally {
224
+ os.close();
225
+ }
226
+ },
227
+
228
+ deleteFile: function (/*String*/fileName) {
229
+ //summary: deletes a file or directory if it exists.
230
+ var fileObj = new java.io.File(fileName), files, i;
231
+ if (fileObj.exists()) {
232
+ if (fileObj.isDirectory()) {
233
+ files = fileObj.listFiles();
234
+ for (i = 0; i < files.length; i++) {
235
+ this.deleteFile(files[i]);
236
+ }
237
+ }
238
+ fileObj["delete"]();
239
+ }
240
+ }
241
+ };
242
+
243
+ return file;
244
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license RequireJS 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
+
7
+ /*jslint strict: false */
8
+ /*global define: false, load: false */
9
+
10
+ define(function () {
11
+ return load;
12
+ });
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @license 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
+
7
+ /*jslint strict: false, plusplus: false */
8
+ /*global define: false, java: false, Packages: false */
9
+
10
+ define(['logger'], function (logger) {
11
+
12
+ //Add .reduce to Rhino so UglifyJS can run in Rhino,
13
+ //inspired by https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
14
+ //but rewritten for brevity, and to be good enough for use by UglifyJS.
15
+ if (!Array.prototype.reduce) {
16
+ Array.prototype.reduce = function (fn /*, initialValue */) {
17
+ var i = 0,
18
+ length = this.length,
19
+ accumulator;
20
+
21
+ if (arguments.length >= 2) {
22
+ accumulator = arguments[1];
23
+ } else {
24
+ do {
25
+ if (i in this) {
26
+ accumulator = this[i++];
27
+ break;
28
+ }
29
+ }
30
+ while (true);
31
+ }
32
+
33
+ for (; i < length; i++) {
34
+ if (i in this) {
35
+ accumulator = fn.call(undefined, accumulator, this[i], i, this);
36
+ }
37
+ }
38
+
39
+ return accumulator;
40
+ };
41
+ }
42
+
43
+ var JSSourceFilefromCode, optimize;
44
+
45
+ //Bind to Closure compiler, but if it is not available, do not sweat it.
46
+ try {
47
+ JSSourceFilefromCode = java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMethod('fromCode', [java.lang.String, java.lang.String]);
48
+ } catch (e) {}
49
+
50
+ //Helper for closure compiler, because of weird Java-JavaScript interactions.
51
+ function closurefromCode(filename, content) {
52
+ return JSSourceFilefromCode.invoke(null, [filename, content]);
53
+ }
54
+
55
+ optimize = {
56
+ closure: function (fileName, fileContents, keepLines, config) {
57
+ config = config || {};
58
+ var jscomp = Packages.com.google.javascript.jscomp,
59
+ flags = Packages.com.google.common.flags,
60
+ //Fake extern
61
+ externSourceFile = closurefromCode("fakeextern.js", " "),
62
+ //Set up source input
63
+ jsSourceFile = closurefromCode(String(fileName), String(fileContents)),
64
+ options, option, FLAG_compilation_level, compiler,
65
+ Compiler = Packages.com.google.javascript.jscomp.Compiler,
66
+ result;
67
+
68
+ logger.trace("Minifying file: " + fileName);
69
+
70
+ //Set up options
71
+ options = new jscomp.CompilerOptions();
72
+ for (option in config.CompilerOptions) {
73
+ // options are false by default and jslint wanted an if statement in this for loop
74
+ if (config.CompilerOptions[option]) {
75
+ options[option] = config.CompilerOptions[option];
76
+ }
77
+
78
+ }
79
+ options.prettyPrint = keepLines || options.prettyPrint;
80
+
81
+ FLAG_compilation_level = jscomp.CompilationLevel[config.CompilationLevel || 'SIMPLE_OPTIMIZATIONS'];
82
+ FLAG_compilation_level.setOptionsForCompilationLevel(options);
83
+
84
+ //Trigger the compiler
85
+ Compiler.setLoggingLevel(Packages.java.util.logging.Level[config.loggingLevel || 'WARNING']);
86
+ compiler = new Compiler();
87
+
88
+ result = compiler.compile(externSourceFile, jsSourceFile, options);
89
+ if (!result.success) {
90
+ logger.error('Cannot closure compile file: ' + fileName + '. Skipping it.');
91
+ } else {
92
+ fileContents = compiler.toSource();
93
+ }
94
+
95
+ return fileContents;
96
+ }
97
+ };
98
+
99
+ return optimize;
100
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license RequireJS 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
+
7
+ /*jslint strict: false */
8
+ /*global define: false, print: false */
9
+
10
+ define(function () {
11
+ return print;
12
+ });
@@ -0,0 +1,16 @@
1
+ This is a copy of UglifyJS from:
2
+ https://github.com/mishoo/UglifyJS
3
+
4
+ Using the "v1.1.1" tag.
5
+
6
+ UglifyJS is under the BSD license, and it a third-party package.
7
+
8
+ * The contents of the package were modified to wrap the modules in a define() wrapper,
9
+ including listing out the separate dependencies.
10
+ * uglify-js.js was renamed to index.js
11
+ * The scripts in the original lib directory were just placed alongside index.js to allow for an easier path mapping.
12
+ * index.js was modified to use the ./ path instead of the ./lib/ path.
13
+
14
+ If UglifyJS is updated, be sure to run a Java-backed optimizer test to be sure
15
+ it still works in that environment. Array.prototype.reduce needed to be added
16
+ to get the existing version to work.
@@ -0,0 +1,21 @@
1
+ define(["require", "exports", "module", "./parse-js", "./process"], function(require, exports, module) {
2
+
3
+ //convienence function(src, [options]);
4
+ function uglify(orig_code, options){
5
+ options || (options = {});
6
+ var jsp = uglify.parser;
7
+ var pro = uglify.uglify;
8
+
9
+ var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST
10
+ ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names
11
+ ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations
12
+ var final_code = pro.gen_code(ast, options.gen_options); // compressed code here
13
+ return final_code;
14
+ };
15
+
16
+ uglify.parser = require("./parse-js");
17
+ uglify.uglify = require("./process");
18
+
19
+ module.exports = uglify
20
+
21
+ });