ninjs 0.13.7 → 0.13.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. data/.bundle/config +2 -0
  2. data/CNAME +1 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +36 -0
  5. data/LICENSE +29 -0
  6. data/README.md +348 -0
  7. data/VERSION +1 -1
  8. data/bin/ninjs +211 -0
  9. data/lib/ninjs.rb +10 -0
  10. data/lib/ninjs/command.rb +88 -0
  11. data/lib/ninjs/configuration.rb +82 -0
  12. data/lib/ninjs/dependencies.rb +16 -0
  13. data/lib/ninjs/generator.rb +57 -0
  14. data/lib/ninjs/helpers.rb +17 -0
  15. data/lib/ninjs/manifest.rb +9 -0
  16. data/lib/ninjs/notification.rb +37 -0
  17. data/lib/ninjs/project.rb +214 -0
  18. data/ninjs.gemspec +294 -5
  19. data/repository/jquery/1.1.4.js +2508 -0
  20. data/repository/jquery/1.2.6.js +32 -0
  21. data/repository/jquery/1.3.2.js +19 -0
  22. data/repository/jquery/1.4.2.js +154 -0
  23. data/repository/jquery/1.4.3.js +166 -0
  24. data/repository/jquery/1.4.4.js +167 -0
  25. data/repository/jquery/1.5.js +16 -0
  26. data/repository/jquery/fancybox/1.3.1.js +1079 -0
  27. data/repository/jquery/fancybox/assets/1.3.1/css/fancybox.css +363 -0
  28. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/blank.gif +0 -0
  29. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_close.png +0 -0
  30. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_loading.png +0 -0
  31. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_left.png +0 -0
  32. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_right.png +0 -0
  33. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_e.png +0 -0
  34. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_n.png +0 -0
  35. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_ne.png +0 -0
  36. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_nw.png +0 -0
  37. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_s.png +0 -0
  38. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_se.png +0 -0
  39. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_sw.png +0 -0
  40. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_w.png +0 -0
  41. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_left.png +0 -0
  42. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_main.png +0 -0
  43. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_over.png +0 -0
  44. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_right.png +0 -0
  45. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-x.png +0 -0
  46. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-y.png +0 -0
  47. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox.png +0 -0
  48. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/jquery.easing-1.3.pack.js +72 -0
  49. data/repository/jquery/fancybox/latest.js +1 -0
  50. data/repository/jquery/latest.js +1 -0
  51. data/repository/jquery/mobile/1.0a3.js +123 -0
  52. data/repository/jquery/mobile/1.0a3/assets/css/jquery.mobile.css +1652 -0
  53. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/ajax-loader.png +0 -0
  54. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-off.png +0 -0
  55. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-check-on.png +0 -0
  56. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-off.png +0 -0
  57. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/form-radio-on.png +0 -0
  58. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icon-search-black.png +0 -0
  59. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-black.png +0 -0
  60. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-18-white.png +0 -0
  61. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-black.png +0 -0
  62. data/repository/jquery/mobile/1.0a3/assets/images/jquerymobile/icons-36-white.png +0 -0
  63. data/repository/jquery/mobile/latest.js +1 -0
  64. data/repository/jquery/mousewheel/3.0.2.js +11 -0
  65. data/repository/jquery/mousewheel/latest.js +1 -0
  66. data/repository/jquery/ui/1.8.7.js +783 -0
  67. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.accordion.css +19 -0
  68. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.all.css +11 -0
  69. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.autocomplete.css +53 -0
  70. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.base.css +11 -0
  71. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.button.css +38 -0
  72. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.core.css +41 -0
  73. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.datepicker.css +68 -0
  74. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.dialog.css +21 -0
  75. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.progressbar.css +11 -0
  76. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.resizable.css +20 -0
  77. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.selectable.css +10 -0
  78. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.slider.css +24 -0
  79. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.tabs.css +18 -0
  80. data/repository/jquery/ui/assets/1.8.7/css/jqueryui/jquery.ui.theme.css +252 -0
  81. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  82. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  83. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  84. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  85. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_dadada_1x400.png +0 -0
  86. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  87. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  88. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  89. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_222222_256x240.png +0 -0
  90. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_2e83ff_256x240.png +0 -0
  91. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_454545_256x240.png +0 -0
  92. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_888888_256x240.png +0 -0
  93. data/repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_cd0a0a_256x240.png +0 -0
  94. data/repository/jquery/ui/latest.js +1 -0
  95. data/repository/json2.js +482 -0
  96. data/repository/modernizr/1.5.js +28 -0
  97. data/repository/modernizr/latest.js +1 -0
  98. data/repository/ninjs/core/.core.pdoc.yaml +0 -0
  99. data/repository/ninjs/core/.existence.pdoc.yaml +12 -0
  100. data/repository/ninjs/core/.extend.pdoc.yaml +0 -0
  101. data/repository/ninjs/core/.nin.pdoc.yaml +0 -0
  102. data/repository/ninjs/core/application.js +47 -0
  103. data/repository/ninjs/core/existence.js +277 -0
  104. data/repository/ninjs/core/extend.js +77 -0
  105. data/repository/ninjs/core/module.js +135 -0
  106. data/repository/ninjs/core/nin.js +4 -0
  107. data/repository/ninjs/docs/Data/ClassHierarchy.nd +0 -0
  108. data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
  109. data/repository/ninjs/docs/Data/FileInfo.nd +16 -0
  110. data/repository/ninjs/docs/Data/ImageFileInfo.nd +0 -0
  111. data/repository/ninjs/docs/Data/ImageReferenceTable.nd +0 -0
  112. data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
  113. data/repository/ninjs/docs/Data/PreviousMenuState.nd +0 -0
  114. data/repository/ninjs/docs/Data/PreviousSettings.nd +0 -0
  115. data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
  116. data/repository/ninjs/docs/Languages.txt +113 -0
  117. data/repository/ninjs/docs/Menu.txt +63 -0
  118. data/repository/ninjs/docs/Topics.txt +81 -0
  119. data/repository/ninjs/docs/files/core/application-js.html +44 -0
  120. data/repository/ninjs/docs/files/core/existence-js.html +60 -0
  121. data/repository/ninjs/docs/files/core/extend-js.html +55 -0
  122. data/repository/ninjs/docs/files/core/module-js.html +80 -0
  123. data/repository/ninjs/docs/files/core/nin-js.html +38 -0
  124. data/repository/ninjs/docs/index.html +1 -0
  125. data/repository/ninjs/docs/index/Classes.html +33 -0
  126. data/repository/ninjs/docs/index/Files.html +45 -0
  127. data/repository/ninjs/docs/index/Functions.html +65 -0
  128. data/repository/ninjs/docs/index/General.html +85 -0
  129. data/repository/ninjs/docs/index/Variables.html +45 -0
  130. data/repository/ninjs/docs/javascript/main.js +841 -0
  131. data/repository/ninjs/docs/javascript/prettify.js +1526 -0
  132. data/repository/ninjs/docs/javascript/searchdata.js +152 -0
  133. data/repository/ninjs/docs/search/ClassesN.html +20 -0
  134. data/repository/ninjs/docs/search/FilesA.html +20 -0
  135. data/repository/ninjs/docs/search/FilesE.html +20 -0
  136. data/repository/ninjs/docs/search/FilesM.html +20 -0
  137. data/repository/ninjs/docs/search/FilesN.html +20 -0
  138. data/repository/ninjs/docs/search/FunctionsA.html +20 -0
  139. data/repository/ninjs/docs/search/FunctionsC.html +20 -0
  140. data/repository/ninjs/docs/search/FunctionsE.html +20 -0
  141. data/repository/ninjs/docs/search/FunctionsI.html +20 -0
  142. data/repository/ninjs/docs/search/FunctionsM.html +20 -0
  143. data/repository/ninjs/docs/search/FunctionsR.html +20 -0
  144. data/repository/ninjs/docs/search/FunctionsS.html +20 -0
  145. data/repository/ninjs/docs/search/FunctionsSymbols.html +20 -0
  146. data/repository/ninjs/docs/search/FunctionsU.html +20 -0
  147. data/repository/ninjs/docs/search/GeneralA.html +20 -0
  148. data/repository/ninjs/docs/search/GeneralC.html +20 -0
  149. data/repository/ninjs/docs/search/GeneralD.html +20 -0
  150. data/repository/ninjs/docs/search/GeneralE.html +20 -0
  151. data/repository/ninjs/docs/search/GeneralF.html +20 -0
  152. data/repository/ninjs/docs/search/GeneralI.html +20 -0
  153. data/repository/ninjs/docs/search/GeneralM.html +20 -0
  154. data/repository/ninjs/docs/search/GeneralN.html +20 -0
  155. data/repository/ninjs/docs/search/GeneralR.html +20 -0
  156. data/repository/ninjs/docs/search/GeneralS.html +20 -0
  157. data/repository/ninjs/docs/search/GeneralSymbols.html +20 -0
  158. data/repository/ninjs/docs/search/GeneralT.html +20 -0
  159. data/repository/ninjs/docs/search/GeneralU.html +20 -0
  160. data/repository/ninjs/docs/search/GeneralV.html +20 -0
  161. data/repository/ninjs/docs/search/NoResults.html +15 -0
  162. data/repository/ninjs/docs/search/VariablesD.html +20 -0
  163. data/repository/ninjs/docs/search/VariablesN.html +20 -0
  164. data/repository/ninjs/docs/search/VariablesR.html +20 -0
  165. data/repository/ninjs/docs/search/VariablesT.html +20 -0
  166. data/repository/ninjs/docs/styles/main.css +828 -0
  167. data/repository/ninjs/extensions/jquery.elements.js +60 -0
  168. data/repository/ninjs/tests/index.html +21 -0
  169. data/repository/ninjs/tests/ninjs.test.js +188 -0
  170. data/repository/ninjs/tests/ninjs.utilities.test.js +137 -0
  171. data/repository/ninjs/tests/qunit/qunit.css +197 -0
  172. data/repository/ninjs/tests/qunit/qunit.js +1415 -0
  173. data/repository/ninjs/utilities/all.js +5 -0
  174. data/repository/ninjs/utilities/array.js +29 -0
  175. data/repository/ninjs/utilities/cookie.js +0 -0
  176. data/repository/ninjs/utilities/css.js +51 -0
  177. data/repository/ninjs/utilities/number.js +11 -0
  178. data/repository/ninjs/utilities/string.js +61 -0
  179. data/repository/nullconsole.js +7 -0
  180. data/repository/qunit/assets/css/qunit.css +196 -0
  181. data/repository/qunit/qunit.js +1374 -0
  182. data/repository/selectivizr/1.0.js +5 -0
  183. data/repository/selectivizr/latest.js +1 -0
  184. data/repository/syntaxhighlighter/all.js +11 -0
  185. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCore.css +226 -0
  186. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDefault.css +328 -0
  187. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDjango.css +331 -0
  188. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEclipse.css +339 -0
  189. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEmacs.css +324 -0
  190. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  191. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMDUltra.css +324 -0
  192. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMidnight.css +324 -0
  193. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreRDark.css +324 -0
  194. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDefault.css +117 -0
  195. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDjango.css +120 -0
  196. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEclipse.css +128 -0
  197. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEmacs.css +113 -0
  198. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  199. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMDUltra.css +113 -0
  200. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMidnight.css +113 -0
  201. data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeRDark.css +113 -0
  202. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCore.scss +216 -0
  203. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDefault.scss +2 -0
  204. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDjango.scss +2 -0
  205. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEclipse.scss +2 -0
  206. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEmacs.scss +2 -0
  207. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreFadeToGrey.scss +2 -0
  208. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMDUltra.scss +2 -0
  209. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMidnight.scss +2 -0
  210. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreRDark.scss +2 -0
  211. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDefault.scss +7 -0
  212. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDjango.scss +36 -0
  213. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEclipse.scss +48 -0
  214. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEmacs.scss +32 -0
  215. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeFadeToGrey.scss +36 -0
  216. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMDUltra.scss +32 -0
  217. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMidnight.scss +32 -0
  218. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeRDark.scss +32 -0
  219. data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_theme_template.scss +120 -0
  220. data/repository/syntaxhighlighter/shAutoloader.js +17 -0
  221. data/repository/syntaxhighlighter/shBrushAS3.js +59 -0
  222. data/repository/syntaxhighlighter/shBrushAppleScript.js +75 -0
  223. data/repository/syntaxhighlighter/shBrushBash.js +59 -0
  224. data/repository/syntaxhighlighter/shBrushCSharp.js +65 -0
  225. data/repository/syntaxhighlighter/shBrushColdFusion.js +100 -0
  226. data/repository/syntaxhighlighter/shBrushCpp.js +97 -0
  227. data/repository/syntaxhighlighter/shBrushCss.js +91 -0
  228. data/repository/syntaxhighlighter/shBrushDelphi.js +55 -0
  229. data/repository/syntaxhighlighter/shBrushDiff.js +41 -0
  230. data/repository/syntaxhighlighter/shBrushErlang.js +52 -0
  231. data/repository/syntaxhighlighter/shBrushGroovy.js +67 -0
  232. data/repository/syntaxhighlighter/shBrushJScript.js +52 -0
  233. data/repository/syntaxhighlighter/shBrushJava.js +57 -0
  234. data/repository/syntaxhighlighter/shBrushJavaFX.js +58 -0
  235. data/repository/syntaxhighlighter/shBrushPerl.js +72 -0
  236. data/repository/syntaxhighlighter/shBrushPhp.js +88 -0
  237. data/repository/syntaxhighlighter/shBrushPlain.js +33 -0
  238. data/repository/syntaxhighlighter/shBrushPowerShell.js +74 -0
  239. data/repository/syntaxhighlighter/shBrushPython.js +64 -0
  240. data/repository/syntaxhighlighter/shBrushRuby.js +55 -0
  241. data/repository/syntaxhighlighter/shBrushSass.js +94 -0
  242. data/repository/syntaxhighlighter/shBrushScala.js +51 -0
  243. data/repository/syntaxhighlighter/shBrushSql.js +66 -0
  244. data/repository/syntaxhighlighter/shBrushVb.js +56 -0
  245. data/repository/syntaxhighlighter/shBrushXml.js +69 -0
  246. data/repository/syntaxhighlighter/shCore.js +17 -0
  247. data/repository/syntaxhighlighter/shLegacy.js +17 -0
  248. data/spec/command_spec.rb +9 -0
  249. data/spec/configuration_spec.rb +70 -0
  250. data/spec/dependencies_spec.rb +27 -0
  251. data/spec/fixtures/autoload.js +3 -0
  252. data/spec/fixtures/changed.ninjs.conf +6 -0
  253. data/spec/fixtures/compressed.myapp.js +39 -0
  254. data/spec/fixtures/core.js +6 -0
  255. data/spec/fixtures/dependencies.js +3 -0
  256. data/spec/fixtures/foo.elements.js +3 -0
  257. data/spec/fixtures/foo.js +17 -0
  258. data/spec/fixtures/foo.model.js +3 -0
  259. data/spec/fixtures/foo.module.js +13 -0
  260. data/spec/fixtures/hello.elements.js +3 -0
  261. data/spec/fixtures/hello.js +17 -0
  262. data/spec/fixtures/hello.model.js +3 -0
  263. data/spec/fixtures/hello.module.js +13 -0
  264. data/spec/fixtures/myapp.initial.js +535 -0
  265. data/spec/fixtures/myapp.js +710 -0
  266. data/spec/fixtures/new.ninjs.conf +6 -0
  267. data/spec/fixtures/ninjs.conf +6 -0
  268. data/spec/generator_spec.rb +34 -0
  269. data/spec/helpers_spec.rb +11 -0
  270. data/spec/manifest_spec.rb +8 -0
  271. data/spec/ninjs_spec.rb +20 -0
  272. data/spec/notification_spec.rb +27 -0
  273. data/spec/project_spec.rb +239 -0
  274. data/spec/spec_helper.rb +29 -0
  275. metadata +294 -50
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_DISABLE_SHARED_GEMS: "1"
data/CNAME ADDED
@@ -0,0 +1 @@
1
+ ninjs.info
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "fssm", ">= 0"
4
+ gem "jsmin", ">= 0"
5
+ gem "sprockets", "1.0.2"
6
+
7
+ group :development do
8
+ gem "shoulda", ">= 0"
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.5.2"
11
+ gem "rcov", ">= 0"
12
+ gem "rspec", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,36 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ fssm (0.2.2)
6
+ git (1.2.5)
7
+ jeweler (1.5.2)
8
+ bundler (~> 1.0.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ jsmin (1.0.1)
12
+ rake (0.8.7)
13
+ rcov (0.9.9)
14
+ rspec (2.4.0)
15
+ rspec-core (~> 2.4.0)
16
+ rspec-expectations (~> 2.4.0)
17
+ rspec-mocks (~> 2.4.0)
18
+ rspec-core (2.4.0)
19
+ rspec-expectations (2.4.0)
20
+ diff-lcs (~> 1.1.2)
21
+ rspec-mocks (2.4.0)
22
+ shoulda (2.11.3)
23
+ sprockets (1.0.2)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.0.0)
30
+ fssm
31
+ jeweler (~> 1.5.2)
32
+ jsmin
33
+ rcov
34
+ rspec
35
+ shoulda
36
+ sprockets (= 1.0.2)
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ Copyright (c) 2010-2011 Dayton D. Nolan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+ No attribution is required by products that make use of this software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ Except as contained in this notice, the name(s) of the above copyright
24
+ holders shall not be used in advertising or otherwise to promote the sale,
25
+ use or other dealings in this Software without prior written authorization.
26
+
27
+ Contributors to this project agree to grant all rights to the copyright
28
+ holder of the primary product. Attribution is maintained in the source
29
+ control history of the product.
data/README.md ADDED
@@ -0,0 +1,348 @@
1
+ Readme
2
+ ======
3
+
4
+ About
5
+ -----
6
+
7
+ ninjs is a new way of building JavaScript applications that allows you to write modular, testable, and reusable JavaScript. ninjs is not really a framework. It provides three essential JavaScript development tools in one coherent package.
8
+
9
+ 1. ninjs uses the "Sprockets" (http://getsprockets.org) JavaScript compiler to package and include scripts. This provides a way to manage all 3rd party and custom libraries and require them directly in your scripts.
10
+ 2. ninjs includes a small JavaScript framework, based on the module pattern (http://javascript.crockford.com/private.html) and "JavaScript: The Good Parts" (http://www.amazon.com/gp/product/B0026OR2ZY/ref=s9_bbs_gw_d6_ir01?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0HQ3A0RDW9269GPJRGW8&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846), which provides a solid foundation for any JavaScript application.
11
+ 3. The "ninjs" command line application eases the pain of repetitive tasks like compiling, scaffolding, and updating your application.
12
+
13
+ ninjs is written in Ruby (http://ruby-lang.org) and packaged as a Ruby gem (http://rubygems.org). However, it is not specific to Ruby or Rails development. While it certainly is usable in Rails or Ruby based projects, it is not designed for any one particular language or framework.
14
+
15
+ Installation
16
+ ------------
17
+
18
+ You will need Ruby (1.8.x or 1.9.x) and RubyGems installed on your system to install ninjs using RubyGems. This is the easiest way of installing and recommended for most users.
19
+
20
+ ```sh
21
+ gem install ninjs
22
+ ```
23
+
24
+ For development, clone the project and add bin/ninjs to your path (or my favorite trick which is to put it in my development folder and make symbolic link in /usr/local/bin or wherever you put your scripts):
25
+
26
+ ```sh
27
+ git clone git://github.com/textnotspeech/ninjs.git
28
+ ln -s ninjs/bin/ninjs /usr/local/bin/ninjs
29
+ ```
30
+
31
+ Using the Command Line Application
32
+ ==================================
33
+
34
+ The ninjs command line application is a simple way to quickly develop and manage your application. With it you can create an application, generate scaffolding, compile, and upgrade your application.
35
+
36
+ Create a ninjs application
37
+ ==========================
38
+
39
+ The first ninjs command you'll need is the "create" command. As it's name implies, this command creates a brand new ninjs application template, creating the necessary files and directories. The create command accepts two arguments. The first argument is the name of your application object which is required. The second argument, which is optional, is a sub directory in which to install the application. For example, from the root of your project, you may wish to put your application in a "js" or "javascripts" directory (creating the directory if it does not exist). Omitting the directory option will create the application in your current working directory. Here is an example of creating a ninjs application in a sub directory named "js" in the current working directory:
40
+
41
+ ```sh
42
+ ninjs create myapplication js
43
+ ```
44
+
45
+ This will create a ninjs application in a directory named "js" in the current working directory. Now we can begin developing our application.
46
+
47
+ Create a ninjs module
48
+ =====================
49
+
50
+ Using the generate command we can create a module scafoold. The generate command takes two arguments, the first is the type of file you'd like to generate (module, elements, or model) and the second is the name of the file/module the scaffold is for. Here's some examples of using the generate command with a module named hello:
51
+
52
+ ```sh
53
+ ninjs generate module hello
54
+ ninjs generate elements hello
55
+ ninjs generate model hello
56
+ ```
57
+
58
+ If you'd like to generate a module with elements and a model all in one go you can pass the -e and -m flags respectively:
59
+
60
+ ```sh
61
+ ninjs generate module hello -em
62
+ ````
63
+
64
+ Although the generate method is very convenient, you may choose to create a module file manually in the /modules directory. By convention the file name ends with a suffix of .module. An example of a module named hello would look like this:
65
+
66
+ ```sh
67
+ /modules/hello.module.js
68
+ ```
69
+
70
+ The basic functionality of a module is to encapsulate specific pieces of logic into a namespace. You may think of a module as a class in the sense that it allows you to namespace properties and behavior within your application. Typically, a module encapsulates the behavior on a specific page. A ninjs module is an extremely lightweight object with a simple API which helps you write clear, concise code. Here's what an empty module scaffold looks like (generated with ninjs generate model hello -em):
71
+
72
+ ```js
73
+ (function() {
74
+ var self = myapplication.add_module('hello');
75
+
76
+ //= require "../models/hello.model"
77
+ //= require "../elements/hello.elements"
78
+
79
+ myapplication.hello.actions = function() {
80
+
81
+ };
82
+
83
+ myapplication.hello.run();
84
+ })();
85
+ ```
86
+
87
+ Notice the module is wrapped in a closure. This allows us to make a private reference to the current module named "self" due to the fact that the add_module method returns the module it creates. This gives us a consistent way to reference the module without having to use the entire namespace. We may also decide to put private variables and functions available to the module but not exposed to the rest of the application.
88
+
89
+ The actions method is the main method of your module. Also known as the composed method pattern, the actions method should simply be a list of other module methods. This makes it easy to scan the actions method to get a sense of what a given module does. It also encourages the "single responsibility principle" (http://en.wikipedia.org/wiki/Single_responsibility_principle).
90
+
91
+ The run method will execute the actions method when the DOM is ready to be manipulated. This is similar to jQuery's $(document).ready() method. If you wish to execute your modules actions as soon as the script is parsed you may call the execute method instead of run:
92
+
93
+ ```js
94
+ myapplication.hello.execute();
95
+ ```
96
+
97
+ This pattern allows you to write in a literate style, making your intentions clear and methods succinct. It's idiomatic to use the module namespace (instead of using self) when defining your module methods to enhance clarity. Another advantage of wrapping your modules in a closure is that you may choose to define an alias for your application object which makes it easier to type while avoiding creation of another global variable. To do this, simply pass in the application object as an argument to the outer function and then name the alias in the argument to the closure like so:
98
+
99
+ ```js
100
+ (function(app) {
101
+
102
+ var self = app.add_module('hello');
103
+
104
+ app.hello.actions = function() {
105
+
106
+ };
107
+
108
+ app.hello.run();
109
+
110
+ })(myapplication);
111
+ ```
112
+
113
+ You can also generate a scaffold with an alias using the -a option of the generate command. The previous example can be generated like so:
114
+
115
+ ```sh
116
+ ninjs generate module hello -a
117
+ ```
118
+
119
+ By default, the alias option will use "app" as the alias. To create a custom alias simply pass the name after the -a option like so:
120
+
121
+ ```sh
122
+ ninjs generate module hello -a myalias
123
+ ```
124
+
125
+ This will generate a file using an alias defined as "myalias". This is simply a convenience and a bit of syntactic sugar, although there are practical benefits to this as well. For example using this pattern, any module can be ported to another application simply by swapping out the application object passed to the closure.
126
+
127
+ Let's take a closer look at the "actions" composed method pattern. Let's define a simple module which demonstrates this:
128
+
129
+ ```js
130
+ (function() {
131
+ var self = myapplication.add_module('hello');
132
+
133
+ myapplication.hello.actions = function() {
134
+ self.set_defaults();
135
+ self.say_hello();
136
+ };
137
+
138
+ myapplication.hello.set_defaults = function() {
139
+ self.greeting = 'Hello';
140
+ self.guest = 'World';
141
+ };
142
+
143
+ myapplication.hello.say_hello = function() {
144
+ alert(self.get_greeting());
145
+ };
146
+
147
+ myapplication.get_greeting = function() {
148
+ return self.greeting + ' ' + self.guest + '!';
149
+ };
150
+
151
+ myapplication.hello.run();
152
+ })();
153
+ ```
154
+
155
+ Although the complexity of this module is contrived, we can easily see what this module does simply by glancing at the actions method. This will make your application logic easier to write, understand, modify, and test
156
+
157
+ Create module elements
158
+ ======================
159
+
160
+ Another common best practice that ninjs encourages is cacheing your element selectors. For example, when using jQuery to select a DOM element, it's typical to assign the result of the selection to a variable in case you need it again. Here's what this looks like in practice:
161
+
162
+ ```js
163
+ // Bad no-caching
164
+ $('#some-element').css({ 'background-color': '#FF0000' });
165
+ $('#some-element').html("I turned red");
166
+
167
+ // Good caching
168
+ var some_element = $('#some-element');
169
+
170
+ some_element.css({ 'background-color': '#FF0000' });
171
+ some_element.html("I turned red");
172
+ ```
173
+
174
+ When we cache our selections, we only have to search the DOM once, improving performance.
175
+
176
+ The only problem with this is that we tend to manipulate a lot of elements and our code can become littered with them. At worst, they're strewn about the file wherever they are used, making it easy to accidentally re-assign them. At best, all selections are cached in one place and easy to see, which prevents us from accidentally caching them twice but it becomes a fair amount of boilerplate that crufts up the file. ninjs goes a step further by putting these cached selectors in their own file in the elements folder. This gives us one place to manage all the cached selectors available to our module.
177
+
178
+ Elements belong to a module and can be added using the elements method. To add elements to the hello module, let's add a hello.elements.js with the generate command:
179
+
180
+ ```sh
181
+ ninjs generate elements hello
182
+ ```
183
+
184
+ This will create a hello.elements.js file inside the elements directory. The elements scaffold looks like this:
185
+
186
+ ```js
187
+ myapplication.hello.elements({
188
+
189
+ });
190
+ ```
191
+
192
+ The elements method facilitates both setting and getting cached elements (violating the single responsibility principle for convenience). When passed an object, the elements method maps the key/value pairs of name/selector to the modules dom object. When passed a string, the elements method pulls the selector via it's name. To set a module's elements, pass an object of key value pairs like so:
193
+
194
+ ```js
195
+ myapplication.hello.elements({
196
+ message_box: $('#message-box')
197
+ });
198
+ ```
199
+
200
+ Now these cached jQuery selectors will be available via the elements command by passing it's name into the method like so:
201
+
202
+ ```js
203
+ myapplication.hello.some_method = function() {
204
+ self.elements('message_box');
205
+ };
206
+ ```
207
+
208
+ This pattern provides a consistent way to access and create elements and also creates an opportunity to add logic to the process (as in the ninjs.jquery.elements.js plugin). That's all there is to creating module elements. Now we require the file in the module using the "Sprockets require directive" (http://getsprockets.org/installation_and_usage#specifying_dependencies_with_the_require_directive) in hello.module.js.
209
+
210
+ ```js
211
+ (function() {
212
+ var self = myapplication.add_module('hello');
213
+
214
+ //= require "../elements/hello.elements"
215
+
216
+ ...
217
+ })();
218
+ ```
219
+
220
+ Be sure to require the elements file after the "add_module" method is called. Now all elements defined in the elements method will be available to the module. Let's take our hello example and instead of alerting the greeting, let's put it in the message_box element (assuming an html page containing this element):
221
+
222
+ ```js
223
+ ...
224
+
225
+ myapplication.hello.say_hello = function() {
226
+ self.elements('message_box').html(self.get_greeting());
227
+ };
228
+
229
+ ...
230
+ ```
231
+
232
+ Again, this pattern keeps the logic very clear and our code very concise. It's easy to read, test, and refactor. With time, you'll develop your own naming conventions and standards. The important thing is to focus on good semantic names that accurately describe the properties and behavior of your application.
233
+
234
+ Most modules will be exactly like the one we just created, only with more methods. However, there is one more piece that helps you achieve greater modularity, which is ninjs models.
235
+
236
+ Create a ninjs model
237
+ ====================
238
+
239
+ ninjs models are simply files in the /models directory that define a data structure for the module. Every module has a data object that stores properties for reuse or configuration.
240
+
241
+ Let's suppose I have a plugin that I want to use in my module. The plugin takes a configuration object, but I want to be able to set a default configuration for my module. I'll use the generate command to create a model:
242
+
243
+ ```sh
244
+ ninjs generate model hello
245
+ ```
246
+
247
+ This will create an empty model scaffold that looks like this:
248
+
249
+ ```js
250
+ myapplication.hello.set_data({
251
+
252
+ });
253
+ ```
254
+
255
+ The set_data method takes either an object or a string as the first argument. When an object is used as the first argument, the key value pairs contained in the object will be copied to the module's "data" object. When a string is used, the first argument is a string representing the name of the property to assign and the second is the value to assign to that property. Using the string method, we could define a configuration object for the plugin like so:
256
+
257
+ ```js
258
+ myapplication.hello.set_data('plugin_config', {
259
+ width: 300,
260
+ height: 250
261
+ });
262
+ ```
263
+
264
+ If we wish to set several properties at once we can use just an object as the first argument:
265
+
266
+ ```js
267
+ myapplication.hello.set_data({
268
+ plugin_config: {
269
+ width: 300,
270
+ height: 250
271
+ },
272
+ another_property: 'some value'
273
+ });
274
+ ```
275
+
276
+ Next we include the model in the module file:
277
+
278
+ ```js
279
+ (function() {
280
+ var self = myapplication.add_module('hello');
281
+
282
+ //= require "../elements/hello.model.js"
283
+ //= require "../elements/hello.elements"
284
+
285
+ ...
286
+ })();
287
+ ```
288
+
289
+ Now whenever I use the plugin in my module, I can mix in the config object like so:
290
+
291
+ ```js
292
+ ...
293
+
294
+ myapplication.hello.setup_plugin = function() {
295
+ self.some_element.some_plugin(self.data.plugin_config);
296
+ self.another_element.some_plugin(self.data.plugin_config);
297
+ };
298
+
299
+ ...
300
+ ```
301
+
302
+ This way, we don't have to keep redefining the same properties each time we use this plugin. If we want to extend the defaults, we can use something like jQuery's extend method:
303
+
304
+ ```js
305
+ ...
306
+
307
+ myapplication.hello.setup_plugin = function() {
308
+ self.some_element.some_plugin(self.data.plugin_config);
309
+ self.another_element.some_plugin($.extend(self.data.plugin_config, {
310
+ height: 300,
311
+ color: #FF0000
312
+ }));
313
+ };
314
+
315
+ ...
316
+ ```
317
+
318
+ The model provides a foundation we can build from, helping use to keep our code DRY.
319
+
320
+ Compiling the application
321
+ =========================
322
+
323
+ Now that we have a complete module including elements and a model, we need to compile these into one coherent file to use in our html. To do so, we have 2 options. Open up a terminal and navigate to the root of your ninjs application. We can compile our application with one of 2 commands. The first choice is the compile command. From the root of your ninjs application type:
324
+
325
+ ```sh
326
+ ninjs compile
327
+ ```
328
+
329
+ This will compile all the files in the modules folder, resolving all dependencies using the Sprockets engine, and finally outputting them into the /application directory with the .module suffix removed. Our hello example module would compile into the application folder as hello.js. Now we can include the hello.js file (along with the myapplication.js) in our html document. Since running compile every time we make a change to any one of our module source files would quickly become a tedious chore, ninjs also has a watch command which will watch your project directory for changes and automatically compile when a file is changed. This speeds up development considerably and frankly makes ninjs usable in a daily development context. To watch a ninjs project simply navigate to the project root and issue the watch command:
330
+
331
+ ```sh
332
+ ninjs watch
333
+ ```
334
+
335
+ That's it! you've created a basic ninjs application! The only step left is to include the compiled script files in our markup:
336
+
337
+ ```html
338
+ <!DOCTYPE html>
339
+ <head>
340
+ <title>ninjs Demo</title>
341
+ </head>
342
+ <body>
343
+ <script src="js/application/myapplication.js"></script>
344
+ <script src="js/application/hello.js"></script>
345
+ </body>
346
+ </html>
347
+ ...
348
+ ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.7
1
+ 0.13.8
data/bin/ninjs ADDED
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
4
+
5
+ begin
6
+ require 'ninjs'
7
+ require 'optparse'
8
+ rescue LoadError
9
+ require 'rubygems'
10
+ require 'ninjs'
11
+ require 'optparse'
12
+ end
13
+
14
+ create = <<-CREATE
15
+ create Creates a new ninjs application in the current working
16
+ directory or sub directory within.
17
+
18
+ Arguments:
19
+ application name - Name of the ninjs application
20
+ subdirectory* - Directory where the application will be
21
+ installed (created if non existent)
22
+
23
+ examples:
24
+ ninjs create myapp
25
+ ninjs create myapp subdirectory
26
+ CREATE
27
+
28
+ generate = <<-GEN
29
+ generate Generates scoffolding for the given component file type.
30
+
31
+ Arguments:
32
+ type - Type of application scaffold to create (module, elements, model).
33
+ name* - Name of the module to generate the scaffold for
34
+
35
+ Options:
36
+ -a, --alias name* - Create an alias of the application object
37
+ (defaults to "app"), passing a name is optional
38
+ -e, --elements - Generate an elements file
39
+ -m, --model - Generate a model file
40
+
41
+ examples:
42
+ ninjs generate module mymodule -em (generates module, elements and model)
43
+ ninjs generate module mymodule -a (generates an application alias)
44
+ ninjs generate elements mymodule -m (generates an elements and a model file)
45
+ ninjs generate model mymodule (generates an model file)
46
+ GEN
47
+
48
+ compile = <<-COMP
49
+ compile Compiles the ninjs project in the current working directory.
50
+
51
+ Options:
52
+ -c, --compress - Compress output with JsMin
53
+
54
+ example:
55
+ ninjs compile
56
+ COMP
57
+
58
+ watch = <<-WATCH
59
+ watch Watches the current working directory for file changes and
60
+ compiles when changes are detected.
61
+
62
+ example:
63
+ ninjs watch
64
+ WATCH
65
+
66
+ upd = <<-UPDATE
67
+ update Updates your application's core files to the latest version.
68
+ UPDATE
69
+
70
+ footer = <<-FOOTER
71
+ * optional argument
72
+ FOOTER
73
+
74
+ help = {
75
+ :create => create,
76
+ :generate => generate,
77
+ :compile => compile,
78
+ :watch => watch,
79
+ :update => upd,
80
+ :footer => footer
81
+ }
82
+
83
+ command = ARGV[0]
84
+
85
+ options = {
86
+ :alias => false,
87
+ :elements => false,
88
+ :model => false,
89
+ :help => false,
90
+ :compress => nil
91
+ }
92
+
93
+ optparse = OptionParser.new do |opts|
94
+ opts.on( '-h', '--help', 'Display this screen' ) do
95
+ options[:help] = true
96
+ end
97
+
98
+ opts.on( '-v', '--version', 'Display the version') do
99
+ time = Time.now
100
+ puts Ninjs::Notification.notice 'ninjs ' + Ninjs::VERSION
101
+ puts Ninjs::Notification.notice "Copyright (c) #{time.year} Dayton Nolan"
102
+ puts Ninjs::Notification.notice "Released under the MIT License"
103
+ exit
104
+ end
105
+
106
+ opts.on( '-a', '--alias [alias]', 'Generate application alias') do |als|
107
+ options[:alias] = als || "app"
108
+ end
109
+
110
+ opts.on( '-d', '--dest [dest]', 'Module destination directory') do |dest|
111
+ options[:dest] = dest
112
+ end
113
+
114
+ opts.on('-e', '--elements', 'Generate elements file') do
115
+ options[:elements] = true
116
+ end
117
+
118
+ opts.on('-m', '--model', 'Generate model file') do
119
+ options[:model] = true
120
+ end
121
+
122
+ opts.on('-c', '--compress', 'Compress with JsMin') do
123
+ options[:compress] = true
124
+ end
125
+ end
126
+
127
+ optparse.parse!
128
+
129
+ case command
130
+ # create
131
+ when "create"
132
+ if options[:help]
133
+ puts help[:create]
134
+ exit
135
+ end
136
+ app_name = ARGV[1]
137
+ sub_dir = ARGV[2] || nil
138
+
139
+ if app_name.nil?
140
+ puts "Error! Application name is required (ninjs create app_name)"
141
+ exit
142
+ end
143
+
144
+ Ninjs::Command.create({ :name => app_name, :directory => sub_dir })
145
+ # generate
146
+ when "generate"
147
+ if options[:help]
148
+ puts help[:generate]
149
+ exit
150
+ end
151
+
152
+ errors = Hash.new
153
+ type = ARGV[1]
154
+ name = ARGV[2]
155
+ als = options[:alias] || nil
156
+ dest = options[:dest] || nil
157
+
158
+ errors[:type] = "Error! Scaffold type is required (ninjs generate module mymodule)" if type.nil?
159
+ errors[:name] = "Error! Module name is required (ninjs generate module mymodule)" if name.nil?
160
+
161
+ unless errors.empty?
162
+ errors.each do |error|
163
+ puts error
164
+ end
165
+ exit
166
+ end
167
+
168
+ dependencies = {
169
+ :model => options[:model],
170
+ :elements => options[:elements]
171
+ }
172
+
173
+ Ninjs::Command.generate({
174
+ :type => type,
175
+ :name => name,
176
+ :alias => als,
177
+ :dest => dest,
178
+ :dependencies => dependencies
179
+ })
180
+ # compile
181
+ when "compile"
182
+ if options[:help]
183
+ puts help[:compile]
184
+ exit
185
+ end
186
+
187
+ unless options[:compress].nil?
188
+ Ninjs::Command.compile(options[:compress])
189
+ else
190
+ Ninjs::Command.compile()
191
+ end
192
+ # watch
193
+ when "watch"
194
+ if options[:help]
195
+ puts help[:watch]
196
+ exit
197
+ end
198
+ Ninjs::Command.watch
199
+ # update
200
+ when "update"
201
+ if options[:help]
202
+ puts help[:update]
203
+ exit
204
+ end
205
+ Ninjs::Command.update
206
+ else
207
+ help.each do |section|
208
+ puts section.last + "\n"
209
+ end
210
+ exit
211
+ end