databaseformalizer 0.3.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.
Files changed (267) hide show
  1. data/.project +18 -0
  2. data/README +256 -0
  3. data/README.md +2 -0
  4. data/Rakefile +21 -0
  5. data/app/controllers/databaseformalizer/attr_defs_controller.rb +98 -0
  6. data/app/controllers/databaseformalizer/attr_vals_controller.rb +85 -0
  7. data/app/controllers/databaseformalizer/dbformahome_controller.rb +7 -0
  8. data/app/controllers/databaseformalizer/entities_controller.rb +105 -0
  9. data/app/controllers/databaseformalizer/entity_defs_controller.rb +90 -0
  10. data/app/helpers/application_helper.rb +2 -0
  11. data/app/helpers/databaseformalizer/application_helper.rb +4 -0
  12. data/app/helpers/databaseformalizer/attr_defs_helper.rb +4 -0
  13. data/app/helpers/databaseformalizer/attr_vals_helper.rb +4 -0
  14. data/app/helpers/databaseformalizer/dbformahome_helper.rb +4 -0
  15. data/app/helpers/databaseformalizer/entities_helper.rb +160 -0
  16. data/app/helpers/databaseformalizer/entity_defs_helper.rb +68 -0
  17. data/app/models/databaseformalizer/attr_def.rb +48 -0
  18. data/app/models/databaseformalizer/attr_list_join_def.rb +17 -0
  19. data/app/models/databaseformalizer/attr_list_join_val.rb +18 -0
  20. data/app/models/databaseformalizer/attr_val.rb +36 -0
  21. data/app/models/databaseformalizer/attr_vals_entity.rb +18 -0
  22. data/app/models/databaseformalizer/entity.rb +27 -0
  23. data/app/models/databaseformalizer/entity_def.rb +24 -0
  24. data/app/models/databaseformalizer/entity_def_attr_def.rb +18 -0
  25. data/app/views/databaseformalizer/attr_defs/_form.html.erb +74 -0
  26. data/app/views/databaseformalizer/attr_defs/edit.html.erb +7 -0
  27. data/app/views/databaseformalizer/attr_defs/index.html.erb +38 -0
  28. data/app/views/databaseformalizer/attr_defs/new.html.erb +6 -0
  29. data/app/views/databaseformalizer/attr_defs/show.html.erb +50 -0
  30. data/app/views/databaseformalizer/attr_vals/_form.html.erb +29 -0
  31. data/app/views/databaseformalizer/attr_vals/edit.html.erb +7 -0
  32. data/app/views/databaseformalizer/attr_vals/index.html.erb +28 -0
  33. data/app/views/databaseformalizer/attr_vals/new.html.erb +6 -0
  34. data/app/views/databaseformalizer/attr_vals/show.html.erb +20 -0
  35. data/app/views/databaseformalizer/dbformahome/index.html.erb +19 -0
  36. data/app/views/databaseformalizer/entities/_attr_val_boolean_form.html.erb +7 -0
  37. data/app/views/databaseformalizer/entities/_attr_val_checkList_form.html.erb +22 -0
  38. data/app/views/databaseformalizer/entities/_attr_val_datetime_form.html.erb +15 -0
  39. data/app/views/databaseformalizer/entities/_attr_val_entityDef_form.html.erb +14 -0
  40. data/app/views/databaseformalizer/entities/_attr_val_form_all.html.erb +4 -0
  41. data/app/views/databaseformalizer/entities/_attr_val_form_one.html.erb +6 -0
  42. data/app/views/databaseformalizer/entities/_attr_val_integer_form.html.erb +10 -0
  43. data/app/views/databaseformalizer/entities/_attr_val_openList_element_form.html.erb +16 -0
  44. data/app/views/databaseformalizer/entities/_attr_val_openList_form.html.erb +12 -0
  45. data/app/views/databaseformalizer/entities/_attr_val_selectOneInList_form.html.erb +20 -0
  46. data/app/views/databaseformalizer/entities/_attr_val_string_form.html.erb +10 -0
  47. data/app/views/databaseformalizer/entities/_attr_val_text_form.html.erb +10 -0
  48. data/app/views/databaseformalizer/entities/_form.html.erb +54 -0
  49. data/app/views/databaseformalizer/entities/edit.html.erb +8 -0
  50. data/app/views/databaseformalizer/entities/index.html.erb +45 -0
  51. data/app/views/databaseformalizer/entities/new.html.erb +10 -0
  52. data/app/views/databaseformalizer/entities/new.js.erb +1 -0
  53. data/app/views/databaseformalizer/entities/show.html.erb +50 -0
  54. data/app/views/databaseformalizer/entity_defs/_form.html.erb +51 -0
  55. data/app/views/databaseformalizer/entity_defs/edit.html.erb +7 -0
  56. data/app/views/databaseformalizer/entity_defs/index.html.erb +57 -0
  57. data/app/views/databaseformalizer/entity_defs/new.html.erb +6 -0
  58. data/app/views/databaseformalizer/entity_defs/show.html.erb +30 -0
  59. data/app/views/databaseformalizer/layouts/application.html.erb +134 -0
  60. data/databaseformalizer.gemspec +34 -0
  61. data/lib/acts_as_entity/base.rb +101 -0
  62. data/lib/application_controller.rb +21 -0
  63. data/lib/application_helper.rb +3 -0
  64. data/lib/databaseformalizer.rb +27 -0
  65. data/lib/engine.rb +23 -0
  66. data/lib/generators/entity_def/USAGE +8 -0
  67. data/lib/generators/entity_def/entity_def_generator.rb +39 -0
  68. data/lib/generators/entity_def/templates/controller.rb +98 -0
  69. data/lib/generators/entity_def/templates/helper.rb +2 -0
  70. data/lib/generators/entity_def/templates/model.rb +3 -0
  71. data/lib/generators/entity_def/templates/view/_form.html.erb +35 -0
  72. data/lib/generators/entity_def/templates/view/edit.html.erb +6 -0
  73. data/lib/generators/entity_def/templates/view/index.html.erb +27 -0
  74. data/lib/generators/entity_def/templates/view/new.html.erb +5 -0
  75. data/lib/generators/entity_def/templates/view/show.html.erb +3 -0
  76. data/lib/rails/generators/databaseformalizer/databaseformalizer_generator.rb +52 -0
  77. data/lib/rails/generators/databaseformalizer/templates/initializer.rb +8 -0
  78. data/lib/rails/generators/databaseformalizer/templates/migration.rb +9 -0
  79. data/lib/rails/generators/databaseformalizer/templates/migration.rb.bak +9 -0
  80. data/lib/rails/generators/databaseformalizer/templates/schema.rb +84 -0
  81. data/lib/rails/railties/tasks.rake +8 -0
  82. data/public/bootstrap/css/bootstrap-fixed-header.css +15 -0
  83. data/public/bootstrap/css/bootstrap-responsive.css +808 -0
  84. data/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
  85. data/public/bootstrap/css/bootstrap-toggle.css +242 -0
  86. data/public/bootstrap/css/cerulean/bootstrap.min.css +740 -0
  87. data/public/bootstrap/css/img/glyphicons-halflings-white.png +0 -0
  88. data/public/bootstrap/css/img/glyphicons-halflings.png +0 -0
  89. data/public/bootstrap/js/bootstrap-alert.js +90 -0
  90. data/public/bootstrap/js/bootstrap-collapse.js +157 -0
  91. data/public/bootstrap/js/bootstrap-dropdown.js +100 -0
  92. data/public/bootstrap/js/bootstrap-fixed-header.js +54 -0
  93. data/public/bootstrap/js/bootstrap-modal.js +218 -0
  94. data/public/bootstrap/js/bootstrap-popover.js +98 -0
  95. data/public/bootstrap/js/bootstrap-tab.js +135 -0
  96. data/public/bootstrap/js/bootstrap-toggle.js +104 -0
  97. data/public/bootstrap/js/bootstrap-tooltip.js +275 -0
  98. data/public/bootstrap/js/bootstrap-transition.js +61 -0
  99. data/public/bootstrap/js/bootstrap.js +1824 -0
  100. data/public/bootstrap/js/bootstrap.min.js +6 -0
  101. data/public/images/Thumbs.db +0 -0
  102. data/public/images/bootstrap/Thumbs.db +0 -0
  103. data/public/images/bootstrap/glyphicons-halflings.png +0 -0
  104. data/public/images/databaseformalizer.jpg +0 -0
  105. data/public/images/metamodel.png +0 -0
  106. data/public/images/model.png +0 -0
  107. data/public/javascripts/databaseformalizer.js +13 -0
  108. data/public/javascripts/jquery.js +9252 -0
  109. data/public/jquery-ui/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  110. data/public/jquery-ui/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  111. data/public/jquery-ui/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  112. data/public/jquery-ui/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  113. data/public/jquery-ui/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  114. data/public/jquery-ui/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  115. data/public/jquery-ui/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  116. data/public/jquery-ui/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  117. data/public/jquery-ui/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  118. data/public/jquery-ui/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  119. data/public/jquery-ui/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  120. data/public/jquery-ui/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  121. data/public/jquery-ui/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  122. data/public/jquery-ui/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  123. data/public/jquery-ui/css/ui-lightness/jquery-ui-1.8.21.custom.css +565 -0
  124. data/public/jquery-ui/js/jquery-1.7.2.min.js +4 -0
  125. data/public/jquery-ui/js/jquery-ui-1.8.21.custom.min.js +125 -0
  126. data/public/jquery-validation/README.md +8 -0
  127. data/public/jquery-validation/additional-methods.js +300 -0
  128. data/public/jquery-validation/additional-methods.min.js +29 -0
  129. data/public/jquery-validation/changelog.txt +277 -0
  130. data/public/jquery-validation/jquery.validate.js +1188 -0
  131. data/public/jquery-validation/jquery.validate.min.js +51 -0
  132. data/public/jquery-validation/lib/jquery-1.3.2.js +4376 -0
  133. data/public/jquery-validation/lib/jquery-1.4.2.js +6240 -0
  134. data/public/jquery-validation/lib/jquery-1.4.4.js +7179 -0
  135. data/public/jquery-validation/lib/jquery-1.5.2.js +8374 -0
  136. data/public/jquery-validation/lib/jquery-1.6.1.js +8936 -0
  137. data/public/jquery-validation/lib/jquery.form.js +660 -0
  138. data/public/jquery-validation/lib/jquery.js +4376 -0
  139. data/public/jquery-validation/lib/jquery.metadata.js +122 -0
  140. data/public/jquery-validation/lib/jquery.mockjax.js +382 -0
  141. data/public/jquery-validation/localization/messages_ar.js +24 -0
  142. data/public/jquery-validation/localization/messages_bg.js +23 -0
  143. data/public/jquery-validation/localization/messages_ca.js +23 -0
  144. data/public/jquery-validation/localization/messages_cn.js +23 -0
  145. data/public/jquery-validation/localization/messages_cs.js +23 -0
  146. data/public/jquery-validation/localization/messages_da.js +20 -0
  147. data/public/jquery-validation/localization/messages_de.js +20 -0
  148. data/public/jquery-validation/localization/messages_el.js +24 -0
  149. data/public/jquery-validation/localization/messages_es.js +23 -0
  150. data/public/jquery-validation/localization/messages_eu.js +23 -0
  151. data/public/jquery-validation/localization/messages_fa.js +23 -0
  152. data/public/jquery-validation/localization/messages_fi.js +21 -0
  153. data/public/jquery-validation/localization/messages_fr.js +23 -0
  154. data/public/jquery-validation/localization/messages_ge.js +23 -0
  155. data/public/jquery-validation/localization/messages_he.js +23 -0
  156. data/public/jquery-validation/localization/messages_hu.js +20 -0
  157. data/public/jquery-validation/localization/messages_it.js +23 -0
  158. data/public/jquery-validation/localization/messages_ja.js +23 -0
  159. data/public/jquery-validation/localization/messages_kk.js +23 -0
  160. data/public/jquery-validation/localization/messages_lt.js +23 -0
  161. data/public/jquery-validation/localization/messages_lv.js +23 -0
  162. data/public/jquery-validation/localization/messages_nl.js +23 -0
  163. data/public/jquery-validation/localization/messages_no.js +23 -0
  164. data/public/jquery-validation/localization/messages_pl.js +23 -0
  165. data/public/jquery-validation/localization/messages_ptbr.js +23 -0
  166. data/public/jquery-validation/localization/messages_ptpt.js +23 -0
  167. data/public/jquery-validation/localization/messages_ro.js +23 -0
  168. data/public/jquery-validation/localization/messages_ru.js +23 -0
  169. data/public/jquery-validation/localization/messages_se.js +21 -0
  170. data/public/jquery-validation/localization/messages_si.js +23 -0
  171. data/public/jquery-validation/localization/messages_sk.js +20 -0
  172. data/public/jquery-validation/localization/messages_sl.js +23 -0
  173. data/public/jquery-validation/localization/messages_sr.js +23 -0
  174. data/public/jquery-validation/localization/messages_th.js +23 -0
  175. data/public/jquery-validation/localization/messages_tr.js +23 -0
  176. data/public/jquery-validation/localization/messages_tw.js +23 -0
  177. data/public/jquery-validation/localization/messages_ua.js +23 -0
  178. data/public/jquery-validation/localization/messages_vi.js +23 -0
  179. data/public/jquery-validation/localization/methods_de.js +12 -0
  180. data/public/jquery-validation/localization/methods_nl.js +9 -0
  181. data/public/jquery-validation/localization/methods_pt.js +9 -0
  182. data/public/jquery-validation/todo +172 -0
  183. data/public/jquery-validation/version.txt +1 -0
  184. data/public/stylesheets/databaseformalizer.css +64 -0
  185. data/public/stylesheets/scaffold.css +56 -0
  186. data/public/tablesorter/addons/.svn/all-wcprops +5 -0
  187. data/public/tablesorter/addons/.svn/entries +31 -0
  188. data/public/tablesorter/addons/pager/.svn/all-wcprops +17 -0
  189. data/public/tablesorter/addons/pager/.svn/entries +96 -0
  190. data/public/tablesorter/addons/pager/.svn/prop-base/jquery.tablesorter.pager.css.svn-base +5 -0
  191. data/public/tablesorter/addons/pager/.svn/prop-base/jquery.tablesorter.pager.js.svn-base +5 -0
  192. data/public/tablesorter/addons/pager/.svn/text-base/jquery.tablesorter.pager.css.svn-base +25 -0
  193. data/public/tablesorter/addons/pager/.svn/text-base/jquery.tablesorter.pager.js.svn-base +184 -0
  194. data/public/tablesorter/addons/pager/jquery.tablesorter.pager.css +25 -0
  195. data/public/tablesorter/addons/pager/jquery.tablesorter.pager.js +184 -0
  196. data/public/tablesorter/build/.svn/all-wcprops +47 -0
  197. data/public/tablesorter/build/.svn/entries +266 -0
  198. data/public/tablesorter/build/.svn/prop-base/ParseMaster.js.svn-base +5 -0
  199. data/public/tablesorter/build/.svn/prop-base/js.jar.svn-base +5 -0
  200. data/public/tablesorter/build/.svn/prop-base/jsmin.js.svn-base +5 -0
  201. data/public/tablesorter/build/.svn/prop-base/min.js.svn-base +5 -0
  202. data/public/tablesorter/build/.svn/prop-base/pack.js.svn-base +5 -0
  203. data/public/tablesorter/build/.svn/prop-base/packer.js.svn-base +5 -0
  204. data/public/tablesorter/build/.svn/prop-base/writeFile.js.svn-base +5 -0
  205. data/public/tablesorter/build/.svn/text-base/ParseMaster.js.svn-base +106 -0
  206. data/public/tablesorter/build/.svn/text-base/js.jar.svn-base +0 -0
  207. data/public/tablesorter/build/.svn/text-base/jsmin.js.svn-base +316 -0
  208. data/public/tablesorter/build/.svn/text-base/min.js.svn-base +5 -0
  209. data/public/tablesorter/build/.svn/text-base/pack.js.svn-base +5 -0
  210. data/public/tablesorter/build/.svn/text-base/packer.js.svn-base +316 -0
  211. data/public/tablesorter/build/.svn/text-base/writeFile.js.svn-base +19 -0
  212. data/public/tablesorter/build/ParseMaster.js +106 -0
  213. data/public/tablesorter/build/js.jar +0 -0
  214. data/public/tablesorter/build/jsmin.js +316 -0
  215. data/public/tablesorter/build/min.js +5 -0
  216. data/public/tablesorter/build/pack.js +5 -0
  217. data/public/tablesorter/build/packer.js +316 -0
  218. data/public/tablesorter/build/writeFile.js +19 -0
  219. data/public/tablesorter/build.xml +26 -0
  220. data/public/tablesorter/changelog +41 -0
  221. data/public/tablesorter/jquery-latest.js +154 -0
  222. data/public/tablesorter/jquery.metadata.js +122 -0
  223. data/public/tablesorter/jquery.tablesorter.js +1031 -0
  224. data/public/tablesorter/jquery.tablesorter.min.js +4 -0
  225. data/public/tablesorter/jquery.tablesorter.widgets.js +433 -0
  226. data/public/tablesorter/jquery.ui.datepicker.js +1727 -0
  227. data/public/tablesorter/style.css +110 -0
  228. data/public/tablesorter/themes/.svn/all-wcprops +5 -0
  229. data/public/tablesorter/themes/.svn/entries +34 -0
  230. data/public/tablesorter/themes/blue/.svn/all-wcprops +35 -0
  231. data/public/tablesorter/themes/blue/.svn/entries +198 -0
  232. data/public/tablesorter/themes/blue/.svn/prop-base/asc.gif.svn-base +5 -0
  233. data/public/tablesorter/themes/blue/.svn/prop-base/bg.gif.svn-base +5 -0
  234. data/public/tablesorter/themes/blue/.svn/prop-base/blue.zip.svn-base +5 -0
  235. data/public/tablesorter/themes/blue/.svn/prop-base/desc.gif.svn-base +5 -0
  236. data/public/tablesorter/themes/blue/.svn/prop-base/style.css.svn-base +5 -0
  237. data/public/tablesorter/themes/blue/.svn/text-base/asc.gif.svn-base +0 -0
  238. data/public/tablesorter/themes/blue/.svn/text-base/bg.gif.svn-base +0 -0
  239. data/public/tablesorter/themes/blue/.svn/text-base/blue.zip.svn-base +0 -0
  240. data/public/tablesorter/themes/blue/.svn/text-base/desc.gif.svn-base +0 -0
  241. data/public/tablesorter/themes/blue/.svn/text-base/style.css.svn-base +39 -0
  242. data/public/tablesorter/themes/blue/asc.gif +0 -0
  243. data/public/tablesorter/themes/blue/bg.gif +0 -0
  244. data/public/tablesorter/themes/blue/blue.zip +0 -0
  245. data/public/tablesorter/themes/blue/desc.gif +0 -0
  246. data/public/tablesorter/themes/blue/style.css +39 -0
  247. data/public/tablesorter/themes/green/.svn/all-wcprops +35 -0
  248. data/public/tablesorter/themes/green/.svn/entries +198 -0
  249. data/public/tablesorter/themes/green/.svn/prop-base/asc.png.svn-base +5 -0
  250. data/public/tablesorter/themes/green/.svn/prop-base/bg.png.svn-base +5 -0
  251. data/public/tablesorter/themes/green/.svn/prop-base/desc.png.svn-base +5 -0
  252. data/public/tablesorter/themes/green/.svn/prop-base/green.zip.svn-base +5 -0
  253. data/public/tablesorter/themes/green/.svn/prop-base/style.css.svn-base +5 -0
  254. data/public/tablesorter/themes/green/.svn/text-base/asc.png.svn-base +0 -0
  255. data/public/tablesorter/themes/green/.svn/text-base/bg.png.svn-base +0 -0
  256. data/public/tablesorter/themes/green/.svn/text-base/desc.png.svn-base +0 -0
  257. data/public/tablesorter/themes/green/.svn/text-base/green.zip.svn-base +0 -0
  258. data/public/tablesorter/themes/green/.svn/text-base/style.css.svn-base +39 -0
  259. data/public/tablesorter/themes/green/asc.png +0 -0
  260. data/public/tablesorter/themes/green/bg.png +0 -0
  261. data/public/tablesorter/themes/green/desc.png +0 -0
  262. data/public/tablesorter/themes/green/green.zip +0 -0
  263. data/public/tablesorter/themes/green/style.css +39 -0
  264. data/test/database.yml +5 -0
  265. data/test/test_helper.rb +56 -0
  266. data/test/unit/databaseformalizer_test.rb +11 -0
  267. metadata +332 -0
@@ -0,0 +1,316 @@
1
+ /* jsmin.js - 2006-08-31
2
+ Author: Franck Marcia
3
+ This work is an adaptation of jsminc.c published by Douglas Crockford.
4
+ Permission is hereby granted to use the Javascript version under the same
5
+ conditions as the jsmin.c on which it is based.
6
+
7
+ jsmin.c
8
+ 2006-05-04
9
+
10
+ Copyright (c) 2002 Douglas Crockford (www.crockford.com)
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
13
+ this software and associated documentation files (the "Software"), to deal in
14
+ the Software without restriction, including without limitation the rights to
15
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
16
+ of the Software, and to permit persons to whom the Software is furnished to do
17
+ so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ The Software shall be used for Good, not Evil.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ Update:
33
+ add level:
34
+ 1: minimal, keep linefeeds if single
35
+ 2: normal, the standard algorithm
36
+ 3: agressive, remove any linefeed and doesn't take care of potential
37
+ missing semicolons (can be regressive)
38
+ store stats
39
+ jsmin.oldSize
40
+ jsmin.newSize
41
+ */
42
+
43
+ String.prototype.has = function(c) {
44
+ return this.indexOf(c) > -1;
45
+ };
46
+
47
+ function jsmin(comment, input, level) {
48
+
49
+ if (input === undefined) {
50
+ input = comment;
51
+ comment = '';
52
+ level = 2;
53
+ } else if (level === undefined || level < 1 || level > 3) {
54
+ level = 2;
55
+ }
56
+
57
+ if (comment.length > 0) {
58
+ comment += '\n';
59
+ }
60
+
61
+ var a = '',
62
+ b = '',
63
+ EOF = -1,
64
+ LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
65
+ DIGITS = '0123456789',
66
+ ALNUM = LETTERS + DIGITS + '_$\\',
67
+ theLookahead = EOF;
68
+
69
+
70
+ /* isAlphanum -- return true if the character is a letter, digit, underscore,
71
+ dollar sign, or non-ASCII character.
72
+ */
73
+
74
+ function isAlphanum(c) {
75
+ return c != EOF && (ALNUM.has(c) || c.charCodeAt(0) > 126);
76
+ }
77
+
78
+
79
+ /* get -- return the next character. Watch out for lookahead. If the
80
+ character is a control character, translate it to a space or
81
+ linefeed.
82
+ */
83
+
84
+ function get() {
85
+
86
+ var c = theLookahead;
87
+ if (get.i == get.l) {
88
+ return EOF;
89
+ }
90
+ theLookahead = EOF;
91
+ if (c == EOF) {
92
+ c = input.charAt(get.i);
93
+ ++get.i;
94
+ }
95
+ if (c >= ' ' || c == '\n') {
96
+ return c;
97
+ }
98
+ if (c == '\r') {
99
+ return '\n';
100
+ }
101
+ return ' ';
102
+ }
103
+
104
+ get.i = 0;
105
+ get.l = input.length;
106
+
107
+
108
+ /* peek -- get the next character without getting it.
109
+ */
110
+
111
+ function peek() {
112
+ theLookahead = get();
113
+ return theLookahead;
114
+ }
115
+
116
+
117
+ /* next -- get the next character, excluding comments. peek() is used to see
118
+ if a '/' is followed by a '/' or '*'.
119
+ */
120
+
121
+ function next() {
122
+
123
+ var c = get();
124
+ if (c == '/') {
125
+ switch (peek()) {
126
+ case '/':
127
+ for (;;) {
128
+ c = get();
129
+ if (c <= '\n') {
130
+ return c;
131
+ }
132
+ }
133
+ break;
134
+ case '*':
135
+ get();
136
+ for (;;) {
137
+ switch (get()) {
138
+ case '*':
139
+ if (peek() == '/') {
140
+ get();
141
+ return ' ';
142
+ }
143
+ break;
144
+ case EOF:
145
+ throw 'Error: Unterminated comment.';
146
+ }
147
+ }
148
+ break;
149
+ default:
150
+ return c;
151
+ }
152
+ }
153
+ return c;
154
+ }
155
+
156
+
157
+ /* action -- do something! What you do is determined by the argument:
158
+ 1 Output A. Copy B to A. Get the next B.
159
+ 2 Copy B to A. Get the next B. (Delete A).
160
+ 3 Get the next B. (Delete B).
161
+ action treats a string as a single character. Wow!
162
+ action recognizes a regular expression if it is preceded by ( or , or =.
163
+ */
164
+
165
+ function action(d) {
166
+
167
+ var r = [];
168
+
169
+ if (d == 1) {
170
+ r.push(a);
171
+ }
172
+
173
+ if (d < 3) {
174
+ a = b;
175
+ if (a == '\'' || a == '"') {
176
+ for (;;) {
177
+ r.push(a);
178
+ a = get();
179
+ if (a == b) {
180
+ break;
181
+ }
182
+ if (a <= '\n') {
183
+ throw 'Error: unterminated string literal: ' + a;
184
+ }
185
+ if (a == '\\') {
186
+ r.push(a);
187
+ a = get();
188
+ }
189
+ }
190
+ }
191
+ }
192
+
193
+ b = next();
194
+
195
+ if (b == '/' && '(,=:[!&|'.has(a)) {
196
+ r.push(a);
197
+ r.push(b);
198
+ for (;;) {
199
+ a = get();
200
+ if (a == '/') {
201
+ break;
202
+ } else if (a =='\\') {
203
+ r.push(a);
204
+ a = get();
205
+ } else if (a <= '\n') {
206
+ throw 'Error: unterminated Regular Expression literal';
207
+ }
208
+ r.push(a);
209
+ }
210
+ b = next();
211
+ }
212
+
213
+ return r.join('');
214
+ }
215
+
216
+
217
+ /* m -- Copy the input to the output, deleting the characters which are
218
+ insignificant to JavaScript. Comments will be removed. Tabs will be
219
+ replaced with spaces. Carriage returns will be replaced with
220
+ linefeeds.
221
+ Most spaces and linefeeds will be removed.
222
+ */
223
+
224
+ function m() {
225
+
226
+ var r = [];
227
+ a = '\n';
228
+
229
+ r.push(action(3));
230
+
231
+ while (a != EOF) {
232
+ switch (a) {
233
+ case ' ':
234
+ if (isAlphanum(b)) {
235
+ r.push(action(1));
236
+ } else {
237
+ r.push(action(2));
238
+ }
239
+ break;
240
+ case '\n':
241
+ switch (b) {
242
+ case '{':
243
+ case '[':
244
+ case '(':
245
+ case '+':
246
+ case '-':
247
+ r.push(action(1));
248
+ break;
249
+ case ' ':
250
+ r.push(action(3));
251
+ break;
252
+ default:
253
+ if (isAlphanum(b)) {
254
+ r.push(action(1));
255
+ } else {
256
+ if (level == 1 && b != '\n') {
257
+ r.push(action(1));
258
+ } else {
259
+ r.push(action(2));
260
+ }
261
+ }
262
+ }
263
+ break;
264
+ default:
265
+ switch (b) {
266
+ case ' ':
267
+ if (isAlphanum(a)) {
268
+ r.push(action(1));
269
+ break;
270
+ }
271
+ r.push(action(3));
272
+ break;
273
+ case '\n':
274
+ if (level == 1 && a != '\n') {
275
+ r.push(action(1));
276
+ } else {
277
+ switch (a) {
278
+ case '}':
279
+ case ']':
280
+ case ')':
281
+ case '+':
282
+ case '-':
283
+ case '"':
284
+ case '\'':
285
+ if (level == 3) {
286
+ r.push(action(3));
287
+ } else {
288
+ r.push(action(1));
289
+ }
290
+ break;
291
+ default:
292
+ if (isAlphanum(a)) {
293
+ r.push(action(1));
294
+ } else {
295
+ r.push(action(3));
296
+ }
297
+ }
298
+ }
299
+ break;
300
+ default:
301
+ r.push(action(1));
302
+ break;
303
+ }
304
+ }
305
+ }
306
+
307
+ return r.join('');
308
+ }
309
+
310
+ jsmin.oldSize = input.length;
311
+ ret = m(input);
312
+ jsmin.newSize = ret.length;
313
+
314
+ return comment + ret;
315
+
316
+ }
@@ -0,0 +1,5 @@
1
+ load("build/jsmin.js", "build/writeFile.js");
2
+
3
+ var f = jsmin('', readFile(arguments[0]), 3);
4
+
5
+ writeFile( arguments[1], f );
@@ -0,0 +1,5 @@
1
+ load("build/ParseMaster.js", "build/packer.js", "build/writeFile.js");
2
+
3
+ var out = readFile( arguments[0] );
4
+
5
+ writeFile( arguments[1], pack( out, 62, true, false ) );
@@ -0,0 +1,316 @@
1
+ /*
2
+ packer, version 2.0.2 (2005-08-19)
3
+ Copyright 2004-2005, Dean Edwards
4
+ License: http://creativecommons.org/licenses/LGPL/2.1/
5
+ */
6
+
7
+ function pack(_script, _encoding, _fastDecode, _specialChars) {
8
+ // constants
9
+ var $IGNORE = "$1";
10
+
11
+ // validate parameters
12
+ _script += "\n";
13
+ _encoding = Math.min(parseInt(_encoding), 95);
14
+
15
+ // apply all parsing routines
16
+ function _pack($script) {
17
+ var i, $parse;
18
+ for (i = 0; ($parse = _parsers[i]); i++) {
19
+ $script = $parse($script);
20
+ }
21
+ return $script;
22
+ };
23
+
24
+ // unpacking function - this is the boot strap function
25
+ // data extracted from this packing routine is passed to
26
+ // this function when decoded in the target
27
+ var _unpack = function($packed, $ascii, $count, $keywords, $encode, $decode) {
28
+ while ($count--)
29
+ if ($keywords[$count])
30
+ $packed = $packed.replace(new RegExp('\\b' + $encode($count) + '\\b', 'g'), $keywords[$count]);
31
+ return $packed;
32
+ };
33
+
34
+ // code-snippet inserted into the unpacker to speed up decoding
35
+ var _decode = function() {
36
+ // does the browser support String.replace where the
37
+ // replacement value is a function?
38
+ if (!''.replace(/^/, String)) {
39
+ // decode all the values we need
40
+ while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
41
+ // global replacement function
42
+ $keywords = [function($encoded){return $decode[$encoded]}];
43
+ // generic match
44
+ $encode = function(){return'\\w+'};
45
+ // reset the loop counter - we are now doing a global replace
46
+ $count = 1;
47
+ }
48
+ };
49
+
50
+ // keep a list of parsing functions, they'll be executed all at once
51
+ var _parsers = [];
52
+ function _addParser($parser) {
53
+ _parsers[_parsers.length] = $parser;
54
+ };
55
+
56
+ // zero encoding - just removal of white space and comments
57
+ function _basicCompression($script) {
58
+ var $parser = new ParseMaster;
59
+ // make safe
60
+ $parser.escapeChar = "\\";
61
+ // protect strings
62
+ $parser.add(/'[^'\n\r]*'/, $IGNORE);
63
+ $parser.add(/"[^"\n\r]*"/, $IGNORE);
64
+ // remove comments
65
+ $parser.add(/\/\/[^\n\r]*[\n\r]/, " ");
66
+ $parser.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//, " ");
67
+ // protect regular expressions
68
+ $parser.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/, "$2"); // IGNORE
69
+ $parser.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/, $IGNORE);
70
+ // remove: ;;; doSomething();
71
+ if (_specialChars) $parser.add(/;;;[^\n\r]+[\n\r]/);
72
+ // remove redundant semi-colons
73
+ $parser.add(/\(;;\)/, $IGNORE); // protect for (;;) loops
74
+ $parser.add(/;+\s*([};])/, "$2");
75
+ // apply the above
76
+ $script = $parser.exec($script);
77
+
78
+ // remove white-space
79
+ $parser.add(/(\b|\x24)\s+(\b|\x24)/, "$2 $3");
80
+ $parser.add(/([+\-])\s+([+\-])/, "$2 $3");
81
+ $parser.add(/\s+/, "");
82
+ // done
83
+ return $parser.exec($script);
84
+ };
85
+
86
+ function _encodeSpecialChars($script) {
87
+ var $parser = new ParseMaster;
88
+ // replace: $name -> n, $$name -> na
89
+ $parser.add(/((\x24+)([a-zA-Z$_]+))(\d*)/, function($match, $offset) {
90
+ var $length = $match[$offset + 2].length;
91
+ var $start = $length - Math.max($length - $match[$offset + 3].length, 0);
92
+ return $match[$offset + 1].substr($start, $length) + $match[$offset + 4];
93
+ });
94
+ // replace: _name -> _0, double-underscore (__name) is ignored
95
+ var $regexp = /\b_[A-Za-z\d]\w*/;
96
+ // build the word list
97
+ var $keywords = _analyze($script, _globalize($regexp), _encodePrivate);
98
+ // quick ref
99
+ var $encoded = $keywords.$encoded;
100
+ $parser.add($regexp, function($match, $offset) {
101
+ return $encoded[$match[$offset]];
102
+ });
103
+ return $parser.exec($script);
104
+ };
105
+
106
+ function _encodeKeywords($script) {
107
+ // escape high-ascii values already in the script (i.e. in strings)
108
+ if (_encoding > 62) $script = _escape95($script);
109
+ // create the parser
110
+ var $parser = new ParseMaster;
111
+ var $encode = _getEncoder(_encoding);
112
+ // for high-ascii, don't encode single character low-ascii
113
+ var $regexp = (_encoding > 62) ? /\w\w+/ : /\w+/;
114
+ // build the word list
115
+ $keywords = _analyze($script, _globalize($regexp), $encode);
116
+ var $encoded = $keywords.$encoded;
117
+ // encode
118
+ $parser.add($regexp, function($match, $offset) {
119
+ return $encoded[$match[$offset]];
120
+ });
121
+ // if encoded, wrap the script in a decoding function
122
+ return $script && _bootStrap($parser.exec($script), $keywords);
123
+ };
124
+
125
+ function _analyze($script, $regexp, $encode) {
126
+ // analyse
127
+ // retreive all words in the script
128
+ var $all = $script.match($regexp);
129
+ var $$sorted = []; // list of words sorted by frequency
130
+ var $$encoded = {}; // dictionary of word->encoding
131
+ var $$protected = {}; // instances of "protected" words
132
+ if ($all) {
133
+ var $unsorted = []; // same list, not sorted
134
+ var $protected = {}; // "protected" words (dictionary of word->"word")
135
+ var $values = {}; // dictionary of charCode->encoding (eg. 256->ff)
136
+ var $count = {}; // word->count
137
+ var i = $all.length, j = 0, $word;
138
+ // count the occurrences - used for sorting later
139
+ do {
140
+ $word = "$" + $all[--i];
141
+ if (!$count[$word]) {
142
+ $count[$word] = 0;
143
+ $unsorted[j] = $word;
144
+ // make a dictionary of all of the protected words in this script
145
+ // these are words that might be mistaken for encoding
146
+ $protected["$" + ($values[j] = $encode(j))] = j++;
147
+ }
148
+ // increment the word counter
149
+ $count[$word]++;
150
+ } while (i);
151
+ // prepare to sort the word list, first we must protect
152
+ // words that are also used as codes. we assign them a code
153
+ // equivalent to the word itself.
154
+ // e.g. if "do" falls within our encoding range
155
+ // then we store keywords["do"] = "do";
156
+ // this avoids problems when decoding
157
+ i = $unsorted.length;
158
+ do {
159
+ $word = $unsorted[--i];
160
+ if ($protected[$word] != null) {
161
+ $$sorted[$protected[$word]] = $word.slice(1);
162
+ $$protected[$protected[$word]] = true;
163
+ $count[$word] = 0;
164
+ }
165
+ } while (i);
166
+ // sort the words by frequency
167
+ $unsorted.sort(function($match1, $match2) {
168
+ return $count[$match2] - $count[$match1];
169
+ });
170
+ j = 0;
171
+ // because there are "protected" words in the list
172
+ // we must add the sorted words around them
173
+ do {
174
+ if ($$sorted[i] == null) $$sorted[i] = $unsorted[j++].slice(1);
175
+ $$encoded[$$sorted[i]] = $values[i];
176
+ } while (++i < $unsorted.length);
177
+ }
178
+ return {$sorted: $$sorted, $encoded: $$encoded, $protected: $$protected};
179
+ };
180
+
181
+ // build the boot function used for loading and decoding
182
+ function _bootStrap($packed, $keywords) {
183
+ var $ENCODE = _safeRegExp("$encode\\($count\\)", "g");
184
+
185
+ // $packed: the packed script
186
+ $packed = "'" + _escape($packed) + "'";
187
+
188
+ // $ascii: base for encoding
189
+ var $ascii = Math.min($keywords.$sorted.length, _encoding) || 1;
190
+
191
+ // $count: number of words contained in the script
192
+ var $count = $keywords.$sorted.length;
193
+
194
+ // $keywords: list of words contained in the script
195
+ for (var i in $keywords.$protected) $keywords.$sorted[i] = "";
196
+ // convert from a string to an array
197
+ $keywords = "'" + $keywords.$sorted.join("|") + "'.split('|')";
198
+
199
+ // $encode: encoding function (used for decoding the script)
200
+ var $encode = _encoding > 62 ? _encode95 : _getEncoder($ascii);
201
+ $encode = String($encode).replace(/_encoding/g, "$ascii").replace(/arguments\.callee/g, "$encode");
202
+ var $inline = "$count" + ($ascii > 10 ? ".toString($ascii)" : "");
203
+
204
+ // $decode: code snippet to speed up decoding
205
+ if (_fastDecode) {
206
+ // create the decoder
207
+ var $decode = _getFunctionBody(_decode);
208
+ if (_encoding > 62) $decode = $decode.replace(/\\\\w/g, "[\\xa1-\\xff]");
209
+ // perform the encoding inline for lower ascii values
210
+ else if ($ascii < 36) $decode = $decode.replace($ENCODE, $inline);
211
+ // special case: when $count==0 there are no keywords. I want to keep
212
+ // the basic shape of the unpacking funcion so i'll frig the code...
213
+ if (!$count) $decode = $decode.replace(_safeRegExp("($count)\\s*=\\s*1"), "$1=0");
214
+ }
215
+
216
+ // boot function
217
+ var $unpack = String(_unpack);
218
+ if (_fastDecode) {
219
+ // insert the decoder
220
+ $unpack = $unpack.replace(/\{/, "{" + $decode + ";");
221
+ }
222
+ $unpack = $unpack.replace(/"/g, "'");
223
+ if (_encoding > 62) { // high-ascii
224
+ // get rid of the word-boundaries for regexp matches
225
+ $unpack = $unpack.replace(/'\\\\b'\s*\+|\+\s*'\\\\b'/g, "");
226
+ }
227
+ if ($ascii > 36 || _encoding > 62 || _fastDecode) {
228
+ // insert the encode function
229
+ $unpack = $unpack.replace(/\{/, "{$encode=" + $encode + ";");
230
+ } else {
231
+ // perform the encoding inline
232
+ $unpack = $unpack.replace($ENCODE, $inline);
233
+ }
234
+ // pack the boot function too
235
+ $unpack = pack($unpack, 0, false, true);
236
+
237
+ // arguments
238
+ var $params = [$packed, $ascii, $count, $keywords];
239
+ if (_fastDecode) {
240
+ // insert placeholders for the decoder
241
+ $params = $params.concat(0, "{}");
242
+ }
243
+
244
+ // the whole thing
245
+ return "eval(" + $unpack + "(" + $params + "))\n";
246
+ };
247
+
248
+ // mmm.. ..which one do i need ??
249
+ function _getEncoder($ascii) {
250
+ return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ? _encode95 : _encode62 : _encode36 : _encode10;
251
+ };
252
+
253
+ // zero encoding
254
+ // characters: 0123456789
255
+ var _encode10 = function($charCode) {
256
+ return $charCode;
257
+ };
258
+
259
+ // inherent base36 support
260
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyz
261
+ var _encode36 = function($charCode) {
262
+ return $charCode.toString(36);
263
+ };
264
+
265
+ // hitch a ride on base36 and add the upper case alpha characters
266
+ // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
267
+ var _encode62 = function($charCode) {
268
+ return ($charCode < _encoding ? '' : arguments.callee(parseInt($charCode / _encoding))) +
269
+ (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
270
+ };
271
+
272
+ // use high-ascii values
273
+ var _encode95 = function($charCode) {
274
+ return ($charCode < _encoding ? '' : arguments.callee($charCode / _encoding)) +
275
+ String.fromCharCode($charCode % _encoding + 161);
276
+ };
277
+
278
+ // special _chars
279
+ var _encodePrivate = function($charCode) {
280
+ return "_" + $charCode;
281
+ };
282
+
283
+ // protect characters used by the parser
284
+ function _escape($script) {
285
+ return $script.replace(/([\\'])/g, "\\$1");
286
+ };
287
+
288
+ // protect high-ascii characters already in the script
289
+ function _escape95($script) {
290
+ return $script.replace(/[\xa1-\xff]/g, function($match) {
291
+ return "\\x" + $match.charCodeAt(0).toString(16);
292
+ });
293
+ };
294
+
295
+ function _safeRegExp($string, $flags) {
296
+ return new RegExp($string.replace(/\$/g, "\\$"), $flags);
297
+ };
298
+
299
+ // extract the body of a function
300
+ function _getFunctionBody($function) {
301
+ with (String($function)) return slice(indexOf("{") + 1, lastIndexOf("}"));
302
+ };
303
+
304
+ // set the global flag on a RegExp (you have to create a new one)
305
+ function _globalize($regexp) {
306
+ return new RegExp(String($regexp).slice(1, -1), "g");
307
+ };
308
+
309
+ // build the parsing routine
310
+ _addParser(_basicCompression);
311
+ if (_specialChars) _addParser(_encodeSpecialChars);
312
+ if (_encoding) _addParser(_encodeKeywords);
313
+
314
+ // go!
315
+ return _pack(_script);
316
+ };
@@ -0,0 +1,19 @@
1
+ importPackage(java.io);
2
+
3
+ function writeFile( file, stream ) {
4
+ var buffer = new PrintWriter( new FileWriter( file ) );
5
+ buffer.print( stream );
6
+ buffer.close();
7
+ }
8
+
9
+ function read( file ) {
10
+ var jq = new File(file);
11
+ var reader = new BufferedReader(new FileReader(jq));
12
+ var line = null;
13
+ var buffer = new java.lang.StringBuffer(jq.length());
14
+ while( (line = reader.readLine()) != null) {
15
+ buffer.append(line);
16
+ buffer.append("\n");
17
+ }
18
+ return buffer.toString();
19
+ }
@@ -0,0 +1,26 @@
1
+ <project name="tablesorter" default="default" basedir=".">
2
+
3
+ <!-- SETUP -->
4
+ <property description="Files for parsing etc." name="BUILD_DIR" value="build" />
5
+ <property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" />
6
+
7
+ <!-- Files names for distribution -->
8
+ <property name="TS" value="jquery.tablesorter.js" />
9
+ <property name="TS_MIN" value="jquery.tablesorter.min.js" />
10
+
11
+ <!-- MAIN -->
12
+ <target name="min">
13
+ <echo message="Building ${TS_MIN}" />
14
+ <java jar="${JAR}" fork="true">
15
+ <arg value="${BUILD_DIR}/min.js" />
16
+ <arg value="${TS}" />
17
+ <arg value="${TS_MIN}" />
18
+ </java>
19
+ <echo message="${TS_MIN} built." />
20
+ </target>
21
+
22
+ <target name="default">
23
+ <antcall target="min"/>
24
+ </target>
25
+
26
+ </project>