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/mixin/colors.rb
CHANGED
|
@@ -1,57 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
# Should be included via include
|
|
3
|
-
#
|
|
4
|
-
# include Mixin::Colors
|
|
5
|
-
#
|
|
6
|
-
|
|
7
1
|
module Nucleon
|
|
8
2
|
module Mixin
|
|
3
|
+
#
|
|
4
|
+
# == Console colors
|
|
5
|
+
#
|
|
6
|
+
# The Nucleon::Mixin::Colors module extends a class or instance to include
|
|
7
|
+
# methods for wrapping strings in colored text markers.
|
|
8
|
+
#
|
|
9
|
+
# For usage and definition:
|
|
10
|
+
#
|
|
11
|
+
# - See Nucleon::Util::Console
|
|
12
|
+
#
|
|
9
13
|
module Colors
|
|
10
|
-
|
|
14
|
+
|
|
15
|
+
# Return a given string wrapped in black text markers.
|
|
16
|
+
#
|
|
17
|
+
# See:
|
|
18
|
+
# - Nucleon::Util::Console::black
|
|
19
|
+
#
|
|
11
20
|
def black(string)
|
|
12
|
-
::Nucleon::Util::Console.black(string)
|
|
21
|
+
::Nucleon::Util::Console.black(string)
|
|
13
22
|
end
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
|
|
24
|
+
# Return a given string wrapped in red text markers.
|
|
25
|
+
#
|
|
26
|
+
# See:
|
|
27
|
+
# - Nucleon::Util::Console::red
|
|
28
|
+
#
|
|
17
29
|
def red(string)
|
|
18
|
-
::Nucleon::Util::Console.red(string)
|
|
30
|
+
::Nucleon::Util::Console.red(string)
|
|
19
31
|
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
|
|
33
|
+
# Return a given string wrapped in green text markers.
|
|
34
|
+
#
|
|
35
|
+
# See:
|
|
36
|
+
# - Nucleon::Util::Console::green
|
|
37
|
+
#
|
|
23
38
|
def green(string)
|
|
24
|
-
::Nucleon::Util::Console.green(string)
|
|
39
|
+
::Nucleon::Util::Console.green(string)
|
|
25
40
|
end
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
|
|
42
|
+
# Return a given string wrapped in yellow text markers.
|
|
43
|
+
#
|
|
44
|
+
# See:
|
|
45
|
+
# - Nucleon::Util::Console::yellow
|
|
46
|
+
#
|
|
29
47
|
def yellow(string)
|
|
30
|
-
::Nucleon::Util::Console.yellow(string)
|
|
48
|
+
::Nucleon::Util::Console.yellow(string)
|
|
31
49
|
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
|
|
51
|
+
# Return a given string wrapped in blue text markers.
|
|
52
|
+
#
|
|
53
|
+
# See:
|
|
54
|
+
# - Nucleon::Util::Console::blue
|
|
55
|
+
#
|
|
35
56
|
def blue(string)
|
|
36
|
-
::Nucleon::Util::Console.blue(string)
|
|
57
|
+
::Nucleon::Util::Console.blue(string)
|
|
37
58
|
end
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
59
|
+
|
|
60
|
+
# Return a given string wrapped in purple text markers.
|
|
61
|
+
#
|
|
62
|
+
# See:
|
|
63
|
+
# - Nucleon::Util::Console::purple
|
|
64
|
+
#
|
|
41
65
|
def purple(string)
|
|
42
|
-
::Nucleon::Util::Console.purple(string)
|
|
66
|
+
::Nucleon::Util::Console.purple(string)
|
|
43
67
|
end
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
|
|
69
|
+
# Return a given string wrapped in cyan text markers.
|
|
70
|
+
#
|
|
71
|
+
# See:
|
|
72
|
+
# - Nucleon::Util::Console::cyan
|
|
73
|
+
#
|
|
47
74
|
def cyan(string)
|
|
48
|
-
::Nucleon::Util::Console.cyan(string)
|
|
75
|
+
::Nucleon::Util::Console.cyan(string)
|
|
49
76
|
end
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
77
|
+
|
|
78
|
+
# Return a given string wrapped in grey text markers.
|
|
79
|
+
#
|
|
80
|
+
# See:
|
|
81
|
+
# - Nucleon::Util::Console::grey
|
|
82
|
+
#
|
|
53
83
|
def grey(string)
|
|
54
|
-
::Nucleon::Util::Console.grey(string)
|
|
84
|
+
::Nucleon::Util::Console.grey(string)
|
|
55
85
|
end
|
|
56
86
|
end
|
|
57
87
|
end
|
|
@@ -1,46 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
# Should be included via extend
|
|
3
|
-
#
|
|
4
|
-
# extend Mixin::ConfigCollection
|
|
5
|
-
#
|
|
6
|
-
|
|
7
1
|
module Nucleon
|
|
8
2
|
module Mixin
|
|
3
|
+
#
|
|
4
|
+
# == Configuration collection
|
|
5
|
+
#
|
|
6
|
+
# The Nucleon::Mixin::ConfigCollection module extends a class to include methods
|
|
7
|
+
# for working with the global property collection.
|
|
8
|
+
#
|
|
9
|
+
# Right now, largely for historical reasons, the Nucleon::Config::Collection
|
|
10
|
+
# class is structured as a global interface and collection for grouping all of
|
|
11
|
+
# the defined options. It was originally contained within Nucleon::Config as
|
|
12
|
+
# part of the global configuration interface. In the future, the class and
|
|
13
|
+
# this mixin will be refactored to support multiple property logs and will
|
|
14
|
+
# have more fully refined persistence methods.
|
|
15
|
+
#
|
|
16
|
+
#
|
|
17
|
+
# For usage and definition:
|
|
18
|
+
#
|
|
19
|
+
# - See core configuration object Nucleon::Config
|
|
20
|
+
# - See collection Nucleon::Config::Collection
|
|
21
|
+
#
|
|
9
22
|
module ConfigCollection
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
#*****************************************************************************
|
|
12
25
|
# Configuration collection interface
|
|
13
|
-
|
|
26
|
+
|
|
27
|
+
# Return a reference to all of the globally defined properties.
|
|
28
|
+
#
|
|
29
|
+
# This method generally should not be used in favor of the ::get method.
|
|
30
|
+
#
|
|
31
|
+
# See:
|
|
32
|
+
# - Nucleon::Config::Collection::all
|
|
33
|
+
#
|
|
14
34
|
def all_properties
|
|
15
35
|
Config::Collection.all
|
|
16
36
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
37
|
+
|
|
38
|
+
# Return specified property value.
|
|
39
|
+
#
|
|
40
|
+
# See:
|
|
41
|
+
# - Nucleon::Config::Collection::get
|
|
42
|
+
#
|
|
20
43
|
def get_property(name)
|
|
21
44
|
Config::Collection.get(name)
|
|
22
45
|
end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
|
|
47
|
+
# Set property value.
|
|
48
|
+
#
|
|
49
|
+
# See:
|
|
50
|
+
# - Nucleon::Config::Collection::set
|
|
51
|
+
#
|
|
26
52
|
def set_property(name, value)
|
|
27
53
|
Config::Collection.set(name, value)
|
|
28
54
|
end
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
|
|
56
|
+
# Delete property from collection.
|
|
57
|
+
#
|
|
58
|
+
# See:
|
|
59
|
+
# - Nucleon::Config::Collection::delete
|
|
60
|
+
#
|
|
32
61
|
def delete_property(name)
|
|
33
62
|
Config::Collection.delete(name)
|
|
34
63
|
end
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
|
|
65
|
+
# Clear all properties from the collection.
|
|
66
|
+
#
|
|
67
|
+
# See:
|
|
68
|
+
# - Nucleon::Config::Collection::clear
|
|
69
|
+
#
|
|
38
70
|
def clear_properties
|
|
39
71
|
Config::Collection.clear
|
|
40
72
|
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
73
|
+
|
|
74
|
+
# Dump properties to disk.
|
|
75
|
+
#
|
|
76
|
+
# See:
|
|
77
|
+
# - Nucleon::Config::Collection::save
|
|
78
|
+
#
|
|
44
79
|
def save_properties(options = {})
|
|
45
80
|
Config::Collection.save(options)
|
|
46
81
|
end
|
|
@@ -1,41 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
# Should be included via extend
|
|
3
|
-
#
|
|
4
|
-
# extend Mixin::ConfigOptions
|
|
5
|
-
#
|
|
6
|
-
|
|
7
1
|
module Nucleon
|
|
8
2
|
module Mixin
|
|
3
|
+
#
|
|
4
|
+
# == Contextualized option collection
|
|
5
|
+
#
|
|
6
|
+
# The Nucleon::Mixin::ConfigOptions module extends a class to include methods
|
|
7
|
+
# for working with the central option collection.
|
|
8
|
+
#
|
|
9
|
+
# Right now, largely for historical reasons, the Nucleon::Config::Options class
|
|
10
|
+
# is structured as a global interface and collection for grouping all of the
|
|
11
|
+
# defined options. It was originally contained within Nucleon::Config as part
|
|
12
|
+
# of the global configuration interface. In the future, the class and this
|
|
13
|
+
# mixin will be refactored to support multiple collections of contextualized
|
|
14
|
+
# properties.
|
|
15
|
+
#
|
|
16
|
+
#
|
|
17
|
+
# For usage and definition:
|
|
18
|
+
#
|
|
19
|
+
# - See core configuration object Nucleon::Config
|
|
20
|
+
# - See collection Nucleon::Config::Options
|
|
21
|
+
#
|
|
9
22
|
module ConfigOptions
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
|
|
24
|
+
#*****************************************************************************
|
|
12
25
|
# Configuration options interface
|
|
13
|
-
|
|
26
|
+
|
|
27
|
+
# Return an array of context names based on given contexts and an optional
|
|
28
|
+
# hierarchy path.
|
|
29
|
+
#
|
|
30
|
+
# This method mainly exists to allow us to create cascading context groups
|
|
31
|
+
# for the properties based on a hierarchical list. We use it to create
|
|
32
|
+
# contextual property lookups for configuring Puppet in the corl gem.
|
|
33
|
+
#
|
|
34
|
+
# See:
|
|
35
|
+
# - Nucleon::Config::Options::contexts
|
|
36
|
+
#
|
|
14
37
|
def contexts(contexts = [], hierarchy = [])
|
|
15
|
-
Config::Options.contexts(contexts, hierarchy)
|
|
38
|
+
Config::Options.contexts(contexts, hierarchy)
|
|
16
39
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
|
|
41
|
+
# Return a reference to all of the globally defined context properties.
|
|
42
|
+
#
|
|
43
|
+
# This method generally should not be used in favor of the ::get method.
|
|
44
|
+
#
|
|
45
|
+
# See:
|
|
46
|
+
# - Nucleon::Config::Options::all
|
|
47
|
+
#
|
|
20
48
|
def all_options
|
|
21
49
|
Config::Options.all
|
|
22
50
|
end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
|
|
52
|
+
# Return merged option groups for given context names.
|
|
53
|
+
#
|
|
54
|
+
# This method allows us to easily request combinations of properties.
|
|
55
|
+
#
|
|
56
|
+
# See:
|
|
57
|
+
# - Nucleon::Config::Options::get
|
|
58
|
+
#
|
|
26
59
|
def get_options(contexts, force = true)
|
|
27
|
-
Config::Options.get(contexts, force)
|
|
60
|
+
Config::Options.get(contexts, force)
|
|
28
61
|
end
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
|
|
63
|
+
# Assign property values to specified context identifiers.
|
|
64
|
+
#
|
|
65
|
+
# This method allows us to easily merge properties across various contexts.
|
|
66
|
+
#
|
|
67
|
+
# See:
|
|
68
|
+
# - Nucleon::Config::Options::set
|
|
69
|
+
#
|
|
32
70
|
def set_options(contexts, options, force = true)
|
|
33
71
|
Config::Options.set(contexts, options, force)
|
|
34
72
|
end
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
73
|
+
|
|
74
|
+
# Clear all properties for specified contexts.
|
|
75
|
+
#
|
|
76
|
+
# Contexts are entirely removed, even the name itself.
|
|
77
|
+
#
|
|
78
|
+
# See:
|
|
79
|
+
# - Nucleon::Config::Options::clear
|
|
80
|
+
#
|
|
81
|
+
def clear_options(contexts = nil)
|
|
39
82
|
Config::Options.clear(contexts)
|
|
40
83
|
end
|
|
41
84
|
end
|
|
@@ -1,199 +1,193 @@
|
|
|
1
|
-
|
|
2
|
-
# Should be included via extend
|
|
3
|
-
#
|
|
4
|
-
# extend Mixin::Macro::ObjectInterface
|
|
5
|
-
#
|
|
6
|
-
|
|
7
1
|
module Nucleon
|
|
8
2
|
module Mixin
|
|
9
3
|
module Macro
|
|
10
4
|
module ObjectInterface
|
|
11
|
-
|
|
5
|
+
|
|
12
6
|
# requires Mixin::SubConfig
|
|
13
7
|
# requires Mixin::Settings
|
|
14
8
|
|
|
15
9
|
#-----------------------------------------------------------------------------
|
|
16
10
|
# Object collections
|
|
17
|
-
|
|
11
|
+
|
|
18
12
|
@@object_types = {}
|
|
19
13
|
|
|
20
14
|
#---
|
|
21
|
-
|
|
15
|
+
|
|
22
16
|
def object_collection(_type, _method_options = {})
|
|
23
17
|
_method_config = Config.ensure(_method_options)
|
|
24
|
-
|
|
18
|
+
|
|
25
19
|
_plural = _method_config.init(:plural, "#{_type}s").get(:plural)
|
|
26
|
-
|
|
20
|
+
|
|
27
21
|
unless _ensure_proc = _method_config.get(:ensure_proc, false)
|
|
28
22
|
_ensure_proc = Proc.new {|name, options = {}| options }
|
|
29
23
|
end
|
|
30
24
|
_delete_proc = _method_config.get(:delete_proc)
|
|
31
25
|
_search_proc = _method_config.get(:search_proc)
|
|
32
|
-
|
|
26
|
+
|
|
33
27
|
@@object_types[_type] = _method_config
|
|
34
|
-
|
|
28
|
+
|
|
35
29
|
logger.debug("Creating new object collection #{_type} with: #{_method_config.inspect}")
|
|
36
|
-
|
|
30
|
+
|
|
37
31
|
#---------------------------------------------------------------------------
|
|
38
|
-
|
|
32
|
+
|
|
39
33
|
object_utilities
|
|
40
|
-
|
|
34
|
+
|
|
41
35
|
#---------------------------------------------------------------------------
|
|
42
|
-
|
|
36
|
+
|
|
43
37
|
logger.debug("Defining object interface method: #{_type}_config")
|
|
44
|
-
|
|
38
|
+
|
|
45
39
|
define_method "#{_type}_config" do |name = nil|
|
|
46
40
|
Config.new( name ? get([ _plural, name ], {}) : get(_plural, {}) )
|
|
47
41
|
end
|
|
48
|
-
|
|
42
|
+
|
|
49
43
|
#---
|
|
50
|
-
|
|
44
|
+
|
|
51
45
|
logger.debug("Defining object interface method: #{_type}_setting")
|
|
52
|
-
|
|
46
|
+
|
|
53
47
|
define_method "#{_type}_setting" do |name, property, default = nil, format = false|
|
|
54
48
|
get([ _plural, name, property ], default, format)
|
|
55
49
|
end
|
|
56
|
-
|
|
50
|
+
|
|
57
51
|
#---
|
|
58
|
-
|
|
52
|
+
|
|
59
53
|
logger.debug("Defining object interface method: #{_plural}")
|
|
60
|
-
|
|
54
|
+
|
|
61
55
|
define_method "#{_plural}" do |reset = false|
|
|
62
56
|
send("init_#{_plural}") if reset || _get(_plural, {}).empty?
|
|
63
57
|
_get(_plural, {})
|
|
64
58
|
end
|
|
65
|
-
|
|
59
|
+
|
|
66
60
|
#---
|
|
67
|
-
|
|
61
|
+
|
|
68
62
|
logger.debug("Defining object interface method: init_#{_plural}")
|
|
69
|
-
|
|
63
|
+
|
|
70
64
|
define_method "init_#{_plural}" do
|
|
71
65
|
data = hash(_search_proc.call) if _search_proc
|
|
72
66
|
data = get_hash(_plural) unless data
|
|
73
|
-
|
|
67
|
+
|
|
74
68
|
logger.debug("Initializing object data: #{data.inspect}")
|
|
75
|
-
|
|
69
|
+
|
|
76
70
|
symbol_map(data).each do |name, options|
|
|
77
71
|
if name != :settings
|
|
78
72
|
options[:object_container] = myself
|
|
79
|
-
|
|
73
|
+
|
|
80
74
|
logger.debug("Initializing object: #{name}")
|
|
81
|
-
|
|
75
|
+
|
|
82
76
|
obj = _ensure_proc.call(name, options)
|
|
83
77
|
_set([ _plural, name ], obj)
|
|
84
78
|
end
|
|
85
79
|
end
|
|
86
80
|
end
|
|
87
|
-
|
|
81
|
+
|
|
88
82
|
#---
|
|
89
|
-
|
|
83
|
+
|
|
90
84
|
logger.debug("Defining object interface method: set_#{_plural}")
|
|
91
85
|
|
|
92
86
|
define_method "set_#{_plural}" do |data = {}|
|
|
93
87
|
data = Config.ensure(data).export
|
|
94
|
-
|
|
88
|
+
|
|
95
89
|
send("clear_#{_plural}")
|
|
96
90
|
set(_plural, data)
|
|
97
|
-
|
|
91
|
+
|
|
98
92
|
logger.debug("Setting #{_plural}")
|
|
99
|
-
|
|
93
|
+
|
|
100
94
|
data.each do |name, options|
|
|
101
95
|
options[:object_container] = myself
|
|
102
|
-
|
|
96
|
+
|
|
103
97
|
logger.debug("Setting #{_type} #{name}: #{options.inspect}")
|
|
104
|
-
|
|
98
|
+
|
|
105
99
|
obj = _ensure_proc.call(name, options)
|
|
106
100
|
_set([ _plural, name ], obj)
|
|
107
101
|
end
|
|
108
102
|
end
|
|
109
103
|
|
|
110
104
|
#---
|
|
111
|
-
|
|
105
|
+
|
|
112
106
|
logger.debug("Defining object interface method: #{_type}")
|
|
113
|
-
|
|
107
|
+
|
|
114
108
|
define_method "#{_type}" do |name, reset = false|
|
|
115
|
-
if reset || _get([ _plural, name ], nil).nil?
|
|
109
|
+
if reset || _get([ _plural, name ], nil).nil?
|
|
116
110
|
options = get([ _plural, name ], nil)
|
|
117
|
-
|
|
111
|
+
|
|
118
112
|
unless options.nil?
|
|
119
113
|
options[:object_container] = myself
|
|
120
|
-
|
|
114
|
+
|
|
121
115
|
logger.debug("Initializing object: #{name}")
|
|
122
|
-
|
|
116
|
+
|
|
123
117
|
obj = _ensure_proc.call(name, options)
|
|
124
118
|
_set([ _plural, name ], obj)
|
|
125
119
|
end
|
|
126
120
|
end
|
|
127
121
|
_get([ _plural, name ])
|
|
128
122
|
end
|
|
129
|
-
|
|
123
|
+
|
|
130
124
|
#---
|
|
131
|
-
|
|
125
|
+
|
|
132
126
|
logger.debug("Defining object interface method: set_#{_type}")
|
|
133
127
|
|
|
134
128
|
define_method "set_#{_type}" do |name, options = {}|
|
|
135
129
|
options = Config.ensure(options).export
|
|
136
|
-
|
|
130
|
+
|
|
137
131
|
set([ _plural, name ], options)
|
|
138
|
-
|
|
132
|
+
|
|
139
133
|
options[:object_container] = myself
|
|
140
|
-
|
|
134
|
+
|
|
141
135
|
logger.debug("Setting #{_type} #{_name}: #{options.inspect}")
|
|
142
|
-
|
|
143
|
-
obj = _ensure_proc.call(name, options)
|
|
136
|
+
|
|
137
|
+
obj = _ensure_proc.call(name, options)
|
|
144
138
|
_set([ _plural, name ], obj)
|
|
145
139
|
end
|
|
146
|
-
|
|
140
|
+
|
|
147
141
|
#---
|
|
148
|
-
|
|
142
|
+
|
|
149
143
|
logger.debug("Defining object interface method: set_#{_type}_setting")
|
|
150
|
-
|
|
144
|
+
|
|
151
145
|
define_method "set_#{_type}_setting" do |name, property, value = nil|
|
|
152
146
|
logger.debug("Setting #{name} property #{property} to #{value.inspect}")
|
|
153
147
|
set([ _plural, name, property ], value)
|
|
154
148
|
end
|
|
155
|
-
|
|
149
|
+
|
|
156
150
|
#---
|
|
157
|
-
|
|
151
|
+
|
|
158
152
|
logger.debug("Defining object interface method: delete_#{_type}")
|
|
159
153
|
|
|
160
154
|
define_method "delete_#{_type}" do |name|
|
|
161
155
|
obj = send(_type, name)
|
|
162
|
-
|
|
156
|
+
|
|
163
157
|
logger.debug("Deleting #{_type} #{name}")
|
|
164
|
-
|
|
158
|
+
|
|
165
159
|
delete([ _plural, name ])
|
|
166
160
|
_delete([ _plural, name ])
|
|
167
|
-
|
|
161
|
+
|
|
168
162
|
_delete_proc.call(obj) if _delete_proc && ! obj.nil?
|
|
169
163
|
end
|
|
170
|
-
|
|
164
|
+
|
|
171
165
|
#---
|
|
172
|
-
|
|
166
|
+
|
|
173
167
|
logger.debug("Defining object interface method: delete_#{_type}_setting")
|
|
174
|
-
|
|
168
|
+
|
|
175
169
|
define_method "delete_#{_type}_setting" do |name, property|
|
|
176
170
|
logger.debug("Deleting #{name} property: #{property}")
|
|
177
|
-
|
|
171
|
+
|
|
178
172
|
delete([ _plural, name, property ])
|
|
179
173
|
end
|
|
180
|
-
|
|
174
|
+
|
|
181
175
|
#---
|
|
182
|
-
|
|
176
|
+
|
|
183
177
|
logger.debug("Defining object interface method: clear_#{_plural}")
|
|
184
|
-
|
|
178
|
+
|
|
185
179
|
define_method "clear_#{_plural}" do
|
|
186
180
|
get(_plural).keys.each do |name|
|
|
187
181
|
logger.debug("Clearing #{_type} #{name}")
|
|
188
|
-
|
|
182
|
+
|
|
189
183
|
send("delete_#{_type}", name)
|
|
190
184
|
end
|
|
191
|
-
end
|
|
192
|
-
|
|
185
|
+
end
|
|
186
|
+
|
|
193
187
|
#---------------------------------------------------------------------------
|
|
194
|
-
|
|
188
|
+
|
|
195
189
|
logger.debug("Defining object interface method: search_#{_type}")
|
|
196
|
-
|
|
190
|
+
|
|
197
191
|
define_method "search_#{_type}" do |name, keys, default = '', format = false, extra_groups = []|
|
|
198
192
|
obj_config = send("#{_type}_config", name)
|
|
199
193
|
search_object(obj_config, keys, default, format, extra_groups)
|
|
@@ -202,87 +196,87 @@ module ObjectInterface
|
|
|
202
196
|
|
|
203
197
|
#-----------------------------------------------------------------------------
|
|
204
198
|
# Utilities
|
|
205
|
-
|
|
199
|
+
|
|
206
200
|
def object_utilities
|
|
207
|
-
|
|
201
|
+
|
|
208
202
|
unless respond_to? :each_object_type
|
|
209
203
|
logger.debug("Defining object utility method: each_object_type")
|
|
210
|
-
|
|
204
|
+
|
|
211
205
|
define_method :each_object_type do |object_types = nil, filter_proc = nil, &code|
|
|
212
206
|
object_types = @@object_types.keys unless object_types
|
|
213
207
|
object_types = [ object_types ] unless object_types.is_a?(Array)
|
|
214
|
-
|
|
208
|
+
|
|
215
209
|
object_types.each do |type|
|
|
216
210
|
logger.debug("Processing object type: #{type}")
|
|
217
|
-
|
|
211
|
+
|
|
218
212
|
unless filter_proc && ! filter_proc.call(type, @@object_types[type])
|
|
219
213
|
plural = @@object_types[type][:plural]
|
|
220
|
-
|
|
214
|
+
|
|
221
215
|
logger.debug("Passing: #{@@object_types[type].inspect}")
|
|
222
216
|
code.call(type, plural, @@object_types[type])
|
|
223
217
|
end
|
|
224
|
-
end
|
|
218
|
+
end
|
|
225
219
|
end
|
|
226
220
|
end
|
|
227
|
-
|
|
221
|
+
|
|
228
222
|
#---
|
|
229
|
-
|
|
223
|
+
|
|
230
224
|
unless respond_to? :each_object
|
|
231
225
|
logger.debug("Defining object utility method: each_object")
|
|
232
|
-
|
|
226
|
+
|
|
233
227
|
define_method :each_object do |object_types = nil, &code|
|
|
234
228
|
each_object_type(object_types) do |type, plural, options|
|
|
235
229
|
logger.debug("Processing object type #{type}/#{plural} with: #{options.inspect}")
|
|
236
|
-
|
|
230
|
+
|
|
237
231
|
send(plural).each do |name, obj|
|
|
238
232
|
logger.debug("Processing object: #{name}")
|
|
239
|
-
code.call(type, name, obj)
|
|
240
|
-
end
|
|
241
|
-
end
|
|
233
|
+
code.call(type, name, obj)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
242
236
|
end
|
|
243
237
|
end
|
|
244
|
-
|
|
238
|
+
|
|
245
239
|
#---
|
|
246
|
-
|
|
240
|
+
|
|
247
241
|
unless respond_to? :init_objects
|
|
248
242
|
logger.debug("Defining object utility method: init_objects")
|
|
249
|
-
|
|
243
|
+
|
|
250
244
|
define_method :init_objects do |object_types = nil, filter_proc = nil|
|
|
251
245
|
logger.debug("Initializing object collection")
|
|
252
|
-
|
|
246
|
+
|
|
253
247
|
each_object_type(object_types, filter_proc) do |type, plural, options|
|
|
254
|
-
send("init_#{plural}")
|
|
255
|
-
end
|
|
248
|
+
send("init_#{plural}")
|
|
249
|
+
end
|
|
256
250
|
end
|
|
257
251
|
end
|
|
258
|
-
|
|
252
|
+
|
|
259
253
|
#---
|
|
260
|
-
|
|
254
|
+
|
|
261
255
|
unless respond_to? :clear_objects
|
|
262
256
|
logger.debug("Defining object utility method: clear_objects")
|
|
263
|
-
|
|
257
|
+
|
|
264
258
|
define_method :clear_objects do |object_types = nil, filter_proc = nil|
|
|
265
259
|
logger.debug("Clearing object collection")
|
|
266
|
-
|
|
260
|
+
|
|
267
261
|
each_object_type(object_types, filter_proc) do |type, plural, options|
|
|
268
|
-
send("clear_#{plural}")
|
|
262
|
+
send("clear_#{plural}")
|
|
269
263
|
end
|
|
270
264
|
end
|
|
271
265
|
end
|
|
272
|
-
|
|
266
|
+
|
|
273
267
|
#---------------------------------------------------------------------------
|
|
274
|
-
|
|
268
|
+
|
|
275
269
|
unless respond_to? :search_object
|
|
276
270
|
logger.debug("Defining object utility method: search_object")
|
|
277
|
-
|
|
271
|
+
|
|
278
272
|
define_method :search_object do |obj_config, keys, default = nil, format = false, extra_groups = []|
|
|
279
273
|
obj_config = Marshal.load(Marshal.dump(obj_config))
|
|
280
|
-
|
|
274
|
+
|
|
281
275
|
logger.debug("Searching object properties: #{obj_config.inspect}")
|
|
282
|
-
|
|
276
|
+
|
|
283
277
|
# TODO: Figure out a way to effectively cache this search operation
|
|
284
278
|
#------------------------------------------------------------------
|
|
285
|
-
|
|
279
|
+
|
|
286
280
|
add_settings = lambda do |final_options, groups|
|
|
287
281
|
if groups
|
|
288
282
|
local_options = {}
|
|
@@ -291,85 +285,85 @@ module ObjectInterface
|
|
|
291
285
|
if group_options.has_key?(:settings)
|
|
292
286
|
group_options = add_settings.call(group_options, group_options[:settings])
|
|
293
287
|
end
|
|
294
|
-
local_options = Util::Data.merge([ local_options, group_options ], true, false)
|
|
288
|
+
local_options = Util::Data.merge([ local_options, group_options ], true, false)
|
|
295
289
|
end
|
|
296
290
|
end
|
|
297
291
|
unless local_options.empty?
|
|
298
|
-
final_options = Util::Data.merge([ local_options, final_options ], true, false)
|
|
292
|
+
final_options = Util::Data.merge([ local_options, final_options ], true, false)
|
|
299
293
|
end
|
|
300
294
|
end
|
|
301
295
|
final_options
|
|
302
296
|
end
|
|
303
|
-
|
|
297
|
+
|
|
304
298
|
#---
|
|
305
|
-
|
|
299
|
+
|
|
306
300
|
settings = {}
|
|
307
|
-
|
|
301
|
+
|
|
308
302
|
keys = [ keys ] unless keys.is_a?(Array)
|
|
309
303
|
temp = keys.dup
|
|
310
|
-
|
|
304
|
+
|
|
311
305
|
logger.debug("Searching object keys: #{keys.inspect}")
|
|
312
|
-
|
|
313
|
-
logger.debug("Searching specialized settings")
|
|
306
|
+
|
|
307
|
+
logger.debug("Searching specialized settings")
|
|
314
308
|
until temp.empty? do
|
|
315
309
|
settings = add_settings.call(settings, obj_config.get([ temp, :settings ]))
|
|
316
310
|
temp.pop
|
|
317
311
|
end
|
|
318
|
-
|
|
319
|
-
logger.debug("Specialized settings found: #{settings.inspect}")
|
|
320
|
-
logger.debug("Searching general settings")
|
|
321
|
-
|
|
312
|
+
|
|
313
|
+
logger.debug("Specialized settings found: #{settings.inspect}")
|
|
314
|
+
logger.debug("Searching general settings")
|
|
315
|
+
|
|
322
316
|
settings = add_settings.call(settings, [ obj_config.get_array(:settings), extra_groups ].flatten)
|
|
323
|
-
|
|
317
|
+
|
|
324
318
|
#------------------------------------------------------------------
|
|
325
|
-
# TODO: Cache the above!!!
|
|
326
|
-
|
|
319
|
+
# TODO: Cache the above!!!
|
|
320
|
+
|
|
327
321
|
logger.debug("Final settings found: #{settings.inspect}")
|
|
328
|
-
|
|
322
|
+
|
|
329
323
|
if settings.empty?
|
|
330
|
-
value = obj_config.get(keys)
|
|
324
|
+
value = obj_config.get(keys)
|
|
331
325
|
else
|
|
332
|
-
final_config = Config.new(Util::Data.merge([
|
|
333
|
-
Util::Data.clean(settings),
|
|
334
|
-
Util::Data.clean(obj_config.export)
|
|
326
|
+
final_config = Config.new(Util::Data.merge([
|
|
327
|
+
Util::Data.clean(settings),
|
|
328
|
+
Util::Data.clean(obj_config.export)
|
|
335
329
|
], true, false))
|
|
336
330
|
value = final_config.get(keys)
|
|
337
|
-
|
|
331
|
+
|
|
338
332
|
logger.debug("Final configuration: #{final_config.export.inspect}")
|
|
339
333
|
end
|
|
340
|
-
|
|
334
|
+
|
|
341
335
|
value = default if Util::Data.undef?(value)
|
|
342
|
-
|
|
336
|
+
|
|
343
337
|
logger.debug("Final value found (format: #{format.inspect}): #{value.inspect}")
|
|
344
338
|
filter(value, format)
|
|
345
339
|
end
|
|
346
340
|
end
|
|
347
|
-
|
|
341
|
+
|
|
348
342
|
#---------------------------------------------------------------------------
|
|
349
343
|
# Configuration loading saving
|
|
350
|
-
|
|
344
|
+
|
|
351
345
|
unless respond_to? :load
|
|
352
346
|
logger.debug("Defining object utility method: load")
|
|
353
|
-
|
|
347
|
+
|
|
354
348
|
define_method :load do |options = {}|
|
|
355
|
-
logger.debug("Loading configuration if possible")
|
|
349
|
+
logger.debug("Loading configuration if possible")
|
|
356
350
|
if config.respond_to?(:load)
|
|
357
|
-
clear_objects
|
|
351
|
+
clear_objects
|
|
358
352
|
config.load(options)
|
|
359
353
|
end
|
|
360
354
|
end
|
|
361
355
|
end
|
|
362
|
-
|
|
356
|
+
|
|
363
357
|
#---
|
|
364
|
-
|
|
358
|
+
|
|
365
359
|
unless respond_to? :save
|
|
366
360
|
logger.debug("Defining object utility method: save")
|
|
367
|
-
|
|
361
|
+
|
|
368
362
|
define_method :save do |options = {}|
|
|
369
|
-
logger.debug("Saving configuration if possible")
|
|
363
|
+
logger.debug("Saving configuration if possible")
|
|
370
364
|
config.save(options) if config.respond_to?(:save)
|
|
371
365
|
end
|
|
372
|
-
end
|
|
366
|
+
end
|
|
373
367
|
end
|
|
374
368
|
end
|
|
375
369
|
end
|