nucleon 0.2.2 → 0.2.3

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 (400) hide show
  1. checksums.yaml +7 -7
  2. data/.gitignore +50 -0
  3. data/ARCHITECTURE.rdoc +12 -11
  4. data/Gemfile +7 -11
  5. data/Gemfile.lock +47 -70
  6. data/Rakefile +22 -20
  7. data/TODO.rdoc +1 -1
  8. data/VERSION +1 -1
  9. data/bin/nucleon +16 -15
  10. data/lib/core/codes.rb +65 -38
  11. data/lib/core/config.rb +774 -153
  12. data/lib/core/config/collection.rb +134 -25
  13. data/lib/core/config/options.rb +160 -36
  14. data/lib/core/core.rb +207 -45
  15. data/lib/core/environment.rb +626 -206
  16. data/lib/core/facade.rb +211 -185
  17. data/lib/core/gems.rb +60 -44
  18. data/lib/core/manager.rb +587 -237
  19. data/lib/core/mixin/colors.rb +66 -36
  20. data/lib/core/mixin/config/collection.rb +58 -23
  21. data/lib/core/mixin/config/options.rb +67 -24
  22. data/lib/core/mixin/macro/object_interface.rb +129 -135
  23. data/lib/core/mixin/macro/plugin_interface.rb +118 -124
  24. data/lib/core/mixin/settings.rb +7 -13
  25. data/lib/core/mixin/sub_config.rb +37 -43
  26. data/lib/core/mod/hash.rb +31 -10
  27. data/lib/core/plugin/action.rb +274 -238
  28. data/lib/core/plugin/base.rb +140 -132
  29. data/lib/core/plugin/project.rb +316 -311
  30. data/lib/core/util/cli.rb +146 -146
  31. data/lib/core/util/console.rb +567 -124
  32. data/lib/core/util/data.rb +654 -139
  33. data/lib/core/util/logger.rb +255 -66
  34. data/lib/nucleon.rb +6 -8
  35. data/lib/nucleon_base.rb +364 -106
  36. data/nucleon.gemspec +40 -389
  37. data/spec/core/codes_spec.rb +209 -0
  38. data/spec/core/config_spec.rb +810 -0
  39. data/spec/core/core_spec.rb +185 -0
  40. data/spec/core/environment_spec.rb +148 -0
  41. data/spec/core/util/console_spec.rb +254 -446
  42. data/spec/nucleon/test.rb +59 -0
  43. data/spec/nucleon/test/first.rb +28 -0
  44. data/spec/nucleon/test/second.rb +28 -0
  45. data/spec/nucleon_codes.rb +98 -0
  46. data/spec/nucleon_config.rb +523 -0
  47. data/spec/nucleon_plugin.rb +439 -0
  48. data/spec/nucleon_test.rb +34 -0
  49. data/spec/spec_helper.rb +6 -4
  50. metadata +157 -615
  51. data/.document +0 -5
  52. data/rdoc/site/0.1.19/ARCHITECTURE_rdoc.html +0 -634
  53. data/rdoc/site/0.1.19/Hash.html +0 -347
  54. data/rdoc/site/0.1.19/Kernel.html +0 -413
  55. data/rdoc/site/0.1.19/Nucleon.html +0 -570
  56. data/rdoc/site/0.1.19/Nucleon/Action.html +0 -280
  57. data/rdoc/site/0.1.19/Nucleon/Action/Add.html +0 -458
  58. data/rdoc/site/0.1.19/Nucleon/Action/Create.html +0 -415
  59. data/rdoc/site/0.1.19/Nucleon/Action/Extract.html +0 -413
  60. data/rdoc/site/0.1.19/Nucleon/Action/Remove.html +0 -461
  61. data/rdoc/site/0.1.19/Nucleon/Action/Save.html +0 -434
  62. data/rdoc/site/0.1.19/Nucleon/Action/Update.html +0 -381
  63. data/rdoc/site/0.1.19/Nucleon/Codes.html +0 -563
  64. data/rdoc/site/0.1.19/Nucleon/Command.html +0 -275
  65. data/rdoc/site/0.1.19/Nucleon/Command/Bash.html +0 -544
  66. data/rdoc/site/0.1.19/Nucleon/Config.html +0 -1623
  67. data/rdoc/site/0.1.19/Nucleon/Config/Collection.html +0 -509
  68. data/rdoc/site/0.1.19/Nucleon/Config/Options.html +0 -489
  69. data/rdoc/site/0.1.19/Nucleon/Core.html +0 -635
  70. data/rdoc/site/0.1.19/Nucleon/Errors.html +0 -275
  71. data/rdoc/site/0.1.19/Nucleon/Errors/BatchError.html +0 -281
  72. data/rdoc/site/0.1.19/Nucleon/Errors/NucleonError.html +0 -657
  73. data/rdoc/site/0.1.19/Nucleon/Errors/SSHUnavailable.html +0 -281
  74. data/rdoc/site/0.1.19/Nucleon/Event.html +0 -275
  75. data/rdoc/site/0.1.19/Nucleon/Event/Regex.html +0 -467
  76. data/rdoc/site/0.1.19/Nucleon/Facade.html +0 -2336
  77. data/rdoc/site/0.1.19/Nucleon/Gems.html +0 -635
  78. data/rdoc/site/0.1.19/Nucleon/Manager.html +0 -1828
  79. data/rdoc/site/0.1.19/Nucleon/Mixin.html +0 -284
  80. data/rdoc/site/0.1.19/Nucleon/Mixin/Action.html +0 -277
  81. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Commit.html +0 -381
  82. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Project.html +0 -395
  83. data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Push.html +0 -371
  84. data/rdoc/site/0.1.19/Nucleon/Mixin/Colors.html +0 -545
  85. data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigCollection.html +0 -481
  86. data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigOptions.html +0 -449
  87. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro.html +0 -276
  88. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/ObjectInterface.html +0 -695
  89. data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/PluginInterface.html +0 -682
  90. data/rdoc/site/0.1.19/Nucleon/Mixin/Settings.html +0 -481
  91. data/rdoc/site/0.1.19/Nucleon/Mixin/SubConfig.html +0 -887
  92. data/rdoc/site/0.1.19/Nucleon/Parallel.html +0 -325
  93. data/rdoc/site/0.1.19/Nucleon/Parallel/ClassMethods.html +0 -325
  94. data/rdoc/site/0.1.19/Nucleon/Parallel/InstanceMethods.html +0 -334
  95. data/rdoc/site/0.1.19/Nucleon/Plugin.html +0 -282
  96. data/rdoc/site/0.1.19/Nucleon/Plugin/Action.html +0 -1368
  97. data/rdoc/site/0.1.19/Nucleon/Plugin/Action/Option.html +0 -459
  98. data/rdoc/site/0.1.19/Nucleon/Plugin/Base.html +0 -1737
  99. data/rdoc/site/0.1.19/Nucleon/Plugin/Command.html +0 -721
  100. data/rdoc/site/0.1.19/Nucleon/Plugin/Event.html +0 -442
  101. data/rdoc/site/0.1.19/Nucleon/Plugin/Extension.html +0 -281
  102. data/rdoc/site/0.1.19/Nucleon/Plugin/Project.html +0 -2864
  103. data/rdoc/site/0.1.19/Nucleon/Plugin/Template.html +0 -476
  104. data/rdoc/site/0.1.19/Nucleon/Plugin/Translator.html +0 -371
  105. data/rdoc/site/0.1.19/Nucleon/Project.html +0 -276
  106. data/rdoc/site/0.1.19/Nucleon/Project/Git.html +0 -1801
  107. data/rdoc/site/0.1.19/Nucleon/Project/Github.html +0 -549
  108. data/rdoc/site/0.1.19/Nucleon/Template.html +0 -277
  109. data/rdoc/site/0.1.19/Nucleon/Template/Json.html +0 -329
  110. data/rdoc/site/0.1.19/Nucleon/Template/Wrapper.html +0 -329
  111. data/rdoc/site/0.1.19/Nucleon/Template/Yaml.html +0 -329
  112. data/rdoc/site/0.1.19/Nucleon/Translator.html +0 -276
  113. data/rdoc/site/0.1.19/Nucleon/Translator/Json.html +0 -366
  114. data/rdoc/site/0.1.19/Nucleon/Translator/Yaml.html +0 -366
  115. data/rdoc/site/0.1.19/Nucleon/Util.html +0 -285
  116. data/rdoc/site/0.1.19/Nucleon/Util/CLI.html +0 -388
  117. data/rdoc/site/0.1.19/Nucleon/Util/CLI/Parser.html +0 -1183
  118. data/rdoc/site/0.1.19/Nucleon/Util/Cache.html +0 -780
  119. data/rdoc/site/0.1.19/Nucleon/Util/Console.html +0 -1294
  120. data/rdoc/site/0.1.19/Nucleon/Util/Data.html +0 -1399
  121. data/rdoc/site/0.1.19/Nucleon/Util/Disk.html +0 -522
  122. data/rdoc/site/0.1.19/Nucleon/Util/Git.html +0 -361
  123. data/rdoc/site/0.1.19/Nucleon/Util/Liquid.html +0 -365
  124. data/rdoc/site/0.1.19/Nucleon/Util/Logger.html +0 -806
  125. data/rdoc/site/0.1.19/Nucleon/Util/Package.html +0 -558
  126. data/rdoc/site/0.1.19/Nucleon/Util/SSH.html +0 -910
  127. data/rdoc/site/0.1.19/Nucleon/Util/SSH/Keypair.html +0 -453
  128. data/rdoc/site/0.1.19/Nucleon/Util/Shell.html +0 -686
  129. data/rdoc/site/0.1.19/Nucleon/Util/Shell/Result.html +0 -497
  130. data/rdoc/site/0.1.19/README_rdoc.html +0 -312
  131. data/rdoc/site/0.1.19/TODO_rdoc.html +0 -267
  132. data/rdoc/site/0.1.19/created.rid +0 -60
  133. data/rdoc/site/0.1.19/images/add.png +0 -0
  134. data/rdoc/site/0.1.19/images/brick.png +0 -0
  135. data/rdoc/site/0.1.19/images/brick_link.png +0 -0
  136. data/rdoc/site/0.1.19/images/bug.png +0 -0
  137. data/rdoc/site/0.1.19/images/bullet_black.png +0 -0
  138. data/rdoc/site/0.1.19/images/bullet_toggle_minus.png +0 -0
  139. data/rdoc/site/0.1.19/images/bullet_toggle_plus.png +0 -0
  140. data/rdoc/site/0.1.19/images/date.png +0 -0
  141. data/rdoc/site/0.1.19/images/delete.png +0 -0
  142. data/rdoc/site/0.1.19/images/find.png +0 -0
  143. data/rdoc/site/0.1.19/images/loadingAnimation.gif +0 -0
  144. data/rdoc/site/0.1.19/images/macFFBgHack.png +0 -0
  145. data/rdoc/site/0.1.19/images/package.png +0 -0
  146. data/rdoc/site/0.1.19/images/page_green.png +0 -0
  147. data/rdoc/site/0.1.19/images/page_white_text.png +0 -0
  148. data/rdoc/site/0.1.19/images/page_white_width.png +0 -0
  149. data/rdoc/site/0.1.19/images/plugin.png +0 -0
  150. data/rdoc/site/0.1.19/images/ruby.png +0 -0
  151. data/rdoc/site/0.1.19/images/tag_blue.png +0 -0
  152. data/rdoc/site/0.1.19/images/tag_green.png +0 -0
  153. data/rdoc/site/0.1.19/images/transparent.png +0 -0
  154. data/rdoc/site/0.1.19/images/wrench.png +0 -0
  155. data/rdoc/site/0.1.19/images/wrench_orange.png +0 -0
  156. data/rdoc/site/0.1.19/images/zoom.png +0 -0
  157. data/rdoc/site/0.1.19/index.html +0 -311
  158. data/rdoc/site/0.1.19/js/darkfish.js +0 -155
  159. data/rdoc/site/0.1.19/js/jquery.js +0 -18
  160. data/rdoc/site/0.1.19/js/navigation.js +0 -142
  161. data/rdoc/site/0.1.19/js/search.js +0 -94
  162. data/rdoc/site/0.1.19/js/search_index.js +0 -1
  163. data/rdoc/site/0.1.19/js/searcher.js +0 -228
  164. data/rdoc/site/0.1.19/rdoc.css +0 -543
  165. data/rdoc/site/0.1.19/table_of_contents.html +0 -1541
  166. data/rdoc/site/0.2.0/ARCHITECTURE_rdoc.html +0 -638
  167. data/rdoc/site/0.2.0/Hash.html +0 -351
  168. data/rdoc/site/0.2.0/Kernel.html +0 -416
  169. data/rdoc/site/0.2.0/Nucleon.html +0 -607
  170. data/rdoc/site/0.2.0/Nucleon/Action.html +0 -284
  171. data/rdoc/site/0.2.0/Nucleon/Action/Extract.html +0 -455
  172. data/rdoc/site/0.2.0/Nucleon/Action/Project.html +0 -283
  173. data/rdoc/site/0.2.0/Nucleon/Action/Project/Add.html +0 -500
  174. data/rdoc/site/0.2.0/Nucleon/Action/Project/Create.html +0 -457
  175. data/rdoc/site/0.2.0/Nucleon/Action/Project/Remove.html +0 -503
  176. data/rdoc/site/0.2.0/Nucleon/Action/Project/Save.html +0 -476
  177. data/rdoc/site/0.2.0/Nucleon/Action/Project/Update.html +0 -423
  178. data/rdoc/site/0.2.0/Nucleon/Codes.html +0 -567
  179. data/rdoc/site/0.2.0/Nucleon/Command.html +0 -279
  180. data/rdoc/site/0.2.0/Nucleon/Command/Bash.html +0 -548
  181. data/rdoc/site/0.2.0/Nucleon/Config.html +0 -1631
  182. data/rdoc/site/0.2.0/Nucleon/Config/Collection.html +0 -513
  183. data/rdoc/site/0.2.0/Nucleon/Config/Options.html +0 -493
  184. data/rdoc/site/0.2.0/Nucleon/Core.html +0 -639
  185. data/rdoc/site/0.2.0/Nucleon/Environment.html +0 -1208
  186. data/rdoc/site/0.2.0/Nucleon/Errors.html +0 -279
  187. data/rdoc/site/0.2.0/Nucleon/Errors/BatchError.html +0 -285
  188. data/rdoc/site/0.2.0/Nucleon/Errors/NucleonError.html +0 -661
  189. data/rdoc/site/0.2.0/Nucleon/Errors/SSHUnavailable.html +0 -285
  190. data/rdoc/site/0.2.0/Nucleon/Event.html +0 -279
  191. data/rdoc/site/0.2.0/Nucleon/Event/Regex.html +0 -471
  192. data/rdoc/site/0.2.0/Nucleon/Facade.html +0 -2409
  193. data/rdoc/site/0.2.0/Nucleon/Gems.html +0 -639
  194. data/rdoc/site/0.2.0/Nucleon/Manager.html +0 -1860
  195. data/rdoc/site/0.2.0/Nucleon/Mixin.html +0 -288
  196. data/rdoc/site/0.2.0/Nucleon/Mixin/Action.html +0 -281
  197. data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Commit.html +0 -385
  198. data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Project.html +0 -399
  199. data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Push.html +0 -375
  200. data/rdoc/site/0.2.0/Nucleon/Mixin/Colors.html +0 -549
  201. data/rdoc/site/0.2.0/Nucleon/Mixin/ConfigCollection.html +0 -485
  202. data/rdoc/site/0.2.0/Nucleon/Mixin/ConfigOptions.html +0 -453
  203. data/rdoc/site/0.2.0/Nucleon/Mixin/Macro.html +0 -280
  204. data/rdoc/site/0.2.0/Nucleon/Mixin/Macro/ObjectInterface.html +0 -699
  205. data/rdoc/site/0.2.0/Nucleon/Mixin/Macro/PluginInterface.html +0 -686
  206. data/rdoc/site/0.2.0/Nucleon/Mixin/Settings.html +0 -485
  207. data/rdoc/site/0.2.0/Nucleon/Mixin/SubConfig.html +0 -891
  208. data/rdoc/site/0.2.0/Nucleon/Parallel.html +0 -330
  209. data/rdoc/site/0.2.0/Nucleon/Parallel/ClassMethods.html +0 -329
  210. data/rdoc/site/0.2.0/Nucleon/Parallel/InstanceMethods.html +0 -456
  211. data/rdoc/site/0.2.0/Nucleon/Plugin.html +0 -286
  212. data/rdoc/site/0.2.0/Nucleon/Plugin/Action.html +0 -1829
  213. data/rdoc/site/0.2.0/Nucleon/Plugin/Action/Option.html +0 -463
  214. data/rdoc/site/0.2.0/Nucleon/Plugin/Base.html +0 -1803
  215. data/rdoc/site/0.2.0/Nucleon/Plugin/Command.html +0 -725
  216. data/rdoc/site/0.2.0/Nucleon/Plugin/Event.html +0 -446
  217. data/rdoc/site/0.2.0/Nucleon/Plugin/Extension.html +0 -285
  218. data/rdoc/site/0.2.0/Nucleon/Plugin/Project.html +0 -2898
  219. data/rdoc/site/0.2.0/Nucleon/Plugin/Template.html +0 -480
  220. data/rdoc/site/0.2.0/Nucleon/Plugin/Translator.html +0 -375
  221. data/rdoc/site/0.2.0/Nucleon/Project.html +0 -280
  222. data/rdoc/site/0.2.0/Nucleon/Project/Git.html +0 -1805
  223. data/rdoc/site/0.2.0/Nucleon/Project/Github.html +0 -553
  224. data/rdoc/site/0.2.0/Nucleon/Template.html +0 -281
  225. data/rdoc/site/0.2.0/Nucleon/Template/JSON.html +0 -333
  226. data/rdoc/site/0.2.0/Nucleon/Template/Wrapper.html +0 -333
  227. data/rdoc/site/0.2.0/Nucleon/Template/YAML.html +0 -333
  228. data/rdoc/site/0.2.0/Nucleon/Translator.html +0 -280
  229. data/rdoc/site/0.2.0/Nucleon/Translator/JSON.html +0 -370
  230. data/rdoc/site/0.2.0/Nucleon/Translator/YAML.html +0 -370
  231. data/rdoc/site/0.2.0/Nucleon/Util.html +0 -289
  232. data/rdoc/site/0.2.0/Nucleon/Util/CLI.html +0 -392
  233. data/rdoc/site/0.2.0/Nucleon/Util/CLI/Parser.html +0 -1250
  234. data/rdoc/site/0.2.0/Nucleon/Util/Cache.html +0 -784
  235. data/rdoc/site/0.2.0/Nucleon/Util/Console.html +0 -1318
  236. data/rdoc/site/0.2.0/Nucleon/Util/Data.html +0 -1411
  237. data/rdoc/site/0.2.0/Nucleon/Util/Disk.html +0 -526
  238. data/rdoc/site/0.2.0/Nucleon/Util/Git.html +0 -365
  239. data/rdoc/site/0.2.0/Nucleon/Util/Liquid.html +0 -369
  240. data/rdoc/site/0.2.0/Nucleon/Util/Logger.html +0 -810
  241. data/rdoc/site/0.2.0/Nucleon/Util/Package.html +0 -562
  242. data/rdoc/site/0.2.0/Nucleon/Util/SSH.html +0 -1033
  243. data/rdoc/site/0.2.0/Nucleon/Util/SSH/Keypair.html +0 -605
  244. data/rdoc/site/0.2.0/Nucleon/Util/Shell.html +0 -693
  245. data/rdoc/site/0.2.0/Nucleon/Util/Shell/Result.html +0 -501
  246. data/rdoc/site/0.2.0/README_rdoc.html +0 -316
  247. data/rdoc/site/0.2.0/TODO_rdoc.html +0 -265
  248. data/rdoc/site/0.2.0/created.rid +0 -61
  249. data/rdoc/site/0.2.0/images/add.png +0 -0
  250. data/rdoc/site/0.2.0/images/brick.png +0 -0
  251. data/rdoc/site/0.2.0/images/brick_link.png +0 -0
  252. data/rdoc/site/0.2.0/images/bug.png +0 -0
  253. data/rdoc/site/0.2.0/images/bullet_black.png +0 -0
  254. data/rdoc/site/0.2.0/images/bullet_toggle_minus.png +0 -0
  255. data/rdoc/site/0.2.0/images/bullet_toggle_plus.png +0 -0
  256. data/rdoc/site/0.2.0/images/date.png +0 -0
  257. data/rdoc/site/0.2.0/images/delete.png +0 -0
  258. data/rdoc/site/0.2.0/images/find.png +0 -0
  259. data/rdoc/site/0.2.0/images/loadingAnimation.gif +0 -0
  260. data/rdoc/site/0.2.0/images/macFFBgHack.png +0 -0
  261. data/rdoc/site/0.2.0/images/package.png +0 -0
  262. data/rdoc/site/0.2.0/images/page_green.png +0 -0
  263. data/rdoc/site/0.2.0/images/page_white_text.png +0 -0
  264. data/rdoc/site/0.2.0/images/page_white_width.png +0 -0
  265. data/rdoc/site/0.2.0/images/plugin.png +0 -0
  266. data/rdoc/site/0.2.0/images/ruby.png +0 -0
  267. data/rdoc/site/0.2.0/images/tag_blue.png +0 -0
  268. data/rdoc/site/0.2.0/images/tag_green.png +0 -0
  269. data/rdoc/site/0.2.0/images/transparent.png +0 -0
  270. data/rdoc/site/0.2.0/images/wrench.png +0 -0
  271. data/rdoc/site/0.2.0/images/wrench_orange.png +0 -0
  272. data/rdoc/site/0.2.0/images/zoom.png +0 -0
  273. data/rdoc/site/0.2.0/index.html +0 -315
  274. data/rdoc/site/0.2.0/js/darkfish.js +0 -155
  275. data/rdoc/site/0.2.0/js/jquery.js +0 -18
  276. data/rdoc/site/0.2.0/js/navigation.js +0 -142
  277. data/rdoc/site/0.2.0/js/search.js +0 -94
  278. data/rdoc/site/0.2.0/js/search_index.js +0 -1
  279. data/rdoc/site/0.2.0/js/searcher.js +0 -228
  280. data/rdoc/site/0.2.0/rdoc.css +0 -543
  281. data/rdoc/site/0.2.0/table_of_contents.html +0 -1657
  282. data/rdoc/site/0.2.1/ARCHITECTURE_rdoc.html +0 -640
  283. data/rdoc/site/0.2.1/Hash.html +0 -353
  284. data/rdoc/site/0.2.1/Kernel.html +0 -420
  285. data/rdoc/site/0.2.1/Nucleon.html +0 -674
  286. data/rdoc/site/0.2.1/Nucleon/Action.html +0 -286
  287. data/rdoc/site/0.2.1/Nucleon/Action/Extract.html +0 -457
  288. data/rdoc/site/0.2.1/Nucleon/Action/Project.html +0 -285
  289. data/rdoc/site/0.2.1/Nucleon/Action/Project/Add.html +0 -502
  290. data/rdoc/site/0.2.1/Nucleon/Action/Project/Create.html +0 -459
  291. data/rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html +0 -505
  292. data/rdoc/site/0.2.1/Nucleon/Action/Project/Save.html +0 -478
  293. data/rdoc/site/0.2.1/Nucleon/Action/Project/Update.html +0 -425
  294. data/rdoc/site/0.2.1/Nucleon/Codes.html +0 -569
  295. data/rdoc/site/0.2.1/Nucleon/Command.html +0 -281
  296. data/rdoc/site/0.2.1/Nucleon/Command/Bash.html +0 -550
  297. data/rdoc/site/0.2.1/Nucleon/Config.html +0 -1634
  298. data/rdoc/site/0.2.1/Nucleon/Config/Collection.html +0 -515
  299. data/rdoc/site/0.2.1/Nucleon/Config/Options.html +0 -495
  300. data/rdoc/site/0.2.1/Nucleon/Core.html +0 -641
  301. data/rdoc/site/0.2.1/Nucleon/Environment.html +0 -1210
  302. data/rdoc/site/0.2.1/Nucleon/Errors.html +0 -281
  303. data/rdoc/site/0.2.1/Nucleon/Errors/BatchError.html +0 -287
  304. data/rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html +0 -663
  305. data/rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html +0 -287
  306. data/rdoc/site/0.2.1/Nucleon/Event.html +0 -281
  307. data/rdoc/site/0.2.1/Nucleon/Event/Regex.html +0 -473
  308. data/rdoc/site/0.2.1/Nucleon/Facade.html +0 -2452
  309. data/rdoc/site/0.2.1/Nucleon/Gems.html +0 -641
  310. data/rdoc/site/0.2.1/Nucleon/Manager.html +0 -1862
  311. data/rdoc/site/0.2.1/Nucleon/Mixin.html +0 -291
  312. data/rdoc/site/0.2.1/Nucleon/Mixin/Action.html +0 -284
  313. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html +0 -387
  314. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html +0 -401
  315. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html +0 -377
  316. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html +0 -575
  317. data/rdoc/site/0.2.1/Nucleon/Mixin/Colors.html +0 -551
  318. data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html +0 -487
  319. data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html +0 -455
  320. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro.html +0 -282
  321. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html +0 -701
  322. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html +0 -688
  323. data/rdoc/site/0.2.1/Nucleon/Mixin/Settings.html +0 -487
  324. data/rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html +0 -893
  325. data/rdoc/site/0.2.1/Nucleon/Parallel.html +0 -332
  326. data/rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html +0 -331
  327. data/rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html +0 -458
  328. data/rdoc/site/0.2.1/Nucleon/Plugin.html +0 -288
  329. data/rdoc/site/0.2.1/Nucleon/Plugin/Action.html +0 -2133
  330. data/rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html +0 -465
  331. data/rdoc/site/0.2.1/Nucleon/Plugin/Base.html +0 -1988
  332. data/rdoc/site/0.2.1/Nucleon/Plugin/Command.html +0 -765
  333. data/rdoc/site/0.2.1/Nucleon/Plugin/Event.html +0 -448
  334. data/rdoc/site/0.2.1/Nucleon/Plugin/Extension.html +0 -287
  335. data/rdoc/site/0.2.1/Nucleon/Plugin/Project.html +0 -2900
  336. data/rdoc/site/0.2.1/Nucleon/Plugin/Template.html +0 -482
  337. data/rdoc/site/0.2.1/Nucleon/Plugin/Translator.html +0 -377
  338. data/rdoc/site/0.2.1/Nucleon/Project.html +0 -282
  339. data/rdoc/site/0.2.1/Nucleon/Project/Git.html +0 -1807
  340. data/rdoc/site/0.2.1/Nucleon/Project/Github.html +0 -555
  341. data/rdoc/site/0.2.1/Nucleon/Template.html +0 -283
  342. data/rdoc/site/0.2.1/Nucleon/Template/JSON.html +0 -335
  343. data/rdoc/site/0.2.1/Nucleon/Template/Wrapper.html +0 -335
  344. data/rdoc/site/0.2.1/Nucleon/Template/YAML.html +0 -335
  345. data/rdoc/site/0.2.1/Nucleon/Translator.html +0 -282
  346. data/rdoc/site/0.2.1/Nucleon/Translator/JSON.html +0 -372
  347. data/rdoc/site/0.2.1/Nucleon/Translator/YAML.html +0 -372
  348. data/rdoc/site/0.2.1/Nucleon/Util.html +0 -291
  349. data/rdoc/site/0.2.1/Nucleon/Util/CLI.html +0 -394
  350. data/rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html +0 -1404
  351. data/rdoc/site/0.2.1/Nucleon/Util/Cache.html +0 -824
  352. data/rdoc/site/0.2.1/Nucleon/Util/Console.html +0 -1330
  353. data/rdoc/site/0.2.1/Nucleon/Util/Data.html +0 -1423
  354. data/rdoc/site/0.2.1/Nucleon/Util/Disk.html +0 -528
  355. data/rdoc/site/0.2.1/Nucleon/Util/Git.html +0 -367
  356. data/rdoc/site/0.2.1/Nucleon/Util/Liquid.html +0 -371
  357. data/rdoc/site/0.2.1/Nucleon/Util/Logger.html +0 -822
  358. data/rdoc/site/0.2.1/Nucleon/Util/Package.html +0 -564
  359. data/rdoc/site/0.2.1/Nucleon/Util/SSH.html +0 -1036
  360. data/rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html +0 -607
  361. data/rdoc/site/0.2.1/Nucleon/Util/Shell.html +0 -697
  362. data/rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html +0 -503
  363. data/rdoc/site/0.2.1/README_rdoc.html +0 -318
  364. data/rdoc/site/0.2.1/TODO_rdoc.html +0 -267
  365. data/rdoc/site/0.2.1/created.rid +0 -62
  366. data/rdoc/site/0.2.1/images/add.png +0 -0
  367. data/rdoc/site/0.2.1/images/brick.png +0 -0
  368. data/rdoc/site/0.2.1/images/brick_link.png +0 -0
  369. data/rdoc/site/0.2.1/images/bug.png +0 -0
  370. data/rdoc/site/0.2.1/images/bullet_black.png +0 -0
  371. data/rdoc/site/0.2.1/images/bullet_toggle_minus.png +0 -0
  372. data/rdoc/site/0.2.1/images/bullet_toggle_plus.png +0 -0
  373. data/rdoc/site/0.2.1/images/date.png +0 -0
  374. data/rdoc/site/0.2.1/images/delete.png +0 -0
  375. data/rdoc/site/0.2.1/images/find.png +0 -0
  376. data/rdoc/site/0.2.1/images/loadingAnimation.gif +0 -0
  377. data/rdoc/site/0.2.1/images/macFFBgHack.png +0 -0
  378. data/rdoc/site/0.2.1/images/package.png +0 -0
  379. data/rdoc/site/0.2.1/images/page_green.png +0 -0
  380. data/rdoc/site/0.2.1/images/page_white_text.png +0 -0
  381. data/rdoc/site/0.2.1/images/page_white_width.png +0 -0
  382. data/rdoc/site/0.2.1/images/plugin.png +0 -0
  383. data/rdoc/site/0.2.1/images/ruby.png +0 -0
  384. data/rdoc/site/0.2.1/images/tag_blue.png +0 -0
  385. data/rdoc/site/0.2.1/images/tag_green.png +0 -0
  386. data/rdoc/site/0.2.1/images/transparent.png +0 -0
  387. data/rdoc/site/0.2.1/images/wrench.png +0 -0
  388. data/rdoc/site/0.2.1/images/wrench_orange.png +0 -0
  389. data/rdoc/site/0.2.1/images/zoom.png +0 -0
  390. data/rdoc/site/0.2.1/index.html +0 -317
  391. data/rdoc/site/0.2.1/js/darkfish.js +0 -155
  392. data/rdoc/site/0.2.1/js/jquery.js +0 -18
  393. data/rdoc/site/0.2.1/js/navigation.js +0 -142
  394. data/rdoc/site/0.2.1/js/search.js +0 -94
  395. data/rdoc/site/0.2.1/js/search_index.js +0 -1
  396. data/rdoc/site/0.2.1/js/searcher.js +0 -228
  397. data/rdoc/site/0.2.1/rdoc.css +0 -543
  398. data/rdoc/site/0.2.1/table_of_contents.html +0 -1718
  399. data/spec/coral_mock_input.rb +0 -29
  400. data/spec/coral_test_kernel.rb +0 -22
@@ -0,0 +1,185 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ module Nucleon
5
+
6
+ describe Core do
7
+
8
+ include_context "nucleon_test"
9
+ include_context "nucleon_config"
10
+
11
+
12
+ #***************************************************************************
13
+
14
+ def core(*args, &code)
15
+ test_object(Core, *args, &code)
16
+ end
17
+
18
+
19
+ #***************************************************************************
20
+
21
+ let(:core_object) { core(config_hash2) }
22
+
23
+
24
+ #***************************************************************************
25
+ # Constructor / Destructor
26
+
27
+ # Initialize a new Nucleon core object
28
+ #
29
+ describe "#initialize" do
30
+
31
+ it "creates via the default values if nil given as the primary data source" do
32
+ test_config core(nil, config_hash1, true, true, true), config_hash1
33
+ test_config core(nil, config_hash1, true, true, false), config_hash1
34
+ test_config core(nil, config_hash1, true, false, true), config_hash1
35
+ test_config core(nil, config_hash1, true, false, false), config_hash1
36
+
37
+ test_config core(nil, config_hash1, false, true, true), config_hash1
38
+ test_config core(nil, config_hash1, false, true, false), config_hash1
39
+ test_config core(nil, config_hash1, false, false, true), config_hash1
40
+ test_config core(nil, config_hash1, false, false, false), config_hash1
41
+ end
42
+
43
+ it "creates via a basic merge of hash with forced overwrites" do
44
+ test_config core(config_hash2, config_hash1, true, true, true), config_hash_force_basic_merge
45
+ test_config core(config_hash2, config_hash1, true, false, true), config_hash_force_basic_merge
46
+ end
47
+ it "creates via a deep merge of hash with forced overwrites" do
48
+ test_config core(config_hash2, config_hash1, true, true, false), config_hash_force_deep_merge
49
+ test_config core(config_hash2, config_hash1, true, false, false), config_hash_force_deep_merge
50
+ end
51
+ it "creates via a basic merge of hash with no forced overwrites" do
52
+ test_config core(config_hash2, config_hash1, false, true, true), config_hash_no_force_basic_merge
53
+ test_config core(config_hash2, config_hash1, false, false, true), config_hash_no_force_basic_merge
54
+ end
55
+ it "creates via a deep merge of hash with no forced overwrites" do
56
+ test_config core(config_hash2, config_hash1, false, true, false), config_hash_no_force_deep_merge
57
+ test_config core(config_hash2, config_hash1, false, false, false), config_hash_no_force_deep_merge
58
+ end
59
+
60
+ it "creates via a basic merge of Config object with forced overwrites" do
61
+ test_config core(core_object, config_hash1, true, true, true), config_hash_force_basic_merge
62
+ test_config core(core_object, config_hash1, true, false, true), config_hash_force_basic_merge
63
+ end
64
+ it "creates via a deep merge of Config object with forced overwrites" do
65
+ test_config core(core_object, config_hash1, true, true, false), config_hash_force_deep_merge
66
+ test_config core(core_object, config_hash1, true, false, false), config_hash_force_deep_merge
67
+ end
68
+ it "creates via a basic merge of Config object with no forced overwrites" do
69
+ test_config core(core_object, config_hash1, false, true, true), config_hash_no_force_basic_merge
70
+ test_config core(core_object, config_hash1, false, false, true), config_hash_no_force_basic_merge
71
+ end
72
+ it "creates via a deep merge of Config object with no forced overwrites" do
73
+ test_config core(core_object, config_hash1, false, true, false), config_hash_no_force_deep_merge
74
+ test_config core(core_object, config_hash1, false, false, false), config_hash_no_force_deep_merge
75
+ end
76
+ end
77
+
78
+
79
+ #***************************************************************************
80
+ # Checks
81
+
82
+ # Check if object is initialized?
83
+ #
84
+ describe "#initialized?" do
85
+
86
+ it "is true after initialization if set_initialized flag given" do
87
+ test_eq core(config_hash2, config_hash1, true, true, true).initialized?, true
88
+ test_eq core(config_hash2, config_hash1, true, true, false).initialized?, true
89
+ test_eq core(config_hash2, config_hash1, false, true, true).initialized?, true
90
+ test_eq core(config_hash2, config_hash1, false, true, false).initialized?, true
91
+ end
92
+
93
+ it "is false after initialization if set_initialized flag not given" do
94
+ test_eq core(config_hash2, config_hash1, true, false, true).initialized?, false
95
+ test_eq core(config_hash2, config_hash1, true, false, false).initialized?, false
96
+ test_eq core(config_hash2, config_hash1, false, false, true).initialized?, false
97
+ test_eq core(config_hash2, config_hash1, false, false, false).initialized?, false
98
+ end
99
+ end
100
+
101
+
102
+ #***************************************************************************
103
+ # Accessor / Modifiers
104
+
105
+ # Return global logger instance
106
+ #
107
+ describe "#logger" do
108
+
109
+ it "returns the global logger instance" do
110
+ test_type Core.logger, Nucleon::Util::Logger
111
+ end
112
+ end
113
+
114
+ # Set current object logger instance
115
+ #
116
+ describe "#logger=" do
117
+
118
+ it "assigns instance logger from existing logger instance" do
119
+ core(config_hash1, {}, true, true, true) do |core|
120
+ logger = test_object(Util::Logger, "test1")
121
+ core.logger = logger
122
+
123
+ test_eq logger == core.logger, true
124
+ test_eq core.logger.resource == "test1", true
125
+ end
126
+ end
127
+
128
+ it "assigns instance logger from new logger instance with specific name" do
129
+ core(config_hash2, {}, true, true, true) do |core|
130
+ core.logger = "test2"
131
+ test_eq core.logger.resource == "test2", true
132
+ end
133
+ end
134
+ end
135
+
136
+ # Return global console instance
137
+ #
138
+ describe "#ui" do
139
+
140
+ it "returns the global console instance" do
141
+ test_type Core.ui, Nucleon::Util::Console
142
+ end
143
+ end
144
+
145
+ # Set current object console instance
146
+ #
147
+ describe "#ui=" do
148
+
149
+ it "assigns instance console from existing console instance" do
150
+ core(config_hash1, {}, true, true, true) do |core|
151
+ console = test_object(Util::Console, "test1")
152
+ core.ui = console
153
+
154
+ test_eq console == core.ui, true
155
+ test_eq core.ui.resource == "test1", true
156
+ end
157
+ end
158
+
159
+ it "assigns instance console from new console instance with specific name" do
160
+ core(config_hash2, {}, true, true, true) do |core|
161
+ core.ui = "test2"
162
+ test_eq core.ui.resource == "test2", true
163
+ end
164
+ end
165
+ end
166
+
167
+
168
+ #***************************************************************************
169
+ # General utilities
170
+
171
+ # Contextualize console operations in a code block with a given resource name.
172
+ #
173
+ describe "#ui_group" do
174
+
175
+ it "prints a colored message with a set prefix to the console" do
176
+ test_output("[\e\[36mtest string\e\[0m] -----------------------------------------------------") do |output|
177
+ Core.ui_group("test string", :cyan) do |ui|
178
+ ui.output = output
179
+ ui.info("-----------------------------------------------------")
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,148 @@
1
+ require 'spec_helper'
2
+
3
+ module Nucleon
4
+
5
+ describe Environment do
6
+
7
+ include_context "nucleon_test"
8
+ include_context "nucleon_plugin"
9
+
10
+
11
+ #***************************************************************************
12
+
13
+ def environment(*args, &code)
14
+ test_object(Environment, *args, &code)
15
+ end
16
+
17
+
18
+ #*****************************************************************************
19
+ # Constructor / Destructor
20
+
21
+ describe "#initialize" do
22
+
23
+ it "tests initialize method" do
24
+ test_config environment, plugin_environment_empty
25
+ end
26
+
27
+ end
28
+
29
+ #*****************************************************************************
30
+ # Plugin type accessor / modifiers
31
+
32
+ describe "#namespaces" do
33
+
34
+ it "tests namespaces with empty array values" do
35
+ test_eq environment.namespaces,[]
36
+ end
37
+
38
+ it "tests namespaces with array values" do
39
+ environment do |environment|
40
+ environment.define_plugin_type :nucleon, :test, :first
41
+ environment.define_plugin_type :unit, :test, :first
42
+ environment.define_plugin_type :testing, :test, :first
43
+ test_eq environment.namespaces, [:nucleon, :unit, :testing]
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ describe "#plugin_types" do
50
+
51
+ it "returns an empty array when no plugin types are defined" do
52
+ test_eq environment.plugin_types(:nucleon),[]
53
+ end
54
+
55
+ it "returns the existing plugin types for a namespace when given an existing namespace" do
56
+ environment do |environment|
57
+ environment.define_plugin_type :nucleon, :test, :first
58
+ test_eq environment.plugin_types(:nucleon), [:test]
59
+ end
60
+ end
61
+
62
+ it "returns an empty array when plugin types are defined but specified namespace does not exist" do
63
+ environment do |environment|
64
+ environment.define_plugin_type :nucleon, :test, :first
65
+ test_eq environment.plugin_types(:nonexist), []
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ # Define a new plugin type in a specified namespace.
72
+ #
73
+
74
+ describe "#define_plugin_type" do
75
+
76
+ it "returns loaded plugins state" do
77
+ test_config environment.define_plugin_type(:nucleon, :test, :first), {
78
+ :plugin_types=>{:nucleon=>{:test=>:first}},
79
+ :load_info=>{},
80
+ :active_info=>{}
81
+ }
82
+ end
83
+
84
+ end
85
+
86
+ # Define one or more new plugin types in a specified namespace.
87
+ #
88
+
89
+ describe "#define_plugin_types" do
90
+
91
+ it "returns loaded plugins state" do
92
+ test_config environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}),{
93
+ :plugin_types=>{:nucleon=>{:test1=>"test2", :test3=>"test4"}},
94
+ :load_info=>{},
95
+ :active_info=>{}
96
+ }
97
+ end
98
+
99
+ it "returns environment object" do
100
+ test_type environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}), Nucleon::Environment
101
+ end
102
+
103
+ end
104
+
105
+ # Check if a specified plugin type has been defined
106
+ #
107
+
108
+ describe "#plugin_type_defined?" do
109
+
110
+ it "returns true for defined plugins" do
111
+ environment do |environment|
112
+ environment.define_plugin_type(:nucleon, :test, :first)
113
+ test_eq environment.plugin_type_defined?(:nucleon, :test),true
114
+ end
115
+ end
116
+
117
+ it "returns false for undefined plugins" do
118
+ environment do |environment|
119
+ environment.define_plugin_type(:nucleon, :test, :first)
120
+ test_eq environment.plugin_type_defined?(:notavail, :test),false
121
+ end
122
+ end
123
+ end
124
+
125
+ # Return the default provider currently registered for a plugin type
126
+ #
127
+
128
+ describe "#plugin_type_default" do
129
+
130
+ it "returns default provider using define_plugin_type" do
131
+ environment do |environment|
132
+ environment.define_plugin_type(:nucleon, :test, :first)
133
+ test_eq environment.plugin_type_default(:nucleon, :test),:first
134
+ end
135
+ end
136
+
137
+ it "returns default provider using define_plugin_types" do
138
+ environment do |environment|
139
+ environment.define_plugin_types(:nucleon1, { :test1 => "test2", :test3 => "test4"})
140
+ test_eq environment.plugin_type_default(:nucleon1, :test3),"test4"
141
+ end
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+
148
+ end
@@ -5,517 +5,325 @@ module Nucleon
5
5
 
6
6
  describe Util::Console do
7
7
 
8
- #---------------------------------------------------------------------------
9
- # UI functionality
10
-
8
+ include_context "nucleon_test"
9
+
10
+
11
+ #***************************************************************************
12
+
13
+ def console(*args, &code)
14
+ test_object(Util::Console, *args, &code)
15
+ end
16
+
17
+
18
+ #***************************************************************************
19
+ # Core IO
20
+
21
+ # Output via a printer method to an output channel unless quiet specified
22
+ #
11
23
  describe "#say" do
12
-
13
- #-------------------------------------------------------------------------
14
- # Delegation
15
-
24
+
16
25
  it "can delegate to another class that contains this method" do
17
- output = double('output')
18
- output.should_receive(:puts).with('message')
19
-
20
- ui = Util::Console.new({
21
- :output => output,
22
- :printer => :puts,
23
- })
24
- Util::Console.new({ :console_delegate => ui }).say(:info, 'message')
25
- end
26
-
27
- #-------------------------------------------------------------------------
28
- # Output formats
26
+ test_output('message', :puts) do |output|
27
+ console({ :output => output }) do |console|
28
+ console({ :console_delegate => console }).say(:info, 'message')
29
+ end
30
+ end
31
+ end
29
32
 
30
33
  it "prints a message with default options" do
31
- output1 = double('output1')
32
- output1.should_receive(:puts).with('message')
33
-
34
- Util::Console.new({ :output => output1 }).say(:info, 'message')
35
-
36
- output2 = double('output2')
37
- output2.should_receive(:puts).with('[component] message')
38
-
39
- Util::Console.new({
40
- :resource => 'component',
41
- :output => output2,
42
- }).say(:info, 'message')
43
- end
44
-
45
- #---
46
-
34
+ test_output('message', :puts) do |output|
35
+ console({ :output => output }).say(:info, 'message')
36
+ end
37
+
38
+ test_output('[component] message', :puts) do |output|
39
+ console({
40
+ :resource => 'component',
41
+ :output => output,
42
+ }).say(:info, 'message')
43
+ end
44
+ end
45
+
47
46
  it "prints a message with and without newlines included" do
48
- output1 = double('output1')
49
- output1.should_receive(:puts).with('message')
50
-
51
- test = Util::Console.new({ :output => output1 })
52
- test.say(:info, 'message', { :new_line => true })
53
-
54
- output2 = double('output2')
55
- output2.should_receive(:print).with('message')
56
-
57
- test = Util::Console.new({ :output => output2 })
58
- test.say(:info, 'message', { :new_line => false })
59
- end
60
-
61
- #---
62
-
63
- it "routes message to output and error channels based on type given" do
47
+ test_output('message', :puts) do |output|
48
+ console({ :output => output }).say(:info, 'message', { :new_line => true })
49
+ end
50
+
51
+ test_output('message', :print) do |output|
52
+ console({ :output => output }).say(:info, 'message', { :new_line => false })
53
+ end
54
+ end
55
+
56
+ it "routes message of different types" do
64
57
  [:info, :warn, :success, :error].each do |type|
65
- output = double('output')
66
- output.should_receive(:puts).with('message')
67
-
68
- Util::Console.new({
69
- :output => output,
70
- :printer => :puts,
71
- :color => false,
72
- }).say(type, 'message')
58
+ test_output('message', :puts) do |output|
59
+ console({ :output => output, :color => false }).say(type, 'message')
60
+ end
73
61
  end
74
-
75
- error = double('error')
76
- error.should_receive(:puts).with('message')
77
-
78
- Util::Console.new({
79
- :error => error,
80
- :printer => :puts,
81
- :color => false,
82
- }).dump('message')
83
- end
84
-
85
- #---
86
-
62
+ end
63
+
87
64
  it "routes message to output and error channels based on channel given" do
88
65
  [:info, :warn, :success].each do |type|
89
- output = double('output')
90
- output.should_receive(:puts).with('message1')
91
-
92
- Util::Console.new({
93
- :printer => :puts,
94
- }).say(:info, 'message1', { :channel => output })
66
+ test_output(type.to_s, :puts) do |output|
67
+ console({ :color => false }).say(type, type.to_s, { :channel => output })
68
+ end
95
69
  end
96
-
97
- error = double('error')
98
- error.should_receive(:puts).with('message2')
99
-
100
- Util::Console.new({
101
- :printer => :puts,
102
- :color => false,
103
- }).say(:info, 'message2', { :channel => error })
104
- end
70
+ end
105
71
  end
106
-
107
- #---
108
-
72
+
73
+ # Dump an object to an output channel even if quiet specified
74
+ #
75
+ describe "#dump" do
76
+
77
+ it "can delegate to another class that contains this method" do
78
+ test_output('message', :puts) do |output|
79
+ console({ :error => output }) do |console|
80
+ console({ :console_delegate => console }).dump('message')
81
+ end
82
+ end
83
+ end
84
+
85
+ it "dumps data to stderr output channel" do
86
+ test_output('message', :puts) do |output|
87
+ console({ :error => output }).dump('message')
88
+ end
89
+ end
90
+ end
91
+
92
+ # Ask terminal user for an input value
93
+ #
109
94
  describe "#ask" do
110
-
111
- #-------------------------------------------------------------------------
112
- # Delegation
113
-
95
+
114
96
  it "can delegate to another class that contains this method"
115
-
116
- #-------------------------------------------------------------------------
117
- # Input
118
-
97
+
119
98
  it "displays a prompt and returns user feedback"
120
99
  end
121
-
122
- #---
123
-
100
+
101
+ # Ask terminal user for an input value
102
+ #
103
+ describe "#password" do
104
+
105
+ it "can delegate to another class that contains this method"
106
+
107
+ it "displays a prompt and returns user feedback with user typing hidden"
108
+ end
109
+
110
+
111
+ #***************************************************************************
112
+ # Specialized output
113
+
114
+ # Output information to an output channel unless quiet specified
115
+ #
124
116
  describe "#info" do
125
-
126
- #-------------------------------------------------------------------------
127
- # Delegation
128
-
117
+
129
118
  it "can delegate to another class that contains this method" do
130
- output = double('output')
131
- output.should_receive(:puts).with('message')
132
-
133
- ui = Util::Console.new({
134
- :output => output,
135
- :printer => :puts,
136
- })
137
- Util::Console.new({ :console_delegate => ui }).info('message')
138
- end
139
-
140
- #-------------------------------------------------------------------------
141
- # Printing
142
-
119
+ test_output('message', :puts) do |output|
120
+ console({ :output => output }) do |console|
121
+ console({ :console_delegate => console }).info('message')
122
+ end
123
+ end
124
+ end
125
+
143
126
  it "prints an uncolored information message" do
144
- output = double('output')
145
- output.should_receive(:puts).with('message')
146
-
147
- Util::Console.new({
148
- :output => output,
149
- :printer => :puts,
150
- }).info('message')
151
- end
127
+ test_output('message', :puts) do |output|
128
+ console({ :output => output }).info('message')
129
+ end
130
+ end
152
131
  end
153
-
154
- #---
155
-
132
+
133
+ # Output warning to an output channel unless quiet specified
134
+ #
156
135
  describe "#warn" do
157
-
158
- #-------------------------------------------------------------------------
159
- # Delegation
160
-
136
+
161
137
  it "can delegate to another class that contains this method" do
162
- output = double('output')
163
- output.should_receive(:puts).with('message')
164
-
165
- ui = Util::Console.new({
166
- :output => output,
167
- :printer => :puts,
168
- :color => false,
169
- })
170
- Util::Console.new({ :console_delegate => ui }).warn('message')
171
- end
172
-
173
- #-------------------------------------------------------------------------
174
- # Printing
175
-
138
+ test_output('message', :puts) do |output|
139
+ console({ :output => output, :color => false }) do |console|
140
+ console({ :console_delegate => console }).warn('message')
141
+ end
142
+ end
143
+ end
144
+
176
145
  it "prints an uncolored warning message" do
177
- output = double('output')
178
- output.should_receive(:puts).with('message')
179
-
180
- Util::Console.new({
181
- :output => output,
182
- :printer => :puts,
183
- :color => false,
184
- }).warn('message')
185
- end
186
-
187
- #---
188
-
146
+ test_output('message', :puts) do |output|
147
+ console({ :output => output, :color => false }).warn('message')
148
+ end
149
+ end
150
+
189
151
  it "prints a colored warning message" do
190
- output = double('output')
191
- output.should_receive(:print).with(/^\e\[33mmessage\e\[0m$/)
192
-
193
- Util::Console.new({
194
- :output => output,
195
- :color => true,
196
- }).warn('message', { :new_line => false })
197
- end
152
+ test_output("\e\[33mmessage\e\[0m", :print) do |output|
153
+ console({ :output => output, :color => true }).warn('message', { :new_line => false })
154
+ end
155
+ end
198
156
  end
199
-
200
- #---
201
-
157
+
158
+ # Output error to an output channel unless quiet specified
159
+ #
202
160
  describe "#error" do
203
-
204
- #-------------------------------------------------------------------------
205
- # Delegation
206
-
161
+
207
162
  it "can delegate to another class that contains this method" do
208
- output = double('output')
209
- output.should_receive(:puts).with('message')
210
-
211
- ui = Util::Console.new({
212
- :output => output,
213
- :printer => :puts,
214
- :color => false,
215
- })
216
- Util::Console.new({ :console_delegate => ui }).error('message')
217
- end
218
-
219
- #-------------------------------------------------------------------------
220
- # Printing
221
-
163
+ test_output('message', :puts) do |output|
164
+ console({ :output => output, :color => false }) do |console|
165
+ console({ :console_delegate => console }).error('message')
166
+ end
167
+ end
168
+ end
169
+
222
170
  it "prints an uncolored error message" do
223
- output = double('output')
224
- output.should_receive(:puts).with('message')
225
-
226
- Util::Console.new({
227
- :output => output,
228
- :printer => :puts,
229
- :color => false,
230
- }).error('message')
231
- end
232
-
233
- #---
234
-
171
+ test_output('message', :puts) do |output|
172
+ console({ :output => output, :color => false }).error('message')
173
+ end
174
+ end
175
+
235
176
  it "prints a colored error message" do
236
- output = double('output')
237
- output.should_receive(:print).with(/^\e\[31mmessage\e\[0m$/)
238
-
239
- Util::Console.new({
240
- :output => output,
241
- :color => true,
242
- }).error('message', { :new_line => false })
243
- end
177
+ test_output("\e\[31mmessage\e\[0m", :print) do |output|
178
+ console({ :output => output, :color => true }).error('message', { :new_line => false })
179
+ end
180
+ end
244
181
  end
245
-
246
- #---
247
-
182
+
183
+ # Output success message to an output channel unless quiet specified
184
+ #
248
185
  describe "#success" do
249
-
250
- #-------------------------------------------------------------------------
251
- # Delegation
252
-
186
+
253
187
  it "can delegate to another class that contains this method" do
254
- output = double('output')
255
- output.should_receive(:puts).with('message')
256
-
257
- ui = Util::Console.new({
258
- :output => output,
259
- :printer => :puts,
260
- :color => false,
261
- })
262
- Util::Console.new({ :console_delegate => ui }).success('message')
263
- end
264
-
265
- #-------------------------------------------------------------------------
266
- # Printing
267
-
188
+ test_output('message', :puts) do |output|
189
+ console({ :output => output, :color => false }) do |console|
190
+ console({ :console_delegate => console }).success('message')
191
+ end
192
+ end
193
+ end
194
+
268
195
  it "prints an uncolored success message" do
269
- output = double('output')
270
- output.should_receive(:puts).with('message')
271
-
272
- Util::Console.new({
273
- :output => output,
274
- :printer => :puts,
275
- :color => false,
276
- }).success('message')
277
- end
278
-
279
- #---
280
-
196
+ test_output('message', :puts) do |output|
197
+ console({ :output => output, :color => false }).success('message')
198
+ end
199
+ end
200
+
281
201
  it "prints a colored success message" do
282
- output = double('output')
283
- output.should_receive(:print).with(/^\e\[32mmessage\e\[0m$/)
284
-
285
- Util::Console.new({
286
- :output => output,
287
- :color => true,
288
- }).success('message', { :new_line => false })
289
- end
290
- end
291
-
292
- #---
293
-
294
- describe "#dump" do
295
-
296
- #-------------------------------------------------------------------------
297
- # Delegation
298
-
299
- it "can delegate to another class that contains this method" do
300
- error = double('error')
301
- error.should_receive(:puts).with('message')
302
-
303
- ui = Util::Console.new({
304
- :error => error,
305
- :printer => :puts,
306
- :color => false,
307
- })
308
- Util::Console.new({ :console_delegate => ui }).dump('message')
309
- end
310
-
311
- #-------------------------------------------------------------------------
312
- # Printing
313
-
314
- it "dumps data to stderr output channel" do
315
- error = double('error')
316
- error.should_receive(:puts).with('message')
317
-
318
- Util::Console.new({
319
- :error => error,
320
- :printer => :puts,
321
- :color => false,
322
- }).dump('message')
202
+ test_output("\e\[32mmessage\e\[0m", :print) do |output|
203
+ console({ :output => output, :color => true }).success('message', { :new_line => false })
204
+ end
323
205
  end
324
206
  end
325
-
326
- #---------------------------------------------------------------------------
207
+
208
+
209
+ #***************************************************************************
327
210
  # Utilities
328
-
211
+
212
+ # Format a message for display
213
+ #
329
214
  describe "#format_message" do
330
-
331
- #-------------------------------------------------------------------------
332
- # Delegation
333
-
215
+
334
216
  it "can delegate to another class that contains this method" do
335
- message = Util::Console.new({
336
- :console_delegate => Util::Console.new('delegate')
337
- }).format_message(:info, 'message', { :prefix => true })
338
-
339
- message.should == '[delegate] message'
340
- end
341
-
342
- #-------------------------------------------------------------------------
343
- # Prefix specifications
344
-
217
+ console({ :console_delegate => console('delegate') }) do |console|
218
+ test_eq console.format_message(:info, 'message', { :prefix => true }), '[delegate] message'
219
+ end
220
+ end
221
+
345
222
  it "returns without a prefix because no resource" do
346
- message = Util::Console.new.format_message(:info, 'message', { :prefix => true })
347
- message.should == 'message'
223
+ test_eq console.format_message(:info, 'message', { :prefix => true }), 'message'
348
224
  end
349
-
350
- #---
351
-
225
+
352
226
  it "returns without a prefix because prefix is false" do
353
- message = Util::Console.new('component').format_message(:info, 'message', { :prefix => false })
354
- message.should == 'message'
227
+ test_eq console('component').format_message(:info, 'message', { :prefix => false }), 'message'
355
228
  end
356
-
357
- #---
358
-
229
+
359
230
  it "returns without a prefix because no prefix option given" do
360
- message = Util::Console.new('component').format_message(:info, 'message')
361
- message.should == 'message'
231
+ test_eq console('component').format_message(:info, 'message'), 'message'
362
232
  end
363
-
364
- #---
365
-
233
+
366
234
  it "returns with a prefix if resource and prefix option given" do
367
- message = Util::Console.new('component').format_message(:info, 'message', { :prefix => true })
368
- message.should == '[component] message'
235
+ test_eq console('component').format_message(:info, 'message', { :prefix => true }), '[component] message'
369
236
  end
370
-
371
- #-------------------------------------------------------------------------
372
- # Color specifications
373
-
237
+
374
238
  it "formats a error message in red if color enabled" do
375
- message = Util::Console.new({
376
- :resource => 'component',
377
- :color => true,
378
- }).format_message(:error, 'message')
379
- message.should match(/^\e\[31mmessage\e\[0m$/)
380
- end
381
-
382
- #---
383
-
239
+ test_eq console({ :resource => 'component', :color => true }).format_message(:error, 'message'), "\e\[31mmessage\e\[0m"
240
+ end
241
+
384
242
  it "formats a warning message in yellow if color enabled" do
385
- message = Util::Console.new({
386
- :resource => 'component',
387
- :color => true,
388
- }).format_message(:warn, 'message')
389
- message.should match(/^\e\[33mmessage\e\[0m$/)
390
- end
391
-
392
- #---
393
-
243
+ test_eq console({ :resource => 'component', :color => true }).format_message(:warn, 'message'), "\e\[33mmessage\e\[0m"
244
+ end
245
+
394
246
  it "formats a success message in green if color enabled" do
395
- message = Util::Console.new({
396
- :resource => 'component',
397
- :color => true,
398
- }).format_message(:success, 'message')
399
- message.should match(/^\e\[32mmessage\e\[0m$/)
247
+ test_eq console({ :resource => 'component', :color => true }).format_message(:success, 'message'), "\e\[32mmessage\e\[0m"
400
248
  end
401
249
  end
402
-
403
- #---------------------------------------------------------------------------
404
-
250
+
251
+ # Safely output via a printer method to an output channel unless quiet specified
252
+ #
405
253
  describe "#safe_puts" do
406
-
407
- #-------------------------------------------------------------------------
408
- # Delegation
409
-
254
+
410
255
  it "can delegate to another class that contains this method" do
411
- output = double('output')
412
- output.should_receive(:puts).with('message')
413
-
414
- ui = Util::Console.new({
415
- :output => output,
416
- :printer => :puts,
417
- })
418
- Util::Console.new({ :console_delegate => ui }).safe_puts('message')
419
- end
420
-
421
- #-------------------------------------------------------------------------
422
- # Instance configuration
423
-
256
+ test_output('message', :puts) do |output|
257
+ console({ :output => output }) do |console|
258
+ console({ :console_delegate => console }).safe_puts('message')
259
+ end
260
+ end
261
+ end
262
+
424
263
  it "prints an empty string unless message given" do
425
- output = double('output')
426
- output.should_receive(:puts).with('')
427
-
428
- Util::Console.new({
429
- :output => output,
430
- :printer => :puts,
431
- }).safe_puts()
432
- end
433
-
434
- #---
435
-
264
+ test_output('', :puts) do |output|
265
+ console({ :output => output }).safe_puts()
266
+ end
267
+ end
268
+
436
269
  it "prints to different output channels if they are given" do
437
- output1 = double('output1')
438
- output1.should_receive(:puts).with('message')
439
-
440
- test = Util::Console.new({
441
- :output => output1,
442
- :printer => :puts,
443
- })
444
- test.safe_puts('message')
445
-
446
- output2 = double('output2')
447
- output2.should_receive(:puts).with('message')
448
-
449
- test.output = output2
450
- test.safe_puts('message')
451
- end
452
-
453
- #---
454
-
270
+ console do |console|
271
+ test_output('message1', :puts) do |output|
272
+ console.output = output
273
+ console.safe_puts('message1')
274
+ end
275
+ test_output('message2', :puts) do |output|
276
+ console.output = output
277
+ console.safe_puts('message2')
278
+ end
279
+ end
280
+ end
281
+
455
282
  it "prints with puts if puts printer option given" do
456
- output = double('output')
457
- output.should_receive(:puts).with('message')
458
-
459
- Util::Console.new({
460
- :output => output,
461
- :printer => :puts,
462
- }).safe_puts('message')
463
- end
464
-
465
- #---
466
-
283
+ test_output('message', :puts) do |output|
284
+ console({ :output => output, :printer => :puts }).safe_puts('message')
285
+ end
286
+ end
287
+
467
288
  it "prints with print if print printer option given" do
468
- output = double('output')
469
- output.should_receive(:print).with('message')
470
-
471
- Util::Console.new({
472
- :output => output,
473
- :printer => :print,
474
- }).safe_puts('message')
475
- end
476
-
477
- #-------------------------------------------------------------------------
478
- # Method configuration
479
-
289
+ test_output('message', :print) do |output|
290
+ console({ :output => output, :printer => :print }).safe_puts('message')
291
+ end
292
+ end
293
+
480
294
  it "can override the instance output channel" do
481
- output1 = double('output1')
482
- output1.should_not_receive(:puts).with('message')
483
-
484
- output2 = double('output2')
485
- output2.should_receive(:puts).with('message')
486
-
487
- Util::Console.new({
488
- :output => output1,
489
- :printer => :puts,
490
- }).safe_puts('message', { :channel => output2 })
491
- end
492
-
493
- #---
494
-
295
+ test_output('message1', :puts) do |output|
296
+ console({ :output => output }) do |console|
297
+ console.safe_puts('message1')
298
+ console.safe_puts('message2', { :channel => test_output('message2', :puts) })
299
+ end
300
+ end
301
+ end
302
+
495
303
  it "can override the instance printer handler" do
496
- output = double('output')
497
- output.should_not_receive(:puts).with('message')
498
- output.should_receive(:print).with('message')
499
-
500
- Util::Console.new({
501
- :output => output,
502
- :printer => :puts,
503
- }).safe_puts('message', { :printer => :print })
304
+ test_output('message1', :puts) do |output|
305
+ console({ :output => output, :printer => :puts }) do |console|
306
+ console.safe_puts('message1')
307
+ console.safe_puts('message2', { :channel => test_output('message2', :print), :printer => :print })
308
+ end
309
+ end
504
310
  end
505
311
  end
506
-
507
- #---------------------------------------------------------------------------
508
-
312
+
313
+ # Check if a registered delegate exists and responds to a specified method.
314
+ #
509
315
  describe "#check_delegate" do
510
-
316
+
511
317
  it "returns false if no delegate exists" do
512
- Util::Console.new.check_delegate('safe_puts').should be_false
318
+ test_eq console.check_delegate('safe_puts'), false
513
319
  end
320
+
514
321
  it "returns true if a delegate exists and it implements given method" do
515
- test = Util::Console.new({ :console_delegate => Util::Console.new })
516
- test.check_delegate('safe_puts').should be_true
517
- test.check_delegate('nonexistent').should be_false
322
+ console({ :console_delegate => console }) do |console|
323
+ test_eq console.check_delegate('safe_puts'), true
324
+ test_eq console.check_delegate('nonexistent'), false
325
+ end
518
326
  end
519
- end
327
+ end
520
328
  end
521
329
  end