nucleon 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/core/config.rb +1 -1
- data/lib/core/core.rb +2 -2
- data/lib/core/environment.rb +9 -6
- data/lib/core/facade.rb +2 -2
- data/lib/core/gems.rb +13 -6
- data/lib/core/manager.rb +12 -5
- data/lib/core/mixin/action/commit.rb +12 -6
- data/lib/core/mixin/action/project.rb +15 -28
- data/lib/core/mixin/action/push.rb +14 -5
- data/lib/core/mixin/action/registration.rb +277 -28
- data/lib/core/mixin/macro/object_interface.rb +3 -3
- data/lib/core/mixin/sub_config.rb +1 -1
- data/lib/core/plugin/action.rb +20 -51
- data/lib/core/plugin/base.rb +41 -8
- data/lib/core/plugin/project.rb +55 -8
- data/lib/nucleon/action/project/add.rb +6 -20
- data/lib/nucleon/action/project/create.rb +2 -2
- data/lib/nucleon/action/project/remove.rb +3 -3
- data/lib/nucleon/action/project/save.rb +3 -3
- data/lib/nucleon/action/project/update.rb +2 -2
- data/lib/nucleon/extension/project.rb +16 -0
- data/lib/nucleon/project/git.rb +1 -0
- data/lib/nucleon/project/github.rb +19 -7
- data/nucleon.gemspec +120 -2
- data/rdoc/site/0.2.1/ARCHITECTURE_rdoc.html +640 -0
- data/rdoc/site/0.2.1/Hash.html +353 -0
- data/rdoc/site/0.2.1/Kernel.html +420 -0
- data/rdoc/site/0.2.1/Nucleon.html +674 -0
- data/rdoc/site/0.2.1/Nucleon/Action.html +286 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Extract.html +457 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project.html +285 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Add.html +502 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Create.html +459 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Remove.html +505 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Save.html +478 -0
- data/rdoc/site/0.2.1/Nucleon/Action/Project/Update.html +425 -0
- data/rdoc/site/0.2.1/Nucleon/Codes.html +569 -0
- data/rdoc/site/0.2.1/Nucleon/Command.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Command/Bash.html +550 -0
- data/rdoc/site/0.2.1/Nucleon/Config.html +1634 -0
- data/rdoc/site/0.2.1/Nucleon/Config/Collection.html +515 -0
- data/rdoc/site/0.2.1/Nucleon/Config/Options.html +495 -0
- data/rdoc/site/0.2.1/Nucleon/Core.html +641 -0
- data/rdoc/site/0.2.1/Nucleon/Environment.html +1210 -0
- data/rdoc/site/0.2.1/Nucleon/Errors.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/BatchError.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/NucleonError.html +663 -0
- data/rdoc/site/0.2.1/Nucleon/Errors/SSHUnavailable.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Event.html +281 -0
- data/rdoc/site/0.2.1/Nucleon/Event/Regex.html +473 -0
- data/rdoc/site/0.2.1/Nucleon/Facade.html +2452 -0
- data/rdoc/site/0.2.1/Nucleon/Gems.html +641 -0
- data/rdoc/site/0.2.1/Nucleon/Manager.html +1862 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin.html +291 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action.html +284 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Commit.html +387 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Project.html +401 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Push.html +377 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Action/Registration.html +575 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Colors.html +551 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigCollection.html +487 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/ConfigOptions.html +455 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/ObjectInterface.html +701 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Macro/PluginInterface.html +688 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/Settings.html +487 -0
- data/rdoc/site/0.2.1/Nucleon/Mixin/SubConfig.html +893 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel.html +332 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel/ClassMethods.html +331 -0
- data/rdoc/site/0.2.1/Nucleon/Parallel/InstanceMethods.html +458 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin.html +288 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action.html +2133 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Action/Option.html +465 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Base.html +1988 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Command.html +765 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Event.html +448 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Extension.html +287 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Project.html +2900 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Template.html +482 -0
- data/rdoc/site/0.2.1/Nucleon/Plugin/Translator.html +377 -0
- data/rdoc/site/0.2.1/Nucleon/Project.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Project/Git.html +1807 -0
- data/rdoc/site/0.2.1/Nucleon/Project/Github.html +555 -0
- data/rdoc/site/0.2.1/Nucleon/Template.html +283 -0
- data/rdoc/site/0.2.1/Nucleon/Template/JSON.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Template/Wrapper.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Template/YAML.html +335 -0
- data/rdoc/site/0.2.1/Nucleon/Translator.html +282 -0
- data/rdoc/site/0.2.1/Nucleon/Translator/JSON.html +372 -0
- data/rdoc/site/0.2.1/Nucleon/Translator/YAML.html +372 -0
- data/rdoc/site/0.2.1/Nucleon/Util.html +291 -0
- data/rdoc/site/0.2.1/Nucleon/Util/CLI.html +394 -0
- data/rdoc/site/0.2.1/Nucleon/Util/CLI/Parser.html +1404 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Cache.html +824 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Console.html +1330 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Data.html +1423 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Disk.html +528 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Git.html +367 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Liquid.html +371 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Logger.html +822 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Package.html +564 -0
- data/rdoc/site/0.2.1/Nucleon/Util/SSH.html +1036 -0
- data/rdoc/site/0.2.1/Nucleon/Util/SSH/Keypair.html +607 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Shell.html +697 -0
- data/rdoc/site/0.2.1/Nucleon/Util/Shell/Result.html +503 -0
- data/rdoc/site/0.2.1/README_rdoc.html +318 -0
- data/rdoc/site/0.2.1/TODO_rdoc.html +267 -0
- data/rdoc/site/0.2.1/created.rid +62 -0
- 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 +317 -0
- data/rdoc/site/0.2.1/js/darkfish.js +155 -0
- data/rdoc/site/0.2.1/js/jquery.js +18 -0
- data/rdoc/site/0.2.1/js/navigation.js +142 -0
- data/rdoc/site/0.2.1/js/search.js +94 -0
- data/rdoc/site/0.2.1/js/search_index.js +1 -0
- data/rdoc/site/0.2.1/js/searcher.js +228 -0
- data/rdoc/site/0.2.1/rdoc.css +543 -0
- data/rdoc/site/0.2.1/table_of_contents.html +1718 -0
- 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
|
-
|
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('
|
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
|
data/lib/nucleon/project/git.rb
CHANGED
@@ -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
|
84
|
-
|
85
|
-
|
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
|
-
|
88
|
-
separator = '/'
|
93
|
+
url = path
|
89
94
|
end
|
90
|
-
|
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
|
data/nucleon.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "nucleon"
|
8
|
-
s.version = "0.2.
|
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-
|
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">'hello'</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">></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 => {</span>
|
265
|
+
<span class="ruby-comment"># :nested => { :property => 'hello' },</span>
|
266
|
+
<span class="ruby-comment"># :other => { :ok => 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">></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 => {</span>
|
282
|
+
<span class="ruby-comment"># :nested => { :property => 'hello' },</span>
|
283
|
+
<span class="ruby-comment"># :other => { :ok => true }</span>
|
284
|
+
<span class="ruby-comment"># },</span>
|
285
|
+
<span class="ruby-comment"># :property => false,</span>
|
286
|
+
<span class="ruby-comment"># :something => { :else => 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">></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">'over-engineered greeting class'</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>, &<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">"Invoking say_hello with #{to}"</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">"We're all good"</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">"Finishing say_hello with #{to}"</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"><</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 <to> is not nil</span>
|
379
|
+
<span class="ruby-comment"># And we don't have to worry about logging</span>
|
380
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"hello #{to}!"</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">'world'</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'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"><</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'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'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">></span> :<span class="ruby-identifier">is</span> })
|
463
|
+
<span class="ruby-comment"># myobj = {</span>
|
464
|
+
<span class="ruby-comment"># :nucleon => :is,</span>
|
465
|
+
<span class="ruby-comment"># :awesome => 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'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'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'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">"Printing: #{num}"</span>
|
546
|
+
<span class="ruby-ivar">@order</span> <span class="ruby-operator"><<</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['NUCLEON_DEBUG'] or ENV['NUCLEON_NO_PARALLEL'] 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'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">></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">></span> <span class="ruby-string">'coralnexus/nucleon'</span>, <span class="ruby-comment"># GitHub identifier</span>
|
592
|
+
:<span class="ruby-identifier">revision</span> =<span class="ruby-operator">></span> <span class="ruby-string">'0.1'</span>, <span class="ruby-comment"># Revision to ensure checked out for project</span>
|
593
|
+
:<span class="ruby-identifier">directory</span> =<span class="ruby-operator">></span> <span class="ruby-string">'/tmp/nucleon'</span>, <span class="ruby-comment"># Directory to setup project</span>
|
594
|
+
:<span class="ruby-identifier">create</span> =<span class="ruby-operator">></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">></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">'0.1'</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">'my-tmp-file.txt'</span>)
|
611
|
+
|
612
|
+
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-string">'some-file.txt, { :message => '</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">' })
|
613
|
+
|
614
|
+
project.add_subproject('</span><span class="ruby-identifier">other</span><span class="ruby-operator">/</span><span class="ruby-identifier">nucleon</span><span class="ruby-string">', '</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">'0.1'</span>)
|
615
|
+
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">delete_subproject</span>(<span class="ruby-string">'other/nucleon'</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
|
+
|