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/plugin/project.rb
CHANGED
|
@@ -2,95 +2,95 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Plugin
|
|
4
4
|
class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
@@projects = {}
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
#---
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
def self.collection
|
|
11
11
|
@@projects
|
|
12
12
|
end
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
#---
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def self.register_ids
|
|
17
17
|
[ :name, :directory ]
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
#-----------------------------------------------------------------------------
|
|
21
21
|
# Constructor / Destructor
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def self.open(directory, provider, options = {})
|
|
24
|
-
config = Config.ensure(options)
|
|
24
|
+
config = Config.ensure(options)
|
|
25
25
|
directory = File.expand_path(Util::Disk.filename(directory))
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
if ! @@projects.has_key?(directory) || config.get(:reset, false)
|
|
28
28
|
logger.info("Creating new project at #{directory} with #{provider}")
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
return Nucleon.project(config.import({
|
|
31
31
|
:name => directory,
|
|
32
32
|
:directory => directory
|
|
33
33
|
}), provider)
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
else
|
|
36
36
|
logger.info("Opening existing project at #{directory}")
|
|
37
37
|
end
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
@@projects[directory]
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
#-----------------------------------------------------------------------------
|
|
43
43
|
# Project plugin interface
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
def normalize(reload)
|
|
46
46
|
super
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
directory = Util::Disk.filename(get(:directory, Dir.pwd))
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
set_directory(directory)
|
|
51
51
|
register
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
set_url(get(:url)) if get(:url, false)
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
myself.plugin_name = path if ! plugin_name || plugin_name.to_sym == plugin_provider
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
ui.resource = plugin_name
|
|
58
58
|
logger = plugin_name
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
if keys = delete(:keys, nil)
|
|
61
61
|
set(:private_key, keys[:private_key])
|
|
62
62
|
set(:public_key, keys[:public_key])
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
extension(:normalize)
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
init_project
|
|
68
68
|
extension(:init)
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
pull if get(:pull, false)
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
unless reload
|
|
73
73
|
@cache = Util::Cache.new(directory, Nucleon.sha1(plugin_name), '.project_cache')
|
|
74
74
|
init_cache
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
unless self.class.load_provider(directory)
|
|
77
77
|
self.class.store_provider(directory, plugin_provider)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
#---
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
def init_project
|
|
85
85
|
init_auth
|
|
86
86
|
init_parent
|
|
87
87
|
init_remotes
|
|
88
88
|
load_revision
|
|
89
89
|
end
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
#-----------------------------------------------------------------------------
|
|
92
92
|
# Plugin operations
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
def register
|
|
95
95
|
super
|
|
96
96
|
if directory
|
|
@@ -100,244 +100,244 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
#-----------------------------------------------------------------------------
|
|
105
105
|
# Checks
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
def can_persist?
|
|
108
108
|
return top?(directory) if directory
|
|
109
109
|
false
|
|
110
110
|
end
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
#---
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
def top?(path)
|
|
115
115
|
return true if File.directory?(path)
|
|
116
116
|
false
|
|
117
117
|
end
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
#---
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
def subproject?(path)
|
|
122
122
|
false
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
#---
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
def project_directory?(path, require_top_level = false)
|
|
128
|
-
path = File.expand_path(path)
|
|
128
|
+
path = File.expand_path(path)
|
|
129
129
|
return true if File.directory?(path) && (! require_top_level || top?(path))
|
|
130
130
|
false
|
|
131
131
|
end
|
|
132
132
|
protected :project_directory?
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
#---
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
def manage_ignore=ignore
|
|
137
137
|
set(:manage_ignore, ignore)
|
|
138
138
|
end
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
def manage_ignore?
|
|
141
141
|
get(:manage_ignore, false)
|
|
142
142
|
end
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
#-----------------------------------------------------------------------------
|
|
145
145
|
# Property accessor / modifiers
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
def cache
|
|
148
148
|
@cache
|
|
149
149
|
end
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
#---
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
def reference
|
|
154
154
|
get(:reference, nil)
|
|
155
155
|
end
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
#---
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
def private_key
|
|
160
160
|
get(:private_key, nil)
|
|
161
161
|
end
|
|
162
|
-
|
|
162
|
+
|
|
163
163
|
def private_key_str
|
|
164
164
|
return Util::Disk.read(private_key) if private_key
|
|
165
165
|
nil
|
|
166
166
|
end
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
def public_key
|
|
169
169
|
get(:public_key, nil)
|
|
170
170
|
end
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
def public_key_str
|
|
173
173
|
return Util::Disk.read(public_key) if public_key
|
|
174
174
|
nil
|
|
175
175
|
end
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
#---
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
def url(default = nil)
|
|
180
180
|
get(:url, default)
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
#---
|
|
184
|
-
|
|
184
|
+
|
|
185
185
|
def set_url(url)
|
|
186
186
|
if url && url = extension_set(:set_url, url.strip)
|
|
187
187
|
logger.info("Setting project #{name} url to #{url}")
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
set(:url, url)
|
|
190
190
|
set_remote(:origin, url)
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
193
|
|
|
194
194
|
#---
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
def edit_url(default = nil)
|
|
197
197
|
get(:edit, default)
|
|
198
198
|
end
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
#---
|
|
201
|
-
|
|
201
|
+
|
|
202
202
|
def set_edit_url(url)
|
|
203
203
|
url = url.strip
|
|
204
|
-
if url && url = extension_set(:set_edit_url, url)
|
|
204
|
+
if url && url = extension_set(:set_edit_url, url)
|
|
205
205
|
logger.info("Setting project #{name} edit url to #{url}")
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
set(:edit, url)
|
|
208
208
|
set_remote(:edit, url)
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
#---
|
|
213
|
-
|
|
213
|
+
|
|
214
214
|
def directory(default = nil)
|
|
215
215
|
get(:directory, default)
|
|
216
216
|
end
|
|
217
|
-
|
|
217
|
+
|
|
218
218
|
#---
|
|
219
|
-
|
|
219
|
+
|
|
220
220
|
def path
|
|
221
221
|
if parent.nil?
|
|
222
|
-
return directory
|
|
222
|
+
return directory
|
|
223
223
|
end
|
|
224
224
|
directory.gsub(parent.directory + File::SEPARATOR, '')
|
|
225
225
|
end
|
|
226
|
-
|
|
226
|
+
|
|
227
227
|
#---
|
|
228
|
-
|
|
228
|
+
|
|
229
229
|
def set_directory(directory)
|
|
230
230
|
if Util::Data.empty?(directory)
|
|
231
231
|
current_directory = Dir.pwd
|
|
232
232
|
else
|
|
233
233
|
current_directory = File.expand_path(Util::Disk.filename(directory))
|
|
234
234
|
end
|
|
235
|
-
|
|
235
|
+
|
|
236
236
|
if current_directory = extension_set(:set_directory, current_directory)
|
|
237
237
|
logger.info("Setting project #{name} directory to #{current_directory}")
|
|
238
|
-
|
|
238
|
+
|
|
239
239
|
@@projects.delete(get(:directory)) if get(:directory)
|
|
240
240
|
@@projects[current_directory] = myself
|
|
241
|
-
|
|
241
|
+
|
|
242
242
|
set(:directory, current_directory)
|
|
243
243
|
end
|
|
244
244
|
end
|
|
245
245
|
protected :set_directory
|
|
246
|
-
|
|
246
|
+
|
|
247
247
|
#---
|
|
248
|
-
|
|
248
|
+
|
|
249
249
|
def set_location(directory)
|
|
250
250
|
set_directory(directory)
|
|
251
|
-
|
|
251
|
+
|
|
252
252
|
yield if block_given?
|
|
253
|
-
|
|
253
|
+
|
|
254
254
|
init_project
|
|
255
255
|
end
|
|
256
|
-
|
|
256
|
+
|
|
257
257
|
#---
|
|
258
|
-
|
|
258
|
+
|
|
259
259
|
def parent(default = nil)
|
|
260
260
|
get(:parent, default)
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
#---
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
def subprojects(default = nil)
|
|
266
266
|
get(:subprojects, default)
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
#---
|
|
270
|
-
|
|
270
|
+
|
|
271
271
|
def revision(default = nil)
|
|
272
272
|
get(:revision, default).to_s
|
|
273
273
|
end
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
#---
|
|
276
|
-
|
|
276
|
+
|
|
277
277
|
def config(name, options = {})
|
|
278
278
|
localize do
|
|
279
279
|
config = Config.ensure(options)
|
|
280
280
|
can_persist? && block_given? ? yield(config) : nil
|
|
281
281
|
end
|
|
282
282
|
end
|
|
283
|
-
|
|
283
|
+
|
|
284
284
|
#---
|
|
285
|
-
|
|
285
|
+
|
|
286
286
|
def set_config(name, value, options = {})
|
|
287
287
|
localize do
|
|
288
|
-
config = Config.ensure(options)
|
|
289
|
-
|
|
288
|
+
config = Config.ensure(options)
|
|
289
|
+
|
|
290
290
|
if can_persist? && value = extension_set(:set_config, value, { :name => name, :config => config })
|
|
291
291
|
logger.info("Setting project #{self.name} configuration: #{name} = #{value.inspect}")
|
|
292
|
-
|
|
292
|
+
|
|
293
293
|
yield(config, value) if block_given?
|
|
294
294
|
end
|
|
295
295
|
end
|
|
296
296
|
end
|
|
297
|
-
|
|
297
|
+
|
|
298
298
|
#---
|
|
299
|
-
|
|
299
|
+
|
|
300
300
|
def delete_config(name, options = {})
|
|
301
301
|
localize do
|
|
302
302
|
config = Config.ensure(options)
|
|
303
|
-
|
|
303
|
+
|
|
304
304
|
if can_persist? && extension_check(:delete_config, { :name => name, :config => config })
|
|
305
305
|
logger.info("Removing project #{self.name} configuration: #{name}")
|
|
306
|
-
|
|
306
|
+
|
|
307
307
|
yield(config) if block_given?
|
|
308
308
|
end
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
|
-
|
|
311
|
+
|
|
312
312
|
#---
|
|
313
|
-
|
|
314
|
-
def subproject_config(options = {})
|
|
313
|
+
|
|
314
|
+
def subproject_config(options = {})
|
|
315
315
|
result = {}
|
|
316
|
-
|
|
316
|
+
|
|
317
317
|
localize do
|
|
318
318
|
if can_persist?
|
|
319
319
|
config = Config.ensure(options)
|
|
320
320
|
result = yield(config) if block_given?
|
|
321
|
-
|
|
321
|
+
|
|
322
322
|
extension(:subproject_config, { :config => result })
|
|
323
|
-
|
|
323
|
+
|
|
324
324
|
logger.debug("Subproject configuration: #{result.inspect}")
|
|
325
325
|
end
|
|
326
326
|
end
|
|
327
327
|
result
|
|
328
328
|
end
|
|
329
329
|
protected :subproject_config
|
|
330
|
-
|
|
330
|
+
|
|
331
331
|
#-----------------------------------------------------------------------------
|
|
332
332
|
# Project operations
|
|
333
|
-
|
|
333
|
+
|
|
334
334
|
def init_cache
|
|
335
335
|
ignore(self.class.state_file)
|
|
336
336
|
end
|
|
337
337
|
protected :init_cache
|
|
338
|
-
|
|
338
|
+
|
|
339
339
|
#---
|
|
340
|
-
|
|
340
|
+
|
|
341
341
|
def init_auth
|
|
342
342
|
if can_persist?
|
|
343
343
|
localize do
|
|
@@ -349,65 +349,65 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
349
349
|
end
|
|
350
350
|
end
|
|
351
351
|
protected :init_auth
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
#---
|
|
354
|
-
|
|
354
|
+
|
|
355
355
|
def init_parent
|
|
356
356
|
delete(:parent)
|
|
357
|
-
|
|
357
|
+
|
|
358
358
|
logger.info("Initializing project #{name} parents")
|
|
359
|
-
|
|
359
|
+
|
|
360
360
|
if top?(directory)
|
|
361
361
|
logger.debug("Project #{name} has no parents to initialize")
|
|
362
362
|
else
|
|
363
363
|
search_dir = directory
|
|
364
364
|
last_dir = nil
|
|
365
|
-
|
|
365
|
+
|
|
366
366
|
while File.directory?((search_dir = File.expand_path('..', search_dir)))
|
|
367
367
|
logger.debug("Scanning directory #{search_dir} for parent project")
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
unless last_dir.nil? || last_dir != search_dir
|
|
370
370
|
break
|
|
371
371
|
end
|
|
372
372
|
if project_directory?(search_dir)
|
|
373
373
|
logger.debug("Directory #{search_dir} is a valid parent for this #{plugin_provider} project")
|
|
374
|
-
|
|
374
|
+
|
|
375
375
|
project = myself.class.open(search_dir, plugin_provider)
|
|
376
|
-
|
|
376
|
+
|
|
377
377
|
extension(:init_parent, { :parent => project })
|
|
378
|
-
|
|
378
|
+
|
|
379
379
|
set(:parent, project)
|
|
380
380
|
logger.debug("Setting parent to #{parent.inspect}")
|
|
381
381
|
break;
|
|
382
382
|
end
|
|
383
|
-
last_dir = search_dir
|
|
384
|
-
end
|
|
383
|
+
last_dir = search_dir
|
|
384
|
+
end
|
|
385
385
|
end
|
|
386
386
|
end
|
|
387
387
|
protected :init_parent
|
|
388
388
|
|
|
389
389
|
#---
|
|
390
|
-
|
|
390
|
+
|
|
391
391
|
def load_revision
|
|
392
392
|
if can_persist?
|
|
393
393
|
localize do
|
|
394
394
|
logger.info("Loading project #{plugin_name} revision")
|
|
395
|
-
|
|
395
|
+
|
|
396
396
|
specified_revision = get(:revision, nil)
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
current_revision = revision.to_s
|
|
399
399
|
current_revision = yield if block_given?
|
|
400
|
-
|
|
400
|
+
|
|
401
401
|
if current_revision && extended_revision = extension_set(:load_revision, specified_revision).to_s.strip
|
|
402
402
|
if extended_revision.empty?
|
|
403
|
-
extended_revision = current_revision
|
|
403
|
+
extended_revision = current_revision
|
|
404
404
|
end
|
|
405
|
-
|
|
405
|
+
|
|
406
406
|
set(:revision, extended_revision)
|
|
407
|
-
checkout(extended_revision) if current_revision != extended_revision
|
|
408
|
-
|
|
407
|
+
checkout(extended_revision) if current_revision != extended_revision
|
|
408
|
+
|
|
409
409
|
logger.debug("Loaded revision: #{revision}")
|
|
410
|
-
|
|
410
|
+
|
|
411
411
|
load_subprojects
|
|
412
412
|
end
|
|
413
413
|
end
|
|
@@ -416,23 +416,23 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
416
416
|
end
|
|
417
417
|
end
|
|
418
418
|
protected :load_revision
|
|
419
|
-
|
|
419
|
+
|
|
420
420
|
#---
|
|
421
|
-
|
|
421
|
+
|
|
422
422
|
def checkout(revision)
|
|
423
423
|
success = false
|
|
424
|
-
|
|
424
|
+
|
|
425
425
|
if can_persist?
|
|
426
|
-
localize do
|
|
426
|
+
localize do
|
|
427
427
|
if extension_check(:checkout, { :revision => revision })
|
|
428
428
|
logger.info("Checking out project #{name} revision: #{revision}")
|
|
429
|
-
|
|
429
|
+
|
|
430
430
|
success = true
|
|
431
431
|
success = yield(success) if block_given?
|
|
432
|
-
|
|
432
|
+
|
|
433
433
|
if success
|
|
434
434
|
set(:revision, revision)
|
|
435
|
-
|
|
435
|
+
|
|
436
436
|
extension(:checkout_success, { :revision => revision })
|
|
437
437
|
load_subprojects
|
|
438
438
|
end
|
|
@@ -443,38 +443,38 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
443
443
|
end
|
|
444
444
|
success
|
|
445
445
|
end
|
|
446
|
-
|
|
446
|
+
|
|
447
447
|
#---
|
|
448
|
-
|
|
448
|
+
|
|
449
449
|
def commit(files = '.', options = {})
|
|
450
450
|
success = false
|
|
451
|
-
|
|
451
|
+
|
|
452
452
|
if can_persist?
|
|
453
453
|
localize do
|
|
454
454
|
config = Config.ensure(options)
|
|
455
|
-
|
|
455
|
+
|
|
456
456
|
if extension_check(:commit, { :files => files, :config => config })
|
|
457
457
|
logger.info("Committing changes to project #{name}: #{files.inspect}")
|
|
458
|
-
|
|
458
|
+
|
|
459
459
|
time = Time.new.strftime("%Y-%m-%d %H:%M:%S")
|
|
460
460
|
user = config.delete(:user, ENV['USER'] + '@' + fact(:fqdn))
|
|
461
|
-
|
|
461
|
+
|
|
462
462
|
message = config.get(:message, '')
|
|
463
463
|
message = 'Saving state: ' + ( files.is_a?(Array) ? "\n\n" + files.join("\n") : files.to_s ) if message.empty?
|
|
464
|
-
|
|
464
|
+
|
|
465
465
|
user = 'UNKNOWN' unless user && ! user.empty?
|
|
466
|
-
|
|
467
|
-
logger.debug("Commit by #{user} at #{time} with #{message}")
|
|
466
|
+
|
|
467
|
+
logger.debug("Commit by #{user} at #{time} with #{message}")
|
|
468
468
|
success = yield(config, time, user, message) if block_given?
|
|
469
|
-
|
|
469
|
+
|
|
470
470
|
if success
|
|
471
471
|
load_revision
|
|
472
|
-
|
|
472
|
+
|
|
473
473
|
extension(:commit_success, { :files => files })
|
|
474
|
-
|
|
474
|
+
|
|
475
475
|
if ! parent.nil? && config.get(:propogate, true)
|
|
476
476
|
logger.info("Commit to parent as parent exists and propogate option given")
|
|
477
|
-
|
|
477
|
+
|
|
478
478
|
parent.load_revision
|
|
479
479
|
parent.commit(directory, config.import({
|
|
480
480
|
:message => "Updating #{path}: #{message}"
|
|
@@ -484,83 +484,83 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
484
484
|
end
|
|
485
485
|
end
|
|
486
486
|
else
|
|
487
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not be committed to")
|
|
487
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not be committed to")
|
|
488
488
|
end
|
|
489
|
-
success
|
|
489
|
+
success
|
|
490
490
|
end
|
|
491
491
|
|
|
492
492
|
#---
|
|
493
493
|
|
|
494
494
|
def ignore(files)
|
|
495
495
|
return unless directory && manage_ignore?
|
|
496
|
-
|
|
496
|
+
|
|
497
497
|
files = nil
|
|
498
498
|
files = yield if block_given?
|
|
499
499
|
commit(files, { :message => "Adding project ignores." }) if files
|
|
500
500
|
end
|
|
501
|
-
|
|
501
|
+
|
|
502
502
|
#-----------------------------------------------------------------------------
|
|
503
503
|
# Subproject operations
|
|
504
|
-
|
|
504
|
+
|
|
505
505
|
def load_subprojects(options = {})
|
|
506
506
|
subprojects = {}
|
|
507
|
-
|
|
507
|
+
|
|
508
508
|
if can_persist?
|
|
509
509
|
config = Config.ensure(options)
|
|
510
|
-
|
|
510
|
+
|
|
511
511
|
logger.info("Loading sub projects for project #{name}")
|
|
512
|
-
|
|
512
|
+
|
|
513
513
|
subproject_config(config).each do |path, data|
|
|
514
514
|
project_path = File.join(directory, path)
|
|
515
|
-
|
|
515
|
+
|
|
516
516
|
if File.directory?(project_path)
|
|
517
517
|
logger.debug("Checking if project path #{project_path} is a valid sub project")
|
|
518
|
-
|
|
518
|
+
|
|
519
519
|
add_project = true
|
|
520
520
|
add_project = yield(project_path, data) if block_given?
|
|
521
|
-
|
|
521
|
+
|
|
522
522
|
if add_project
|
|
523
523
|
logger.debug("Directory #{project_path} is a valid sub project for this #{plugin_provider} project")
|
|
524
|
-
|
|
524
|
+
|
|
525
525
|
project = myself.class.open(project_path, plugin_provider)
|
|
526
|
-
|
|
526
|
+
|
|
527
527
|
extension(:load_project, { :project => project })
|
|
528
528
|
subprojects[path] = project
|
|
529
529
|
else
|
|
530
|
-
logger.warn("Directory #{project_path} is not a valid sub project for this #{plugin_provider} project")
|
|
530
|
+
logger.warn("Directory #{project_path} is not a valid sub project for this #{plugin_provider} project")
|
|
531
531
|
end
|
|
532
532
|
else
|
|
533
|
-
logger.warn("Sub project configuration points to a location that is not a directory: #{project_path}")
|
|
533
|
+
logger.warn("Sub project configuration points to a location that is not a directory: #{project_path}")
|
|
534
534
|
end
|
|
535
535
|
end
|
|
536
536
|
else
|
|
537
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
537
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
538
538
|
end
|
|
539
539
|
set(:subprojects, subprojects)
|
|
540
540
|
end
|
|
541
541
|
protected :load_subprojects
|
|
542
|
-
|
|
542
|
+
|
|
543
543
|
#---
|
|
544
|
-
|
|
545
|
-
def add_subproject(path, url, revision, options = {})
|
|
544
|
+
|
|
545
|
+
def add_subproject(path, url, revision, options = {})
|
|
546
546
|
success = true
|
|
547
|
-
|
|
547
|
+
|
|
548
548
|
if can_persist?
|
|
549
549
|
localize do
|
|
550
550
|
config = Config.ensure(options).import({ :path => path, :url => url, :revision => revision })
|
|
551
|
-
|
|
551
|
+
|
|
552
552
|
if extension_check(:add_project, { :config => config })
|
|
553
553
|
logger.info("Adding a sub project to #{config[:path]} from #{config[:url]} at #{config[:revision]}")
|
|
554
|
-
|
|
554
|
+
|
|
555
555
|
success = yield(config) if block_given?
|
|
556
|
-
|
|
556
|
+
|
|
557
557
|
if success
|
|
558
558
|
extension(:add_project_success, { :config => config })
|
|
559
|
-
|
|
559
|
+
|
|
560
560
|
config.init(:files, '.')
|
|
561
561
|
config.init(:message, "Adding project #{config[:url]} to #{config[:path]}")
|
|
562
|
-
|
|
563
|
-
commit(config[:files], { :message => config[:message] })
|
|
562
|
+
|
|
563
|
+
commit(config[:files], { :message => config[:message] })
|
|
564
564
|
update_subprojects
|
|
565
565
|
end
|
|
566
566
|
else
|
|
@@ -568,55 +568,55 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
568
568
|
end
|
|
569
569
|
end
|
|
570
570
|
else
|
|
571
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
571
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
572
572
|
end
|
|
573
573
|
success
|
|
574
574
|
end
|
|
575
|
-
|
|
575
|
+
|
|
576
576
|
#---
|
|
577
|
-
|
|
578
|
-
def delete_subproject(path)
|
|
577
|
+
|
|
578
|
+
def delete_subproject(path)
|
|
579
579
|
success = true
|
|
580
|
-
|
|
580
|
+
|
|
581
581
|
if can_persist?
|
|
582
582
|
localize do
|
|
583
583
|
config = Config.new({ :path => path })
|
|
584
|
-
|
|
584
|
+
|
|
585
585
|
if extension_check(:delete_project, { :config => config })
|
|
586
586
|
logger.info("Deleting a sub project at #{config[:path]}")
|
|
587
|
-
|
|
587
|
+
|
|
588
588
|
success = yield(config) if block_given?
|
|
589
|
-
|
|
589
|
+
|
|
590
590
|
if success
|
|
591
591
|
extension(:delete_project_success, { :config => config })
|
|
592
|
-
|
|
592
|
+
|
|
593
593
|
config.init(:files, '.')
|
|
594
594
|
config.init(:message, "Removing project at #{config[:path]}")
|
|
595
|
-
|
|
596
|
-
commit(config[:files], { :message => config[:message] })
|
|
595
|
+
|
|
596
|
+
commit(config[:files], { :message => config[:message] })
|
|
597
597
|
update_subprojects
|
|
598
598
|
end
|
|
599
599
|
end
|
|
600
600
|
end
|
|
601
601
|
else
|
|
602
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
602
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
603
603
|
end
|
|
604
604
|
success
|
|
605
605
|
end
|
|
606
|
-
|
|
606
|
+
|
|
607
607
|
#---
|
|
608
|
-
|
|
608
|
+
|
|
609
609
|
def update_subprojects(options = {})
|
|
610
610
|
if can_persist?
|
|
611
611
|
localize do
|
|
612
612
|
config = Config.ensure(options)
|
|
613
|
-
|
|
613
|
+
|
|
614
614
|
if extension_check(:update_projects)
|
|
615
615
|
logger.info("Updating sub projects in project #{name}")
|
|
616
|
-
|
|
616
|
+
|
|
617
617
|
success = false
|
|
618
618
|
success = yield(config) if block_given?
|
|
619
|
-
|
|
619
|
+
|
|
620
620
|
if success
|
|
621
621
|
extension(:update_projects_success)
|
|
622
622
|
load_subprojects
|
|
@@ -624,41 +624,41 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
624
624
|
end
|
|
625
625
|
end
|
|
626
626
|
else
|
|
627
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
627
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
628
628
|
end
|
|
629
629
|
end
|
|
630
630
|
protected :update_subprojects
|
|
631
|
-
|
|
631
|
+
|
|
632
632
|
#---
|
|
633
|
-
|
|
633
|
+
|
|
634
634
|
def each
|
|
635
635
|
if can_persist?
|
|
636
636
|
localize do
|
|
637
637
|
logger.info("Iterating through all sub projects of project #{name}")
|
|
638
|
-
|
|
638
|
+
|
|
639
639
|
subprojects.each do |path, project|
|
|
640
640
|
extension(:process_project, { :project => project })
|
|
641
|
-
|
|
641
|
+
|
|
642
642
|
logger.debug("Running process on sub project #{path}")
|
|
643
|
-
yield(path, project)
|
|
643
|
+
yield(path, project)
|
|
644
644
|
end
|
|
645
645
|
end
|
|
646
646
|
else
|
|
647
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
647
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not have sub projects")
|
|
648
648
|
end
|
|
649
|
-
end
|
|
650
|
-
|
|
649
|
+
end
|
|
650
|
+
|
|
651
651
|
#-----------------------------------------------------------------------------
|
|
652
652
|
# Remote operations
|
|
653
|
-
|
|
653
|
+
|
|
654
654
|
def init_remotes
|
|
655
655
|
if can_persist?
|
|
656
656
|
localize do
|
|
657
657
|
logger.info("Initializing project #{name} remotes")
|
|
658
|
-
|
|
658
|
+
|
|
659
659
|
origin_url = url
|
|
660
660
|
origin_url = yield if block_given?
|
|
661
|
-
|
|
661
|
+
|
|
662
662
|
if origin_url && origin_url = extension_set(:init_remotes, origin_url).to_s.strip
|
|
663
663
|
set(:url, origin_url)
|
|
664
664
|
set_edit_url(translate_edit_url(url))
|
|
@@ -669,9 +669,9 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
669
669
|
end
|
|
670
670
|
end
|
|
671
671
|
protected :init_remotes
|
|
672
|
-
|
|
672
|
+
|
|
673
673
|
#---
|
|
674
|
-
|
|
674
|
+
|
|
675
675
|
def remote(name)
|
|
676
676
|
url = nil
|
|
677
677
|
if can_persist?
|
|
@@ -682,65 +682,65 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
682
682
|
end
|
|
683
683
|
url
|
|
684
684
|
end
|
|
685
|
-
|
|
685
|
+
|
|
686
686
|
#---
|
|
687
|
-
|
|
687
|
+
|
|
688
688
|
def set_remote(name, url, options = {})
|
|
689
689
|
config = Config.ensure(options)
|
|
690
|
-
|
|
690
|
+
|
|
691
691
|
if can_persist?
|
|
692
692
|
localize do
|
|
693
|
-
unless url.strip.empty?
|
|
693
|
+
unless url.strip.empty?
|
|
694
694
|
if url = extension_set(:set_remote, url, { :name => name })
|
|
695
695
|
delete_remote(name)
|
|
696
|
-
|
|
696
|
+
|
|
697
697
|
url = translate_edit_url(url) if name == :edit && config.get(:translate, true)
|
|
698
|
-
|
|
698
|
+
|
|
699
699
|
logger.info("Setting project remote #{name} to #{url}")
|
|
700
700
|
yield(url) if block_given?
|
|
701
701
|
end
|
|
702
702
|
end
|
|
703
703
|
end
|
|
704
704
|
else
|
|
705
|
-
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
705
|
+
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
706
706
|
end
|
|
707
707
|
end
|
|
708
|
-
|
|
708
|
+
|
|
709
709
|
#---
|
|
710
|
-
|
|
710
|
+
|
|
711
711
|
def add_remote_url(name, url, options = {})
|
|
712
712
|
if can_persist?
|
|
713
713
|
localize do
|
|
714
714
|
config = Config.ensure(options)
|
|
715
|
-
|
|
715
|
+
|
|
716
716
|
if url = extension_set(:add_remote_url, url, { :name => name, :config => config })
|
|
717
717
|
url = translate_edit_url(url) if name == :edit && config.get(:translate, true)
|
|
718
|
-
|
|
719
|
-
logger.info("Adding project remote url #{url} to #{name}")
|
|
718
|
+
|
|
719
|
+
logger.info("Adding project remote url #{url} to #{name}")
|
|
720
720
|
yield(config, url) if block_given?
|
|
721
721
|
end
|
|
722
722
|
end
|
|
723
723
|
else
|
|
724
|
-
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
724
|
+
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
725
725
|
end
|
|
726
726
|
end
|
|
727
|
-
|
|
727
|
+
|
|
728
728
|
#---
|
|
729
|
-
|
|
729
|
+
|
|
730
730
|
def set_host_remote(name, hosts, path, options = {})
|
|
731
731
|
if can_persist?
|
|
732
732
|
localize do
|
|
733
733
|
config = Config.ensure(options).import({ :path => path, :translate => false })
|
|
734
734
|
hosts = array(hosts)
|
|
735
|
-
|
|
735
|
+
|
|
736
736
|
unless hosts.empty?
|
|
737
737
|
if hosts = extension_set(:set_host_remote, hosts, { :name => name, :config => config })
|
|
738
738
|
unless ! hosts || hosts.empty?
|
|
739
739
|
path = config.delete(:path)
|
|
740
|
-
|
|
741
|
-
logger.info("Setting host remote #{name} for #{hosts.inspect} at #{path}")
|
|
740
|
+
|
|
741
|
+
logger.info("Setting host remote #{name} for #{hosts.inspect} at #{path}")
|
|
742
742
|
set_remote(name, translate_url(hosts.shift, path, config.export), config)
|
|
743
|
-
|
|
743
|
+
|
|
744
744
|
hosts.each do |host|
|
|
745
745
|
logger.debug("Adding remote url to #{host}")
|
|
746
746
|
add_remote_url(name, translate_url(host, path, config.export), config)
|
|
@@ -750,50 +750,53 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
750
750
|
end
|
|
751
751
|
end
|
|
752
752
|
else
|
|
753
|
-
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
753
|
+
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
754
754
|
end
|
|
755
755
|
end
|
|
756
|
-
|
|
756
|
+
|
|
757
757
|
#---
|
|
758
|
-
|
|
758
|
+
|
|
759
759
|
def delete_remote(name)
|
|
760
760
|
if can_persist?
|
|
761
761
|
localize do
|
|
762
762
|
if extension_check(:delete_remote, { :name => name })
|
|
763
|
-
logger.info("Deleting project remote #{name}")
|
|
763
|
+
logger.info("Deleting project remote #{name}")
|
|
764
764
|
yield if block_given?
|
|
765
765
|
end
|
|
766
766
|
end
|
|
767
767
|
else
|
|
768
|
-
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
768
|
+
logger.warn("Project #{self.name} does not meet the criteria for persistence and can not have remotes")
|
|
769
769
|
end
|
|
770
770
|
end
|
|
771
|
-
|
|
771
|
+
|
|
772
772
|
#-----------------------------------------------------------------------------
|
|
773
773
|
# Remote operations
|
|
774
|
-
|
|
774
|
+
|
|
775
775
|
def pull(remote = :origin, options = {})
|
|
776
|
-
config
|
|
776
|
+
config = Config.ensure(options)
|
|
777
|
+
|
|
778
|
+
config[:remote] = remote(:edit) && remote == :origin ? :edit : remote
|
|
779
|
+
|
|
777
780
|
success = false
|
|
778
|
-
|
|
781
|
+
|
|
779
782
|
if can_persist?
|
|
780
|
-
localize do
|
|
783
|
+
localize do
|
|
781
784
|
if extension_check(:pull, { :directory => directory, :config => config })
|
|
782
785
|
remote = config.delete(:remote)
|
|
783
|
-
|
|
786
|
+
|
|
784
787
|
if remote(remote)
|
|
785
|
-
logger.info("Pulling from #{remote} into #{directory}")
|
|
788
|
+
logger.info("Pulling from #{remote} into #{directory}")
|
|
786
789
|
success = yield(config, remote) if block_given?
|
|
787
790
|
end
|
|
788
|
-
|
|
791
|
+
|
|
789
792
|
if success
|
|
790
793
|
update_subprojects
|
|
791
|
-
|
|
792
|
-
extension(:pull_success, { :directory => directory, :remote => remote, :config => config })
|
|
793
|
-
|
|
794
|
+
|
|
795
|
+
extension(:pull_success, { :directory => directory, :remote => remote, :config => config })
|
|
796
|
+
|
|
794
797
|
if ! parent.nil? && config.get(:propogate, true)
|
|
795
798
|
logger.debug("Commit to parent as parent exists and propogate option was given")
|
|
796
|
-
|
|
799
|
+
|
|
797
800
|
parent.commit(directory, config.import({
|
|
798
801
|
:message => "Pulling updates for subproject #{path}",
|
|
799
802
|
:allow_empty => true
|
|
@@ -803,68 +806,70 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
803
806
|
end
|
|
804
807
|
end
|
|
805
808
|
else
|
|
806
|
-
logger.warn("Project #{name} does not meet the criteria for persistence and can not pull from remotes")
|
|
809
|
+
logger.warn("Project #{name} does not meet the criteria for persistence and can not pull from remotes")
|
|
807
810
|
end
|
|
808
811
|
success
|
|
809
812
|
end
|
|
810
|
-
|
|
813
|
+
|
|
811
814
|
#---
|
|
812
|
-
|
|
815
|
+
|
|
813
816
|
def push(remote = :edit, options = {})
|
|
814
817
|
config = Config.ensure(options).import({ :remote => remote })
|
|
815
818
|
no_pull = config.delete(:no_pull, false)
|
|
816
819
|
success = false
|
|
817
|
-
|
|
820
|
+
|
|
818
821
|
push_project = lambda do |push_remote|
|
|
819
|
-
logger.info("Pushing to #{push_remote} from #{directory}")
|
|
820
|
-
success = yield(config, push_remote) if block_given? && ( no_pull || pull(push_remote, config) )
|
|
822
|
+
logger.info("Pushing to #{push_remote} from #{directory}")
|
|
823
|
+
success = yield(config, push_remote) if block_given? && ( no_pull || pull(push_remote, config) )
|
|
821
824
|
end
|
|
822
|
-
|
|
825
|
+
|
|
823
826
|
if can_persist?
|
|
824
|
-
|
|
827
|
+
unless remote(remote)
|
|
828
|
+
logger.warn("Project #{plugin_name} does not have the remote '#{remote}' defined")
|
|
829
|
+
return true
|
|
830
|
+
end
|
|
831
|
+
localize do
|
|
825
832
|
if extension_check(:push, { :directory => directory, :config => config })
|
|
826
833
|
remote = config.delete(:remote)
|
|
827
834
|
tries = config.delete(:tries, 5)
|
|
828
|
-
|
|
835
|
+
|
|
829
836
|
# TODO: Figure out a better way through specialized exception handling
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
retry if tries > 0
|
|
838
|
-
end
|
|
837
|
+
begin
|
|
838
|
+
success = push_project.call(remote)
|
|
839
|
+
raise unless success
|
|
840
|
+
|
|
841
|
+
rescue
|
|
842
|
+
tries -= 1
|
|
843
|
+
retry if tries > 0
|
|
839
844
|
end
|
|
840
|
-
|
|
845
|
+
|
|
841
846
|
if success
|
|
842
847
|
config.delete(:revision)
|
|
843
|
-
|
|
844
|
-
extension(:push_success, { :directory => directory, :remote => remote, :config => config })
|
|
845
|
-
|
|
848
|
+
|
|
849
|
+
extension(:push_success, { :directory => directory, :remote => remote, :config => config })
|
|
850
|
+
|
|
846
851
|
if config.get(:propogate, true)
|
|
847
852
|
unless parent.nil?
|
|
848
853
|
propogate_up = config.get(:propogate_up, nil)
|
|
849
|
-
|
|
854
|
+
|
|
850
855
|
if propogate_up.nil? || propogate_up
|
|
851
856
|
logger.debug("Commit to parent as parent exists and propogate option was given")
|
|
852
|
-
parent.push(remote, Config.new(config.export.dup).import({
|
|
853
|
-
:propogate_up => true,
|
|
854
|
-
:propogate_down => false
|
|
857
|
+
parent.push(remote, Config.new(config.export.dup).import({
|
|
858
|
+
:propogate_up => true,
|
|
859
|
+
:propogate_down => false
|
|
855
860
|
}))
|
|
856
861
|
end
|
|
857
862
|
end
|
|
858
|
-
|
|
863
|
+
|
|
859
864
|
logger.debug("Pushing sub projects")
|
|
860
|
-
|
|
865
|
+
|
|
861
866
|
propogate_down = config.get(:propogate_down, nil)
|
|
862
|
-
|
|
867
|
+
|
|
863
868
|
if propogate_down.nil? || propogate_down
|
|
864
869
|
each do |path, project|
|
|
865
|
-
project.push(remote, Config.new(config.export.dup).import({
|
|
866
|
-
:propogate_up => false,
|
|
867
|
-
:propogate_down => true
|
|
870
|
+
project.push(remote, Config.new(config.export.dup).import({
|
|
871
|
+
:propogate_up => false,
|
|
872
|
+
:propogate_down => true
|
|
868
873
|
}))
|
|
869
874
|
end
|
|
870
875
|
end
|
|
@@ -873,168 +878,168 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
|
873
878
|
end
|
|
874
879
|
end
|
|
875
880
|
else
|
|
876
|
-
logger.warn("Project #{
|
|
881
|
+
logger.warn("Project #{plugin_name} does not meet the criteria for persistence and can not push to remotes")
|
|
877
882
|
end
|
|
878
883
|
success
|
|
879
884
|
end
|
|
880
|
-
|
|
885
|
+
|
|
881
886
|
#-----------------------------------------------------------------------------
|
|
882
887
|
# State configurations
|
|
883
|
-
|
|
888
|
+
|
|
884
889
|
def self.state_file
|
|
885
890
|
'.corl'
|
|
886
891
|
end
|
|
887
|
-
|
|
892
|
+
|
|
888
893
|
#---
|
|
889
|
-
|
|
894
|
+
|
|
890
895
|
@@project_data = {}
|
|
891
|
-
|
|
896
|
+
|
|
892
897
|
def self.store_provider(directory, provider)
|
|
893
898
|
if File.directory?(directory)
|
|
894
899
|
@@project_data[directory] = {
|
|
895
900
|
:provider => provider
|
|
896
901
|
}
|
|
897
|
-
json_data = Util::Data.to_json(@@project_data[directory], true)
|
|
902
|
+
json_data = Util::Data.to_json(@@project_data[directory], true)
|
|
898
903
|
Util::Disk.write(File.join(directory, state_file), json_data)
|
|
899
904
|
end
|
|
900
905
|
end
|
|
901
|
-
|
|
906
|
+
|
|
902
907
|
#---
|
|
903
|
-
|
|
908
|
+
|
|
904
909
|
def self.clear_provider(directory)
|
|
905
910
|
@@project_data.delete(directory)
|
|
906
911
|
end
|
|
907
|
-
|
|
912
|
+
|
|
908
913
|
#---
|
|
909
|
-
|
|
914
|
+
|
|
910
915
|
def self.load_provider(directory, override = nil)
|
|
911
916
|
@@project_data[directory] = {} unless @@project_data.has_key?(directory)
|
|
912
|
-
|
|
917
|
+
|
|
913
918
|
if override.nil? && @@project_data[directory].empty?
|
|
914
919
|
json_data = Util::Disk.read(File.join(directory, state_file))
|
|
915
920
|
@@project_data[directory] = hash(Util::Data.parse_json(json_data)) if json_data
|
|
916
921
|
end
|
|
917
|
-
override.nil? ? symbol_map(@@project_data[directory])[:provider] : override
|
|
922
|
+
override.nil? ? symbol_map(@@project_data[directory])[:provider] : override
|
|
918
923
|
end
|
|
919
|
-
|
|
924
|
+
|
|
920
925
|
#-----------------------------------------------------------------------------
|
|
921
926
|
# Utilities
|
|
922
|
-
|
|
923
|
-
def self.build_info(namespace, plugin_type, data)
|
|
927
|
+
|
|
928
|
+
def self.build_info(namespace, plugin_type, data)
|
|
924
929
|
data = data.split(/\s*,\s*/) if data.is_a?(String)
|
|
925
930
|
super(namespace, plugin_type, data)
|
|
926
931
|
end
|
|
927
|
-
|
|
932
|
+
|
|
928
933
|
#---
|
|
929
|
-
|
|
934
|
+
|
|
930
935
|
def self.translate(data)
|
|
931
936
|
options = super(data)
|
|
932
|
-
|
|
933
|
-
case data
|
|
937
|
+
|
|
938
|
+
case data
|
|
934
939
|
when String
|
|
935
940
|
options = { :url => data }
|
|
936
941
|
when Hash
|
|
937
942
|
options = data
|
|
938
943
|
end
|
|
939
|
-
|
|
944
|
+
|
|
940
945
|
if options.has_key?(:url)
|
|
941
946
|
if matches = translate_reference(options[:url])
|
|
942
947
|
options[:provider] = matches[:provider]
|
|
943
948
|
options[:reference] = matches[:reference]
|
|
944
949
|
options[:url] = matches[:url]
|
|
945
950
|
options[:revision] = matches[:revision] unless options.has_key?(:revision)
|
|
946
|
-
|
|
947
|
-
logger.debug("Translating project options: #{options.inspect}")
|
|
951
|
+
|
|
952
|
+
logger.debug("Translating project options: #{options.inspect}")
|
|
948
953
|
end
|
|
949
954
|
end
|
|
950
955
|
options
|
|
951
956
|
end
|
|
952
|
-
|
|
957
|
+
|
|
953
958
|
#---
|
|
954
|
-
|
|
959
|
+
|
|
955
960
|
def self.translate_reference(reference, editable = false)
|
|
956
961
|
# ex: github:::username/project[branch/revision]
|
|
957
962
|
if reference && reference.match(/^\s*([a-zA-Z0-9_-]+):::([^\]\s]+)\s*(?:\[\s*([^\]\s]+)\s*\])?\s*$/)
|
|
958
963
|
provider = $1
|
|
959
964
|
url = $2
|
|
960
965
|
revision = $3
|
|
961
|
-
|
|
966
|
+
|
|
962
967
|
logger.debug("Translating project reference: #{provider} #{url} #{revision}")
|
|
963
|
-
|
|
968
|
+
|
|
964
969
|
if provider && Nucleon.loaded_plugins(:nucleon, :project).keys.include?(provider.to_sym)
|
|
965
|
-
klass = Nucleon.class_const([ :nucleon, :project, provider ])
|
|
970
|
+
klass = Nucleon.class_const([ :nucleon, :project, provider ])
|
|
966
971
|
expanded_url = klass.send(:expand_url, url, editable) if klass.respond_to?(:expand_url)
|
|
967
972
|
end
|
|
968
973
|
expanded_url = url unless expanded_url
|
|
969
|
-
|
|
974
|
+
|
|
970
975
|
info = {
|
|
971
976
|
:provider => provider,
|
|
972
977
|
:reference => url,
|
|
973
978
|
:url => expanded_url,
|
|
974
979
|
:revision => revision
|
|
975
980
|
}
|
|
976
|
-
|
|
981
|
+
|
|
977
982
|
logger.debug("Project reference info: #{info.inspect}")
|
|
978
983
|
return info
|
|
979
984
|
end
|
|
980
985
|
nil
|
|
981
986
|
end
|
|
982
|
-
|
|
987
|
+
|
|
983
988
|
#---
|
|
984
|
-
|
|
989
|
+
|
|
985
990
|
def translate_reference(reference, editable = false)
|
|
986
991
|
myself.class.translate_reference(reference, editable)
|
|
987
992
|
end
|
|
988
|
-
|
|
993
|
+
|
|
989
994
|
#---
|
|
990
|
-
|
|
995
|
+
|
|
991
996
|
def translate_url(host, path, options = {})
|
|
992
997
|
config = Config.ensure(options)
|
|
993
998
|
url = "#{host}/#{path}"
|
|
994
|
-
|
|
999
|
+
|
|
995
1000
|
if block_given?
|
|
996
1001
|
temp_url = yield(config)
|
|
997
1002
|
url = temp_url if temp_url
|
|
998
1003
|
end
|
|
999
1004
|
url
|
|
1000
1005
|
end
|
|
1001
|
-
|
|
1006
|
+
|
|
1002
1007
|
#---
|
|
1003
|
-
|
|
1008
|
+
|
|
1004
1009
|
def translate_edit_url(url, options = {})
|
|
1005
1010
|
config = Config.ensure(options)
|
|
1006
|
-
|
|
1011
|
+
|
|
1007
1012
|
if block_given?
|
|
1008
1013
|
temp_url = yield(config)
|
|
1009
1014
|
url = temp_url if temp_url
|
|
1010
1015
|
end
|
|
1011
1016
|
url
|
|
1012
1017
|
end
|
|
1013
|
-
|
|
1018
|
+
|
|
1014
1019
|
#---
|
|
1015
|
-
|
|
1020
|
+
|
|
1016
1021
|
def localize(path = nil)
|
|
1017
1022
|
prev_directory = Dir.pwd
|
|
1018
1023
|
path = directory if path.nil?
|
|
1019
|
-
|
|
1024
|
+
|
|
1020
1025
|
Dir.chdir(path)
|
|
1021
|
-
|
|
1026
|
+
|
|
1022
1027
|
result = safe_exec(true) do
|
|
1023
|
-
yield
|
|
1028
|
+
yield
|
|
1024
1029
|
end
|
|
1025
|
-
|
|
1030
|
+
|
|
1026
1031
|
Dir.chdir(prev_directory)
|
|
1027
1032
|
result
|
|
1028
1033
|
end
|
|
1029
|
-
|
|
1034
|
+
|
|
1030
1035
|
#---
|
|
1031
|
-
|
|
1036
|
+
|
|
1032
1037
|
def local_path(file_path)
|
|
1033
|
-
file_path.gsub(directory + File::SEPARATOR, '')
|
|
1038
|
+
file_path.gsub(directory + File::SEPARATOR, '')
|
|
1034
1039
|
end
|
|
1035
|
-
|
|
1040
|
+
|
|
1036
1041
|
#---
|
|
1037
|
-
|
|
1042
|
+
|
|
1038
1043
|
def full_path(local_path)
|
|
1039
1044
|
File.join(directory, local_path)
|
|
1040
1045
|
end
|