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.
- checksums.yaml +7 -7
- data/.gitignore +50 -0
- data/ARCHITECTURE.rdoc +12 -11
- data/Gemfile +7 -11
- data/Gemfile.lock +47 -70
- data/Rakefile +22 -20
- data/TODO.rdoc +1 -1
- data/VERSION +1 -1
- data/bin/nucleon +16 -15
- data/lib/core/codes.rb +65 -38
- data/lib/core/config.rb +774 -153
- data/lib/core/config/collection.rb +134 -25
- data/lib/core/config/options.rb +160 -36
- data/lib/core/core.rb +207 -45
- data/lib/core/environment.rb +626 -206
- data/lib/core/facade.rb +211 -185
- data/lib/core/gems.rb +60 -44
- data/lib/core/manager.rb +587 -237
- data/lib/core/mixin/colors.rb +66 -36
- data/lib/core/mixin/config/collection.rb +58 -23
- data/lib/core/mixin/config/options.rb +67 -24
- data/lib/core/mixin/macro/object_interface.rb +129 -135
- data/lib/core/mixin/macro/plugin_interface.rb +118 -124
- data/lib/core/mixin/settings.rb +7 -13
- data/lib/core/mixin/sub_config.rb +37 -43
- data/lib/core/mod/hash.rb +31 -10
- data/lib/core/plugin/action.rb +274 -238
- data/lib/core/plugin/base.rb +140 -132
- data/lib/core/plugin/project.rb +316 -311
- data/lib/core/util/cli.rb +146 -146
- data/lib/core/util/console.rb +567 -124
- data/lib/core/util/data.rb +654 -139
- data/lib/core/util/logger.rb +255 -66
- data/lib/nucleon.rb +6 -8
- data/lib/nucleon_base.rb +364 -106
- data/nucleon.gemspec +40 -389
- data/spec/core/codes_spec.rb +209 -0
- data/spec/core/config_spec.rb +810 -0
- data/spec/core/core_spec.rb +185 -0
- data/spec/core/environment_spec.rb +148 -0
- data/spec/core/util/console_spec.rb +254 -446
- data/spec/nucleon/test.rb +59 -0
- data/spec/nucleon/test/first.rb +28 -0
- data/spec/nucleon/test/second.rb +28 -0
- data/spec/nucleon_codes.rb +98 -0
- data/spec/nucleon_config.rb +523 -0
- data/spec/nucleon_plugin.rb +439 -0
- data/spec/nucleon_test.rb +34 -0
- data/spec/spec_helper.rb +6 -4
- metadata +157 -615
- data/.document +0 -5
- data/rdoc/site/0.1.19/ARCHITECTURE_rdoc.html +0 -634
- data/rdoc/site/0.1.19/Hash.html +0 -347
- data/rdoc/site/0.1.19/Kernel.html +0 -413
- data/rdoc/site/0.1.19/Nucleon.html +0 -570
- data/rdoc/site/0.1.19/Nucleon/Action.html +0 -280
- data/rdoc/site/0.1.19/Nucleon/Action/Add.html +0 -458
- data/rdoc/site/0.1.19/Nucleon/Action/Create.html +0 -415
- data/rdoc/site/0.1.19/Nucleon/Action/Extract.html +0 -413
- data/rdoc/site/0.1.19/Nucleon/Action/Remove.html +0 -461
- data/rdoc/site/0.1.19/Nucleon/Action/Save.html +0 -434
- data/rdoc/site/0.1.19/Nucleon/Action/Update.html +0 -381
- data/rdoc/site/0.1.19/Nucleon/Codes.html +0 -563
- data/rdoc/site/0.1.19/Nucleon/Command.html +0 -275
- data/rdoc/site/0.1.19/Nucleon/Command/Bash.html +0 -544
- data/rdoc/site/0.1.19/Nucleon/Config.html +0 -1623
- data/rdoc/site/0.1.19/Nucleon/Config/Collection.html +0 -509
- data/rdoc/site/0.1.19/Nucleon/Config/Options.html +0 -489
- data/rdoc/site/0.1.19/Nucleon/Core.html +0 -635
- data/rdoc/site/0.1.19/Nucleon/Errors.html +0 -275
- data/rdoc/site/0.1.19/Nucleon/Errors/BatchError.html +0 -281
- data/rdoc/site/0.1.19/Nucleon/Errors/NucleonError.html +0 -657
- data/rdoc/site/0.1.19/Nucleon/Errors/SSHUnavailable.html +0 -281
- data/rdoc/site/0.1.19/Nucleon/Event.html +0 -275
- data/rdoc/site/0.1.19/Nucleon/Event/Regex.html +0 -467
- data/rdoc/site/0.1.19/Nucleon/Facade.html +0 -2336
- data/rdoc/site/0.1.19/Nucleon/Gems.html +0 -635
- data/rdoc/site/0.1.19/Nucleon/Manager.html +0 -1828
- data/rdoc/site/0.1.19/Nucleon/Mixin.html +0 -284
- data/rdoc/site/0.1.19/Nucleon/Mixin/Action.html +0 -277
- data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Commit.html +0 -381
- data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Project.html +0 -395
- data/rdoc/site/0.1.19/Nucleon/Mixin/Action/Push.html +0 -371
- data/rdoc/site/0.1.19/Nucleon/Mixin/Colors.html +0 -545
- data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigCollection.html +0 -481
- data/rdoc/site/0.1.19/Nucleon/Mixin/ConfigOptions.html +0 -449
- data/rdoc/site/0.1.19/Nucleon/Mixin/Macro.html +0 -276
- data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/ObjectInterface.html +0 -695
- data/rdoc/site/0.1.19/Nucleon/Mixin/Macro/PluginInterface.html +0 -682
- data/rdoc/site/0.1.19/Nucleon/Mixin/Settings.html +0 -481
- data/rdoc/site/0.1.19/Nucleon/Mixin/SubConfig.html +0 -887
- data/rdoc/site/0.1.19/Nucleon/Parallel.html +0 -325
- data/rdoc/site/0.1.19/Nucleon/Parallel/ClassMethods.html +0 -325
- data/rdoc/site/0.1.19/Nucleon/Parallel/InstanceMethods.html +0 -334
- data/rdoc/site/0.1.19/Nucleon/Plugin.html +0 -282
- data/rdoc/site/0.1.19/Nucleon/Plugin/Action.html +0 -1368
- data/rdoc/site/0.1.19/Nucleon/Plugin/Action/Option.html +0 -459
- data/rdoc/site/0.1.19/Nucleon/Plugin/Base.html +0 -1737
- data/rdoc/site/0.1.19/Nucleon/Plugin/Command.html +0 -721
- data/rdoc/site/0.1.19/Nucleon/Plugin/Event.html +0 -442
- data/rdoc/site/0.1.19/Nucleon/Plugin/Extension.html +0 -281
- data/rdoc/site/0.1.19/Nucleon/Plugin/Project.html +0 -2864
- data/rdoc/site/0.1.19/Nucleon/Plugin/Template.html +0 -476
- data/rdoc/site/0.1.19/Nucleon/Plugin/Translator.html +0 -371
- data/rdoc/site/0.1.19/Nucleon/Project.html +0 -276
- data/rdoc/site/0.1.19/Nucleon/Project/Git.html +0 -1801
- data/rdoc/site/0.1.19/Nucleon/Project/Github.html +0 -549
- data/rdoc/site/0.1.19/Nucleon/Template.html +0 -277
- data/rdoc/site/0.1.19/Nucleon/Template/Json.html +0 -329
- data/rdoc/site/0.1.19/Nucleon/Template/Wrapper.html +0 -329
- data/rdoc/site/0.1.19/Nucleon/Template/Yaml.html +0 -329
- data/rdoc/site/0.1.19/Nucleon/Translator.html +0 -276
- data/rdoc/site/0.1.19/Nucleon/Translator/Json.html +0 -366
- data/rdoc/site/0.1.19/Nucleon/Translator/Yaml.html +0 -366
- data/rdoc/site/0.1.19/Nucleon/Util.html +0 -285
- data/rdoc/site/0.1.19/Nucleon/Util/CLI.html +0 -388
- data/rdoc/site/0.1.19/Nucleon/Util/CLI/Parser.html +0 -1183
- data/rdoc/site/0.1.19/Nucleon/Util/Cache.html +0 -780
- data/rdoc/site/0.1.19/Nucleon/Util/Console.html +0 -1294
- data/rdoc/site/0.1.19/Nucleon/Util/Data.html +0 -1399
- data/rdoc/site/0.1.19/Nucleon/Util/Disk.html +0 -522
- data/rdoc/site/0.1.19/Nucleon/Util/Git.html +0 -361
- data/rdoc/site/0.1.19/Nucleon/Util/Liquid.html +0 -365
- data/rdoc/site/0.1.19/Nucleon/Util/Logger.html +0 -806
- data/rdoc/site/0.1.19/Nucleon/Util/Package.html +0 -558
- data/rdoc/site/0.1.19/Nucleon/Util/SSH.html +0 -910
- data/rdoc/site/0.1.19/Nucleon/Util/SSH/Keypair.html +0 -453
- data/rdoc/site/0.1.19/Nucleon/Util/Shell.html +0 -686
- data/rdoc/site/0.1.19/Nucleon/Util/Shell/Result.html +0 -497
- data/rdoc/site/0.1.19/README_rdoc.html +0 -312
- data/rdoc/site/0.1.19/TODO_rdoc.html +0 -267
- data/rdoc/site/0.1.19/created.rid +0 -60
- data/rdoc/site/0.1.19/images/add.png +0 -0
- data/rdoc/site/0.1.19/images/brick.png +0 -0
- data/rdoc/site/0.1.19/images/brick_link.png +0 -0
- data/rdoc/site/0.1.19/images/bug.png +0 -0
- data/rdoc/site/0.1.19/images/bullet_black.png +0 -0
- data/rdoc/site/0.1.19/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.1.19/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.1.19/images/date.png +0 -0
- data/rdoc/site/0.1.19/images/delete.png +0 -0
- data/rdoc/site/0.1.19/images/find.png +0 -0
- data/rdoc/site/0.1.19/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.1.19/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.1.19/images/package.png +0 -0
- data/rdoc/site/0.1.19/images/page_green.png +0 -0
- data/rdoc/site/0.1.19/images/page_white_text.png +0 -0
- data/rdoc/site/0.1.19/images/page_white_width.png +0 -0
- data/rdoc/site/0.1.19/images/plugin.png +0 -0
- data/rdoc/site/0.1.19/images/ruby.png +0 -0
- data/rdoc/site/0.1.19/images/tag_blue.png +0 -0
- data/rdoc/site/0.1.19/images/tag_green.png +0 -0
- data/rdoc/site/0.1.19/images/transparent.png +0 -0
- data/rdoc/site/0.1.19/images/wrench.png +0 -0
- data/rdoc/site/0.1.19/images/wrench_orange.png +0 -0
- data/rdoc/site/0.1.19/images/zoom.png +0 -0
- data/rdoc/site/0.1.19/index.html +0 -311
- data/rdoc/site/0.1.19/js/darkfish.js +0 -155
- data/rdoc/site/0.1.19/js/jquery.js +0 -18
- data/rdoc/site/0.1.19/js/navigation.js +0 -142
- data/rdoc/site/0.1.19/js/search.js +0 -94
- data/rdoc/site/0.1.19/js/search_index.js +0 -1
- data/rdoc/site/0.1.19/js/searcher.js +0 -228
- data/rdoc/site/0.1.19/rdoc.css +0 -543
- data/rdoc/site/0.1.19/table_of_contents.html +0 -1541
- data/rdoc/site/0.2.0/ARCHITECTURE_rdoc.html +0 -638
- data/rdoc/site/0.2.0/Hash.html +0 -351
- data/rdoc/site/0.2.0/Kernel.html +0 -416
- data/rdoc/site/0.2.0/Nucleon.html +0 -607
- data/rdoc/site/0.2.0/Nucleon/Action.html +0 -284
- data/rdoc/site/0.2.0/Nucleon/Action/Extract.html +0 -455
- data/rdoc/site/0.2.0/Nucleon/Action/Project.html +0 -283
- data/rdoc/site/0.2.0/Nucleon/Action/Project/Add.html +0 -500
- data/rdoc/site/0.2.0/Nucleon/Action/Project/Create.html +0 -457
- data/rdoc/site/0.2.0/Nucleon/Action/Project/Remove.html +0 -503
- data/rdoc/site/0.2.0/Nucleon/Action/Project/Save.html +0 -476
- data/rdoc/site/0.2.0/Nucleon/Action/Project/Update.html +0 -423
- data/rdoc/site/0.2.0/Nucleon/Codes.html +0 -567
- data/rdoc/site/0.2.0/Nucleon/Command.html +0 -279
- data/rdoc/site/0.2.0/Nucleon/Command/Bash.html +0 -548
- data/rdoc/site/0.2.0/Nucleon/Config.html +0 -1631
- data/rdoc/site/0.2.0/Nucleon/Config/Collection.html +0 -513
- data/rdoc/site/0.2.0/Nucleon/Config/Options.html +0 -493
- data/rdoc/site/0.2.0/Nucleon/Core.html +0 -639
- data/rdoc/site/0.2.0/Nucleon/Environment.html +0 -1208
- data/rdoc/site/0.2.0/Nucleon/Errors.html +0 -279
- data/rdoc/site/0.2.0/Nucleon/Errors/BatchError.html +0 -285
- data/rdoc/site/0.2.0/Nucleon/Errors/NucleonError.html +0 -661
- data/rdoc/site/0.2.0/Nucleon/Errors/SSHUnavailable.html +0 -285
- data/rdoc/site/0.2.0/Nucleon/Event.html +0 -279
- data/rdoc/site/0.2.0/Nucleon/Event/Regex.html +0 -471
- data/rdoc/site/0.2.0/Nucleon/Facade.html +0 -2409
- data/rdoc/site/0.2.0/Nucleon/Gems.html +0 -639
- data/rdoc/site/0.2.0/Nucleon/Manager.html +0 -1860
- data/rdoc/site/0.2.0/Nucleon/Mixin.html +0 -288
- data/rdoc/site/0.2.0/Nucleon/Mixin/Action.html +0 -281
- data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Commit.html +0 -385
- data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Project.html +0 -399
- data/rdoc/site/0.2.0/Nucleon/Mixin/Action/Push.html +0 -375
- data/rdoc/site/0.2.0/Nucleon/Mixin/Colors.html +0 -549
- data/rdoc/site/0.2.0/Nucleon/Mixin/ConfigCollection.html +0 -485
- data/rdoc/site/0.2.0/Nucleon/Mixin/ConfigOptions.html +0 -453
- data/rdoc/site/0.2.0/Nucleon/Mixin/Macro.html +0 -280
- data/rdoc/site/0.2.0/Nucleon/Mixin/Macro/ObjectInterface.html +0 -699
- data/rdoc/site/0.2.0/Nucleon/Mixin/Macro/PluginInterface.html +0 -686
- data/rdoc/site/0.2.0/Nucleon/Mixin/Settings.html +0 -485
- data/rdoc/site/0.2.0/Nucleon/Mixin/SubConfig.html +0 -891
- data/rdoc/site/0.2.0/Nucleon/Parallel.html +0 -330
- data/rdoc/site/0.2.0/Nucleon/Parallel/ClassMethods.html +0 -329
- data/rdoc/site/0.2.0/Nucleon/Parallel/InstanceMethods.html +0 -456
- data/rdoc/site/0.2.0/Nucleon/Plugin.html +0 -286
- data/rdoc/site/0.2.0/Nucleon/Plugin/Action.html +0 -1829
- data/rdoc/site/0.2.0/Nucleon/Plugin/Action/Option.html +0 -463
- data/rdoc/site/0.2.0/Nucleon/Plugin/Base.html +0 -1803
- data/rdoc/site/0.2.0/Nucleon/Plugin/Command.html +0 -725
- data/rdoc/site/0.2.0/Nucleon/Plugin/Event.html +0 -446
- data/rdoc/site/0.2.0/Nucleon/Plugin/Extension.html +0 -285
- data/rdoc/site/0.2.0/Nucleon/Plugin/Project.html +0 -2898
- data/rdoc/site/0.2.0/Nucleon/Plugin/Template.html +0 -480
- data/rdoc/site/0.2.0/Nucleon/Plugin/Translator.html +0 -375
- data/rdoc/site/0.2.0/Nucleon/Project.html +0 -280
- data/rdoc/site/0.2.0/Nucleon/Project/Git.html +0 -1805
- data/rdoc/site/0.2.0/Nucleon/Project/Github.html +0 -553
- data/rdoc/site/0.2.0/Nucleon/Template.html +0 -281
- data/rdoc/site/0.2.0/Nucleon/Template/JSON.html +0 -333
- data/rdoc/site/0.2.0/Nucleon/Template/Wrapper.html +0 -333
- data/rdoc/site/0.2.0/Nucleon/Template/YAML.html +0 -333
- data/rdoc/site/0.2.0/Nucleon/Translator.html +0 -280
- data/rdoc/site/0.2.0/Nucleon/Translator/JSON.html +0 -370
- data/rdoc/site/0.2.0/Nucleon/Translator/YAML.html +0 -370
- data/rdoc/site/0.2.0/Nucleon/Util.html +0 -289
- data/rdoc/site/0.2.0/Nucleon/Util/CLI.html +0 -392
- data/rdoc/site/0.2.0/Nucleon/Util/CLI/Parser.html +0 -1250
- data/rdoc/site/0.2.0/Nucleon/Util/Cache.html +0 -784
- data/rdoc/site/0.2.0/Nucleon/Util/Console.html +0 -1318
- data/rdoc/site/0.2.0/Nucleon/Util/Data.html +0 -1411
- data/rdoc/site/0.2.0/Nucleon/Util/Disk.html +0 -526
- data/rdoc/site/0.2.0/Nucleon/Util/Git.html +0 -365
- data/rdoc/site/0.2.0/Nucleon/Util/Liquid.html +0 -369
- data/rdoc/site/0.2.0/Nucleon/Util/Logger.html +0 -810
- data/rdoc/site/0.2.0/Nucleon/Util/Package.html +0 -562
- data/rdoc/site/0.2.0/Nucleon/Util/SSH.html +0 -1033
- data/rdoc/site/0.2.0/Nucleon/Util/SSH/Keypair.html +0 -605
- data/rdoc/site/0.2.0/Nucleon/Util/Shell.html +0 -693
- data/rdoc/site/0.2.0/Nucleon/Util/Shell/Result.html +0 -501
- data/rdoc/site/0.2.0/README_rdoc.html +0 -316
- data/rdoc/site/0.2.0/TODO_rdoc.html +0 -265
- data/rdoc/site/0.2.0/created.rid +0 -61
- data/rdoc/site/0.2.0/images/add.png +0 -0
- data/rdoc/site/0.2.0/images/brick.png +0 -0
- data/rdoc/site/0.2.0/images/brick_link.png +0 -0
- data/rdoc/site/0.2.0/images/bug.png +0 -0
- data/rdoc/site/0.2.0/images/bullet_black.png +0 -0
- data/rdoc/site/0.2.0/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.2.0/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.2.0/images/date.png +0 -0
- data/rdoc/site/0.2.0/images/delete.png +0 -0
- data/rdoc/site/0.2.0/images/find.png +0 -0
- data/rdoc/site/0.2.0/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.2.0/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.2.0/images/package.png +0 -0
- data/rdoc/site/0.2.0/images/page_green.png +0 -0
- data/rdoc/site/0.2.0/images/page_white_text.png +0 -0
- data/rdoc/site/0.2.0/images/page_white_width.png +0 -0
- data/rdoc/site/0.2.0/images/plugin.png +0 -0
- data/rdoc/site/0.2.0/images/ruby.png +0 -0
- data/rdoc/site/0.2.0/images/tag_blue.png +0 -0
- data/rdoc/site/0.2.0/images/tag_green.png +0 -0
- data/rdoc/site/0.2.0/images/transparent.png +0 -0
- data/rdoc/site/0.2.0/images/wrench.png +0 -0
- data/rdoc/site/0.2.0/images/wrench_orange.png +0 -0
- data/rdoc/site/0.2.0/images/zoom.png +0 -0
- data/rdoc/site/0.2.0/index.html +0 -315
- data/rdoc/site/0.2.0/js/darkfish.js +0 -155
- data/rdoc/site/0.2.0/js/jquery.js +0 -18
- data/rdoc/site/0.2.0/js/navigation.js +0 -142
- data/rdoc/site/0.2.0/js/search.js +0 -94
- data/rdoc/site/0.2.0/js/search_index.js +0 -1
- data/rdoc/site/0.2.0/js/searcher.js +0 -228
- data/rdoc/site/0.2.0/rdoc.css +0 -543
- data/rdoc/site/0.2.0/table_of_contents.html +0 -1657
- data/rdoc/site/0.2.1/ARCHITECTURE_rdoc.html +0 -640
- data/rdoc/site/0.2.1/Hash.html +0 -353
- data/rdoc/site/0.2.1/Kernel.html +0 -420
- data/rdoc/site/0.2.1/Nucleon.html +0 -674
- data/rdoc/site/0.2.1/Nucleon/Action.html +0 -286
- data/rdoc/site/0.2.1/Nucleon/Action/Extract.html +0 -457
- data/rdoc/site/0.2.1/Nucleon/Action/Project.html +0 -285
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Add.html +0 -502
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Create.html +0 -459
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html +0 -505
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Save.html +0 -478
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Update.html +0 -425
- data/rdoc/site/0.2.1/Nucleon/Codes.html +0 -569
- data/rdoc/site/0.2.1/Nucleon/Command.html +0 -281
- data/rdoc/site/0.2.1/Nucleon/Command/Bash.html +0 -550
- data/rdoc/site/0.2.1/Nucleon/Config.html +0 -1634
- data/rdoc/site/0.2.1/Nucleon/Config/Collection.html +0 -515
- data/rdoc/site/0.2.1/Nucleon/Config/Options.html +0 -495
- data/rdoc/site/0.2.1/Nucleon/Core.html +0 -641
- data/rdoc/site/0.2.1/Nucleon/Environment.html +0 -1210
- data/rdoc/site/0.2.1/Nucleon/Errors.html +0 -281
- data/rdoc/site/0.2.1/Nucleon/Errors/BatchError.html +0 -287
- data/rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html +0 -663
- data/rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html +0 -287
- data/rdoc/site/0.2.1/Nucleon/Event.html +0 -281
- data/rdoc/site/0.2.1/Nucleon/Event/Regex.html +0 -473
- data/rdoc/site/0.2.1/Nucleon/Facade.html +0 -2452
- data/rdoc/site/0.2.1/Nucleon/Gems.html +0 -641
- data/rdoc/site/0.2.1/Nucleon/Manager.html +0 -1862
- data/rdoc/site/0.2.1/Nucleon/Mixin.html +0 -291
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action.html +0 -284
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html +0 -387
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html +0 -401
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html +0 -377
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html +0 -575
- data/rdoc/site/0.2.1/Nucleon/Mixin/Colors.html +0 -551
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html +0 -487
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html +0 -455
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro.html +0 -282
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html +0 -701
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html +0 -688
- data/rdoc/site/0.2.1/Nucleon/Mixin/Settings.html +0 -487
- data/rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html +0 -893
- data/rdoc/site/0.2.1/Nucleon/Parallel.html +0 -332
- data/rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html +0 -331
- data/rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html +0 -458
- data/rdoc/site/0.2.1/Nucleon/Plugin.html +0 -288
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action.html +0 -2133
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html +0 -465
- data/rdoc/site/0.2.1/Nucleon/Plugin/Base.html +0 -1988
- data/rdoc/site/0.2.1/Nucleon/Plugin/Command.html +0 -765
- data/rdoc/site/0.2.1/Nucleon/Plugin/Event.html +0 -448
- data/rdoc/site/0.2.1/Nucleon/Plugin/Extension.html +0 -287
- data/rdoc/site/0.2.1/Nucleon/Plugin/Project.html +0 -2900
- data/rdoc/site/0.2.1/Nucleon/Plugin/Template.html +0 -482
- data/rdoc/site/0.2.1/Nucleon/Plugin/Translator.html +0 -377
- data/rdoc/site/0.2.1/Nucleon/Project.html +0 -282
- data/rdoc/site/0.2.1/Nucleon/Project/Git.html +0 -1807
- data/rdoc/site/0.2.1/Nucleon/Project/Github.html +0 -555
- data/rdoc/site/0.2.1/Nucleon/Template.html +0 -283
- data/rdoc/site/0.2.1/Nucleon/Template/JSON.html +0 -335
- data/rdoc/site/0.2.1/Nucleon/Template/Wrapper.html +0 -335
- data/rdoc/site/0.2.1/Nucleon/Template/YAML.html +0 -335
- data/rdoc/site/0.2.1/Nucleon/Translator.html +0 -282
- data/rdoc/site/0.2.1/Nucleon/Translator/JSON.html +0 -372
- data/rdoc/site/0.2.1/Nucleon/Translator/YAML.html +0 -372
- data/rdoc/site/0.2.1/Nucleon/Util.html +0 -291
- data/rdoc/site/0.2.1/Nucleon/Util/CLI.html +0 -394
- data/rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html +0 -1404
- data/rdoc/site/0.2.1/Nucleon/Util/Cache.html +0 -824
- data/rdoc/site/0.2.1/Nucleon/Util/Console.html +0 -1330
- data/rdoc/site/0.2.1/Nucleon/Util/Data.html +0 -1423
- data/rdoc/site/0.2.1/Nucleon/Util/Disk.html +0 -528
- data/rdoc/site/0.2.1/Nucleon/Util/Git.html +0 -367
- data/rdoc/site/0.2.1/Nucleon/Util/Liquid.html +0 -371
- data/rdoc/site/0.2.1/Nucleon/Util/Logger.html +0 -822
- data/rdoc/site/0.2.1/Nucleon/Util/Package.html +0 -564
- data/rdoc/site/0.2.1/Nucleon/Util/SSH.html +0 -1036
- data/rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html +0 -607
- data/rdoc/site/0.2.1/Nucleon/Util/Shell.html +0 -697
- data/rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html +0 -503
- data/rdoc/site/0.2.1/README_rdoc.html +0 -318
- data/rdoc/site/0.2.1/TODO_rdoc.html +0 -267
- data/rdoc/site/0.2.1/created.rid +0 -62
- data/rdoc/site/0.2.1/images/add.png +0 -0
- data/rdoc/site/0.2.1/images/brick.png +0 -0
- data/rdoc/site/0.2.1/images/brick_link.png +0 -0
- data/rdoc/site/0.2.1/images/bug.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_black.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.2.1/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.2.1/images/date.png +0 -0
- data/rdoc/site/0.2.1/images/delete.png +0 -0
- data/rdoc/site/0.2.1/images/find.png +0 -0
- data/rdoc/site/0.2.1/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.2.1/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.2.1/images/package.png +0 -0
- data/rdoc/site/0.2.1/images/page_green.png +0 -0
- data/rdoc/site/0.2.1/images/page_white_text.png +0 -0
- data/rdoc/site/0.2.1/images/page_white_width.png +0 -0
- data/rdoc/site/0.2.1/images/plugin.png +0 -0
- data/rdoc/site/0.2.1/images/ruby.png +0 -0
- data/rdoc/site/0.2.1/images/tag_blue.png +0 -0
- data/rdoc/site/0.2.1/images/tag_green.png +0 -0
- data/rdoc/site/0.2.1/images/transparent.png +0 -0
- data/rdoc/site/0.2.1/images/wrench.png +0 -0
- data/rdoc/site/0.2.1/images/wrench_orange.png +0 -0
- data/rdoc/site/0.2.1/images/zoom.png +0 -0
- data/rdoc/site/0.2.1/index.html +0 -317
- data/rdoc/site/0.2.1/js/darkfish.js +0 -155
- data/rdoc/site/0.2.1/js/jquery.js +0 -18
- data/rdoc/site/0.2.1/js/navigation.js +0 -142
- data/rdoc/site/0.2.1/js/search.js +0 -94
- data/rdoc/site/0.2.1/js/search_index.js +0 -1
- data/rdoc/site/0.2.1/js/searcher.js +0 -228
- data/rdoc/site/0.2.1/rdoc.css +0 -543
- data/rdoc/site/0.2.1/table_of_contents.html +0 -1718
- data/spec/coral_mock_input.rb +0 -29
- data/spec/coral_test_kernel.rb +0 -22
data/lib/core/util/logger.rb
CHANGED
|
@@ -1,45 +1,132 @@
|
|
|
1
|
-
|
|
2
1
|
module Nucleon
|
|
3
2
|
module Util
|
|
3
|
+
#
|
|
4
|
+
# == Logger
|
|
5
|
+
#
|
|
6
|
+
# The Nucleon::Util::Logger class defines a logging interface that wraps the Log4r
|
|
7
|
+
# gem interface to provide all Nucleon classes with logging capabilities.
|
|
8
|
+
#
|
|
9
|
+
# Logging methods exposed:
|
|
10
|
+
#
|
|
11
|
+
# 1. *error* Display all serious errors
|
|
12
|
+
# 2. *warn* Warnings that do not trigger an error
|
|
13
|
+
# 3. *info* Concise runtime information
|
|
14
|
+
# 4. *debug* Potentially verbose debug information
|
|
15
|
+
#
|
|
16
|
+
# *Note*: This is the first Nucleon library loaded so it can *NOT* depend on
|
|
17
|
+
# any other library or core object.
|
|
18
|
+
#
|
|
19
|
+
# See also:
|
|
20
|
+
# - Nucleon::Core (base logging capable object)
|
|
21
|
+
#
|
|
4
22
|
class Logger
|
|
5
|
-
|
|
6
|
-
|
|
23
|
+
|
|
24
|
+
#*****************************************************************************
|
|
7
25
|
# Properties
|
|
8
|
-
|
|
9
|
-
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# Global log level
|
|
29
|
+
#
|
|
30
|
+
# Can be:
|
|
31
|
+
# - *:debug*
|
|
32
|
+
# - *:info*
|
|
33
|
+
# - *:warn*
|
|
34
|
+
# - *:error*
|
|
35
|
+
#
|
|
36
|
+
@@level = nil
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Global collection of instantiated loggers
|
|
40
|
+
#
|
|
10
41
|
@@loggers = {}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
42
|
+
|
|
43
|
+
# Check current global log level
|
|
44
|
+
#
|
|
45
|
+
# * *Parameters*
|
|
46
|
+
#
|
|
47
|
+
# * *Returns*
|
|
48
|
+
# - [Symbol] Global log level; *:debug*, *:info*, *:warn*, *:error*
|
|
49
|
+
#
|
|
50
|
+
# * *Errors*
|
|
51
|
+
#
|
|
52
|
+
# See also:
|
|
53
|
+
# - ::level=
|
|
54
|
+
#
|
|
14
55
|
def self.level
|
|
15
|
-
@@level
|
|
56
|
+
@@level
|
|
16
57
|
end
|
|
17
|
-
|
|
58
|
+
|
|
59
|
+
# Set current global log level
|
|
60
|
+
#
|
|
61
|
+
# * *Parameters*
|
|
62
|
+
# - [Symbol] *level* Global log level; *:debug*, *:info*, *:warn*, *:error*
|
|
63
|
+
#
|
|
64
|
+
# * *Returns*
|
|
65
|
+
# - [Void] This method does not return a value
|
|
66
|
+
#
|
|
67
|
+
# * *Errors*
|
|
68
|
+
#
|
|
69
|
+
# See also:
|
|
70
|
+
# - ::level
|
|
71
|
+
# - ::set_level
|
|
72
|
+
#
|
|
18
73
|
def self.level=level
|
|
19
74
|
@@level = set_level(level)
|
|
20
75
|
end
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
76
|
+
|
|
77
|
+
# Return a reference to all globally instantiated loggers
|
|
78
|
+
#
|
|
79
|
+
# * *Parameters*
|
|
80
|
+
#
|
|
81
|
+
# * *Returns*
|
|
82
|
+
# - [Hash<Symbol|Log4r>] Collection of globally accessible loggers
|
|
83
|
+
#
|
|
84
|
+
# * *Errors*
|
|
85
|
+
#
|
|
24
86
|
def self.loggers
|
|
25
87
|
@@loggers
|
|
26
88
|
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
89
|
+
|
|
90
|
+
# Define a list of Log4r levels
|
|
91
|
+
#
|
|
92
|
+
# Due to how Log4r is built this can only happen at the very beginning of our
|
|
93
|
+
# execution run before any loggers are instantiated.
|
|
94
|
+
#
|
|
95
|
+
# This should never be called directly outside of this class.
|
|
96
|
+
#
|
|
97
|
+
# * *Parameters*
|
|
98
|
+
# - [Symbol, String, Array<Symbol, String>] *levels* Available log levels
|
|
99
|
+
#
|
|
100
|
+
# * *Returns*
|
|
101
|
+
# - [Void] This method does not return a value
|
|
102
|
+
#
|
|
103
|
+
# * *Errors*
|
|
104
|
+
#
|
|
30
105
|
def self.set_levels(*levels)
|
|
31
|
-
levels = levels.flatten.collect do |level|
|
|
106
|
+
levels = levels.flatten.collect do |level|
|
|
32
107
|
level.to_s.upcase
|
|
33
108
|
end
|
|
34
109
|
Log4r::Configurator.custom_levels(*levels)
|
|
35
110
|
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
111
|
+
|
|
112
|
+
# Set the logging level for either all instantiated loggers or a specified logger.
|
|
113
|
+
#
|
|
114
|
+
# * *Parameters*
|
|
115
|
+
# - [Symbol, String] *level* Global log level; *:debug*, *:info*, *:warn*, *:error*
|
|
116
|
+
# - [Log4r] *logger* Log4r instance to set log level or all if none provided
|
|
117
|
+
#
|
|
118
|
+
# * *Returns*
|
|
119
|
+
# - [Symbol] Return the current global log level
|
|
120
|
+
#
|
|
121
|
+
# * *Errors*
|
|
122
|
+
#
|
|
123
|
+
# See also:
|
|
124
|
+
# - ::level=
|
|
125
|
+
#
|
|
39
126
|
def self.set_level(level, logger = nil)
|
|
40
127
|
level_sym = level.to_s.downcase.to_sym
|
|
41
128
|
level_id = level.to_s.upcase
|
|
42
|
-
|
|
129
|
+
|
|
43
130
|
if logger.nil?
|
|
44
131
|
loggers.each do |name, registered_logger|
|
|
45
132
|
@@loggers[name].level = Log4r.const_get(level_id)
|
|
@@ -51,37 +138,78 @@ class Logger
|
|
|
51
138
|
end
|
|
52
139
|
level_sym
|
|
53
140
|
end
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
141
|
+
|
|
142
|
+
# Add a instantiated logger to the global logger registry.
|
|
143
|
+
#
|
|
144
|
+
# TODO: Is there a better way to handle the outputter for more flexibility?
|
|
145
|
+
#
|
|
146
|
+
# * *Parameters*
|
|
147
|
+
# - [Symbol, String] *name* Logger name
|
|
148
|
+
# - [Log4r] *logger* Log4r instance to register
|
|
149
|
+
#
|
|
150
|
+
# * *Returns*
|
|
151
|
+
# - [Void] This method does not return a value
|
|
152
|
+
#
|
|
153
|
+
# * *Errors*
|
|
154
|
+
#
|
|
155
|
+
# See also:
|
|
156
|
+
# - ::set_level
|
|
157
|
+
#
|
|
57
158
|
def self.add_logger(name, logger)
|
|
58
159
|
logger.outputters = Log4r::StdoutOutputter.new('console')
|
|
59
|
-
|
|
160
|
+
|
|
60
161
|
level = Logger.level.nil? ? 'off' : Logger.level
|
|
61
|
-
set_level(level, logger)
|
|
62
|
-
|
|
63
|
-
@@loggers[name] = logger
|
|
162
|
+
set_level(level, logger)
|
|
163
|
+
|
|
164
|
+
@@loggers[name.to_sym] = logger
|
|
64
165
|
end
|
|
65
|
-
|
|
166
|
+
|
|
167
|
+
#
|
|
66
168
|
# Initialize log levels
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
169
|
+
#
|
|
170
|
+
# *IMPORTANT* Log levels must be registered before Log4r instances are created
|
|
171
|
+
#
|
|
172
|
+
# TODO: This process does not work when using as a library through another
|
|
173
|
+
# executable that already loads Log4r.
|
|
174
|
+
#
|
|
175
|
+
set_levels :debug, :info, :warn, :error
|
|
176
|
+
|
|
177
|
+
#
|
|
178
|
+
# Set starting log level if defined in "NUCLEON_LOG" environment variable
|
|
179
|
+
#
|
|
70
180
|
if ENV['NUCLEON_LOG']
|
|
71
181
|
Logger.level = ENV['NUCLEON_LOG']
|
|
72
182
|
end
|
|
73
|
-
|
|
74
|
-
|
|
183
|
+
|
|
184
|
+
#*****************************************************************************
|
|
75
185
|
# Constructor
|
|
76
|
-
|
|
186
|
+
|
|
187
|
+
# Initialize a new logging object
|
|
188
|
+
#
|
|
189
|
+
# TODO: Figure out some way to make the logger system pluggable?
|
|
190
|
+
#
|
|
191
|
+
# * *Parameters*
|
|
192
|
+
# - [Hash] *options* Logger options
|
|
193
|
+
# - [String] *:resource* Logger resource identifier (also serves as prefix)
|
|
194
|
+
# - [nil, Log4r] *:logger* Log4r logger of nil if new one created
|
|
195
|
+
#
|
|
196
|
+
# * *Returns*
|
|
197
|
+
# - [Void] This method does not return a value
|
|
198
|
+
#
|
|
199
|
+
# * *Errors*
|
|
200
|
+
#
|
|
201
|
+
# See also:
|
|
202
|
+
# - #logger=
|
|
203
|
+
# - Nucleon::Config::ensure
|
|
204
|
+
#
|
|
77
205
|
def initialize(options = {})
|
|
78
206
|
if options.is_a?(String)
|
|
79
207
|
options = { :logger => options }
|
|
80
208
|
end
|
|
81
209
|
config = Config.ensure(options)
|
|
82
|
-
|
|
210
|
+
|
|
83
211
|
@resource = config.get(:resource, '')
|
|
84
|
-
|
|
212
|
+
|
|
85
213
|
if config.get(:logger, false)
|
|
86
214
|
self.logger = config[:logger]
|
|
87
215
|
else
|
|
@@ -89,19 +217,42 @@ class Logger
|
|
|
89
217
|
end
|
|
90
218
|
end
|
|
91
219
|
|
|
92
|
-
|
|
93
|
-
|
|
220
|
+
# Return a string reference that identifies this logger
|
|
221
|
+
#
|
|
222
|
+
# * *Parameters*
|
|
223
|
+
#
|
|
224
|
+
# * *Returns*
|
|
225
|
+
# - [String] Identification string
|
|
226
|
+
#
|
|
227
|
+
# * *Errors*
|
|
228
|
+
#
|
|
94
229
|
def inspect
|
|
95
230
|
"#<#{self.class}: #{@resource}>"
|
|
96
231
|
end
|
|
97
|
-
|
|
98
|
-
|
|
232
|
+
|
|
233
|
+
#*****************************************************************************
|
|
99
234
|
# Accessors / Modifiers
|
|
100
|
-
|
|
235
|
+
|
|
236
|
+
#
|
|
237
|
+
# [String] Logger resource name
|
|
238
|
+
#
|
|
239
|
+
# This is the string identifier and logger prefix used when logging.
|
|
240
|
+
#
|
|
101
241
|
attr_reader :resource
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
242
|
+
|
|
243
|
+
# Set current logger object
|
|
244
|
+
#
|
|
245
|
+
# * *Parameters*
|
|
246
|
+
# - [String, Log4r] *logger* Log4r object or string resource name
|
|
247
|
+
#
|
|
248
|
+
# * *Returns*
|
|
249
|
+
# - [Void] This method does not return a value
|
|
250
|
+
#
|
|
251
|
+
# * *Errors*
|
|
252
|
+
#
|
|
253
|
+
# See also:
|
|
254
|
+
# - ::add_logger
|
|
255
|
+
#
|
|
105
256
|
def logger=logger
|
|
106
257
|
if logger.is_a?(String)
|
|
107
258
|
@resource = logger
|
|
@@ -109,49 +260,87 @@ class Logger
|
|
|
109
260
|
else
|
|
110
261
|
@logger = logger
|
|
111
262
|
end
|
|
112
|
-
self.class.add_logger(@resource, @logger) unless self.class.loggers.has_key?(@resource)
|
|
263
|
+
self.class.add_logger(@resource, @logger) unless self.class.loggers.has_key?(@resource)
|
|
113
264
|
end
|
|
114
|
-
|
|
115
|
-
|
|
265
|
+
|
|
266
|
+
#*****************************************************************************
|
|
116
267
|
# Log statements
|
|
117
|
-
|
|
268
|
+
|
|
269
|
+
# Log a debug message
|
|
270
|
+
#
|
|
271
|
+
# * *Parameters*
|
|
272
|
+
# - [String] *message* Debug related message
|
|
273
|
+
#
|
|
274
|
+
# * *Returns*
|
|
275
|
+
# - [Void] This method does not return a value
|
|
276
|
+
#
|
|
277
|
+
# * *Errors*
|
|
278
|
+
#
|
|
279
|
+
# See also:
|
|
280
|
+
# - Nucleon::Util::Console::quiet
|
|
281
|
+
#
|
|
118
282
|
def debug(message)
|
|
119
283
|
unless Util::Console.quiet
|
|
120
284
|
@logger.debug(message)
|
|
121
285
|
end
|
|
122
286
|
end
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
287
|
+
|
|
288
|
+
# Log an info message
|
|
289
|
+
#
|
|
290
|
+
# * *Parameters*
|
|
291
|
+
# - [String] *message* Concise informational message
|
|
292
|
+
#
|
|
293
|
+
# * *Returns*
|
|
294
|
+
# - [Void] This method does not return a value
|
|
295
|
+
#
|
|
296
|
+
# * *Errors*
|
|
297
|
+
#
|
|
298
|
+
# See also:
|
|
299
|
+
# - Nucleon::Util::Console::quiet
|
|
300
|
+
#
|
|
126
301
|
def info(message)
|
|
127
302
|
unless Util::Console.quiet
|
|
128
303
|
@logger.info(message)
|
|
129
304
|
end
|
|
130
305
|
end
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
306
|
+
|
|
307
|
+
# Log a warning message (non error)
|
|
308
|
+
#
|
|
309
|
+
# * *Parameters*
|
|
310
|
+
# - [String] *message* Warning message
|
|
311
|
+
#
|
|
312
|
+
# * *Returns*
|
|
313
|
+
# - [Void] This method does not return a value
|
|
314
|
+
#
|
|
315
|
+
# * *Errors*
|
|
316
|
+
#
|
|
317
|
+
# See also:
|
|
318
|
+
# - Nucleon::Util::Console::quiet
|
|
319
|
+
#
|
|
134
320
|
def warn(message)
|
|
135
321
|
unless Util::Console.quiet
|
|
136
322
|
@logger.warn(message)
|
|
137
323
|
end
|
|
138
324
|
end
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
325
|
+
|
|
326
|
+
# Log an error message
|
|
327
|
+
#
|
|
328
|
+
# * *Parameters*
|
|
329
|
+
# - [String] *message* Error message
|
|
330
|
+
#
|
|
331
|
+
# * *Returns*
|
|
332
|
+
# - [Void] This method does not return a value
|
|
333
|
+
#
|
|
334
|
+
# * *Errors*
|
|
335
|
+
#
|
|
336
|
+
# See also:
|
|
337
|
+
# - Nucleon::Util::Console::quiet
|
|
338
|
+
#
|
|
142
339
|
def error(message)
|
|
143
340
|
unless Util::Console.quiet
|
|
144
341
|
@logger.error(message)
|
|
145
342
|
end
|
|
146
343
|
end
|
|
147
|
-
|
|
148
|
-
#---
|
|
149
|
-
|
|
150
|
-
def hook(message)
|
|
151
|
-
unless Util::Console.quiet
|
|
152
|
-
@logger.hook(message)
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
344
|
end
|
|
156
345
|
end
|
|
157
346
|
end
|
data/lib/nucleon.rb
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
#*******************************************************************************
|
|
3
|
-
# Nucleon
|
|
4
1
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
2
|
+
# == Nucleon
|
|
3
|
+
#
|
|
4
|
+
# Framework that provides a simple foundation for building distributed,
|
|
5
|
+
# pluggable, and integrated applications.
|
|
8
6
|
#
|
|
9
7
|
# Author:: Adrian Webb (mailto:adrian.webb@coralnexus.com)
|
|
10
|
-
# License::
|
|
8
|
+
# License:: Apache License, version 2
|
|
11
9
|
|
|
12
10
|
require File.join(File.dirname(__FILE__), "nucleon_base.rb")
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
#*******************************************************************************
|
|
15
13
|
# Core initialization
|
|
16
14
|
|
|
17
15
|
Nucleon.reload(true)
|
data/lib/nucleon_base.rb
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
|
-
#*******************************************************************************
|
|
2
|
-
# Nucleon
|
|
3
1
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
2
|
+
# == Nucleon
|
|
3
|
+
#
|
|
4
|
+
# Framework that provides a simple foundation for building distributed,
|
|
5
|
+
# pluggable, and integrated applications.
|
|
7
6
|
#
|
|
8
7
|
# Author:: Adrian Webb (mailto:adrian.webb@coralnexus.com)
|
|
9
|
-
# License::
|
|
8
|
+
# License:: Apache License, version 2
|
|
9
|
+
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
#*******************************************************************************
|
|
12
12
|
# Global namespace
|
|
13
13
|
|
|
14
|
+
# Kernel module additions
|
|
15
|
+
#
|
|
16
|
+
# These methods, all of which are prefixed with "nucleon_" are available in any
|
|
17
|
+
# class or module within the Nucleon framework or derivatives.
|
|
18
|
+
#
|
|
14
19
|
module Kernel
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
# Locate an application command or return nil otherwise.
|
|
22
|
+
#
|
|
23
|
+
# This is used to check for applications, such as Git, so that we may
|
|
24
|
+
# conditionally install packages based upon applications installed.
|
|
25
|
+
#
|
|
26
|
+
# * *Parameters*
|
|
27
|
+
# - [String, Symbol] *command* Command name to locale on system
|
|
28
|
+
#
|
|
29
|
+
# * *Returns*
|
|
30
|
+
# - [nil, String] File path to executable or nil if not found
|
|
31
|
+
#
|
|
32
|
+
# * *Errors*
|
|
33
|
+
#
|
|
16
34
|
def nucleon_locate(command)
|
|
17
35
|
command = command.to_s
|
|
18
36
|
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
|
@@ -24,70 +42,208 @@ module Kernel
|
|
|
24
42
|
end
|
|
25
43
|
return nil
|
|
26
44
|
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
|
|
46
|
+
# Require resource files into Nucleon execution flow.
|
|
47
|
+
#
|
|
48
|
+
# This method auto-requires resources in the following order:
|
|
49
|
+
#
|
|
50
|
+
# 1. *{name}.rb*
|
|
51
|
+
# 2. *{base_dir/name}/**/*.rb
|
|
52
|
+
#
|
|
53
|
+
# If resources within the directory depend on each other those requires should
|
|
54
|
+
# be present in the resource files doing the requiring so we don't get load
|
|
55
|
+
# order conflicts.
|
|
56
|
+
#
|
|
57
|
+
# * *Parameters*
|
|
58
|
+
# - [String, Symbol] *base_dir* Command name to locale on system
|
|
59
|
+
# - [String, Symbol] *name* Command name to locale on system
|
|
60
|
+
#
|
|
61
|
+
# * *Returns*
|
|
62
|
+
# - [Void] This method does not have a return value
|
|
63
|
+
#
|
|
64
|
+
# * *Errors*
|
|
65
|
+
#
|
|
30
66
|
def nucleon_require(base_dir, name)
|
|
31
|
-
|
|
67
|
+
base_dir = base_dir.to_s
|
|
68
|
+
name = name.to_s
|
|
32
69
|
top_level_file = File.join(base_dir, "#{name}.rb")
|
|
33
|
-
|
|
34
|
-
require top_level_file if File.exists?(top_level_file)
|
|
35
|
-
|
|
70
|
+
|
|
71
|
+
require top_level_file if File.exists?(top_level_file)
|
|
72
|
+
|
|
36
73
|
directory = File.join(base_dir, name)
|
|
37
|
-
|
|
74
|
+
|
|
38
75
|
if File.directory?(directory)
|
|
39
76
|
Dir.glob(File.join(directory, '**', '*.rb')).each do |sub_file|
|
|
40
77
|
require sub_file
|
|
41
78
|
end
|
|
42
|
-
end
|
|
79
|
+
end
|
|
43
80
|
end
|
|
44
81
|
end
|
|
45
82
|
|
|
46
|
-
|
|
47
|
-
# Load paths
|
|
83
|
+
#*******************************************************************************
|
|
84
|
+
# Load paths
|
|
48
85
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
86
|
+
#
|
|
87
|
+
# The following variables refer to Nucleon file load paths loaded during
|
|
88
|
+
# initialization.
|
|
89
|
+
#
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# Base library path
|
|
93
|
+
#
|
|
94
|
+
lib_dir = File.dirname(__FILE__)
|
|
95
|
+
#
|
|
96
|
+
# Core class load path
|
|
97
|
+
#
|
|
98
|
+
core_dir = File.join(lib_dir, 'core')
|
|
99
|
+
#
|
|
100
|
+
# Base mixin load path
|
|
101
|
+
#
|
|
102
|
+
mixin_dir = File.join(core_dir, 'mixin')
|
|
103
|
+
#
|
|
104
|
+
# Configuration mixin load path
|
|
105
|
+
#
|
|
52
106
|
mixin_config_dir = File.join(mixin_dir, 'config')
|
|
107
|
+
#
|
|
108
|
+
# Action mixin load path
|
|
109
|
+
#
|
|
53
110
|
mixin_action_dir = File.join(mixin_dir, 'action')
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
111
|
+
#
|
|
112
|
+
# Macro mixin load path
|
|
113
|
+
#
|
|
114
|
+
macro_dir = File.join(mixin_dir, 'macro')
|
|
115
|
+
#
|
|
116
|
+
# Utilities load path
|
|
117
|
+
#
|
|
118
|
+
util_dir = File.join(core_dir, 'util')
|
|
119
|
+
#
|
|
120
|
+
# Mod load path (monkey patches)
|
|
121
|
+
#
|
|
122
|
+
mod_dir = File.join(core_dir, 'mod')
|
|
123
|
+
#
|
|
124
|
+
# Base plugin load path
|
|
125
|
+
#
|
|
126
|
+
plugin_dir = File.join(core_dir, 'plugin')
|
|
58
127
|
|
|
59
|
-
|
|
128
|
+
#*******************************************************************************
|
|
60
129
|
# Environment checks and debugging
|
|
61
130
|
|
|
131
|
+
# Nucleon top level module
|
|
132
|
+
#
|
|
133
|
+
# Any methods contained in this file are purely for enabling early checks or
|
|
134
|
+
# operations needed for loading Nucleon effectively?
|
|
135
|
+
#
|
|
136
|
+
# Most methods to the Nucleon module should be loaded via the Nucleon::Facade.
|
|
137
|
+
#
|
|
62
138
|
module Nucleon
|
|
63
|
-
|
|
139
|
+
|
|
140
|
+
# Get currently loaded versioin of Nucleon
|
|
141
|
+
#
|
|
142
|
+
# This method loads from the VERSION file in the top level directory. This file
|
|
143
|
+
# gets automatically updated as we build and release new versions.
|
|
144
|
+
#
|
|
145
|
+
# See the Rakefile and the Coral Toolbox project at:
|
|
146
|
+
#
|
|
147
|
+
# http://github.com/coralnexus/coral-toolbox
|
|
148
|
+
#
|
|
149
|
+
# *Note*: This process might change in the near future.
|
|
150
|
+
#
|
|
151
|
+
# * *Parameters*
|
|
152
|
+
#
|
|
153
|
+
# * *Returns*
|
|
154
|
+
# - [String] Currently loaded version of Nucleon framework
|
|
155
|
+
#
|
|
156
|
+
# * *Errors*
|
|
157
|
+
#
|
|
64
158
|
def self.VERSION
|
|
65
|
-
File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
|
159
|
+
File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
|
66
160
|
end
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
161
|
+
|
|
162
|
+
#*****************************************************************************
|
|
163
|
+
|
|
164
|
+
#
|
|
165
|
+
# Global flag that indicate whether or not dumping with dbg() is active
|
|
166
|
+
#
|
|
167
|
+
# Think of this as a global on/off switch in case dbg() statements are
|
|
168
|
+
# accidentally left in code.
|
|
169
|
+
#
|
|
70
170
|
@@dump_enabled = false
|
|
71
|
-
|
|
171
|
+
|
|
172
|
+
# Enable or disable variable dumping through dbg()
|
|
173
|
+
#
|
|
174
|
+
# * *Parameters*
|
|
175
|
+
# - [Boolean] *dump* Whether or not to enable dumping through dbg()
|
|
176
|
+
#
|
|
177
|
+
# * *Returns*
|
|
178
|
+
# - [Void] This method does not return a value
|
|
179
|
+
#
|
|
180
|
+
# * *Errors*
|
|
181
|
+
#
|
|
182
|
+
# See also:
|
|
183
|
+
# - ::dump_enabled
|
|
184
|
+
#
|
|
72
185
|
def self.dump_enabled=dump
|
|
73
186
|
@@dump_enabled = dump
|
|
74
187
|
end
|
|
75
|
-
|
|
188
|
+
|
|
189
|
+
# Check whether dumping is enabled or disabled through dbg()
|
|
190
|
+
#
|
|
191
|
+
# * *Parameters*
|
|
192
|
+
#
|
|
193
|
+
# * *Returns*
|
|
194
|
+
# - [Boolean] Whether or not to enable dumping through dbg()
|
|
195
|
+
#
|
|
196
|
+
# * *Errors*
|
|
197
|
+
#
|
|
198
|
+
# See also:
|
|
199
|
+
# - ::dump_enabled=
|
|
200
|
+
#
|
|
76
201
|
def self.dump_enabled
|
|
77
202
|
@@dump_enabled
|
|
78
203
|
end
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
204
|
+
|
|
205
|
+
#*****************************************************************************
|
|
206
|
+
|
|
207
|
+
# Check if debugging is enabled
|
|
208
|
+
#
|
|
209
|
+
# This uses the environment variable *"NUCLEON_DEBUG"*
|
|
210
|
+
#
|
|
211
|
+
# ENV["NUCLEON_DEBUG"]
|
|
212
|
+
#
|
|
213
|
+
# * *Parameters*
|
|
214
|
+
#
|
|
215
|
+
# * *Returns*
|
|
216
|
+
# - [Boolean] Whether or not debugging is enabled
|
|
217
|
+
#
|
|
218
|
+
# * *Errors*
|
|
219
|
+
#
|
|
220
|
+
# See also:
|
|
221
|
+
# - ::debug_break
|
|
222
|
+
#
|
|
82
223
|
def self.debugging?
|
|
83
|
-
ENV["NUCLEON_DEBUG"] ? true : false
|
|
224
|
+
ENV["NUCLEON_DEBUG"] ? true : false
|
|
84
225
|
end
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
226
|
+
|
|
227
|
+
# Set a debug break poing at the line of invocation if debugging is enabled.
|
|
228
|
+
#
|
|
229
|
+
# Nucleon uses Pry to perform stepwise debugging through the code.
|
|
230
|
+
#
|
|
231
|
+
# Note: This is not used very often so it may be buggy in areas.
|
|
232
|
+
#
|
|
233
|
+
# * *Parameters*
|
|
234
|
+
# - [Boolean] *condition* Boolean test to check if the debugging breakpoint should be active
|
|
235
|
+
#
|
|
236
|
+
# * *Returns*
|
|
237
|
+
# - [Void] This method does not return a value
|
|
238
|
+
#
|
|
239
|
+
# * *Errors*
|
|
240
|
+
#
|
|
241
|
+
# See also:
|
|
242
|
+
# - ::debugging?
|
|
243
|
+
#
|
|
88
244
|
def self.debug_break(condition = true)
|
|
89
245
|
if debugging?
|
|
90
|
-
|
|
246
|
+
#*******************************************************************************
|
|
91
247
|
# Nucleon Pry powered development console
|
|
92
248
|
#
|
|
93
249
|
# Usage:
|
|
@@ -97,15 +253,15 @@ module Nucleon
|
|
|
97
253
|
#
|
|
98
254
|
# :> [ sudo ] NUCLEON_DEBUG=1 nucleon <args>...
|
|
99
255
|
#
|
|
100
|
-
# * Call the debug_break method anywhere in the code to start a debugging
|
|
256
|
+
# * Call the debug_break method anywhere in the code to start a debugging
|
|
101
257
|
# session.
|
|
102
258
|
#
|
|
103
259
|
# :> Nucleon.debug_break or :> Nucleon.debug_break <test?>
|
|
104
260
|
#
|
|
105
|
-
# * Since the debugging tools don't work in parallel, parallel operations are
|
|
261
|
+
# * Since the debugging tools don't work in parallel, parallel operations are
|
|
106
262
|
# serialized when NUCLEON_DEBUG environment variable is found.
|
|
107
263
|
#
|
|
108
|
-
|
|
264
|
+
#*******************************************************************************
|
|
109
265
|
# General information
|
|
110
266
|
#
|
|
111
267
|
# For more information on Pry: http://pryrepl.org
|
|
@@ -117,14 +273,14 @@ module Nucleon
|
|
|
117
273
|
# For available commands and help information: [ help ]
|
|
118
274
|
# For command specific help: [ <command> --help ]
|
|
119
275
|
#
|
|
120
|
-
|
|
276
|
+
#*******************************************************************************
|
|
121
277
|
# General commands:
|
|
122
278
|
#
|
|
123
279
|
# :> cd <Class> Change to inspect class (class constant)
|
|
124
280
|
# :> show-method <method> Show source for class method
|
|
125
281
|
# :> .<CLI command> <args>... Execute a CLI command (always starts with dot)
|
|
126
282
|
#
|
|
127
|
-
|
|
283
|
+
#*******************************************************************************
|
|
128
284
|
# Breakpoints
|
|
129
285
|
#
|
|
130
286
|
# :> breakpoints List all defined breakpoints
|
|
@@ -143,7 +299,7 @@ module Nucleon
|
|
|
143
299
|
#
|
|
144
300
|
# :> break --show <breakpoint> Show details about breakpoint.
|
|
145
301
|
#
|
|
146
|
-
|
|
302
|
+
#*******************************************************************************
|
|
147
303
|
# Stack inspection / traversal
|
|
148
304
|
#
|
|
149
305
|
# :> show-stack Show all accessible frames in the call stack.
|
|
@@ -151,7 +307,7 @@ module Nucleon
|
|
|
151
307
|
# :> up Move up one frame in the call stack.
|
|
152
308
|
# :> down Move down one frame in the call stack.
|
|
153
309
|
#
|
|
154
|
-
|
|
310
|
+
#*******************************************************************************
|
|
155
311
|
# Debugging execution flow:
|
|
156
312
|
#
|
|
157
313
|
# :> s = [ step | step <times> ] Step execution into the next line or method.
|
|
@@ -160,28 +316,78 @@ module Nucleon
|
|
|
160
316
|
# :> c = [ continue ] Continue program execution (end Pry session).
|
|
161
317
|
#
|
|
162
318
|
binding.pry if condition
|
|
163
|
-
end
|
|
319
|
+
end
|
|
164
320
|
end
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
321
|
+
|
|
322
|
+
#*****************************************************************************
|
|
323
|
+
|
|
324
|
+
# Check if parallel execution is enabled
|
|
325
|
+
#
|
|
326
|
+
# This uses the environment variable *"NUCLEON_NO_PARALLEL"*. Parallelism is
|
|
327
|
+
# enabled by default.
|
|
328
|
+
#
|
|
329
|
+
# ENV["NUCLEON_NO_PARALLEL"]
|
|
330
|
+
#
|
|
331
|
+
# Due to the complications with parallel debugging, parallel is suspended
|
|
332
|
+
# when debugging is enabled
|
|
333
|
+
#
|
|
334
|
+
# * *Parameters*
|
|
335
|
+
#
|
|
336
|
+
# * *Returns*
|
|
337
|
+
# - [Boolean] Whether or not parallel is enabled
|
|
338
|
+
#
|
|
339
|
+
# * *Errors*
|
|
340
|
+
#
|
|
341
|
+
# See also:
|
|
342
|
+
# - ::debugging?
|
|
343
|
+
#
|
|
168
344
|
def self.parallel?
|
|
169
345
|
debugging? || ENV['NUCLEON_NO_PARALLEL'] ? false : true
|
|
170
346
|
end
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
347
|
+
|
|
348
|
+
#
|
|
349
|
+
# Global console Mutex lock
|
|
350
|
+
#
|
|
351
|
+
# TODO: This may not be needed?
|
|
352
|
+
#
|
|
174
353
|
@@console_lock = Mutex.new
|
|
175
|
-
|
|
354
|
+
|
|
355
|
+
# Get the global console Mutex for synchronized console operations.
|
|
356
|
+
#
|
|
357
|
+
# * *Parameters*
|
|
358
|
+
#
|
|
359
|
+
# * *Returns*
|
|
360
|
+
# - [Mutex] Console Mutex object
|
|
361
|
+
#
|
|
362
|
+
# * *Errors*
|
|
363
|
+
#
|
|
176
364
|
def self.console_lock
|
|
177
365
|
@@console_lock
|
|
178
|
-
end
|
|
366
|
+
end
|
|
179
367
|
end
|
|
180
368
|
|
|
181
|
-
|
|
369
|
+
#*******************************************************************************
|
|
182
370
|
|
|
371
|
+
#
|
|
372
|
+
# We also define a generic debug dump method that is available in any Nucleon
|
|
373
|
+
# derived class or module.
|
|
374
|
+
#
|
|
183
375
|
module Kernel
|
|
184
|
-
|
|
376
|
+
|
|
377
|
+
# Dump data to the console with optional label.
|
|
378
|
+
#
|
|
379
|
+
# This must be defined under the definition of Nucleon::dump_enabled
|
|
380
|
+
#
|
|
381
|
+
# * *Parameters*
|
|
382
|
+
# - [ANY] *data* Data to dump to the console
|
|
383
|
+
# - [String] *label* Label to render above data dump
|
|
384
|
+
# - [Boolean] *override_enabled* Whether or not to override override Nucleon::dump_enabled
|
|
385
|
+
#
|
|
386
|
+
# * *Returns*
|
|
387
|
+
# - [Void] This method does not have a return value
|
|
388
|
+
#
|
|
389
|
+
# * *Errors*
|
|
390
|
+
#
|
|
185
391
|
def dbg(data, label = '', override_enabled = false)
|
|
186
392
|
# Invocations of this function should NOT be committed to the project
|
|
187
393
|
if Nucleon.dump_enabled || override_enabled
|
|
@@ -196,79 +402,126 @@ module Kernel
|
|
|
196
402
|
end
|
|
197
403
|
end
|
|
198
404
|
end
|
|
199
|
-
|
|
200
|
-
|
|
405
|
+
|
|
406
|
+
#*******************************************************************************
|
|
201
407
|
# Coral requirements
|
|
202
408
|
|
|
409
|
+
#
|
|
410
|
+
# Initialize Gem load path
|
|
411
|
+
#
|
|
203
412
|
$:.unshift(lib_dir) unless $:.include?(lib_dir) || $:.include?(File.expand_path(lib_dir))
|
|
204
413
|
|
|
205
|
-
|
|
206
|
-
|
|
414
|
+
#
|
|
415
|
+
# Only require debugging packages if debugging is enabled
|
|
416
|
+
#
|
|
207
417
|
if Nucleon.debugging?
|
|
208
418
|
require 'pry'
|
|
209
419
|
require 'pry-stack_explorer'
|
|
210
|
-
require 'pry-
|
|
420
|
+
require 'pry-byebug'
|
|
211
421
|
|
|
212
422
|
if defined?(PryDebugger)
|
|
213
423
|
Pry.commands.alias_command 'c', 'continue'
|
|
214
424
|
Pry.commands.alias_command 's', 'step'
|
|
215
425
|
Pry.commands.alias_command 'n', 'next'
|
|
216
426
|
Pry.commands.alias_command 'f', 'finish'
|
|
217
|
-
end
|
|
427
|
+
end
|
|
218
428
|
end
|
|
219
429
|
|
|
220
|
-
|
|
221
|
-
|
|
430
|
+
#
|
|
431
|
+
# General requirements
|
|
432
|
+
#
|
|
222
433
|
# TODO: Reduce the number of dependencies loaded in this load script (for performance).
|
|
223
434
|
# Decentralize!
|
|
224
435
|
|
|
436
|
+
#
|
|
437
|
+
# Allows us to work with Gem objects
|
|
438
|
+
#
|
|
439
|
+
# See:
|
|
440
|
+
# - Nucleon::Gems
|
|
441
|
+
#
|
|
225
442
|
require 'rubygems'
|
|
226
|
-
|
|
443
|
+
#
|
|
444
|
+
# Basic CLI option parsing
|
|
445
|
+
#
|
|
227
446
|
require 'optparse'
|
|
447
|
+
#
|
|
448
|
+
# Internationalization
|
|
449
|
+
#
|
|
228
450
|
require 'i18n'
|
|
451
|
+
#
|
|
452
|
+
# Logging capabilities
|
|
453
|
+
#
|
|
229
454
|
require 'log4r'
|
|
230
455
|
require 'log4r/configurator'
|
|
456
|
+
#
|
|
457
|
+
# Data merging
|
|
458
|
+
#
|
|
231
459
|
require 'deep_merge'
|
|
232
|
-
|
|
460
|
+
#
|
|
461
|
+
# SHA1 identification
|
|
462
|
+
#
|
|
233
463
|
require 'digest/sha1'
|
|
464
|
+
#
|
|
465
|
+
# Object serialization
|
|
466
|
+
#
|
|
234
467
|
require 'base64'
|
|
235
|
-
|
|
468
|
+
#
|
|
469
|
+
# YAML parsing / generation
|
|
470
|
+
#
|
|
236
471
|
require 'yaml'
|
|
472
|
+
#
|
|
473
|
+
# JSON parsing / generation
|
|
474
|
+
#
|
|
237
475
|
require 'multi_json'
|
|
238
|
-
|
|
476
|
+
#
|
|
477
|
+
# Temp directory access
|
|
478
|
+
#
|
|
239
479
|
require 'tmpdir'
|
|
480
|
+
#
|
|
481
|
+
# SSH private / public key access and generation
|
|
482
|
+
#
|
|
240
483
|
require 'sshkey'
|
|
241
|
-
|
|
484
|
+
#
|
|
485
|
+
# Sub process execution
|
|
486
|
+
#
|
|
242
487
|
require 'childprocess'
|
|
488
|
+
#
|
|
489
|
+
# Basic threading
|
|
490
|
+
#
|
|
243
491
|
require 'thread'
|
|
244
|
-
|
|
492
|
+
#
|
|
493
|
+
# Celluloid actors
|
|
494
|
+
#
|
|
245
495
|
if Nucleon.parallel?
|
|
246
496
|
require 'celluloid'
|
|
247
|
-
require 'celluloid/autostart'
|
|
497
|
+
require 'celluloid/autostart'
|
|
248
498
|
end
|
|
249
499
|
|
|
250
|
-
|
|
251
|
-
|
|
500
|
+
#
|
|
501
|
+
# I18n settings
|
|
502
|
+
#
|
|
252
503
|
# TODO: Make this dynamically settable
|
|
253
|
-
|
|
504
|
+
#
|
|
254
505
|
I18n.enforce_available_locales = false
|
|
255
506
|
I18n.load_path << File.expand_path(File.join('..', 'locales', 'en.yml'), lib_dir)
|
|
256
507
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
#
|
|
508
|
+
#
|
|
509
|
+
# Logger
|
|
510
|
+
#
|
|
511
|
+
# *IMPORTANT* Make sure logger is at the top of our load order priorities
|
|
512
|
+
#
|
|
260
513
|
nucleon_require(util_dir, :logger)
|
|
261
514
|
|
|
262
|
-
|
|
263
|
-
|
|
515
|
+
#
|
|
264
516
|
# Object modifications (100% pure monkey patches)
|
|
517
|
+
#
|
|
265
518
|
Dir.glob(File.join(mod_dir, '*.rb')).each do |file|
|
|
266
519
|
require file
|
|
267
520
|
end
|
|
268
521
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
#
|
|
522
|
+
#
|
|
523
|
+
# Class mixins
|
|
524
|
+
#
|
|
272
525
|
Dir.glob(File.join(mixin_dir, '*.rb')).each do |file|
|
|
273
526
|
require file
|
|
274
527
|
end
|
|
@@ -282,48 +535,53 @@ Dir.glob(File.join(macro_dir, '*.rb')).each do |file|
|
|
|
282
535
|
require file
|
|
283
536
|
end
|
|
284
537
|
|
|
285
|
-
|
|
286
|
-
|
|
538
|
+
#
|
|
539
|
+
# Nucleon facade
|
|
540
|
+
#
|
|
287
541
|
nucleon_require(core_dir, :facade)
|
|
288
542
|
|
|
543
|
+
#
|
|
544
|
+
# Nucleon::Facade extends Nucleon
|
|
545
|
+
#
|
|
289
546
|
module Nucleon
|
|
290
547
|
extend Facade
|
|
291
548
|
end
|
|
292
549
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
#
|
|
550
|
+
#
|
|
551
|
+
# Bootstrap classes
|
|
552
|
+
#
|
|
296
553
|
nucleon_require(core_dir, :errors)
|
|
297
554
|
nucleon_require(core_dir, :codes)
|
|
298
555
|
nucleon_require(util_dir, :data)
|
|
299
556
|
nucleon_require(core_dir, :config)
|
|
300
|
-
nucleon_require(util_dir, :console)
|
|
301
|
-
nucleon_require(core_dir, :core)
|
|
302
|
-
|
|
303
|
-
#---
|
|
557
|
+
nucleon_require(util_dir, :console)
|
|
558
|
+
nucleon_require(core_dir, :core)
|
|
304
559
|
|
|
305
|
-
#
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
560
|
+
#
|
|
561
|
+
# Core utilities
|
|
562
|
+
#
|
|
563
|
+
[ :liquid,
|
|
564
|
+
:cli,
|
|
565
|
+
:disk,
|
|
309
566
|
:package,
|
|
310
|
-
:cache,
|
|
567
|
+
:cache,
|
|
311
568
|
:shell,
|
|
312
569
|
:ssh
|
|
313
|
-
].each do |name|
|
|
570
|
+
].each do |name|
|
|
314
571
|
nucleon_require(util_dir, name)
|
|
315
572
|
end
|
|
316
573
|
|
|
317
|
-
|
|
318
|
-
|
|
574
|
+
#
|
|
575
|
+
# Git (if it exists on the system)
|
|
576
|
+
#
|
|
319
577
|
if nucleon_locate('git')
|
|
320
578
|
require 'rugged'
|
|
321
579
|
nucleon_require(util_dir, :git)
|
|
322
580
|
end
|
|
323
581
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
#
|
|
582
|
+
#
|
|
583
|
+
# Nucleon plugin system
|
|
584
|
+
#
|
|
327
585
|
nucleon_require(core_dir, :gems)
|
|
328
586
|
nucleon_require(core_dir, :environment)
|
|
329
587
|
nucleon_require(core_dir, :manager)
|