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