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
@@ -1,22 +1,77 @@
1
-
2
1
  module Nucleon
3
2
  class Config
3
+ #
4
+ # == Configuration collection
5
+ #
6
+ # The Nucleon::Config::Collection class defines a container for logging properties
7
+ # and values. This class is not currently used within Nucleon itself but it
8
+ # does serve as a configuration log for the corl gem.
9
+ #
10
+ # This basically provides standard access methods. It implements the ability
11
+ # to dump registered properties to the file system through a machine readable
12
+ # format.
13
+ #
14
+ # How we use it in CORL:
15
+ #
16
+ # 1. As we look up configurations and modify them we save new values in global registry
17
+ # 2. When we get to the end of our execution we log them to disk so they are viewable
18
+ #
19
+ # Right now, largely for historical reasons, this class is structured as a
20
+ # global interface and collection for grouping all of the defined options.
21
+ # It was originally contained within Nucleon::Config as part of the global
22
+ # configuration interface. In the future, this class will be refactored to
23
+ # support multiple property logs and will have more fully refined persistence
24
+ # methods.
25
+ #
26
+ # *TODO*: Mutex synchronization probably not needed?
27
+ #
28
+ # For usage:
29
+ #
30
+ # - See core configuration object Nucleon::Config
31
+ # - See configuration mixin Nucleon::Mixin::ConfigCollection
32
+ #
4
33
  class Collection
5
34
 
6
- #-----------------------------------------------------------------------------
35
+ #*****************************************************************************
7
36
  # Property accessor / modifiers
8
37
 
9
- @@lock = Mutex.new
38
+ # Global access lock
39
+ #
40
+ # *TODO*: Might not be needed?
41
+ #
42
+ @@lock = Mutex.new
43
+
44
+ # Global property collection
45
+ #
46
+ # Structure: @@properties[property] = value
47
+ #
10
48
  @@properties = {}
11
-
12
- #---
13
-
49
+
50
+ # Return a reference to all of the globally defined properties.
51
+ #
52
+ # This method generally should not be used in favor of the ::get method.
53
+ #
54
+ # * *Parameters*
55
+ #
56
+ # * *Returns*
57
+ # - [Hash<Symbol|ANY>] Global reference to property registry
58
+ #
59
+ # * *Errors*
60
+ #
14
61
  def self.all
15
62
  @@properties
16
63
  end
17
-
18
- #---
19
-
64
+
65
+ # Return specified property value.
66
+ #
67
+ # * *Parameters*
68
+ # - [String, Symbol] *name* Property name to return value
69
+ #
70
+ # * *Returns*
71
+ # - [ANY] Specified property value
72
+ #
73
+ # * *Errors*
74
+ #
20
75
  def self.get(name)
21
76
  value = nil
22
77
  @@lock.synchronize do
@@ -24,44 +79,98 @@ class Collection
24
79
  end
25
80
  value
26
81
  end
27
-
28
- #---
29
-
82
+
83
+ # Set property value.
84
+ #
85
+ # * *Parameters*
86
+ # - [String, Symbol] *name* Property name to set value
87
+ # - [ANY] *value* Specified property value
88
+ #
89
+ # * *Returns*
90
+ # - [Void] This method does not currently have a return value
91
+ #
92
+ # * *Errors*
93
+ #
30
94
  def self.set(name, value)
31
95
  @@lock.synchronize do
32
96
  @@properties[name.to_sym] = value
33
97
  end
34
98
  end
35
-
36
- #---
37
-
99
+
100
+ # Delete property from collection.
101
+ #
102
+ # * *Parameters*
103
+ # - [String, Symbol] *name* Property name to remove
104
+ #
105
+ # * *Returns*
106
+ # - [Void] This method does not currently have a return value
107
+ #
108
+ # * *Errors*
109
+ #
38
110
  def self.delete(name)
39
111
  @@lock.synchronize do
40
112
  @@properties.delete(name.to_sym)
41
113
  end
42
114
  end
43
-
44
- #---
45
-
115
+
116
+ # Clear all properties from the collection.
117
+ #
118
+ # * *Parameters*
119
+ #
120
+ # * *Returns*
121
+ # - [Void] This method does not currently have a return value
122
+ #
123
+ # * *Errors*
124
+ #
46
125
  def self.clear
47
126
  @@lock.synchronize do
48
127
  @@properties = {}
49
128
  end
50
129
  end
51
-
52
- #---
53
-
130
+
131
+ # Dump properties to disk.
132
+ #
133
+ # This class was originally designed as a logging mechanism so it is focused
134
+ # on providing write methods so far. Notice the missing load() method.
135
+ #
136
+ # The property dump must be explicitly enabled with the :config_store option.
137
+ #
138
+ # *TODO*:
139
+ # 1. This method will undergo a large'ish transformation in the future as it
140
+ # is rewritten to make it more flexible.
141
+ # 2. Throw appropriate error if write fails.
142
+ #
143
+ # * *Parameters*
144
+ # - [Hash<Symbol|ANY>] *options* Method options
145
+ # - [String] *:log_dir* Directory to store the log files
146
+ # - [String] *:log_name* Name of the log file (*no dot or extension*)
147
+ # - [Boolean] *:config_store* Check whether configurations should be stored
148
+ #
149
+ # * *Returns*
150
+ # - [Void] This method does not currently have a return value
151
+ #
152
+ # * *Errors*
153
+ #
154
+ # See also:
155
+ # - Nucleon::Util::Data::empty?
156
+ # - Nucleon::Util::Data.string_map
157
+ # - Nucleon::Util::Data::to_json
158
+ # - Nucleon::Util::Data::to_yaml
159
+ #
54
160
  def self.save(options = {})
55
161
  unless Util::Data.empty?(options[:log_dir])
56
162
  @@lock.synchronize do
57
- log_dir = options[:log_dir]
58
-
163
+ log_dir = options[:log_dir]
164
+
165
+ log_name = options[:log_name]
166
+ log_name = 'properties' unless log_name
167
+
59
168
  if options[:config_store]
60
169
  unless File.directory?(log_dir)
61
170
  FileUtils.mkdir_p(log_dir)
62
171
  end
63
- Util::Disk.write(File.join(log_dir, "properties.json"), Util::Data.to_json(@@properties, true))
64
- Util::Disk.write(File.join(log_dir, "properties.yaml"), Util::Data.to_yaml(Util::Data.string_map(@@properties)))
172
+ Util::Disk.write(File.join(log_dir, "#{log_name}.json"), Util::Data.to_json(@@properties, true))
173
+ Util::Disk.write(File.join(log_dir, "#{log_name}.yaml"), Util::Data.to_yaml(Util::Data.string_map(@@properties)))
65
174
  end
66
175
  end
67
176
  end
@@ -1,74 +1,198 @@
1
-
2
1
  module Nucleon
3
2
  class Config
3
+ #
4
+ # == Contextualized option collection
5
+ #
6
+ # The Nucleon::Config::Options class defines a container for contextualized
7
+ # access of grouped properties.
8
+ #
9
+ # This basically does three things:
10
+ #
11
+ # 1. Group properties by contextual identifiers and store in a centralized location
12
+ # 2. Access all defined properties for one or more contextual identifiers
13
+ # 3. Clear contextual properties
14
+ #
15
+ # Right now, largely for historical reasons, this class is structured as a
16
+ # global interface and collection for grouping all of the defined options.
17
+ # It was originally contained within Nucleon::Config as part of the global
18
+ # configuration interface. In the future, this class will be refactored to
19
+ # support multiple collections of contextualized properties.
20
+ #
21
+ # For usage:
22
+ #
23
+ # - See core configuration object Nucleon::Config::init
24
+ # - See configuration mixin Nucleon::Mixin::ConfigOptions
25
+ #
4
26
  class Options
5
-
6
- #-----------------------------------------------------------------------------
27
+
28
+ #*****************************************************************************
7
29
  # Property accessors / modifiers
8
-
30
+
31
+ # Global contextualized property collection
32
+ #
33
+ # Structure: @@options[context_name][property] = value
34
+ #
9
35
  @@options = {}
10
-
11
- #---
12
-
36
+
37
+ # Return an array of context names based on given contexts and an optional
38
+ # hierarchy path.
39
+ #
40
+ # This method mainly exists to allow us to create cascading context groups
41
+ # for the properties based on a hierarchical list. We use it to create
42
+ # contextual property lookups for configuring Puppet in the corl gem.
43
+ #
44
+ # For example:
45
+ #
46
+ # contexts = Nucleon::Config::Options.contexts([ :parameter, :var_name ], :module)
47
+ # contexts = [
48
+ # 'all',
49
+ # 'parameter',
50
+ # 'var_name',
51
+ # 'module_parameter',
52
+ # 'module_var_name'
53
+ # ]
54
+ #
55
+ # * *Parameters*
56
+ # - [Array<String, Symbol>, String, Symbol] *contexts* Context names to include in list
57
+ # - [Array<String, Symbol>, String, Symbol] *hierarchy* Hierarchy of prefixes to apply to given contexts
58
+ #
59
+ # * *Returns*
60
+ # - [Array<String>] Generated array of ordered context names
61
+ #
62
+ # * *Errors*
63
+ #
64
+ # See also:
65
+ # - Nucleon::Util::Data::empty?
66
+ # - Nucleon::Util::Data::prefix
67
+ #
13
68
  def self.contexts(contexts = [], hierarchy = [])
14
69
  contexts = [ 'all', contexts ].flatten
15
-
70
+ results = contexts
71
+
16
72
  unless hierarchy.is_a?(Array)
17
73
  hierarchy = ( ! Util::Data.empty?(hierarchy) ? [ hierarchy ].flatten : [] )
18
74
  end
19
-
20
- hierarchy.each do |group|
75
+
76
+ hierarchy.each do |group|
21
77
  group_contexts = Util::Data.prefix(group, contexts)
22
- contexts = [ contexts, group_contexts ].flatten
78
+ results = [ results, group_contexts ].flatten
23
79
  end
24
-
25
- return contexts
80
+
81
+ return results
26
82
  end
27
-
28
- #---
29
-
83
+
84
+ # Return a reference to all of the globally defined context properties.
85
+ #
86
+ # This method generally should not be used in favor of the ::get method.
87
+ #
88
+ # * *Parameters*
89
+ #
90
+ # * *Returns*
91
+ # - [Hash<Symbol|Symbol|ANY>] Global reference to option registry
92
+ #
93
+ # * *Errors*
94
+ #
30
95
  def self.all
31
96
  @@options
32
97
  end
33
-
34
- #---
35
-
98
+
99
+ # Return merged option groups for given context names.
100
+ #
101
+ # This method allows us to easily request combinations of properties.
102
+ #
103
+ # For example:
104
+ #
105
+ # Nucleon::Config::Options.set(:context1, { :property1 => 'some value' })
106
+ # Nucleon::Config::Options.set(:context2, { :property2 => 'another value' })
107
+ #
108
+ # options = Nucleon::Config::Options.get([ :context1, :context2 ])
109
+ # options = {
110
+ # :property1 => 'some value',
111
+ # :property2 => 'another value'
112
+ # }
113
+ #
114
+ # * *Parameters*
115
+ # - [Array<String, Symbol>, String, Symbol] *contexts* Context names to aggregate
116
+ # - [Boolean] *force* Force merge override if different types of data being merged
117
+ #
118
+ # * *Returns*
119
+ # - [Hash<Symbol|ANY>] Aggregated context property collection
120
+ #
121
+ # * *Errors*
122
+ #
123
+ # See also:
124
+ # - Nucleon::Util::Data::empty?
125
+ # - Nucleon::Util::Data::merge
126
+ #
36
127
  def self.get(contexts, force = true)
37
128
  options = {}
38
-
129
+
39
130
  unless contexts.is_a?(Array)
40
131
  contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] )
41
132
  end
42
133
  contexts.each do |name|
43
134
  name = name.to_sym
44
135
  if @@options.has_key?(name)
45
- options = Util::Data.merge([ options, @@options[name] ], force)
136
+ options = Util::Data.merge([ options, @@options[name] ], force, false)
46
137
  end
47
138
  end
48
139
  return options
49
140
  end
50
-
51
- #---
52
-
141
+
142
+ # Assign property values to specified context identifiers.
143
+ #
144
+ # This method allows us to easily merge properties across various contexts.
145
+ #
146
+ # For example, see ::get method
147
+ #
148
+ # * *Parameters*
149
+ # - [Array<String, Symbol>, String, Symbol] *contexts* Context names to assign properties
150
+ # - [Hash<String, Symbol|ANY>] *options* Property collection to merge with existing properties
151
+ # - [Boolean] *force* Force merge override if different types of data being merged
152
+ #
153
+ # * *Returns*
154
+ # - [Void] This method does not currently have a return value
155
+ #
156
+ # * *Errors*
157
+ #
158
+ # See also:
159
+ # - Nucleon::Util::Data::empty?
160
+ # - Nucleon::Util::Data::merge
161
+ #
53
162
  def self.set(contexts, options, force = true)
54
163
  unless contexts.is_a?(Array)
55
164
  contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] )
56
165
  end
57
166
  contexts.each do |name|
58
- name = name.to_sym
167
+ name = name.to_sym
59
168
  current_options = ( @@options.has_key?(name) ? @@options[name] : {} )
60
- @@options[name] = Util::Data.merge([ current_options, Config.symbol_map(options) ], force)
61
- end
62
- end
63
-
64
- #---
65
-
66
- def self.clear(contexts)
67
- unless contexts.is_a?(Array)
68
- contexts = [ contexts ]
169
+ @@options[name] = Util::Data.merge([ current_options, Config.symbol_map(options) ], force, false)
69
170
  end
70
- contexts.each do |name|
71
- @@options.delete(name.to_sym)
171
+ end
172
+
173
+ # Clear all properties for specified contexts.
174
+ #
175
+ # Contexts are entirely removed, even the name itself. If nil is given (default)
176
+ # then all data is removed and options are reinitialized.
177
+ #
178
+ # * *Parameters*
179
+ # - [nil, Array<String, Symbol>, String, Symbol] *contexts* Context names to remove
180
+ #
181
+ # * *Returns*
182
+ # - [Void] This method does not currently have a return value
183
+ #
184
+ # * *Errors*
185
+ #
186
+ def self.clear(contexts = nil)
187
+ if contexts.nil?
188
+ @@options = {}
189
+ else
190
+ unless contexts.is_a?(Array)
191
+ contexts = [ contexts ]
192
+ end
193
+ contexts.each do |name|
194
+ @@options.delete(name.to_sym)
195
+ end
72
196
  end
73
197
  end
74
198
  end
@@ -1,99 +1,261 @@
1
-
2
1
  module Nucleon
2
+ #
3
+ # == Core Nucleon object
4
+ #
5
+ # The Nucleon::Core class defines a minimal base class for creating other
6
+ # capable objects, combining configurations, console capabilities, and logging
7
+ # capabilities.
8
+ #
9
+ # All of the plugins build off of the Core object, as do some utility classes.
10
+ #
11
+ # Five main goals with this object:
12
+ #
13
+ # 1. Global and instance Nucleon::Util::Logger interfaces
14
+ # 2. Global and instance Nucleon::Util::Console interfaces
15
+ # 3. Include color methods
16
+ # 4. Provide contextually prefixed UI groups for console output operations
17
+ # 5. Provide an initialized lookup
18
+ #
3
19
  class Core < Config
4
-
20
+
21
+ #
22
+ # Provide colored text rendering methods
23
+ #
24
+ # See:
25
+ # - Nucleon::Mixin::Colors
26
+ # - Nucleon::Util::Console
27
+ #
5
28
  include Mixin::Colors
6
-
7
- #-----------------------------------------------------------------------------
29
+
30
+ #*****************************************************************************
8
31
  # Properties
9
-
10
- @@logger = Util::Logger.new('core')
11
- @@ui = Util::Console.new('core')
32
+
33
+ #
34
+ # Global logger instance
35
+ #
36
+ # See:
37
+ # - Nucleon::Util::Logger
38
+ #
39
+ @@logger = Util::Logger.new('core')
40
+ #
41
+ # Global console instance
42
+ #
43
+ # See:
44
+ # - Nucleon::Util::Console
45
+ #
46
+ @@ui = Util::Console.new('core')
47
+ #
48
+ # Global UI Mutex
49
+ #
50
+ # TODO: This may not be needed?
51
+ #
12
52
  @@ui_lock = Mutex.new
13
-
14
- #-----------------------------------------------------------------------------
53
+
54
+ #*****************************************************************************
15
55
  # Constructor / Destructor
16
-
56
+
57
+ # Initialize a new core Nucleon object
58
+ #
59
+ # TODO: Figure out some way to make the console and logging systems pluggable?
60
+ #
61
+ # * *Parameters*
62
+ # - [nil, Hash, Nucleon::Config] *data* Configurations to import
63
+ # - [Hash] *defaults* Configuration defaults that may be overridden by config data
64
+ # - [Boolean] *force* Whether or not to force override of values where types don't match during merge
65
+ # - [Boolean] *set_initialized* Whether or not to the initialized flag is set after this object is constructed
66
+ # - [Boolean] *basic_merge* Whether or not to perform a basic merge or deep (recursive) merge
67
+ #
68
+ # * *Returns*
69
+ # - [Void] This method does not return a value
70
+ #
71
+ # * *Errors*
72
+ #
73
+ # See also:
74
+ # - Nucleon::Config::new
75
+ # - Nucleon::Config#delete
76
+ # - Nucleon::Config#export
77
+ # - Nucleon::Config#defaults
78
+ # - Nucleon::Util::Data::ensure_value
79
+ # - Nucleon::Util::Console::colorize
80
+ #
17
81
  def initialize(data = {}, defaults = {}, force = true, set_initialized = true, basic_merge = true)
18
- super(data, defaults, force, basic_merge)
19
-
82
+ super(data, defaults, force, basic_merge)
83
+
84
+ @initialized = false
20
85
  @class_color = Util::Data.ensure_value(delete(:class_color, :cyan), :cyan)
21
86
  @class_label = self.class.to_s.downcase.gsub(/^nucleon::/, '')
22
-
87
+
23
88
  self.logger = delete(:logger, @class_label)
24
89
  self.ui = Config.new(export).defaults({ :resource => Util::Console.colorize(@class_label, @class_color) })
25
-
90
+
26
91
  logger.debug('Initialized instance logger and interface')
27
92
  @initialized = true if set_initialized
28
93
  end
29
-
30
- #-----------------------------------------------------------------------------
94
+
95
+ #*****************************************************************************
31
96
  # Checks
32
-
97
+
98
+ # Check if object is initialized?
99
+ #
100
+ # The initialized flag must be set from a method within the class. It can not
101
+ # be set externally.
102
+ #
103
+ # * *Parameters*
104
+ #
105
+ # * *Returns*
106
+ # - [Boolean] Whether or not object has been marked as initialized
107
+ #
108
+ # * *Errors*
109
+ #
33
110
  def initialized?
34
111
  @initialized
35
112
  end
36
-
37
- #-----------------------------------------------------------------------------
113
+
114
+ #*****************************************************************************
38
115
  # Accessor / Modifiers
39
-
40
- attr_reader :logger, :ui
41
-
42
- #---
43
-
116
+
117
+ #
118
+ # [Nucleon::Util::Logger] Instance logger
119
+ #
120
+ attr_reader :logger
121
+ #
122
+ # [Nucleon::Util::Console] Instance console
123
+ #
124
+ attr_reader :ui
125
+
126
+ # Return global logger instance
127
+ #
128
+ # * *Parameters*
129
+ #
130
+ # * *Returns*
131
+ # - [Nucleon::Util::Logger] Global logger instance
132
+ #
133
+ # * *Errors*
134
+ #
44
135
  def self.logger
45
136
  return @@logger
46
137
  end
47
-
138
+
139
+ # Set current object logger instance
140
+ #
141
+ # * *Parameters*
142
+ # - [String, Nucleon::Util::Logger] *logger* Logger instance or resource name for new logger
143
+ #
144
+ # * *Returns*
145
+ # - [Void] This method does not return a value
146
+ #
147
+ # * *Errors*
148
+ #
149
+ # See also:
150
+ # - Nucleon::Util::Logger::loggers
151
+ # - Nucleon::Util::Logger::new
152
+ #
48
153
  def logger=logger
49
154
  Util::Logger.loggers.delete(self.logger.resource) if self.logger
50
-
155
+
51
156
  if logger.is_a?(Util::Logger)
52
157
  @logger = logger
53
158
  else
54
159
  @logger = Util::Logger.new(logger)
55
160
  end
56
161
  end
57
-
58
- #---
59
-
162
+
163
+ # Return global console instance
164
+ #
165
+ # This is named ui for historical reasons. It might change to console in the
166
+ # future.
167
+ #
168
+ # * *Parameters*
169
+ #
170
+ # * *Returns*
171
+ # - [Nucleon::Util::Console] Global console instance
172
+ #
173
+ # * *Errors*
174
+ #
60
175
  def self.ui
61
176
  return @@ui
62
177
  end
63
-
178
+
179
+ # Set current object console instance
180
+ #
181
+ # * *Parameters*
182
+ # - [String, Nucleon::Util::Console] *ui* Console instance or resource name for new console
183
+ #
184
+ # * *Returns*
185
+ # - [Void] This method does not return a value
186
+ #
187
+ # * *Errors*
188
+ #
189
+ # See also:
190
+ # - Nucleon::Util::Console::new
191
+ #
64
192
  def ui=ui
65
193
  if ui.is_a?(Util::Console)
66
194
  @ui = ui
67
195
  else
68
196
  @ui = Util::Console.new(ui)
69
- end
197
+ end
70
198
  end
71
-
72
- #-----------------------------------------------------------------------------
199
+
200
+ #*****************************************************************************
73
201
  # General utilities
74
-
75
- def self.ui_group(resource, color = :cyan)
202
+
203
+ # Contextualize console operations in a code block with a given resource name.
204
+ #
205
+ # TODO: May not need Mutex synchronization?
206
+ #
207
+ # * *Parameters*
208
+ # - [String, Symbol] *resource* Console resource identifier (prefix)
209
+ # - [Symbol] *color* Color to use; *:black*, *:red*, *:green*, *:yellow*, *:blue*, *:purple*, *:cyan*, *:grey*
210
+ #
211
+ # * *Returns*
212
+ # - [Void] This method does not return a value
213
+ #
214
+ # * *Errors*
215
+ #
216
+ # * *Yields*
217
+ # - [Nucleon::Util::Console] *ui* Current global console instance
218
+ #
219
+ # See also:
220
+ # - Nucleon::Util::Console::colorize
221
+ #
222
+ def self.ui_group(resource, color = :cyan) # :yields: ui
76
223
  @@ui_lock.synchronize do
77
224
  begin
78
225
  ui_resource = ui.resource
79
226
  ui.resource = Util::Console.colorize(resource, color)
80
227
  yield(ui)
81
-
228
+
82
229
  ensure
83
230
  ui.resource = ui_resource
84
231
  end
85
- end
86
- end
87
-
88
- #---
89
-
90
- def ui_group(resource, color = :cyan)
232
+ end
233
+ end
234
+
235
+ # Contextualize console operations in a code block with a given resource name.
236
+ #
237
+ # * *Parameters*
238
+ # - [String, Symbol] *resource* Console resource identifier (prefix)
239
+ # - [Symbol] *color* Color to use; *:black*, *:red*, *:green*, *:yellow*, *:blue*, *:purple*, *:cyan*, *:grey*
240
+ #
241
+ # * *Returns*
242
+ # - [Void] This method does not return a value
243
+ #
244
+ # * *Errors*
245
+ #
246
+ # * *Yields*
247
+ # - [Nucleon::Util::Console] *ui* Current object console instance
248
+ #
249
+ # See also:
250
+ # - Nucleon::Util::Console::colorize
251
+ #
252
+ def ui_group(resource, color = :cyan) # :yields: ui
91
253
  ui_resource = ui.resource
92
254
  ui.resource = Util::Console.colorize(resource, color)
93
255
  yield(ui)
94
-
256
+
95
257
  ensure
96
- ui.resource = ui_resource
97
- end
258
+ ui.resource = ui_resource
259
+ end
98
260
  end
99
261
  end