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
@@ -4,43 +4,43 @@ module Nucleon
4
4
  # Parallel interface (include Parallel)
5
5
 
6
6
  module Parallel
7
-
7
+
8
8
  def self.included(klass)
9
9
  if Nucleon.parallel?
10
10
  klass.send :include, Celluloid
11
- klass.finalizer :parallel_finalize
12
- end
11
+ klass.finalizer :parallel_finalize
12
+ end
13
13
  klass.send :include, InstanceMethods
14
14
  klass.extend ClassMethods
15
15
  end
16
-
16
+
17
17
  #---
18
-
18
+
19
19
  module InstanceMethods
20
20
  def parallel_finalize
21
- # Override if needed
21
+ # Override if needed
22
22
  end
23
-
23
+
24
24
  #---
25
-
25
+
26
26
  def parallel(method, args, *shared_args)
27
27
  results = nil
28
-
28
+
29
29
  case args
30
30
  when Hash
31
31
  results = parallel_hash(method, args, *shared_args)
32
32
  when Array, String, Symbol
33
- results = parallel_array(method, args, *shared_args)
33
+ results = parallel_array(method, args, *shared_args)
34
34
  end
35
35
  results
36
36
  end
37
-
37
+
38
38
  #---
39
-
39
+
40
40
  def parallel_array(method, array_args, *shared_args)
41
41
  results = []
42
42
  array_args = [ array_args ] unless array_args.is_a?(Array)
43
-
43
+
44
44
  if Nucleon.parallel?
45
45
  array_args.each do |arg|
46
46
  results << future.send(method, arg, *shared_args)
@@ -49,16 +49,16 @@ module Parallel
49
49
  else
50
50
  array_args.each do |arg|
51
51
  results << send(method, arg, *shared_args)
52
- end
52
+ end
53
53
  end
54
54
  results
55
55
  end
56
-
56
+
57
57
  #---
58
-
58
+
59
59
  def parallel_hash(method, hash_args, *shared_args)
60
60
  results = {}
61
-
61
+
62
62
  if Nucleon.parallel?
63
63
  hash_args.each do |key, value|
64
64
  results[key] = future.send(method, key, value, *shared_args)
@@ -69,12 +69,12 @@ module Parallel
69
69
  else
70
70
  hash_args.each do |key, value|
71
71
  results[key] = send(method, key, value, *shared_args)
72
- end
72
+ end
73
73
  end
74
74
  results
75
75
  end
76
76
  end
77
-
77
+
78
78
  #---
79
79
 
80
80
  module ClassMethods
@@ -90,41 +90,41 @@ end
90
90
 
91
91
  #-------------------------------------------------------------------------------
92
92
  # Core Nucleon facade (extend Facade)
93
-
93
+
94
94
  module Facade
95
-
95
+
96
96
  include Mixin::Colors
97
-
97
+
98
98
  #-----------------------------------------------------------------------------
99
-
99
+
100
100
  def ui
101
101
  Core.ui
102
102
  end
103
-
103
+
104
104
  def ui_group(resource, color = :cyan, &code)
105
105
  Core.ui_group(resource, color, &code)
106
106
  end
107
-
107
+
108
108
  def quiet=quiet
109
- Util::Console.quiet = quiet
109
+ Util::Console.quiet = quiet
110
110
  end
111
-
111
+
112
112
  #---
113
-
113
+
114
114
  def logger
115
115
  Core.logger
116
116
  end
117
-
117
+
118
118
  def log_level
119
119
  Util::Logger.level
120
120
  end
121
-
121
+
122
122
  def log_level=log_level
123
123
  Util::Logger.level = log_level
124
124
  end
125
-
125
+
126
126
  #-----------------------------------------------------------------------------
127
-
127
+
128
128
  def handle(klass)
129
129
  if parallel? && klass.respond_to?(:current_actor)
130
130
  myself = klass.current_actor
@@ -133,13 +133,13 @@ module Facade
133
133
  end
134
134
  myself
135
135
  end
136
-
136
+
137
137
  #---
138
-
138
+
139
139
  def manager(collection, name, klass, reset = false)
140
140
  name = name.to_sym
141
141
  actor_id = "#{klass}::#{name}".to_sym
142
-
142
+
143
143
  if collection.has_key?(actor_id)
144
144
  manager = parallel? ? Celluloid::Actor[actor_id] : collection[actor_id]
145
145
  else
@@ -153,22 +153,22 @@ module Facade
153
153
  end
154
154
  test_connection(actor_id, manager)
155
155
  end
156
-
156
+
157
157
  def test_connection(actor_id, manager)
158
158
  if parallel?
159
159
  begin
160
160
  # Raise error if no test method found but retry for dead actors
161
161
  manager.test_connection
162
-
163
- rescue Celluloid::DeadActorError
162
+
163
+ rescue NoMethodError, Celluloid::DeadActorError
164
164
  retry
165
165
  end
166
166
  end
167
167
  manager
168
168
  end
169
-
169
+
170
170
  #-----------------------------------------------------------------------------
171
-
171
+
172
172
  def admin?
173
173
  is_admin = ( ENV['USER'] == 'root' )
174
174
  ext_admin = exec(:check_admin) do |op, results|
@@ -180,24 +180,24 @@ module Facade
180
180
  end
181
181
  is_admin || ext_admin ? true : false
182
182
  end
183
-
183
+
184
184
  #---
185
-
185
+
186
186
  @@ip_cache = nil
187
-
187
+
188
188
  def ip_address(reset = false)
189
189
  external_ip = nil
190
190
  cached_ip_file = File.join(Dir.tmpdir(), 'nucleon_ip.json')
191
-
192
- unless @@ip_cache
191
+
192
+ unless @@ip_cache
193
193
  json_text = Util::Data.ensure_value(Util::Disk.read(cached_ip_file), '')
194
194
  @@ip_cache = Util::Data.parse_json(json_text) unless json_text.empty?
195
195
  end
196
-
196
+
197
197
  fetch_ip = lambda do
198
- result = cli_run(value(:external_address_command, 'curl --silent ifconfig.me'), { :quiet => true })
199
- ip_address = result.output
200
-
198
+ ip_command = value(:external_address_command, 'curl --silent ifconfig.me')
199
+ ip_address = `#{ip_command}`.strip
200
+
201
201
  unless ip_address.empty?
202
202
  @@ip_cache = {
203
203
  'ip' => ip_address,
@@ -207,385 +207,412 @@ module Facade
207
207
  end
208
208
  ip_address
209
209
  end
210
-
210
+
211
211
  if reset || (! @@ip_cache || @@ip_cache.empty? || ! @@ip_cache.has_key?('ip'))
212
212
  external_ip = fetch_ip.call
213
213
  else
214
214
  external_ip = @@ip_cache['ip']
215
215
  updated_time = Time.parse(@@ip_cache['updated'])
216
216
  cache_duration = (Time.new - updated_time) / 60 # Seconds to minutes
217
-
217
+
218
218
  if cache_duration >= value(:external_address_lifetime, 60)
219
219
  external_ip = fetch_ip.call
220
220
  end
221
221
  end
222
222
  external_ip
223
223
  end
224
-
224
+
225
225
  #-----------------------------------------------------------------------------
226
226
  # Status codes
227
-
227
+
228
228
  def code
229
229
  Codes.new
230
230
  end
231
-
231
+
232
232
  def codes(*codes)
233
233
  Codes.codes(*codes)
234
234
  end
235
-
235
+
236
236
  #-----------------------------------------------------------------------------
237
237
  # Core plugin interface
238
-
238
+
239
239
  def reload(core = false, loaded = [], &code)
240
- Manager.connection.reload(core, loaded, &code)
240
+ Manager.connection.reload(core, loaded, &code)
241
241
  end
242
-
242
+
243
243
  #---
244
-
244
+
245
245
  def namespaces
246
246
  Manager.connection.namespaces
247
247
  end
248
-
248
+
249
249
  #---
250
-
250
+
251
251
  def types(namespace)
252
252
  Manager.connection.types(namespace)
253
253
  end
254
-
254
+
255
255
  def define_types(namespace, type_info)
256
256
  Manager.connection.define_types(namespace, type_info)
257
257
  end
258
-
258
+
259
259
  def type_default(namespace, plugin_type)
260
260
  Manager.connection.type_default(namespace, plugin_type)
261
261
  end
262
-
262
+
263
263
  #---
264
-
264
+
265
265
  def load_plugins(base_dir = nil)
266
266
  base_dir = base_dir.nil? ? Dir.pwd : base_dir
267
-
267
+
268
268
  search_plugins = lambda do |search_dir|
269
269
  lib_dir = File.join(search_dir, 'lib')
270
-
270
+
271
271
  if File.directory?(lib_dir)
272
272
  logger.debug("Registering plugins at #{lib_dir}")
273
273
  register(lib_dir)
274
274
  end
275
-
275
+
276
276
  parent_search_dir = search_dir.sub(/#{File::SEPARATOR}[^#{File::SEPARATOR}]+$/, '')
277
277
  search_plugins.call(parent_search_dir) unless parent_search_dir.split(File::SEPARATOR).empty?
278
278
  end
279
-
279
+
280
280
  search_plugins.call(base_dir)
281
281
  end
282
-
282
+
283
283
  def register(base_path, &code)
284
284
  Manager.connection.register(base_path, &code)
285
285
  Manager.connection.autoload
286
286
  end
287
-
287
+
288
288
  def loaded_plugins(namespace = nil, plugin_type = nil, provider = nil)
289
- Manager.connection.loaded_plugins(namespace, plugin_type, provider)
289
+ Manager.connection.loaded_plugins(namespace, plugin_type, provider)
290
290
  end
291
-
291
+
292
292
  #---
293
-
293
+
294
294
  def active_plugins(namespace = nil, plugin_type = nil, provider = nil)
295
- Manager.connection.active_plugins(namespace, plugin_type, provider)
295
+ Manager.connection.active_plugins(namespace, plugin_type, provider)
296
296
  end
297
-
297
+
298
298
  #---
299
-
299
+
300
300
  def plugin(namespace, plugin_type, provider, options = {})
301
301
  Manager.connection.load(namespace, plugin_type, provider, options)
302
302
  end
303
-
303
+
304
304
  #---
305
-
305
+
306
306
  def plugins(namespace, plugin_type, data, build_hash = false, keep_array = false)
307
307
  Manager.connection.load_multiple(namespace, plugin_type, data, build_hash, keep_array)
308
308
  end
309
-
309
+
310
310
  #---
311
-
311
+
312
312
  def create_plugin(namespace, plugin_type, provider, options = {})
313
313
  Manager.connection.create(namespace, plugin_type, provider, options)
314
314
  end
315
-
315
+
316
316
  #---
317
-
317
+
318
318
  def get_plugin(namespace, plugin_type, plugin_name)
319
319
  Manager.connection.get(namespace, plugin_type, plugin_name)
320
320
  end
321
-
321
+
322
322
  #---
323
-
323
+
324
324
  def remove_plugin_by_name(namespace, plugin_type, plugin_instance_name)
325
- Manager.connection.remove_by_name(namespace, plugin_type, plugin_instance_name)
325
+ Manager.connection.remove_by_name(namespace, plugin_type, plugin_instance_name)
326
326
  end
327
-
327
+
328
328
  def remove_plugin(plugin)
329
329
  Manager.connection.remove(plugin)
330
330
  end
331
-
331
+
332
332
  #---
333
-
333
+
334
334
  def plugin_class(namespace, plugin_type)
335
335
  Manager.connection.plugin_class(namespace, plugin_type)
336
336
  end
337
-
337
+
338
+ def provider_class(namespace, plugin_type, provider)
339
+ Manager.connection.provider_class(namespace, plugin_type, provider)
340
+ end
341
+
338
342
  #-----------------------------------------------------------------------------
339
343
  # Core plugin type facade
340
-
344
+
341
345
  def extension(provider)
342
346
  plugin(:nucleon, :extension, provider, {})
343
347
  end
344
-
348
+
345
349
  #---
346
-
350
+
347
351
  def action(provider, options)
348
352
  plugin(:nucleon, :action, provider, options)
349
353
  end
350
-
354
+
351
355
  def actions(data, build_hash = false, keep_array = false)
352
- plugins(:nucleon, :action, data, build_hash, keep_array)
356
+ plugins(:nucleon, :action, data, build_hash, keep_array)
353
357
  end
354
-
358
+
355
359
  def action_config(provider)
356
360
  action = action(provider, { :settings => {}, :quiet => true })
357
361
  return {} unless action
358
-
362
+
359
363
  action.configure
360
364
  action.config
361
365
  end
362
-
363
- def action_run(provider, options = {}, quiet = true)
364
- Plugin::Action.exec(provider, options, quiet)
366
+
367
+ def action_run(provider, options = {}, quiet = true, display_errors = true, state = nil)
368
+ Plugin::Action.exec(provider, options, quiet, display_errors, state)
365
369
  end
366
-
367
- def action_cli(provider, args = [], quiet = false, name = :nucleon)
368
- Plugin::Action.exec_cli(provider, args, quiet, name)
370
+
371
+ def action_cli(provider, args = [], quiet = false, name = :nucleon, display_errors = true, state = nil)
372
+ Plugin::Action.exec_cli(provider, args, quiet, name, display_errors, state)
369
373
  end
370
-
374
+
371
375
  def search_actions(args)
372
376
  action_info = Plugin::Action.search_actions(args)
373
-
377
+
374
378
  action_components = action_info[:components]
375
379
  action = action_info[:actions]
376
-
380
+
377
381
  action_components.each do |component|
378
382
  args.shift
379
383
  end
380
-
384
+
381
385
  [ action, action_components, args ]
382
386
  end
383
-
387
+
384
388
  def action_help(action = nil, extended_help = false)
385
389
  Plugin::Action.action_help(action, extended_help)
386
390
  end
387
-
391
+
388
392
  #---
389
-
393
+
390
394
  def project(options, provider = nil)
391
395
  plugin(:nucleon, :project, provider, options)
392
396
  end
393
-
397
+
394
398
  def projects(data, build_hash = false, keep_array = false)
395
399
  plugins(:nucleon, :project, data, build_hash, keep_array)
396
400
  end
397
-
401
+
398
402
  #-----------------------------------------------------------------------------
399
403
  # Utility plugin type facade
400
-
404
+
401
405
  def command(options, provider = nil)
402
406
  plugin(:nucleon, :command, provider, options)
403
407
  end
404
-
408
+
405
409
  def commands(data, build_hash = false, keep_array = false)
406
410
  plugins(:nucleon, :command, data, build_hash, keep_array)
407
411
  end
408
-
412
+
409
413
  #---
410
-
414
+
411
415
  def event(options, provider = nil)
412
416
  plugin(:nucleon, :event, provider, options)
413
417
  end
414
-
418
+
415
419
  def events(data, build_hash = false, keep_array = false)
416
420
  plugins(:nucleon, :event, data, build_hash, keep_array)
417
421
  end
418
-
422
+
419
423
  #---
420
-
424
+
421
425
  def template(options, provider = nil)
422
426
  plugin(:nucleon, :template, provider, options)
423
427
  end
424
-
428
+
425
429
  def templates(data, build_hash = false, keep_array = false)
426
430
  plugins(:nucleon, :template, data, build_hash, keep_array)
427
431
  end
428
-
432
+
429
433
  #---
430
-
434
+
431
435
  def translator(options, provider = nil)
432
436
  plugin(:nucleon, :translator, provider, options)
433
437
  end
434
-
438
+
435
439
  def translators(data, build_hash = false, keep_array = false)
436
440
  plugins(:nucleon, :translator, data, build_hash, keep_array)
437
441
  end
438
-
442
+
439
443
  #-----------------------------------------------------------------------------
440
444
  # Plugin extensions
441
-
445
+
442
446
  def exec(method, options = {}, &code)
443
447
  Manager.connection.exec(method, options, &code)
444
448
  end
445
-
449
+
446
450
  #---
447
-
451
+
448
452
  def config(type, options = {})
449
453
  Manager.connection.config(type, options)
450
454
  end
451
-
455
+
452
456
  #---
453
-
457
+
454
458
  def check(method, options = {})
455
459
  Manager.connection.check(method, options)
456
460
  end
457
-
461
+
458
462
  #---
459
-
463
+
460
464
  def value(method, value, options = {})
461
465
  Manager.connection.value(method, value, options)
462
466
  end
463
-
467
+
464
468
  #---
465
-
469
+
466
470
  def collect(method, options = {})
467
471
  Manager.connection.collect(method, options)
468
472
  end
469
-
473
+
470
474
  #-----------------------------------------------------------------------------
471
475
  # External execution
472
-
476
+
473
477
  def run
474
478
  begin
475
479
  logger.debug("Running contained process at #{Time.now}")
476
480
  yield
477
-
481
+
478
482
  rescue Exception => error
479
483
  logger.error("Nucleon run experienced an error! Details:")
480
484
  logger.error(error.inspect)
481
485
  logger.error(error.message)
482
486
  logger.error(Util::Data.to_yaml(error.backtrace))
483
-
487
+
484
488
  ui.error(error.message) if error.message
485
489
  raise
486
490
  end
487
491
  end
488
-
492
+
489
493
  #---
490
-
494
+
491
495
  def cli_run(command, options = {}, &code)
492
496
  command = command.join(' ') if command.is_a?(Array)
493
497
  config = Config.ensure(options)
494
-
498
+
495
499
  logger.info("Executing command #{command}")
496
-
500
+
497
501
  result = Util::Shell.connection.exec(command, config, &code)
498
-
502
+
499
503
  unless config.get(:quiet, false) || result.status == Nucleon.code.success
500
504
  ui.error("Command #{command} failed to execute")
501
- end
505
+ end
502
506
  result
503
507
  end
504
-
508
+
505
509
  #---
506
-
510
+
511
+ @@exec_state = nil
512
+
513
+
514
+ def executable_state
515
+ Plugin::Action::State.new(code.unknown_status)
516
+ end
517
+
507
518
  def executable(args, name = 'nucleon') #ARGV
508
519
  logger.info("`#{name}` invoked: #{args.inspect}")
509
520
 
510
521
  $stdout.sync = true
511
522
  $stderr.sync = true
512
-
513
- exit_status = nil
514
-
523
+
524
+ @@exec_state = executable_state
525
+ exit_status = code.unknown_status
526
+
515
527
  # We need to catch this early.
516
528
  Util::Console.use_colors = ! args.include?("--no-color")
517
529
  args = args - [ "--no-color", "--color" ]
518
530
 
519
531
  begin
520
532
  logger.debug("Beginning execution run")
521
-
533
+
522
534
  load_plugins
523
-
535
+
524
536
  arg_components = Util::CLI::Parser.split(args, cyan(name) + yellow(" <action components> [<arg> ...]"))
525
537
  main_command = arg_components.shift
526
-
538
+
527
539
  action, action_components, args = search_actions(args)
528
-
540
+
529
541
  if main_command.processed && action.is_a?(Hash)
530
- exit_status = action_cli(action[:provider], args, false, name)
542
+ action_cli(action[:provider], args, false, name, false, @@exec_state)
543
+
544
+ action_error = @@exec_state.error
545
+ exit_status = @@exec_state.status
531
546
  else
532
547
  puts I18n.t('nucleon.core.exec.help.usage') + ': ' + main_command.help + "\n"
533
548
  puts I18n.t('nucleon.core.exec.help.header') + ":\n"
534
-
549
+
535
550
  action = main_command.processed ? action : nil
536
551
  puts action_help(action, args.include?("--help"))
537
-
538
- puts "\n" + I18n.t('nucleon.core.exec.help.footer', { :command => cyan(name) + yellow(" <action> -h") }) + "\n\n"
539
- exit_status = code.help_wanted
540
- end
541
-
552
+
553
+ puts "\n" + I18n.t('nucleon.core.exec.help.footer', { :command => cyan(name) + yellow(" <action> -h") }) + "\n\n"
554
+ exit_status = code.help_wanted
555
+ end
556
+
542
557
  rescue => error
558
+ action_error = error
559
+ exit_status = code.unknown_status
560
+ end
561
+
562
+ if action_error && ! action_error.is_a?(SystemExit)
543
563
  logger.error("Nucleon executable experienced an error:")
544
- logger.error(error.inspect)
545
- logger.error(error.message)
546
- logger.error(Util::Data.to_yaml(error.backtrace))
564
+ logger.error(action_error.inspect)
565
+ logger.error(action_error.message)
566
+ logger.error(Util::Data.to_yaml(action_error.backtrace))
547
567
 
548
- ui.error(error.message, { :prefix => false }) if error.message
549
-
550
- exit_status = error.status_code if error.respond_to?(:status_code)
551
- exit_status = code.unknown_status if exit_status.nil?
568
+ ui.error(action_error.message, { :prefix => false }) if action_error.message
552
569
  end
553
-
554
570
  exit_status
555
571
  end
556
-
572
+
573
+ #---
574
+
575
+ def interrupt_handler
576
+ logger.warn("Nucleon executable interrupted, shutting down")
577
+ if @@exec_state.action
578
+ @@exec_state.action.status = code.action_interrupted
579
+ @@exec_state.action.finalize_execution(false)
580
+ end
581
+ code.action_interrupted
582
+ end
583
+
557
584
  #-----------------------------------------------------------------------------
558
585
  # Utilities
559
-
586
+
560
587
  def class_name(name, separator = '::', want_array = false)
561
588
  Manager.connection.class_name(name, separator, want_array)
562
589
  end
563
-
590
+
564
591
  #---
565
-
592
+
566
593
  def class_const(name, separator = '::')
567
594
  Manager.connection.class_const(name, separator)
568
595
  end
569
-
596
+
570
597
  #---
571
-
598
+
572
599
  def sha1(data)
573
600
  Digest::SHA1.hexdigest(Util::Data.to_json(data, false))
574
601
  end
575
-
602
+
576
603
  #---
577
-
604
+
578
605
  def silence
579
606
  result = nil
580
-
607
+
581
608
  begin
582
609
  orig_stderr = $stderr.clone
583
610
  orig_stdout = $stdout.clone
584
611
  $stderr.reopen File.new('/dev/null', 'w')
585
612
  $stdout.reopen File.new('/dev/null', 'w')
586
-
613
+
587
614
  result = yield
588
-
615
+
589
616
  rescue Exception => error
590
617
  $stdout.reopen orig_stdout
591
618
  $stderr.reopen orig_stderr
@@ -596,28 +623,27 @@ module Facade
596
623
  end
597
624
  result
598
625
  end
599
-
626
+
600
627
  #---
601
-
628
+
602
629
  def render_object(data)
603
630
  require 'pp'
604
631
  PP.pp(data, "").strip
605
632
  end
606
-
633
+
607
634
  #---
608
-
635
+
609
636
  def render_tree(data, logger, state = :debug, padding = '')
610
637
  if data.is_a?(Hash) || data.is_a?(Nucleon::Config)
611
638
  data = data.export if data.is_a?(Nucleon::Config)
612
639
  data.each do |key, value|
613
640
  logger.send(state, "#{padding}#{key}")
614
641
  if value.is_a?(Hash) || value.is_a?(Nucleon::Config)
615
- value = value.export if value.is_a?(Nucleon::Config)
616
- render_tree(value, logger, state, "#{padding} ")
642
+ render_tree(value, logger, state, "#{padding} ")
617
643
  end
618
644
  end
619
645
  end
620
- end
646
+ end
621
647
  end
622
648
  end
623
649