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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
module Nucleon
|
|
5
|
+
|
|
6
|
+
describe Core do
|
|
7
|
+
|
|
8
|
+
include_context "nucleon_test"
|
|
9
|
+
include_context "nucleon_config"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#***************************************************************************
|
|
13
|
+
|
|
14
|
+
def core(*args, &code)
|
|
15
|
+
test_object(Core, *args, &code)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#***************************************************************************
|
|
20
|
+
|
|
21
|
+
let(:core_object) { core(config_hash2) }
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
#***************************************************************************
|
|
25
|
+
# Constructor / Destructor
|
|
26
|
+
|
|
27
|
+
# Initialize a new Nucleon core object
|
|
28
|
+
#
|
|
29
|
+
describe "#initialize" do
|
|
30
|
+
|
|
31
|
+
it "creates via the default values if nil given as the primary data source" do
|
|
32
|
+
test_config core(nil, config_hash1, true, true, true), config_hash1
|
|
33
|
+
test_config core(nil, config_hash1, true, true, false), config_hash1
|
|
34
|
+
test_config core(nil, config_hash1, true, false, true), config_hash1
|
|
35
|
+
test_config core(nil, config_hash1, true, false, false), config_hash1
|
|
36
|
+
|
|
37
|
+
test_config core(nil, config_hash1, false, true, true), config_hash1
|
|
38
|
+
test_config core(nil, config_hash1, false, true, false), config_hash1
|
|
39
|
+
test_config core(nil, config_hash1, false, false, true), config_hash1
|
|
40
|
+
test_config core(nil, config_hash1, false, false, false), config_hash1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "creates via a basic merge of hash with forced overwrites" do
|
|
44
|
+
test_config core(config_hash2, config_hash1, true, true, true), config_hash_force_basic_merge
|
|
45
|
+
test_config core(config_hash2, config_hash1, true, false, true), config_hash_force_basic_merge
|
|
46
|
+
end
|
|
47
|
+
it "creates via a deep merge of hash with forced overwrites" do
|
|
48
|
+
test_config core(config_hash2, config_hash1, true, true, false), config_hash_force_deep_merge
|
|
49
|
+
test_config core(config_hash2, config_hash1, true, false, false), config_hash_force_deep_merge
|
|
50
|
+
end
|
|
51
|
+
it "creates via a basic merge of hash with no forced overwrites" do
|
|
52
|
+
test_config core(config_hash2, config_hash1, false, true, true), config_hash_no_force_basic_merge
|
|
53
|
+
test_config core(config_hash2, config_hash1, false, false, true), config_hash_no_force_basic_merge
|
|
54
|
+
end
|
|
55
|
+
it "creates via a deep merge of hash with no forced overwrites" do
|
|
56
|
+
test_config core(config_hash2, config_hash1, false, true, false), config_hash_no_force_deep_merge
|
|
57
|
+
test_config core(config_hash2, config_hash1, false, false, false), config_hash_no_force_deep_merge
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "creates via a basic merge of Config object with forced overwrites" do
|
|
61
|
+
test_config core(core_object, config_hash1, true, true, true), config_hash_force_basic_merge
|
|
62
|
+
test_config core(core_object, config_hash1, true, false, true), config_hash_force_basic_merge
|
|
63
|
+
end
|
|
64
|
+
it "creates via a deep merge of Config object with forced overwrites" do
|
|
65
|
+
test_config core(core_object, config_hash1, true, true, false), config_hash_force_deep_merge
|
|
66
|
+
test_config core(core_object, config_hash1, true, false, false), config_hash_force_deep_merge
|
|
67
|
+
end
|
|
68
|
+
it "creates via a basic merge of Config object with no forced overwrites" do
|
|
69
|
+
test_config core(core_object, config_hash1, false, true, true), config_hash_no_force_basic_merge
|
|
70
|
+
test_config core(core_object, config_hash1, false, false, true), config_hash_no_force_basic_merge
|
|
71
|
+
end
|
|
72
|
+
it "creates via a deep merge of Config object with no forced overwrites" do
|
|
73
|
+
test_config core(core_object, config_hash1, false, true, false), config_hash_no_force_deep_merge
|
|
74
|
+
test_config core(core_object, config_hash1, false, false, false), config_hash_no_force_deep_merge
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
#***************************************************************************
|
|
80
|
+
# Checks
|
|
81
|
+
|
|
82
|
+
# Check if object is initialized?
|
|
83
|
+
#
|
|
84
|
+
describe "#initialized?" do
|
|
85
|
+
|
|
86
|
+
it "is true after initialization if set_initialized flag given" do
|
|
87
|
+
test_eq core(config_hash2, config_hash1, true, true, true).initialized?, true
|
|
88
|
+
test_eq core(config_hash2, config_hash1, true, true, false).initialized?, true
|
|
89
|
+
test_eq core(config_hash2, config_hash1, false, true, true).initialized?, true
|
|
90
|
+
test_eq core(config_hash2, config_hash1, false, true, false).initialized?, true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "is false after initialization if set_initialized flag not given" do
|
|
94
|
+
test_eq core(config_hash2, config_hash1, true, false, true).initialized?, false
|
|
95
|
+
test_eq core(config_hash2, config_hash1, true, false, false).initialized?, false
|
|
96
|
+
test_eq core(config_hash2, config_hash1, false, false, true).initialized?, false
|
|
97
|
+
test_eq core(config_hash2, config_hash1, false, false, false).initialized?, false
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
#***************************************************************************
|
|
103
|
+
# Accessor / Modifiers
|
|
104
|
+
|
|
105
|
+
# Return global logger instance
|
|
106
|
+
#
|
|
107
|
+
describe "#logger" do
|
|
108
|
+
|
|
109
|
+
it "returns the global logger instance" do
|
|
110
|
+
test_type Core.logger, Nucleon::Util::Logger
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Set current object logger instance
|
|
115
|
+
#
|
|
116
|
+
describe "#logger=" do
|
|
117
|
+
|
|
118
|
+
it "assigns instance logger from existing logger instance" do
|
|
119
|
+
core(config_hash1, {}, true, true, true) do |core|
|
|
120
|
+
logger = test_object(Util::Logger, "test1")
|
|
121
|
+
core.logger = logger
|
|
122
|
+
|
|
123
|
+
test_eq logger == core.logger, true
|
|
124
|
+
test_eq core.logger.resource == "test1", true
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it "assigns instance logger from new logger instance with specific name" do
|
|
129
|
+
core(config_hash2, {}, true, true, true) do |core|
|
|
130
|
+
core.logger = "test2"
|
|
131
|
+
test_eq core.logger.resource == "test2", true
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Return global console instance
|
|
137
|
+
#
|
|
138
|
+
describe "#ui" do
|
|
139
|
+
|
|
140
|
+
it "returns the global console instance" do
|
|
141
|
+
test_type Core.ui, Nucleon::Util::Console
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Set current object console instance
|
|
146
|
+
#
|
|
147
|
+
describe "#ui=" do
|
|
148
|
+
|
|
149
|
+
it "assigns instance console from existing console instance" do
|
|
150
|
+
core(config_hash1, {}, true, true, true) do |core|
|
|
151
|
+
console = test_object(Util::Console, "test1")
|
|
152
|
+
core.ui = console
|
|
153
|
+
|
|
154
|
+
test_eq console == core.ui, true
|
|
155
|
+
test_eq core.ui.resource == "test1", true
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "assigns instance console from new console instance with specific name" do
|
|
160
|
+
core(config_hash2, {}, true, true, true) do |core|
|
|
161
|
+
core.ui = "test2"
|
|
162
|
+
test_eq core.ui.resource == "test2", true
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
#***************************************************************************
|
|
169
|
+
# General utilities
|
|
170
|
+
|
|
171
|
+
# Contextualize console operations in a code block with a given resource name.
|
|
172
|
+
#
|
|
173
|
+
describe "#ui_group" do
|
|
174
|
+
|
|
175
|
+
it "prints a colored message with a set prefix to the console" do
|
|
176
|
+
test_output("[\e\[36mtest string\e\[0m] -----------------------------------------------------") do |output|
|
|
177
|
+
Core.ui_group("test string", :cyan) do |ui|
|
|
178
|
+
ui.output = output
|
|
179
|
+
ui.info("-----------------------------------------------------")
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
module Nucleon
|
|
4
|
+
|
|
5
|
+
describe Environment do
|
|
6
|
+
|
|
7
|
+
include_context "nucleon_test"
|
|
8
|
+
include_context "nucleon_plugin"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#***************************************************************************
|
|
12
|
+
|
|
13
|
+
def environment(*args, &code)
|
|
14
|
+
test_object(Environment, *args, &code)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#*****************************************************************************
|
|
19
|
+
# Constructor / Destructor
|
|
20
|
+
|
|
21
|
+
describe "#initialize" do
|
|
22
|
+
|
|
23
|
+
it "tests initialize method" do
|
|
24
|
+
test_config environment, plugin_environment_empty
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#*****************************************************************************
|
|
30
|
+
# Plugin type accessor / modifiers
|
|
31
|
+
|
|
32
|
+
describe "#namespaces" do
|
|
33
|
+
|
|
34
|
+
it "tests namespaces with empty array values" do
|
|
35
|
+
test_eq environment.namespaces,[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "tests namespaces with array values" do
|
|
39
|
+
environment do |environment|
|
|
40
|
+
environment.define_plugin_type :nucleon, :test, :first
|
|
41
|
+
environment.define_plugin_type :unit, :test, :first
|
|
42
|
+
environment.define_plugin_type :testing, :test, :first
|
|
43
|
+
test_eq environment.namespaces, [:nucleon, :unit, :testing]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "#plugin_types" do
|
|
50
|
+
|
|
51
|
+
it "returns an empty array when no plugin types are defined" do
|
|
52
|
+
test_eq environment.plugin_types(:nucleon),[]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "returns the existing plugin types for a namespace when given an existing namespace" do
|
|
56
|
+
environment do |environment|
|
|
57
|
+
environment.define_plugin_type :nucleon, :test, :first
|
|
58
|
+
test_eq environment.plugin_types(:nucleon), [:test]
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "returns an empty array when plugin types are defined but specified namespace does not exist" do
|
|
63
|
+
environment do |environment|
|
|
64
|
+
environment.define_plugin_type :nucleon, :test, :first
|
|
65
|
+
test_eq environment.plugin_types(:nonexist), []
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Define a new plugin type in a specified namespace.
|
|
72
|
+
#
|
|
73
|
+
|
|
74
|
+
describe "#define_plugin_type" do
|
|
75
|
+
|
|
76
|
+
it "returns loaded plugins state" do
|
|
77
|
+
test_config environment.define_plugin_type(:nucleon, :test, :first), {
|
|
78
|
+
:plugin_types=>{:nucleon=>{:test=>:first}},
|
|
79
|
+
:load_info=>{},
|
|
80
|
+
:active_info=>{}
|
|
81
|
+
}
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Define one or more new plugin types in a specified namespace.
|
|
87
|
+
#
|
|
88
|
+
|
|
89
|
+
describe "#define_plugin_types" do
|
|
90
|
+
|
|
91
|
+
it "returns loaded plugins state" do
|
|
92
|
+
test_config environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}),{
|
|
93
|
+
:plugin_types=>{:nucleon=>{:test1=>"test2", :test3=>"test4"}},
|
|
94
|
+
:load_info=>{},
|
|
95
|
+
:active_info=>{}
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
it "returns environment object" do
|
|
100
|
+
test_type environment.define_plugin_types(:nucleon, { :test1 => "test2", :test3 => "test4"}), Nucleon::Environment
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Check if a specified plugin type has been defined
|
|
106
|
+
#
|
|
107
|
+
|
|
108
|
+
describe "#plugin_type_defined?" do
|
|
109
|
+
|
|
110
|
+
it "returns true for defined plugins" do
|
|
111
|
+
environment do |environment|
|
|
112
|
+
environment.define_plugin_type(:nucleon, :test, :first)
|
|
113
|
+
test_eq environment.plugin_type_defined?(:nucleon, :test),true
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it "returns false for undefined plugins" do
|
|
118
|
+
environment do |environment|
|
|
119
|
+
environment.define_plugin_type(:nucleon, :test, :first)
|
|
120
|
+
test_eq environment.plugin_type_defined?(:notavail, :test),false
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Return the default provider currently registered for a plugin type
|
|
126
|
+
#
|
|
127
|
+
|
|
128
|
+
describe "#plugin_type_default" do
|
|
129
|
+
|
|
130
|
+
it "returns default provider using define_plugin_type" do
|
|
131
|
+
environment do |environment|
|
|
132
|
+
environment.define_plugin_type(:nucleon, :test, :first)
|
|
133
|
+
test_eq environment.plugin_type_default(:nucleon, :test),:first
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it "returns default provider using define_plugin_types" do
|
|
138
|
+
environment do |environment|
|
|
139
|
+
environment.define_plugin_types(:nucleon1, { :test1 => "test2", :test3 => "test4"})
|
|
140
|
+
test_eq environment.plugin_type_default(:nucleon1, :test3),"test4"
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
@@ -5,517 +5,325 @@ module Nucleon
|
|
|
5
5
|
|
|
6
6
|
describe Util::Console do
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
include_context "nucleon_test"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#***************************************************************************
|
|
12
|
+
|
|
13
|
+
def console(*args, &code)
|
|
14
|
+
test_object(Util::Console, *args, &code)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#***************************************************************************
|
|
19
|
+
# Core IO
|
|
20
|
+
|
|
21
|
+
# Output via a printer method to an output channel unless quiet specified
|
|
22
|
+
#
|
|
11
23
|
describe "#say" do
|
|
12
|
-
|
|
13
|
-
#-------------------------------------------------------------------------
|
|
14
|
-
# Delegation
|
|
15
|
-
|
|
24
|
+
|
|
16
25
|
it "can delegate to another class that contains this method" do
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
Util::Console.new({ :console_delegate => ui }).say(:info, 'message')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
#-------------------------------------------------------------------------
|
|
28
|
-
# Output formats
|
|
26
|
+
test_output('message', :puts) do |output|
|
|
27
|
+
console({ :output => output }) do |console|
|
|
28
|
+
console({ :console_delegate => console }).say(:info, 'message')
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
29
32
|
|
|
30
33
|
it "prints a message with default options" do
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
#---
|
|
46
|
-
|
|
34
|
+
test_output('message', :puts) do |output|
|
|
35
|
+
console({ :output => output }).say(:info, 'message')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
test_output('[component] message', :puts) do |output|
|
|
39
|
+
console({
|
|
40
|
+
:resource => 'component',
|
|
41
|
+
:output => output,
|
|
42
|
+
}).say(:info, 'message')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
47
46
|
it "prints a message with and without newlines included" do
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
test.say(:info, 'message', { :new_line => false })
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
#---
|
|
62
|
-
|
|
63
|
-
it "routes message to output and error channels based on type given" do
|
|
47
|
+
test_output('message', :puts) do |output|
|
|
48
|
+
console({ :output => output }).say(:info, 'message', { :new_line => true })
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
test_output('message', :print) do |output|
|
|
52
|
+
console({ :output => output }).say(:info, 'message', { :new_line => false })
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "routes message of different types" do
|
|
64
57
|
[:info, :warn, :success, :error].each do |type|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Util::Console.new({
|
|
69
|
-
:output => output,
|
|
70
|
-
:printer => :puts,
|
|
71
|
-
:color => false,
|
|
72
|
-
}).say(type, 'message')
|
|
58
|
+
test_output('message', :puts) do |output|
|
|
59
|
+
console({ :output => output, :color => false }).say(type, 'message')
|
|
60
|
+
end
|
|
73
61
|
end
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
error.should_receive(:puts).with('message')
|
|
77
|
-
|
|
78
|
-
Util::Console.new({
|
|
79
|
-
:error => error,
|
|
80
|
-
:printer => :puts,
|
|
81
|
-
:color => false,
|
|
82
|
-
}).dump('message')
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
#---
|
|
86
|
-
|
|
62
|
+
end
|
|
63
|
+
|
|
87
64
|
it "routes message to output and error channels based on channel given" do
|
|
88
65
|
[:info, :warn, :success].each do |type|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Util::Console.new({
|
|
93
|
-
:printer => :puts,
|
|
94
|
-
}).say(:info, 'message1', { :channel => output })
|
|
66
|
+
test_output(type.to_s, :puts) do |output|
|
|
67
|
+
console({ :color => false }).say(type, type.to_s, { :channel => output })
|
|
68
|
+
end
|
|
95
69
|
end
|
|
96
|
-
|
|
97
|
-
error = double('error')
|
|
98
|
-
error.should_receive(:puts).with('message2')
|
|
99
|
-
|
|
100
|
-
Util::Console.new({
|
|
101
|
-
:printer => :puts,
|
|
102
|
-
:color => false,
|
|
103
|
-
}).say(:info, 'message2', { :channel => error })
|
|
104
|
-
end
|
|
70
|
+
end
|
|
105
71
|
end
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
72
|
+
|
|
73
|
+
# Dump an object to an output channel even if quiet specified
|
|
74
|
+
#
|
|
75
|
+
describe "#dump" do
|
|
76
|
+
|
|
77
|
+
it "can delegate to another class that contains this method" do
|
|
78
|
+
test_output('message', :puts) do |output|
|
|
79
|
+
console({ :error => output }) do |console|
|
|
80
|
+
console({ :console_delegate => console }).dump('message')
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "dumps data to stderr output channel" do
|
|
86
|
+
test_output('message', :puts) do |output|
|
|
87
|
+
console({ :error => output }).dump('message')
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Ask terminal user for an input value
|
|
93
|
+
#
|
|
109
94
|
describe "#ask" do
|
|
110
|
-
|
|
111
|
-
#-------------------------------------------------------------------------
|
|
112
|
-
# Delegation
|
|
113
|
-
|
|
95
|
+
|
|
114
96
|
it "can delegate to another class that contains this method"
|
|
115
|
-
|
|
116
|
-
#-------------------------------------------------------------------------
|
|
117
|
-
# Input
|
|
118
|
-
|
|
97
|
+
|
|
119
98
|
it "displays a prompt and returns user feedback"
|
|
120
99
|
end
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
100
|
+
|
|
101
|
+
# Ask terminal user for an input value
|
|
102
|
+
#
|
|
103
|
+
describe "#password" do
|
|
104
|
+
|
|
105
|
+
it "can delegate to another class that contains this method"
|
|
106
|
+
|
|
107
|
+
it "displays a prompt and returns user feedback with user typing hidden"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
#***************************************************************************
|
|
112
|
+
# Specialized output
|
|
113
|
+
|
|
114
|
+
# Output information to an output channel unless quiet specified
|
|
115
|
+
#
|
|
124
116
|
describe "#info" do
|
|
125
|
-
|
|
126
|
-
#-------------------------------------------------------------------------
|
|
127
|
-
# Delegation
|
|
128
|
-
|
|
117
|
+
|
|
129
118
|
it "can delegate to another class that contains this method" do
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Util::Console.new({ :console_delegate => ui }).info('message')
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
#-------------------------------------------------------------------------
|
|
141
|
-
# Printing
|
|
142
|
-
|
|
119
|
+
test_output('message', :puts) do |output|
|
|
120
|
+
console({ :output => output }) do |console|
|
|
121
|
+
console({ :console_delegate => console }).info('message')
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
143
126
|
it "prints an uncolored information message" do
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
:output => output,
|
|
149
|
-
:printer => :puts,
|
|
150
|
-
}).info('message')
|
|
151
|
-
end
|
|
127
|
+
test_output('message', :puts) do |output|
|
|
128
|
+
console({ :output => output }).info('message')
|
|
129
|
+
end
|
|
130
|
+
end
|
|
152
131
|
end
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
132
|
+
|
|
133
|
+
# Output warning to an output channel unless quiet specified
|
|
134
|
+
#
|
|
156
135
|
describe "#warn" do
|
|
157
|
-
|
|
158
|
-
#-------------------------------------------------------------------------
|
|
159
|
-
# Delegation
|
|
160
|
-
|
|
136
|
+
|
|
161
137
|
it "can delegate to another class that contains this method" do
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})
|
|
170
|
-
Util::Console.new({ :console_delegate => ui }).warn('message')
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
#-------------------------------------------------------------------------
|
|
174
|
-
# Printing
|
|
175
|
-
|
|
138
|
+
test_output('message', :puts) do |output|
|
|
139
|
+
console({ :output => output, :color => false }) do |console|
|
|
140
|
+
console({ :console_delegate => console }).warn('message')
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
176
145
|
it "prints an uncolored warning message" do
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
:printer => :puts,
|
|
183
|
-
:color => false,
|
|
184
|
-
}).warn('message')
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
#---
|
|
188
|
-
|
|
146
|
+
test_output('message', :puts) do |output|
|
|
147
|
+
console({ :output => output, :color => false }).warn('message')
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
189
151
|
it "prints a colored warning message" do
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
:output => output,
|
|
195
|
-
:color => true,
|
|
196
|
-
}).warn('message', { :new_line => false })
|
|
197
|
-
end
|
|
152
|
+
test_output("\e\[33mmessage\e\[0m", :print) do |output|
|
|
153
|
+
console({ :output => output, :color => true }).warn('message', { :new_line => false })
|
|
154
|
+
end
|
|
155
|
+
end
|
|
198
156
|
end
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
157
|
+
|
|
158
|
+
# Output error to an output channel unless quiet specified
|
|
159
|
+
#
|
|
202
160
|
describe "#error" do
|
|
203
|
-
|
|
204
|
-
#-------------------------------------------------------------------------
|
|
205
|
-
# Delegation
|
|
206
|
-
|
|
161
|
+
|
|
207
162
|
it "can delegate to another class that contains this method" do
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
})
|
|
216
|
-
Util::Console.new({ :console_delegate => ui }).error('message')
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
#-------------------------------------------------------------------------
|
|
220
|
-
# Printing
|
|
221
|
-
|
|
163
|
+
test_output('message', :puts) do |output|
|
|
164
|
+
console({ :output => output, :color => false }) do |console|
|
|
165
|
+
console({ :console_delegate => console }).error('message')
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
222
170
|
it "prints an uncolored error message" do
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
:printer => :puts,
|
|
229
|
-
:color => false,
|
|
230
|
-
}).error('message')
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
#---
|
|
234
|
-
|
|
171
|
+
test_output('message', :puts) do |output|
|
|
172
|
+
console({ :output => output, :color => false }).error('message')
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
235
176
|
it "prints a colored error message" do
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
:output => output,
|
|
241
|
-
:color => true,
|
|
242
|
-
}).error('message', { :new_line => false })
|
|
243
|
-
end
|
|
177
|
+
test_output("\e\[31mmessage\e\[0m", :print) do |output|
|
|
178
|
+
console({ :output => output, :color => true }).error('message', { :new_line => false })
|
|
179
|
+
end
|
|
180
|
+
end
|
|
244
181
|
end
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
182
|
+
|
|
183
|
+
# Output success message to an output channel unless quiet specified
|
|
184
|
+
#
|
|
248
185
|
describe "#success" do
|
|
249
|
-
|
|
250
|
-
#-------------------------------------------------------------------------
|
|
251
|
-
# Delegation
|
|
252
|
-
|
|
186
|
+
|
|
253
187
|
it "can delegate to another class that contains this method" do
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
})
|
|
262
|
-
Util::Console.new({ :console_delegate => ui }).success('message')
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
#-------------------------------------------------------------------------
|
|
266
|
-
# Printing
|
|
267
|
-
|
|
188
|
+
test_output('message', :puts) do |output|
|
|
189
|
+
console({ :output => output, :color => false }) do |console|
|
|
190
|
+
console({ :console_delegate => console }).success('message')
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
268
195
|
it "prints an uncolored success message" do
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
:printer => :puts,
|
|
275
|
-
:color => false,
|
|
276
|
-
}).success('message')
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
#---
|
|
280
|
-
|
|
196
|
+
test_output('message', :puts) do |output|
|
|
197
|
+
console({ :output => output, :color => false }).success('message')
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
281
201
|
it "prints a colored success message" do
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
Util::Console.new({
|
|
286
|
-
:output => output,
|
|
287
|
-
:color => true,
|
|
288
|
-
}).success('message', { :new_line => false })
|
|
289
|
-
end
|
|
290
|
-
end
|
|
291
|
-
|
|
292
|
-
#---
|
|
293
|
-
|
|
294
|
-
describe "#dump" do
|
|
295
|
-
|
|
296
|
-
#-------------------------------------------------------------------------
|
|
297
|
-
# Delegation
|
|
298
|
-
|
|
299
|
-
it "can delegate to another class that contains this method" do
|
|
300
|
-
error = double('error')
|
|
301
|
-
error.should_receive(:puts).with('message')
|
|
302
|
-
|
|
303
|
-
ui = Util::Console.new({
|
|
304
|
-
:error => error,
|
|
305
|
-
:printer => :puts,
|
|
306
|
-
:color => false,
|
|
307
|
-
})
|
|
308
|
-
Util::Console.new({ :console_delegate => ui }).dump('message')
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
#-------------------------------------------------------------------------
|
|
312
|
-
# Printing
|
|
313
|
-
|
|
314
|
-
it "dumps data to stderr output channel" do
|
|
315
|
-
error = double('error')
|
|
316
|
-
error.should_receive(:puts).with('message')
|
|
317
|
-
|
|
318
|
-
Util::Console.new({
|
|
319
|
-
:error => error,
|
|
320
|
-
:printer => :puts,
|
|
321
|
-
:color => false,
|
|
322
|
-
}).dump('message')
|
|
202
|
+
test_output("\e\[32mmessage\e\[0m", :print) do |output|
|
|
203
|
+
console({ :output => output, :color => true }).success('message', { :new_line => false })
|
|
204
|
+
end
|
|
323
205
|
end
|
|
324
206
|
end
|
|
325
|
-
|
|
326
|
-
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
#***************************************************************************
|
|
327
210
|
# Utilities
|
|
328
|
-
|
|
211
|
+
|
|
212
|
+
# Format a message for display
|
|
213
|
+
#
|
|
329
214
|
describe "#format_message" do
|
|
330
|
-
|
|
331
|
-
#-------------------------------------------------------------------------
|
|
332
|
-
# Delegation
|
|
333
|
-
|
|
215
|
+
|
|
334
216
|
it "can delegate to another class that contains this method" do
|
|
335
|
-
|
|
336
|
-
:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
#-------------------------------------------------------------------------
|
|
343
|
-
# Prefix specifications
|
|
344
|
-
|
|
217
|
+
console({ :console_delegate => console('delegate') }) do |console|
|
|
218
|
+
test_eq console.format_message(:info, 'message', { :prefix => true }), '[delegate] message'
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
345
222
|
it "returns without a prefix because no resource" do
|
|
346
|
-
|
|
347
|
-
message.should == 'message'
|
|
223
|
+
test_eq console.format_message(:info, 'message', { :prefix => true }), 'message'
|
|
348
224
|
end
|
|
349
|
-
|
|
350
|
-
#---
|
|
351
|
-
|
|
225
|
+
|
|
352
226
|
it "returns without a prefix because prefix is false" do
|
|
353
|
-
|
|
354
|
-
message.should == 'message'
|
|
227
|
+
test_eq console('component').format_message(:info, 'message', { :prefix => false }), 'message'
|
|
355
228
|
end
|
|
356
|
-
|
|
357
|
-
#---
|
|
358
|
-
|
|
229
|
+
|
|
359
230
|
it "returns without a prefix because no prefix option given" do
|
|
360
|
-
|
|
361
|
-
message.should == 'message'
|
|
231
|
+
test_eq console('component').format_message(:info, 'message'), 'message'
|
|
362
232
|
end
|
|
363
|
-
|
|
364
|
-
#---
|
|
365
|
-
|
|
233
|
+
|
|
366
234
|
it "returns with a prefix if resource and prefix option given" do
|
|
367
|
-
|
|
368
|
-
message.should == '[component] message'
|
|
235
|
+
test_eq console('component').format_message(:info, 'message', { :prefix => true }), '[component] message'
|
|
369
236
|
end
|
|
370
|
-
|
|
371
|
-
#-------------------------------------------------------------------------
|
|
372
|
-
# Color specifications
|
|
373
|
-
|
|
237
|
+
|
|
374
238
|
it "formats a error message in red if color enabled" do
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}).format_message(:error, 'message')
|
|
379
|
-
message.should match(/^\e\[31mmessage\e\[0m$/)
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
#---
|
|
383
|
-
|
|
239
|
+
test_eq console({ :resource => 'component', :color => true }).format_message(:error, 'message'), "\e\[31mmessage\e\[0m"
|
|
240
|
+
end
|
|
241
|
+
|
|
384
242
|
it "formats a warning message in yellow if color enabled" do
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}).format_message(:warn, 'message')
|
|
389
|
-
message.should match(/^\e\[33mmessage\e\[0m$/)
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
#---
|
|
393
|
-
|
|
243
|
+
test_eq console({ :resource => 'component', :color => true }).format_message(:warn, 'message'), "\e\[33mmessage\e\[0m"
|
|
244
|
+
end
|
|
245
|
+
|
|
394
246
|
it "formats a success message in green if color enabled" do
|
|
395
|
-
|
|
396
|
-
:resource => 'component',
|
|
397
|
-
:color => true,
|
|
398
|
-
}).format_message(:success, 'message')
|
|
399
|
-
message.should match(/^\e\[32mmessage\e\[0m$/)
|
|
247
|
+
test_eq console({ :resource => 'component', :color => true }).format_message(:success, 'message'), "\e\[32mmessage\e\[0m"
|
|
400
248
|
end
|
|
401
249
|
end
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
250
|
+
|
|
251
|
+
# Safely output via a printer method to an output channel unless quiet specified
|
|
252
|
+
#
|
|
405
253
|
describe "#safe_puts" do
|
|
406
|
-
|
|
407
|
-
#-------------------------------------------------------------------------
|
|
408
|
-
# Delegation
|
|
409
|
-
|
|
254
|
+
|
|
410
255
|
it "can delegate to another class that contains this method" do
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
Util::Console.new({ :console_delegate => ui }).safe_puts('message')
|
|
419
|
-
end
|
|
420
|
-
|
|
421
|
-
#-------------------------------------------------------------------------
|
|
422
|
-
# Instance configuration
|
|
423
|
-
|
|
256
|
+
test_output('message', :puts) do |output|
|
|
257
|
+
console({ :output => output }) do |console|
|
|
258
|
+
console({ :console_delegate => console }).safe_puts('message')
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
424
263
|
it "prints an empty string unless message given" do
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
:printer => :puts,
|
|
431
|
-
}).safe_puts()
|
|
432
|
-
end
|
|
433
|
-
|
|
434
|
-
#---
|
|
435
|
-
|
|
264
|
+
test_output('', :puts) do |output|
|
|
265
|
+
console({ :output => output }).safe_puts()
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
436
269
|
it "prints to different output channels if they are given" do
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
:
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
test.output = output2
|
|
450
|
-
test.safe_puts('message')
|
|
451
|
-
end
|
|
452
|
-
|
|
453
|
-
#---
|
|
454
|
-
|
|
270
|
+
console do |console|
|
|
271
|
+
test_output('message1', :puts) do |output|
|
|
272
|
+
console.output = output
|
|
273
|
+
console.safe_puts('message1')
|
|
274
|
+
end
|
|
275
|
+
test_output('message2', :puts) do |output|
|
|
276
|
+
console.output = output
|
|
277
|
+
console.safe_puts('message2')
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
455
282
|
it "prints with puts if puts printer option given" do
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
:printer => :puts,
|
|
462
|
-
}).safe_puts('message')
|
|
463
|
-
end
|
|
464
|
-
|
|
465
|
-
#---
|
|
466
|
-
|
|
283
|
+
test_output('message', :puts) do |output|
|
|
284
|
+
console({ :output => output, :printer => :puts }).safe_puts('message')
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
467
288
|
it "prints with print if print printer option given" do
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
:printer => :print,
|
|
474
|
-
}).safe_puts('message')
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
#-------------------------------------------------------------------------
|
|
478
|
-
# Method configuration
|
|
479
|
-
|
|
289
|
+
test_output('message', :print) do |output|
|
|
290
|
+
console({ :output => output, :printer => :print }).safe_puts('message')
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
480
294
|
it "can override the instance output channel" do
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
:printer => :puts,
|
|
490
|
-
}).safe_puts('message', { :channel => output2 })
|
|
491
|
-
end
|
|
492
|
-
|
|
493
|
-
#---
|
|
494
|
-
|
|
295
|
+
test_output('message1', :puts) do |output|
|
|
296
|
+
console({ :output => output }) do |console|
|
|
297
|
+
console.safe_puts('message1')
|
|
298
|
+
console.safe_puts('message2', { :channel => test_output('message2', :puts) })
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
495
303
|
it "can override the instance printer handler" do
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
:printer => :puts,
|
|
503
|
-
}).safe_puts('message', { :printer => :print })
|
|
304
|
+
test_output('message1', :puts) do |output|
|
|
305
|
+
console({ :output => output, :printer => :puts }) do |console|
|
|
306
|
+
console.safe_puts('message1')
|
|
307
|
+
console.safe_puts('message2', { :channel => test_output('message2', :print), :printer => :print })
|
|
308
|
+
end
|
|
309
|
+
end
|
|
504
310
|
end
|
|
505
311
|
end
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
312
|
+
|
|
313
|
+
# Check if a registered delegate exists and responds to a specified method.
|
|
314
|
+
#
|
|
509
315
|
describe "#check_delegate" do
|
|
510
|
-
|
|
316
|
+
|
|
511
317
|
it "returns false if no delegate exists" do
|
|
512
|
-
|
|
318
|
+
test_eq console.check_delegate('safe_puts'), false
|
|
513
319
|
end
|
|
320
|
+
|
|
514
321
|
it "returns true if a delegate exists and it implements given method" do
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
322
|
+
console({ :console_delegate => console }) do |console|
|
|
323
|
+
test_eq console.check_delegate('safe_puts'), true
|
|
324
|
+
test_eq console.check_delegate('nonexistent'), false
|
|
325
|
+
end
|
|
518
326
|
end
|
|
519
|
-
end
|
|
327
|
+
end
|
|
520
328
|
end
|
|
521
329
|
end
|