nucleon 0.2.1 → 0.2.2

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.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/core/config.rb +1 -1
  4. data/lib/core/core.rb +2 -2
  5. data/lib/core/environment.rb +9 -6
  6. data/lib/core/facade.rb +2 -2
  7. data/lib/core/gems.rb +13 -6
  8. data/lib/core/manager.rb +12 -5
  9. data/lib/core/mixin/action/commit.rb +12 -6
  10. data/lib/core/mixin/action/project.rb +15 -28
  11. data/lib/core/mixin/action/push.rb +14 -5
  12. data/lib/core/mixin/action/registration.rb +277 -28
  13. data/lib/core/mixin/macro/object_interface.rb +3 -3
  14. data/lib/core/mixin/sub_config.rb +1 -1
  15. data/lib/core/plugin/action.rb +20 -51
  16. data/lib/core/plugin/base.rb +41 -8
  17. data/lib/core/plugin/project.rb +55 -8
  18. data/lib/nucleon/action/project/add.rb +6 -20
  19. data/lib/nucleon/action/project/create.rb +2 -2
  20. data/lib/nucleon/action/project/remove.rb +3 -3
  21. data/lib/nucleon/action/project/save.rb +3 -3
  22. data/lib/nucleon/action/project/update.rb +2 -2
  23. data/lib/nucleon/extension/project.rb +16 -0
  24. data/lib/nucleon/project/git.rb +1 -0
  25. data/lib/nucleon/project/github.rb +19 -7
  26. data/nucleon.gemspec +120 -2
  27. data/rdoc/site/0.2.1/ARCHITECTURE_rdoc.html +640 -0
  28. data/rdoc/site/0.2.1/Hash.html +353 -0
  29. data/rdoc/site/0.2.1/Kernel.html +420 -0
  30. data/rdoc/site/0.2.1/Nucleon.html +674 -0
  31. data/rdoc/site/0.2.1/Nucleon/Action.html +286 -0
  32. data/rdoc/site/0.2.1/Nucleon/Action/Extract.html +457 -0
  33. data/rdoc/site/0.2.1/Nucleon/Action/Project.html +285 -0
  34. data/rdoc/site/0.2.1/Nucleon/Action/Project/Add.html +502 -0
  35. data/rdoc/site/0.2.1/Nucleon/Action/Project/Create.html +459 -0
  36. data/rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html +505 -0
  37. data/rdoc/site/0.2.1/Nucleon/Action/Project/Save.html +478 -0
  38. data/rdoc/site/0.2.1/Nucleon/Action/Project/Update.html +425 -0
  39. data/rdoc/site/0.2.1/Nucleon/Codes.html +569 -0
  40. data/rdoc/site/0.2.1/Nucleon/Command.html +281 -0
  41. data/rdoc/site/0.2.1/Nucleon/Command/Bash.html +550 -0
  42. data/rdoc/site/0.2.1/Nucleon/Config.html +1634 -0
  43. data/rdoc/site/0.2.1/Nucleon/Config/Collection.html +515 -0
  44. data/rdoc/site/0.2.1/Nucleon/Config/Options.html +495 -0
  45. data/rdoc/site/0.2.1/Nucleon/Core.html +641 -0
  46. data/rdoc/site/0.2.1/Nucleon/Environment.html +1210 -0
  47. data/rdoc/site/0.2.1/Nucleon/Errors.html +281 -0
  48. data/rdoc/site/0.2.1/Nucleon/Errors/BatchError.html +287 -0
  49. data/rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html +663 -0
  50. data/rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html +287 -0
  51. data/rdoc/site/0.2.1/Nucleon/Event.html +281 -0
  52. data/rdoc/site/0.2.1/Nucleon/Event/Regex.html +473 -0
  53. data/rdoc/site/0.2.1/Nucleon/Facade.html +2452 -0
  54. data/rdoc/site/0.2.1/Nucleon/Gems.html +641 -0
  55. data/rdoc/site/0.2.1/Nucleon/Manager.html +1862 -0
  56. data/rdoc/site/0.2.1/Nucleon/Mixin.html +291 -0
  57. data/rdoc/site/0.2.1/Nucleon/Mixin/Action.html +284 -0
  58. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html +387 -0
  59. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html +401 -0
  60. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html +377 -0
  61. data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html +575 -0
  62. data/rdoc/site/0.2.1/Nucleon/Mixin/Colors.html +551 -0
  63. data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html +487 -0
  64. data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html +455 -0
  65. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro.html +282 -0
  66. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html +701 -0
  67. data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html +688 -0
  68. data/rdoc/site/0.2.1/Nucleon/Mixin/Settings.html +487 -0
  69. data/rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html +893 -0
  70. data/rdoc/site/0.2.1/Nucleon/Parallel.html +332 -0
  71. data/rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html +331 -0
  72. data/rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html +458 -0
  73. data/rdoc/site/0.2.1/Nucleon/Plugin.html +288 -0
  74. data/rdoc/site/0.2.1/Nucleon/Plugin/Action.html +2133 -0
  75. data/rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html +465 -0
  76. data/rdoc/site/0.2.1/Nucleon/Plugin/Base.html +1988 -0
  77. data/rdoc/site/0.2.1/Nucleon/Plugin/Command.html +765 -0
  78. data/rdoc/site/0.2.1/Nucleon/Plugin/Event.html +448 -0
  79. data/rdoc/site/0.2.1/Nucleon/Plugin/Extension.html +287 -0
  80. data/rdoc/site/0.2.1/Nucleon/Plugin/Project.html +2900 -0
  81. data/rdoc/site/0.2.1/Nucleon/Plugin/Template.html +482 -0
  82. data/rdoc/site/0.2.1/Nucleon/Plugin/Translator.html +377 -0
  83. data/rdoc/site/0.2.1/Nucleon/Project.html +282 -0
  84. data/rdoc/site/0.2.1/Nucleon/Project/Git.html +1807 -0
  85. data/rdoc/site/0.2.1/Nucleon/Project/Github.html +555 -0
  86. data/rdoc/site/0.2.1/Nucleon/Template.html +283 -0
  87. data/rdoc/site/0.2.1/Nucleon/Template/JSON.html +335 -0
  88. data/rdoc/site/0.2.1/Nucleon/Template/Wrapper.html +335 -0
  89. data/rdoc/site/0.2.1/Nucleon/Template/YAML.html +335 -0
  90. data/rdoc/site/0.2.1/Nucleon/Translator.html +282 -0
  91. data/rdoc/site/0.2.1/Nucleon/Translator/JSON.html +372 -0
  92. data/rdoc/site/0.2.1/Nucleon/Translator/YAML.html +372 -0
  93. data/rdoc/site/0.2.1/Nucleon/Util.html +291 -0
  94. data/rdoc/site/0.2.1/Nucleon/Util/CLI.html +394 -0
  95. data/rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html +1404 -0
  96. data/rdoc/site/0.2.1/Nucleon/Util/Cache.html +824 -0
  97. data/rdoc/site/0.2.1/Nucleon/Util/Console.html +1330 -0
  98. data/rdoc/site/0.2.1/Nucleon/Util/Data.html +1423 -0
  99. data/rdoc/site/0.2.1/Nucleon/Util/Disk.html +528 -0
  100. data/rdoc/site/0.2.1/Nucleon/Util/Git.html +367 -0
  101. data/rdoc/site/0.2.1/Nucleon/Util/Liquid.html +371 -0
  102. data/rdoc/site/0.2.1/Nucleon/Util/Logger.html +822 -0
  103. data/rdoc/site/0.2.1/Nucleon/Util/Package.html +564 -0
  104. data/rdoc/site/0.2.1/Nucleon/Util/SSH.html +1036 -0
  105. data/rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html +607 -0
  106. data/rdoc/site/0.2.1/Nucleon/Util/Shell.html +697 -0
  107. data/rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html +503 -0
  108. data/rdoc/site/0.2.1/README_rdoc.html +318 -0
  109. data/rdoc/site/0.2.1/TODO_rdoc.html +267 -0
  110. data/rdoc/site/0.2.1/created.rid +62 -0
  111. data/rdoc/site/0.2.1/images/add.png +0 -0
  112. data/rdoc/site/0.2.1/images/brick.png +0 -0
  113. data/rdoc/site/0.2.1/images/brick_link.png +0 -0
  114. data/rdoc/site/0.2.1/images/bug.png +0 -0
  115. data/rdoc/site/0.2.1/images/bullet_black.png +0 -0
  116. data/rdoc/site/0.2.1/images/bullet_toggle_minus.png +0 -0
  117. data/rdoc/site/0.2.1/images/bullet_toggle_plus.png +0 -0
  118. data/rdoc/site/0.2.1/images/date.png +0 -0
  119. data/rdoc/site/0.2.1/images/delete.png +0 -0
  120. data/rdoc/site/0.2.1/images/find.png +0 -0
  121. data/rdoc/site/0.2.1/images/loadingAnimation.gif +0 -0
  122. data/rdoc/site/0.2.1/images/macFFBgHack.png +0 -0
  123. data/rdoc/site/0.2.1/images/package.png +0 -0
  124. data/rdoc/site/0.2.1/images/page_green.png +0 -0
  125. data/rdoc/site/0.2.1/images/page_white_text.png +0 -0
  126. data/rdoc/site/0.2.1/images/page_white_width.png +0 -0
  127. data/rdoc/site/0.2.1/images/plugin.png +0 -0
  128. data/rdoc/site/0.2.1/images/ruby.png +0 -0
  129. data/rdoc/site/0.2.1/images/tag_blue.png +0 -0
  130. data/rdoc/site/0.2.1/images/tag_green.png +0 -0
  131. data/rdoc/site/0.2.1/images/transparent.png +0 -0
  132. data/rdoc/site/0.2.1/images/wrench.png +0 -0
  133. data/rdoc/site/0.2.1/images/wrench_orange.png +0 -0
  134. data/rdoc/site/0.2.1/images/zoom.png +0 -0
  135. data/rdoc/site/0.2.1/index.html +317 -0
  136. data/rdoc/site/0.2.1/js/darkfish.js +155 -0
  137. data/rdoc/site/0.2.1/js/jquery.js +18 -0
  138. data/rdoc/site/0.2.1/js/navigation.js +142 -0
  139. data/rdoc/site/0.2.1/js/search.js +94 -0
  140. data/rdoc/site/0.2.1/js/search_index.js +1 -0
  141. data/rdoc/site/0.2.1/js/searcher.js +228 -0
  142. data/rdoc/site/0.2.1/rdoc.css +543 -0
  143. data/rdoc/site/0.2.1/table_of_contents.html +1718 -0
  144. metadata +120 -2
@@ -20,7 +20,7 @@ class Update < Nucleon.plugin_class(:nucleon, :action)
20
20
  super do
21
21
  codes :project_failure
22
22
 
23
- register :path, :str, Dir.pwd
23
+ register_str :path, Dir.pwd
24
24
  project_config
25
25
  end
26
26
  end
@@ -30,7 +30,7 @@ class Update < Nucleon.plugin_class(:nucleon, :action)
30
30
 
31
31
  def execute
32
32
  super do
33
- info('nucleon.action.project.update.start')
33
+ info('start')
34
34
 
35
35
  project = project_load(settings[:path], false, true)
36
36
  myself.status = code.project_failure unless project
@@ -0,0 +1,16 @@
1
+
2
+ module Nucleon
3
+ module Extension
4
+ class Project < Nucleon.plugin_class(:nucleon, :extension)
5
+
6
+ def manager_plugin_provider(config)
7
+ if config[:namespace] == :nucleon && config[:type] == :project
8
+ if config[:directory] && provider = Nucleon::Plugin::Project.load_provider(config[:directory])
9
+ return provider
10
+ end
11
+ end
12
+ nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -200,6 +200,7 @@ class Git < Nucleon.plugin_class(:nucleon, :project)
200
200
  # Operations
201
201
 
202
202
  def init_cache
203
+ super
203
204
  ignore(cache.directory_name)
204
205
  end
205
206
 
@@ -12,7 +12,7 @@ class Github < Git
12
12
 
13
13
  def normalize(reload)
14
14
  if reference = delete(:reference, nil)
15
- myself.plugin_name = reference
15
+ myself.plugin_name = normalize_reference(reference)
16
16
  else
17
17
  if url = get(:url, nil)
18
18
  myself.plugin_name = url
@@ -80,14 +80,19 @@ class Github < Git
80
80
  # Utilities
81
81
 
82
82
  def self.expand_url(path, editable = false)
83
- if editable
84
- protocol = 'git@'
85
- separator = ':'
83
+ if path =~ /^[a-zA-Z0-9_\-\/]+$/
84
+ if editable
85
+ protocol = 'git@'
86
+ separator = ':'
87
+ else
88
+ protocol = 'https://'
89
+ separator = '/'
90
+ end
91
+ url = "#{protocol}github.com#{separator}" + path + '.git'
86
92
  else
87
- protocol = 'https://'
88
- separator = '/'
93
+ url = path
89
94
  end
90
- return "#{protocol}github.com#{separator}" + path + '.git'
95
+ url
91
96
  end
92
97
 
93
98
  #---
@@ -97,6 +102,13 @@ class Github < Git
97
102
  Util::SSH.close('github.com', 'git')
98
103
  end
99
104
  protected :verify_key
105
+
106
+ #---
107
+
108
+ def normalize_reference(reference)
109
+ reference.sub(/^(git\@|(https?|git)\:\/\/)[^\/\:]+(\/|\:)?/, '').sub(/\.git$/, '')
110
+ end
111
+ protected :normalize_reference
100
112
  end
101
113
  end
102
114
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "nucleon"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adrian Webb"]
12
- s.date = "2014-07-10"
12
+ s.date = "2014-08-10"
13
13
  s.description = "\nA framework that provides a simple foundation for building Ruby applications that are:\n\n* Highly configurable (with both distributed and persistent configurations)\n* Extremely pluggable and extendable\n* Easily parallel\n\nNote: This framework is still very early in development!\n"
14
14
  s.email = "adrian.webb@coralnexus.com"
15
15
  s.executables = ["nucleon"]
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
79
79
  "lib/nucleon/action/project/update.rb",
80
80
  "lib/nucleon/command/bash.rb",
81
81
  "lib/nucleon/event/regex.rb",
82
+ "lib/nucleon/extension/project.rb",
82
83
  "lib/nucleon/project/git.rb",
83
84
  "lib/nucleon/project/github.rb",
84
85
  "lib/nucleon/template/JSON.rb",
@@ -319,6 +320,123 @@ Gem::Specification.new do |s|
319
320
  "rdoc/site/0.2.0/js/searcher.js",
320
321
  "rdoc/site/0.2.0/rdoc.css",
321
322
  "rdoc/site/0.2.0/table_of_contents.html",
323
+ "rdoc/site/0.2.1/ARCHITECTURE_rdoc.html",
324
+ "rdoc/site/0.2.1/Hash.html",
325
+ "rdoc/site/0.2.1/Kernel.html",
326
+ "rdoc/site/0.2.1/Nucleon.html",
327
+ "rdoc/site/0.2.1/Nucleon/Action.html",
328
+ "rdoc/site/0.2.1/Nucleon/Action/Extract.html",
329
+ "rdoc/site/0.2.1/Nucleon/Action/Project.html",
330
+ "rdoc/site/0.2.1/Nucleon/Action/Project/Add.html",
331
+ "rdoc/site/0.2.1/Nucleon/Action/Project/Create.html",
332
+ "rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html",
333
+ "rdoc/site/0.2.1/Nucleon/Action/Project/Save.html",
334
+ "rdoc/site/0.2.1/Nucleon/Action/Project/Update.html",
335
+ "rdoc/site/0.2.1/Nucleon/Codes.html",
336
+ "rdoc/site/0.2.1/Nucleon/Command.html",
337
+ "rdoc/site/0.2.1/Nucleon/Command/Bash.html",
338
+ "rdoc/site/0.2.1/Nucleon/Config.html",
339
+ "rdoc/site/0.2.1/Nucleon/Config/Collection.html",
340
+ "rdoc/site/0.2.1/Nucleon/Config/Options.html",
341
+ "rdoc/site/0.2.1/Nucleon/Core.html",
342
+ "rdoc/site/0.2.1/Nucleon/Environment.html",
343
+ "rdoc/site/0.2.1/Nucleon/Errors.html",
344
+ "rdoc/site/0.2.1/Nucleon/Errors/BatchError.html",
345
+ "rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html",
346
+ "rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html",
347
+ "rdoc/site/0.2.1/Nucleon/Event.html",
348
+ "rdoc/site/0.2.1/Nucleon/Event/Regex.html",
349
+ "rdoc/site/0.2.1/Nucleon/Facade.html",
350
+ "rdoc/site/0.2.1/Nucleon/Gems.html",
351
+ "rdoc/site/0.2.1/Nucleon/Manager.html",
352
+ "rdoc/site/0.2.1/Nucleon/Mixin.html",
353
+ "rdoc/site/0.2.1/Nucleon/Mixin/Action.html",
354
+ "rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html",
355
+ "rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html",
356
+ "rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html",
357
+ "rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html",
358
+ "rdoc/site/0.2.1/Nucleon/Mixin/Colors.html",
359
+ "rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html",
360
+ "rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html",
361
+ "rdoc/site/0.2.1/Nucleon/Mixin/Macro.html",
362
+ "rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html",
363
+ "rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html",
364
+ "rdoc/site/0.2.1/Nucleon/Mixin/Settings.html",
365
+ "rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html",
366
+ "rdoc/site/0.2.1/Nucleon/Parallel.html",
367
+ "rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html",
368
+ "rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html",
369
+ "rdoc/site/0.2.1/Nucleon/Plugin.html",
370
+ "rdoc/site/0.2.1/Nucleon/Plugin/Action.html",
371
+ "rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html",
372
+ "rdoc/site/0.2.1/Nucleon/Plugin/Base.html",
373
+ "rdoc/site/0.2.1/Nucleon/Plugin/Command.html",
374
+ "rdoc/site/0.2.1/Nucleon/Plugin/Event.html",
375
+ "rdoc/site/0.2.1/Nucleon/Plugin/Extension.html",
376
+ "rdoc/site/0.2.1/Nucleon/Plugin/Project.html",
377
+ "rdoc/site/0.2.1/Nucleon/Plugin/Template.html",
378
+ "rdoc/site/0.2.1/Nucleon/Plugin/Translator.html",
379
+ "rdoc/site/0.2.1/Nucleon/Project.html",
380
+ "rdoc/site/0.2.1/Nucleon/Project/Git.html",
381
+ "rdoc/site/0.2.1/Nucleon/Project/Github.html",
382
+ "rdoc/site/0.2.1/Nucleon/Template.html",
383
+ "rdoc/site/0.2.1/Nucleon/Template/JSON.html",
384
+ "rdoc/site/0.2.1/Nucleon/Template/Wrapper.html",
385
+ "rdoc/site/0.2.1/Nucleon/Template/YAML.html",
386
+ "rdoc/site/0.2.1/Nucleon/Translator.html",
387
+ "rdoc/site/0.2.1/Nucleon/Translator/JSON.html",
388
+ "rdoc/site/0.2.1/Nucleon/Translator/YAML.html",
389
+ "rdoc/site/0.2.1/Nucleon/Util.html",
390
+ "rdoc/site/0.2.1/Nucleon/Util/CLI.html",
391
+ "rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html",
392
+ "rdoc/site/0.2.1/Nucleon/Util/Cache.html",
393
+ "rdoc/site/0.2.1/Nucleon/Util/Console.html",
394
+ "rdoc/site/0.2.1/Nucleon/Util/Data.html",
395
+ "rdoc/site/0.2.1/Nucleon/Util/Disk.html",
396
+ "rdoc/site/0.2.1/Nucleon/Util/Git.html",
397
+ "rdoc/site/0.2.1/Nucleon/Util/Liquid.html",
398
+ "rdoc/site/0.2.1/Nucleon/Util/Logger.html",
399
+ "rdoc/site/0.2.1/Nucleon/Util/Package.html",
400
+ "rdoc/site/0.2.1/Nucleon/Util/SSH.html",
401
+ "rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html",
402
+ "rdoc/site/0.2.1/Nucleon/Util/Shell.html",
403
+ "rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html",
404
+ "rdoc/site/0.2.1/README_rdoc.html",
405
+ "rdoc/site/0.2.1/TODO_rdoc.html",
406
+ "rdoc/site/0.2.1/created.rid",
407
+ "rdoc/site/0.2.1/images/add.png",
408
+ "rdoc/site/0.2.1/images/brick.png",
409
+ "rdoc/site/0.2.1/images/brick_link.png",
410
+ "rdoc/site/0.2.1/images/bug.png",
411
+ "rdoc/site/0.2.1/images/bullet_black.png",
412
+ "rdoc/site/0.2.1/images/bullet_toggle_minus.png",
413
+ "rdoc/site/0.2.1/images/bullet_toggle_plus.png",
414
+ "rdoc/site/0.2.1/images/date.png",
415
+ "rdoc/site/0.2.1/images/delete.png",
416
+ "rdoc/site/0.2.1/images/find.png",
417
+ "rdoc/site/0.2.1/images/loadingAnimation.gif",
418
+ "rdoc/site/0.2.1/images/macFFBgHack.png",
419
+ "rdoc/site/0.2.1/images/package.png",
420
+ "rdoc/site/0.2.1/images/page_green.png",
421
+ "rdoc/site/0.2.1/images/page_white_text.png",
422
+ "rdoc/site/0.2.1/images/page_white_width.png",
423
+ "rdoc/site/0.2.1/images/plugin.png",
424
+ "rdoc/site/0.2.1/images/ruby.png",
425
+ "rdoc/site/0.2.1/images/tag_blue.png",
426
+ "rdoc/site/0.2.1/images/tag_green.png",
427
+ "rdoc/site/0.2.1/images/transparent.png",
428
+ "rdoc/site/0.2.1/images/wrench.png",
429
+ "rdoc/site/0.2.1/images/wrench_orange.png",
430
+ "rdoc/site/0.2.1/images/zoom.png",
431
+ "rdoc/site/0.2.1/index.html",
432
+ "rdoc/site/0.2.1/js/darkfish.js",
433
+ "rdoc/site/0.2.1/js/jquery.js",
434
+ "rdoc/site/0.2.1/js/navigation.js",
435
+ "rdoc/site/0.2.1/js/search.js",
436
+ "rdoc/site/0.2.1/js/search_index.js",
437
+ "rdoc/site/0.2.1/js/searcher.js",
438
+ "rdoc/site/0.2.1/rdoc.css",
439
+ "rdoc/site/0.2.1/table_of_contents.html",
322
440
  "spec/coral_mock_input.rb",
323
441
  "spec/coral_test_kernel.rb",
324
442
  "spec/core/util/console_spec.rb",
@@ -0,0 +1,640 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>ARCHITECTURE - nucleon 0.2.1</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./ARCHITECTURE_rdoc.html">ARCHITECTURE</a>
53
+
54
+ <li class="file"><a href="./README_rdoc.html">README</a>
55
+
56
+ <li class="file"><a href="./TODO_rdoc.html">TODO</a>
57
+
58
+ </ul>
59
+ </nav>
60
+
61
+ <nav id="classindex-section" class="section project-section">
62
+ <h3 class="section-header">Class and Module Index</h3>
63
+
64
+ <ul class="link-list">
65
+
66
+ <li><a href="./Nucleon.html">Nucleon</a>
67
+
68
+ <li><a href="./Nucleon/Action.html">Nucleon::Action</a>
69
+
70
+ <li><a href="./Nucleon/Action/Extract.html">Nucleon::Action::Extract</a>
71
+
72
+ <li><a href="./Nucleon/Action/Project.html">Nucleon::Action::Project</a>
73
+
74
+ <li><a href="./Nucleon/Action/Project/Add.html">Nucleon::Action::Project::Add</a>
75
+
76
+ <li><a href="./Nucleon/Action/Project/Create.html">Nucleon::Action::Project::Create</a>
77
+
78
+ <li><a href="./Nucleon/Action/Project/Remove.html">Nucleon::Action::Project::Remove</a>
79
+
80
+ <li><a href="./Nucleon/Action/Project/Save.html">Nucleon::Action::Project::Save</a>
81
+
82
+ <li><a href="./Nucleon/Action/Project/Update.html">Nucleon::Action::Project::Update</a>
83
+
84
+ <li><a href="./Nucleon/Codes.html">Nucleon::Codes</a>
85
+
86
+ <li><a href="./Nucleon/Command.html">Nucleon::Command</a>
87
+
88
+ <li><a href="./Nucleon/Command/Bash.html">Nucleon::Command::Bash</a>
89
+
90
+ <li><a href="./Nucleon/Config.html">Nucleon::Config</a>
91
+
92
+ <li><a href="./Nucleon/Config/Collection.html">Nucleon::Config::Collection</a>
93
+
94
+ <li><a href="./Nucleon/Config/Options.html">Nucleon::Config::Options</a>
95
+
96
+ <li><a href="./Nucleon/Core.html">Nucleon::Core</a>
97
+
98
+ <li><a href="./Nucleon/Environment.html">Nucleon::Environment</a>
99
+
100
+ <li><a href="./Nucleon/Errors.html">Nucleon::Errors</a>
101
+
102
+ <li><a href="./Nucleon/Errors/BatchError.html">Nucleon::Errors::BatchError</a>
103
+
104
+ <li><a href="./Nucleon/Errors/NucleonError.html">Nucleon::Errors::NucleonError</a>
105
+
106
+ <li><a href="./Nucleon/Errors/SSHUnavailable.html">Nucleon::Errors::SSHUnavailable</a>
107
+
108
+ <li><a href="./Nucleon/Event.html">Nucleon::Event</a>
109
+
110
+ <li><a href="./Nucleon/Event/Regex.html">Nucleon::Event::Regex</a>
111
+
112
+ <li><a href="./Nucleon/Facade.html">Nucleon::Facade</a>
113
+
114
+ <li><a href="./Nucleon/Gems.html">Nucleon::Gems</a>
115
+
116
+ <li><a href="./Nucleon/Manager.html">Nucleon::Manager</a>
117
+
118
+ <li><a href="./Nucleon/Mixin.html">Nucleon::Mixin</a>
119
+
120
+ <li><a href="./Nucleon/Mixin/Action.html">Nucleon::Mixin::Action</a>
121
+
122
+ <li><a href="./Nucleon/Mixin/Action/Commit.html">Nucleon::Mixin::Action::Commit</a>
123
+
124
+ <li><a href="./Nucleon/Mixin/Action/Project.html">Nucleon::Mixin::Action::Project</a>
125
+
126
+ <li><a href="./Nucleon/Mixin/Action/Push.html">Nucleon::Mixin::Action::Push</a>
127
+
128
+ <li><a href="./Nucleon/Mixin/Action/Registration.html">Nucleon::Mixin::Action::Registration</a>
129
+
130
+ <li><a href="./Nucleon/Mixin/Colors.html">Nucleon::Mixin::Colors</a>
131
+
132
+ <li><a href="./Nucleon/Mixin/ConfigCollection.html">Nucleon::Mixin::ConfigCollection</a>
133
+
134
+ <li><a href="./Nucleon/Mixin/ConfigOptions.html">Nucleon::Mixin::ConfigOptions</a>
135
+
136
+ <li><a href="./Nucleon/Mixin/Macro.html">Nucleon::Mixin::Macro</a>
137
+
138
+ <li><a href="./Nucleon/Mixin/Macro/ObjectInterface.html">Nucleon::Mixin::Macro::ObjectInterface</a>
139
+
140
+ <li><a href="./Nucleon/Mixin/Macro/PluginInterface.html">Nucleon::Mixin::Macro::PluginInterface</a>
141
+
142
+ <li><a href="./Nucleon/Mixin/Settings.html">Nucleon::Mixin::Settings</a>
143
+
144
+ <li><a href="./Nucleon/Mixin/SubConfig.html">Nucleon::Mixin::SubConfig</a>
145
+
146
+ <li><a href="./Nucleon/Parallel.html">Nucleon::Parallel</a>
147
+
148
+ <li><a href="./Nucleon/Parallel/ClassMethods.html">Nucleon::Parallel::ClassMethods</a>
149
+
150
+ <li><a href="./Nucleon/Parallel/InstanceMethods.html">Nucleon::Parallel::InstanceMethods</a>
151
+
152
+ <li><a href="./Nucleon/Plugin.html">Nucleon::Plugin</a>
153
+
154
+ <li><a href="./Nucleon/Plugin/Action.html">Nucleon::Plugin::Action</a>
155
+
156
+ <li><a href="./Nucleon/Plugin/Action/Option.html">Nucleon::Plugin::Action::Option</a>
157
+
158
+ <li><a href="./Nucleon/Plugin/Base.html">Nucleon::Plugin::Base</a>
159
+
160
+ <li><a href="./Nucleon/Plugin/Command.html">Nucleon::Plugin::Command</a>
161
+
162
+ <li><a href="./Nucleon/Plugin/Event.html">Nucleon::Plugin::Event</a>
163
+
164
+ <li><a href="./Nucleon/Plugin/Extension.html">Nucleon::Plugin::Extension</a>
165
+
166
+ <li><a href="./Nucleon/Plugin/Project.html">Nucleon::Plugin::Project</a>
167
+
168
+ <li><a href="./Nucleon/Plugin/Template.html">Nucleon::Plugin::Template</a>
169
+
170
+ <li><a href="./Nucleon/Plugin/Translator.html">Nucleon::Plugin::Translator</a>
171
+
172
+ <li><a href="./Nucleon/Project.html">Nucleon::Project</a>
173
+
174
+ <li><a href="./Nucleon/Project/Git.html">Nucleon::Project::Git</a>
175
+
176
+ <li><a href="./Nucleon/Project/Github.html">Nucleon::Project::Github</a>
177
+
178
+ <li><a href="./Nucleon/Template.html">Nucleon::Template</a>
179
+
180
+ <li><a href="./Nucleon/Template/JSON.html">Nucleon::Template::JSON</a>
181
+
182
+ <li><a href="./Nucleon/Template/Wrapper.html">Nucleon::Template::Wrapper</a>
183
+
184
+ <li><a href="./Nucleon/Template/YAML.html">Nucleon::Template::YAML</a>
185
+
186
+ <li><a href="./Nucleon/Translator.html">Nucleon::Translator</a>
187
+
188
+ <li><a href="./Nucleon/Translator/JSON.html">Nucleon::Translator::JSON</a>
189
+
190
+ <li><a href="./Nucleon/Translator/YAML.html">Nucleon::Translator::YAML</a>
191
+
192
+ <li><a href="./Nucleon/Util.html">Nucleon::Util</a>
193
+
194
+ <li><a href="./Nucleon/Util/CLI.html">Nucleon::Util::CLI</a>
195
+
196
+ <li><a href="./Nucleon/Util/CLI/Parser.html">Nucleon::Util::CLI::Parser</a>
197
+
198
+ <li><a href="./Nucleon/Util/Cache.html">Nucleon::Util::Cache</a>
199
+
200
+ <li><a href="./Nucleon/Util/Console.html">Nucleon::Util::Console</a>
201
+
202
+ <li><a href="./Nucleon/Util/Data.html">Nucleon::Util::Data</a>
203
+
204
+ <li><a href="./Nucleon/Util/Disk.html">Nucleon::Util::Disk</a>
205
+
206
+ <li><a href="./Nucleon/Util/Git.html">Nucleon::Util::Git</a>
207
+
208
+ <li><a href="./Nucleon/Util/Liquid.html">Nucleon::Util::Liquid</a>
209
+
210
+ <li><a href="./Nucleon/Util/Logger.html">Nucleon::Util::Logger</a>
211
+
212
+ <li><a href="./Nucleon/Util/Package.html">Nucleon::Util::Package</a>
213
+
214
+ <li><a href="./Nucleon/Util/SSH.html">Nucleon::Util::SSH</a>
215
+
216
+ <li><a href="./Nucleon/Util/SSH/Keypair.html">Nucleon::Util::SSH::Keypair</a>
217
+
218
+ <li><a href="./Nucleon/Util/Shell.html">Nucleon::Util::Shell</a>
219
+
220
+ <li><a href="./Nucleon/Util/Shell/Result.html">Nucleon::Util::Shell::Result</a>
221
+
222
+ <li><a href="./Hash.html">Hash</a>
223
+
224
+ <li><a href="./Kernel.html">Kernel</a>
225
+
226
+ </ul>
227
+ </nav>
228
+
229
+ </div>
230
+ </nav>
231
+
232
+ <div id="documentation" class="description">
233
+
234
+ <h2 id="label-Nucleon+architecture+guide"><a href="Nucleon.html">Nucleon</a> architecture guide</h2>
235
+
236
+ <p><a href="Nucleon.html">Nucleon</a> is built to provide an easy and minimal,
237
+ yet extremely powerful, framework for building applications that are
238
+ highly distributable in nature.</p>
239
+
240
+ <p>This project should be applicable to any Ruby application that needs to be
241
+ built in a pluggable, concurrent, and configurable fashion. It is capable
242
+ of being used as pieces in existing programming models and it provides an
243
+ extremely simple core programming model that you can build on.</p>
244
+
245
+ <p>There are five major architectural goals of the project:</p>
246
+
247
+ <h3 id="label-Persistent+and+mergeable+objects">Persistent and mergeable objects</h3>
248
+
249
+ <h4 id="label-Important+concept%3A++Objects+%3D%3D+Property+trees">Important concept: Objects == Property trees</h4>
250
+
251
+ <p>At the core of the <a href="Nucleon.html">Nucleon</a> framework is the
252
+ configuration. The configuration is used for allowing us to store,
253
+ lookup, and perform other operations (such as merge) on our class data by
254
+ treating a subset of class properties as a tree based data structure.</p>
255
+
256
+ <p>Examples of <a href="Nucleon.html">Nucleon</a> configurations:</p>
257
+
258
+ <pre class="ruby"><span class="ruby-identifier">first_config</span> = <span class="ruby-constant">Nucleon</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>
259
+ <span class="ruby-identifier">first_config</span>.<span class="ruby-identifier">set</span>([ :<span class="ruby-identifier">my</span> <span class="ruby-operator">:</span><span class="ruby-identifier">nested</span>, :<span class="ruby-identifier">property</span> ], <span class="ruby-string">&#39;hello&#39;</span>)
260
+ <span class="ruby-identifier">first_config</span>.<span class="ruby-identifier">set</span>([ :<span class="ruby-identifier">my</span>, :<span class="ruby-identifier">other</span> ], { :<span class="ruby-identifier">ok</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span> })
261
+
262
+ <span class="ruby-identifier">tree_data</span> = <span class="ruby-identifier">first_config</span>.<span class="ruby-identifier">export</span>
263
+ <span class="ruby-comment"># tree_data = { </span>
264
+ <span class="ruby-comment"># :my =&gt; {</span>
265
+ <span class="ruby-comment"># :nested =&gt; { :property =&gt; &#39;hello&#39; },</span>
266
+ <span class="ruby-comment"># :other =&gt; { :ok =&gt; true }</span>
267
+ <span class="ruby-comment"># }</span>
268
+ <span class="ruby-comment"># }</span>
269
+
270
+ <span class="ruby-identifier">second_config</span> = <span class="ruby-constant">Nucleon</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>
271
+ <span class="ruby-identifier">second_config</span>.<span class="ruby-identifier">set</span>([ :<span class="ruby-identifier">my</span>, :<span class="ruby-identifier">other</span>, :<span class="ruby-identifier">ok</span> ], <span class="ruby-keyword">false</span>)
272
+ <span class="ruby-identifier">second_config</span>.<span class="ruby-identifier">set</span>(:<span class="ruby-identifier">property</span>, <span class="ruby-keyword">true</span>)
273
+ <span class="ruby-identifier">second_config</span>.<span class="ruby-identifier">set</span>([ :<span class="ruby-identifier">something</span>, :<span class="ruby-keyword">else</span> ], <span class="ruby-keyword">true</span>)
274
+
275
+ <span class="ruby-identifier">third_config</span> = <span class="ruby-constant">Nucleon</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">new</span>({ :<span class="ruby-identifier">property</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span> })
276
+ <span class="ruby-identifier">third_config</span>.<span class="ruby-identifier">import</span>(<span class="ruby-identifier">first_config</span>)
277
+ <span class="ruby-identifier">third_config</span>.<span class="ruby-identifier">defaults</span>(<span class="ruby-identifier">second_config</span>)
278
+
279
+ <span class="ruby-identifier">tree_data</span> = <span class="ruby-identifier">third_config</span>.<span class="ruby-identifier">export</span>
280
+ <span class="ruby-comment"># tree_data = { </span>
281
+ <span class="ruby-comment"># :my =&gt; {</span>
282
+ <span class="ruby-comment"># :nested =&gt; { :property =&gt; &#39;hello&#39; },</span>
283
+ <span class="ruby-comment"># :other =&gt; { :ok =&gt; true }</span>
284
+ <span class="ruby-comment"># },</span>
285
+ <span class="ruby-comment"># :property =&gt; false,</span>
286
+ <span class="ruby-comment"># :something =&gt; { :else =&gt; true }</span>
287
+ <span class="ruby-comment"># }</span>
288
+ </pre>
289
+
290
+ <p>As you can see the concept is pretty simple. In <a
291
+ href="Nucleon.html">Nucleon</a> most classes extend the configuration so
292
+ they have the above elastic and persistable qualities. Upon the
293
+ configuration primitives are built specialized accessors / modifiers in sub
294
+ classes. This creates a very dynamic and flexible object model upon which
295
+ we can build effective distributed systems.</p>
296
+
297
+ <h3 id="label-Extremely+pluggable+and+extensible">Extremely pluggable and extensible</h3>
298
+
299
+ <p>In the future application programming will focus much more on plugins and
300
+ extensions to existing systems than crafting a bunch of standalone systems.
301
+ This trend has already begun. But it can be harder to start an application
302
+ with a capable plugin and extensibility model unless already building on an
303
+ extensible framework (at which point you are most likely creating plugins).</p>
304
+
305
+ <p>One of the driving goals behind the <a href="Nucleon.html">Nucleon</a>
306
+ project is to deliver a cutting edge plugin and extensibility model that
307
+ other applications or frameworks can build on to provide their parallel
308
+ capable pluggable architecture. In order to do this effectively we need
309
+ to bridge different extensible systems to create an integrated hybrid.</p>
310
+
311
+ <p><a href="Nucleon.html">Nucleon</a> provides (and will provide) quite a few
312
+ means of extension:</p>
313
+
314
+ <h4 id="label-Plugin+%2F+providers+architecture">Plugin / providers architecture</h4>
315
+
316
+ <p><a href="Nucleon.html">Nucleon</a> implements a model where we define a
317
+ base API interface/implementation as a base plugin, which can be extended
318
+ by specialized providers loaded from a myriad of locations (that you can
319
+ define). This allows us to utilize base capabilities that can be easily
320
+ extended by developers with a single Ruby file provider implementation.
321
+ These plugin instances are usually created via a facade that makes
322
+ referencing them very easy. The facade is layered like an onion so it is
323
+ very easy to extend as needed.</p>
324
+
325
+ <p>For example:</p>
326
+
327
+ <pre class="ruby"><span class="ruby-identifier">translator</span> = <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">translator</span>({ :<span class="ruby-identifier">provider</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">json</span> })
328
+ <span class="ruby-identifier">obj_string</span> = <span class="ruby-identifier">translator</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">properties</span>)
329
+ <span class="ruby-identifier">properties</span> = <span class="ruby-identifier">translator</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">obj_string</span>)
330
+ </pre>
331
+
332
+ <p>It should be noted that ALL <a href="Nucleon.html">Nucleon</a> plugins are
333
+ at their core, configurations.</p>
334
+
335
+ <h4 id="label-Method+block+extension">Method block extension</h4>
336
+
337
+ <p>Sometimes it is nice to have a base implementation handle mundane details
338
+ of a task and leave the juicy bits to the child implementation. Normally,
339
+ in most OOP languages, we do this by simply extending parent methods
340
+ through inheritance. This leaves us with a problem though. How can we
341
+ get the parent to process before, after, or even in between the execution
342
+ of the child implementation?</p>
343
+
344
+ <p>Ruby makes thie very easy! To fulfill this goal we often use code blocks
345
+ passed to the parent that the parent then executes on behalf of the child.</p>
346
+
347
+ <p>For example:</p>
348
+
349
+ <pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">ParentClass</span>
350
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
351
+ <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Log4r</span><span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;over-engineered greeting class&#39;</span>)
352
+ <span class="ruby-keyword">end</span>
353
+
354
+ <span class="ruby-comment">#---</span>
355
+
356
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">say_hello</span>(<span class="ruby-identifier">to</span>, &amp;<span class="ruby-identifier">code</span>)
357
+ <span class="ruby-identifier">result</span> = <span class="ruby-keyword">false</span>
358
+ <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Invoking say_hello with #{to}&quot;</span>)
359
+
360
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">code</span>.<span class="ruby-identifier">call</span>(:<span class="ruby-identifier">validate</span>)
361
+ <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-string">&quot;We&#39;re all good&quot;</span>)
362
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">call</span>(:<span class="ruby-identifier">run</span>)
363
+ <span class="ruby-keyword">end</span>
364
+
365
+ <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;Finishing say_hello with #{to}&quot;</span>)
366
+ <span class="ruby-identifier">result</span>
367
+ <span class="ruby-keyword">end</span>
368
+ <span class="ruby-keyword">end</span>
369
+
370
+ <span class="ruby-comment">#---</span>
371
+
372
+ <span class="ruby-keyword">class</span> <span class="ruby-constant">ChildClass</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ParentClass</span>
373
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">say_hello</span>(<span class="ruby-identifier">to</span>)
374
+ <span class="ruby-keyword">super</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span><span class="ruby-operator">|</span>
375
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">op</span> <span class="ruby-operator">==</span> :<span class="ruby-identifier">validate</span>
376
+ <span class="ruby-operator">!</span><span class="ruby-identifier">to</span>.<span class="ruby-identifier">nil?</span>
377
+ <span class="ruby-keyword">else</span>
378
+ <span class="ruby-comment"># This code only gets executed if &lt;to&gt; is not nil</span>
379
+ <span class="ruby-comment"># And we don&#39;t have to worry about logging</span>
380
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;hello #{to}!&quot;</span>
381
+ <span class="ruby-keyword">true</span>
382
+ <span class="ruby-keyword">end</span>
383
+ <span class="ruby-keyword">end</span>
384
+ <span class="ruby-keyword">end</span>
385
+ <span class="ruby-keyword">end</span>
386
+
387
+ <span class="ruby-comment">#---</span>
388
+
389
+ <span class="ruby-identifier">obj</span> = <span class="ruby-constant">ChildClass</span>.<span class="ruby-identifier">new</span>
390
+ <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">say_hello</span>(<span class="ruby-string">&#39;world&#39;</span>)
391
+ <span class="ruby-comment"># hello world!</span>
392
+ </pre>
393
+
394
+ <p>As you can see we executed the child method statements multiple times from
395
+ the parent method so that we could abstract out some of the operations in
396
+ the sub class, thus making the provider easier to develop and the parent
397
+ abstract enough to support various providers.</p>
398
+
399
+ <p>Also notice that we did not expose the external block execution to the
400
+ users of the class or to child classes of ChildClass. In this case we
401
+ chose to stop the block execution propogation because the implementation
402
+ was very simple; say hello. If it had been more complex we could propogate
403
+ the block execution on down the line.</p>
404
+
405
+ <h4 id="label-Event+based+plugin+extensions">Event based plugin extensions</h4>
406
+
407
+ <p>It is extremely useful to be able to tap into the execution flow of
408
+ existing objects and methods. This allows the flow to change based on
409
+ actions that are defined by plugins that hook into other plugins
410
+ operations.</p>
411
+
412
+ <p><a href="Nucleon.html">Nucleon</a> implements a plugin type called the
413
+ Extension. It&#39;s sole purpose is to extend other plugins (including
414
+ Extensions). The base extension plugin has no special methods, leaving
415
+ the method interface pretty clean. These extensions are instantiated (only
416
+ one per defined extension) and they act on events as the application
417
+ execution flows. The are true class instances so they can manage state
418
+ between registered events.</p>
419
+
420
+ <p>Events are triggered by named method calls run by a central plugin manager.
421
+ They look just like regular methods but call out to other extensions to
422
+ help configure, get/set values, or otherwise act on the state of the
423
+ application at the time triggered. Extensions register for events by
424
+ defining an instance method that matches the name of the event. Every
425
+ event method (hook) takes one parameter (you guessed it); a configuration.
426
+ This makes the process quick and painless and code for events remains
427
+ easily localized and separated.</p>
428
+
429
+ <p>For example:</p>
430
+
431
+ <pre class="ruby"><span class="ruby-comment">#</span>
432
+ <span class="ruby-comment"># This would be defined within a namespaced load path.</span>
433
+ <span class="ruby-comment"># More on that in the usage section.</span>
434
+ <span class="ruby-comment"># </span>
435
+ <span class="ruby-keyword">class</span> <span class="ruby-constant">MyExtension</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">plugin_class</span>(:<span class="ruby-identifier">extension</span>)
436
+
437
+ <span class="ruby-ivar">@objs</span> = []
438
+
439
+ <span class="ruby-comment">#---</span>
440
+
441
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">myobj_config</span>(<span class="ruby-identifier">config</span>)
442
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">check</span>(:<span class="ruby-identifier">is_nucleon_awesome</span>, <span class="ruby-identifier">config</span>)
443
+ <span class="ruby-comment"># I&#39;m going to be nice and let other extensions help me decide.</span>
444
+ <span class="ruby-identifier">config</span>[:<span class="ruby-identifier">awesome</span>] = <span class="ruby-keyword">true</span>
445
+ <span class="ruby-keyword">end</span>
446
+ <span class="ruby-keyword">end</span>
447
+
448
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">is_nucleon_awesome</span>(<span class="ruby-identifier">config</span>)
449
+ <span class="ruby-keyword">true</span> <span class="ruby-comment"># Of course I&#39;m a little biased</span>
450
+ <span class="ruby-keyword">end</span>
451
+
452
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">record_object</span>(<span class="ruby-identifier">config</span>)
453
+ <span class="ruby-ivar">@objs</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">config</span>)
454
+ <span class="ruby-keyword">end</span>
455
+ <span class="ruby-keyword">end</span>
456
+
457
+ <span class="ruby-comment">#---</span>
458
+
459
+ <span class="ruby-comment"># Extension would normally be loaded via Nucleon.register(load_path)</span>
460
+ <span class="ruby-comment"># No one overruled me, Whew!</span>
461
+
462
+ <span class="ruby-identifier">myobj</span> = <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">config</span>(:<span class="ruby-identifier">myobj</span>, { :<span class="ruby-identifier">nucleon</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">is</span> })
463
+ <span class="ruby-comment"># myobj = {</span>
464
+ <span class="ruby-comment"># :nucleon =&gt; :is,</span>
465
+ <span class="ruby-comment"># :awesome =&gt; true</span>
466
+ <span class="ruby-comment"># }</span>
467
+
468
+ <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">exec</span>(:<span class="ruby-identifier">record_object</span>, <span class="ruby-identifier">myobj</span>)
469
+ </pre>
470
+
471
+ <h4 id="label-Middleware+sequences+%28NOT+YET+IMPLEMENTED%29">Middleware sequences (NOT YET IMPLEMENTED)</h4>
472
+
473
+ <p>We are evaluating the implementation of stacked actions or some form of
474
+ composite plugin execution model. Mitchell Hashimoto has created an
475
+ extremely useful solution for Vagrant and a separate middleware gem that
476
+ provides standalone middleware sequencing capabilities.</p>
477
+
478
+ <p>In the future we might integrate this system to stack our action plugins so
479
+ we can derive action lists. This would most likely be a framework that was
480
+ primarily used by the action plugin system and derivative projects.</p>
481
+
482
+ <p>Your thoughts are welcome? Contact the maintainers or file an issue.</p>
483
+
484
+ <h4 id="label-Execution+plans+%28NOT+YET+MIGRATED%29">Execution plans (NOT YET MIGRATED)</h4>
485
+
486
+ <p>In the early days of this project (or it&#39;s predecessor), I created and
487
+ utilized a system of executing JSON based CLI execution plans that could
488
+ respond to and trigger events, resulting in a responsive CLI sequence that
489
+ was programmed entirely in JSON as configurations. This fits our “make
490
+ everything a configuration” philosophy.</p>
491
+
492
+ <p>This system will be brought up to the current architecture before version
493
+ 1.0 (first production release). It will be very powerful, allowing for the
494
+ creation of new CLI commands and event driven programmatic actions purely
495
+ by working with JSON, YAML, or any other defined translator in the
496
+ application.</p>
497
+
498
+ <p>The goal is to allow for the ultimate in high level scriptable programming;
499
+ configuring data objects that execute programs.</p>
500
+
501
+ <p>This might eventually be integrated with the middleware sequences discussed
502
+ above.</p>
503
+
504
+ <h3 id="label-Easily+parallel">Easily parallel</h3>
505
+
506
+ <p>Concurrency is the backbone of scalability and fault tolerance. With <a
507
+ href="Nucleon.html">Nucleon</a> we seek to create a system that can utilize
508
+ the whole of the resources available to us in the most flexible way
509
+ possible. We should be able to write parallel capable objects without even
510
+ thinking about it (ok, maybe a litle). It should also be capable of
511
+ completely disabling the parallel execution and library inclusion to make
512
+ it easier to troubleshoot and debug.</p>
513
+
514
+ <p>There are two main popular concurrency methodologies currently being
515
+ promoted today. Erlang has popularized the actor based concurrency model
516
+ which has been widely discussed and adopted across the enterprise.
517
+ Another popular model is channel based communication between workers
518
+ popularized by the Go programming language. We would eventually like to
519
+ support both.</p>
520
+
521
+ <p>Currently we utilize and build on a super awesome Actor based parallel
522
+ framework for Ruby called Celluloid (<a
523
+ href="http://celluloid.io">celluloid.io</a>). This library is designed
524
+ around principles gleaned from Erlang&#39;s concurrency mechanism and is
525
+ built around an object oriented message passing architecture. It is very
526
+ well written.</p>
527
+
528
+ <p><a href="Nucleon.html">Nucleon</a> provides an interface to wrap and load
529
+ Celluloid actor proxies into your object&#39;s but allows for the parallel
530
+ abilities to be completely disabled, reducing the complexity of the code
531
+ (good for stack traces) and allowing for sequentially based debugging
532
+ tools (trapping through the code) to function correctly.</p>
533
+
534
+ <p>How easy is it to create a parallel object?</p>
535
+
536
+ <pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">MyClass</span>
537
+ <span class="ruby-identifier">include</span> <span class="ruby-constant">Nucleon</span><span class="ruby-operator">::</span><span class="ruby-constant">Parallel</span> <span class="ruby-comment"># Uses Celluloid under the hood!</span>
538
+
539
+ <span class="ruby-ivar">@order</span> = []
540
+
541
+ <span class="ruby-identifier">attr_reader</span> :<span class="ruby-identifier">order</span>
542
+
543
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_number</span>(<span class="ruby-identifier">num</span>)
544
+ <span class="ruby-identifier">sleep</span>(<span class="ruby-constant">Random</span>.<span class="ruby-identifier">rand</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>))
545
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Printing: #{num}&quot;</span>
546
+ <span class="ruby-ivar">@order</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">num</span>
547
+ <span class="ruby-keyword">end</span>
548
+ <span class="ruby-keyword">end</span>
549
+
550
+ <span class="ruby-comment">#---</span>
551
+
552
+ <span class="ruby-identifier">printer</span> = <span class="ruby-constant">MyClass</span>.<span class="ruby-identifier">new</span>
553
+ <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">parallel</span>(:<span class="ruby-identifier">print_number</span>, <span class="ruby-constant">Array</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">100</span>))
554
+ <span class="ruby-comment"># prints sequence out of sequence</span>
555
+ <span class="ruby-comment"># unless (ENV[&#39;NUCLEON_DEBUG&#39;] or ENV[&#39;NUCLEON_NO_PARALLEL&#39;] defined)</span>
556
+
557
+ <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">order</span> <span class="ruby-comment"># Whatever order they were executed in</span>
558
+ </pre>
559
+
560
+ <p>In the future we will put research into the channel based communication
561
+ concurrency model used by Go.</p>
562
+
563
+ <h3 id="label-Automatable+project+workflows">Automatable project workflows</h3>
564
+
565
+ <p>Configurations are great, but if they can&#39;t persist and be recalled
566
+ later by the application or framework they have limited effectiveness.
567
+ Since we want projects that are distributed in nature the configurations
568
+ need to be, not just persistent, but remotely available. With this in mind
569
+ the Project plugin was born.</p>
570
+
571
+ <p>The project is a revisionable data store with a local directory. It could
572
+ be a file repository or an active database some where (or even a service
573
+ like Dropbox). The idea is we provide a basic implementation of the
574
+ project in abstract operations and specialized providers fill in the
575
+ details.</p>
576
+
577
+ <p>So far we have implemented Git, and an extension to Git, GitHub. We use a
578
+ lot of text based files in our projects and Git is great for compressing
579
+ and storing versions of them, so Git was the first project integration.
580
+ Git is also a highly popular distributed mission critical capable version
581
+ control system, which is also a contributing factor in its prioritization.</p>
582
+
583
+ <p>In the future we plan on integrating more project providers and reworking
584
+ the Git provider to utilize more of the performance oriented Rugged
585
+ (LibGit2) libraries.</p>
586
+
587
+ <p>What a project looks like as a programming construct:</p>
588
+
589
+ <pre class="ruby"><span class="ruby-identifier">project</span> = <span class="ruby-constant">Nucleon</span>.<span class="ruby-identifier">project</span>({
590
+ :<span class="ruby-identifier">provider</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">github</span>, <span class="ruby-comment"># Project resides at Github (use special API sauce)</span>
591
+ :<span class="ruby-identifier">reference</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;coralnexus/nucleon&#39;</span>, <span class="ruby-comment"># GitHub identifier</span>
592
+ :<span class="ruby-identifier">revision</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;0.1&#39;</span>, <span class="ruby-comment"># Revision to ensure checked out for project</span>
593
+ :<span class="ruby-identifier">directory</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;/tmp/nucleon&#39;</span>, <span class="ruby-comment"># Directory to setup project</span>
594
+ :<span class="ruby-identifier">create</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>, <span class="ruby-comment"># Create project if does not exist yet</span>
595
+ :<span class="ruby-identifier">pull</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span> <span class="ruby-comment"># Go ahead and pull updates</span>
596
+ })
597
+
598
+ <span class="ruby-comment"># If you have a .netrc file with auth credentials in your home directory</span>
599
+ <span class="ruby-comment"># the plugin will manage deploy keys for private projects.</span>
600
+
601
+ <span class="ruby-identifier">origin</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">remote</span>(:<span class="ruby-identifier">origin</span>)
602
+ <span class="ruby-comment"># http://github.com/coralnexus/nucleon.git</span>
603
+
604
+ <span class="ruby-identifier">edit</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">remote</span>(:<span class="ruby-identifier">edit</span>)
605
+ <span class="ruby-comment"># git@github.com:coralnexus/nucleon.git</span>
606
+
607
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">checkout</span>(<span class="ruby-string">&#39;0.1&#39;</span>)
608
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">pull</span>(:<span class="ruby-identifier">edit</span>)
609
+
610
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">ignore</span>(<span class="ruby-string">&#39;my-tmp-file.txt&#39;</span>)
611
+
612
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-string">&#39;some-file.txt, { :message =&gt; &#39;</span><span class="ruby-constant">Changing</span> <span class="ruby-identifier">some</span> <span class="ruby-identifier">file</span> <span class="ruby-identifier">text</span>.<span class="ruby-string">&#39; })
613
+
614
+ project.add_subproject(&#39;</span><span class="ruby-identifier">other</span><span class="ruby-operator">/</span><span class="ruby-identifier">nucleon</span><span class="ruby-string">&#39;, &#39;</span><span class="ruby-identifier">http</span><span class="ruby-operator">:</span><span class="ruby-regexp">//</span><span class="ruby-identifier">github</span>.<span class="ruby-identifier">com</span><span class="ruby-operator">/</span><span class="ruby-identifier">coralnexus</span><span class="ruby-operator">/</span><span class="ruby-identifier">nucleon</span>.<span class="ruby-identifier">git</span>, <span class="ruby-string">&#39;0.1&#39;</span>)
615
+ <span class="ruby-identifier">project</span>.<span class="ruby-identifier">delete_subproject</span>(<span class="ruby-string">&#39;other/nucleon&#39;</span>)
616
+ </pre>
617
+
618
+ <p>There are more methods and options for the above methods, but the above
619
+ should give you an idea of what you can expect. The interface API is
620
+ definitely skewed towards the Git idioms, such as remotes, checkout,
621
+ commit, but the implementation can vary so if the data store can map to
622
+ most of the typical distributed version control ablities then it should be
623
+ fairly easy to integrate.</p>
624
+
625
+ <h3 id="label-Flexible+action+execution+model">Flexible action execution model</h3>
626
+
627
+ <p>One of the goals of the project is to create a very flexible action
628
+ execution system that can be used from the CLI, internally as method calls,
629
+ and eventually as service API endpoints.</p>
630
+
631
+ </div>
632
+
633
+
634
+
635
+ <footer id="validator-badges">
636
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
637
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
638
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
639
+ </footer>
640
+