nucleon 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ARCHITECTURE.rdoc +384 -0
- data/Gemfile.lock +2 -2
- data/LICENSE.txt +201 -674
- data/README.rdoc +41 -11
- data/TODO.rdoc +15 -0
- data/VERSION +1 -1
- data/lib/core/config.rb +1 -1
- data/lib/core/facade.rb +23 -1
- data/lib/core/util/disk.rb +16 -64
- data/lib/nucleon/project/github.rb +13 -23
- data/nucleon.gemspec +5 -3
- metadata +4 -2
data/README.rdoc
CHANGED
@@ -1,17 +1,47 @@
|
|
1
|
-
|
1
|
+
== Nucleon
|
2
2
|
|
3
|
-
|
3
|
+
=== Description
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
3. Easily parallel
|
5
|
+
Nucleon is built to provide an easy and minimal, yet extremely powerful,
|
6
|
+
framework for building applications that are highly distributable in nature.
|
8
7
|
|
9
|
-
|
8
|
+
See: ARCHITECTURE.rdoc
|
9
|
+
|
10
|
+
=== Installation / Dependencies
|
11
|
+
|
12
|
+
See the Gemfile for all Nucleon gem dependencies.
|
13
|
+
|
14
|
+
If the project plugin is used, you will probably need Git installed on the
|
15
|
+
system. If you do not and you use the project plugin Git providers, Git
|
16
|
+
projects will not do anything and will give you persistence warnings.
|
17
|
+
|
18
|
+
To install:
|
19
|
+
|
20
|
+
gem install nucleon
|
21
|
+
|
22
|
+
or put something like this in your Gemfile (for Bundler)
|
23
|
+
|
24
|
+
gem "nucleon", "~> 0.1"
|
25
|
+
|
26
|
+
Then you can require as needed and use what you need.
|
27
|
+
|
28
|
+
This library has so far been developed and tested on an Ubuntu environment but
|
29
|
+
the groundwork has been laid for development and testing on other platforms.
|
30
|
+
The library also currently lacks unit tests, which will be coming before the
|
31
|
+
1.0 (first production) release.
|
32
|
+
|
33
|
+
Consider this library experimental, but you are welcome to play around with it
|
34
|
+
and tell us what you think or how we could improve it.
|
35
|
+
|
36
|
+
|
37
|
+
=== Usage
|
38
|
+
|
39
|
+
=== Links
|
10
40
|
|
11
41
|
Note: This library is still very early in development!
|
12
42
|
|
13
43
|
|
14
|
-
|
44
|
+
=== Contributing to Nucleon
|
15
45
|
|
16
46
|
* Check out the latest {major}.{minor} branch to make sure the feature hasn't
|
17
47
|
been implemented or the bug hasn't been fixed yet.
|
@@ -26,9 +56,9 @@ Note: This library is still very early in development!
|
|
26
56
|
to have your own version, or is otherwise necessary, that is fine, but
|
27
57
|
please isolate to its own commit so I can cherry-pick around it.
|
28
58
|
|
29
|
-
|
59
|
+
=== Copyright
|
30
60
|
|
31
|
-
Licensed under
|
61
|
+
Licensed under the Apache License 2.0. See LICENSE.txt for further details.
|
32
62
|
|
33
|
-
Copyright (c) 2014 Adrian Webb <adrian.webb@coralnexus.com>
|
34
|
-
Coral Technology Group LLC
|
63
|
+
Copyright (c) 2013-2014 Adrian Webb <adrian.webb@coralnexus.com>
|
64
|
+
Coral Technology Group LLC
|
data/TODO.rdoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
== Nucleon tasks to complete before 1.0 release
|
2
|
+
|
3
|
+
* Namespace implementation
|
4
|
+
* Meta (composite) actions
|
5
|
+
* Execution plans
|
6
|
+
* Error handling improvements
|
7
|
+
* Full code documentation
|
8
|
+
* Full coverage unit tests (starting with core Nucleon unit testing library)
|
9
|
+
* Performance improvements
|
10
|
+
* Ensure fault tolerance for Actor managers
|
11
|
+
* Deeper GitHub API integration in project provider
|
12
|
+
* UI console color profiles
|
13
|
+
* Localization improvements
|
14
|
+
* Logging consolidation (eliminate redundant log entries)
|
15
|
+
* Fix bugs :-(
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.15
|
data/lib/core/config.rb
CHANGED
data/lib/core/facade.rb
CHANGED
@@ -7,11 +7,33 @@ module Parallel
|
|
7
7
|
|
8
8
|
def self.included(klass)
|
9
9
|
if Nucleon.parallel?
|
10
|
-
klass.send :include, Celluloid
|
10
|
+
klass.send :include, Celluloid
|
11
11
|
end
|
12
|
+
klass.send :include, InstanceMethods
|
12
13
|
klass.extend ClassMethods
|
13
14
|
end
|
14
15
|
|
16
|
+
#---
|
17
|
+
|
18
|
+
module InstanceMethods
|
19
|
+
def parallel(method, split_args, *shared_args)
|
20
|
+
results = []
|
21
|
+
split_args = [ split_args ] unless split_args.is_a?(Array)
|
22
|
+
|
23
|
+
if Nucleon.parallel?
|
24
|
+
split_args.each do |arg|
|
25
|
+
results << future.send(method, arg, *shared_args)
|
26
|
+
end
|
27
|
+
results.map { |future| future.value } # Wait for all to finish.
|
28
|
+
else
|
29
|
+
split_args.each do |arg|
|
30
|
+
results << send(method, arg, *shared_args)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
results
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
15
37
|
#---
|
16
38
|
|
17
39
|
module ClassMethods
|
data/lib/core/util/disk.rb
CHANGED
@@ -6,8 +6,6 @@ class Disk
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Properties
|
8
8
|
|
9
|
-
@@files = {}
|
10
|
-
|
11
9
|
@@separator = false
|
12
10
|
@@description = ''
|
13
11
|
|
@@ -28,42 +26,17 @@ class Disk
|
|
28
26
|
|
29
27
|
#---
|
30
28
|
|
31
|
-
def self.open(file_name, options = {}, reset = false)
|
32
|
-
mode = options[:mode].to_s
|
33
|
-
|
34
|
-
@@separator = ( options[:separator] ? options[:separator] : false )
|
35
|
-
@@description = ( options[:description] ? options[:description] : '' )
|
36
|
-
|
37
|
-
if @@files.has_key?(file_name) && ! reset
|
38
|
-
reset = true if ! mode.empty? && mode != @@files[file_name][:mode]
|
39
|
-
end
|
40
|
-
|
41
|
-
@@file_lock.synchronize do
|
42
|
-
if ! @@files.has_key?(file_name) || ! @@files[file_name][:file] || reset
|
43
|
-
@@files[file_name][:file].close if @@files[file_name] && @@files[file_name][:file]
|
44
|
-
unless mode.empty? || ( mode == 'r' && ! ::File.exists?(file_name) )
|
45
|
-
@@files[file_name] = {
|
46
|
-
:file => ::File.open(file_name, mode),
|
47
|
-
:mode => mode,
|
48
|
-
}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
return nil unless @@files[file_name]
|
53
|
-
return @@files[file_name][:file]
|
54
|
-
end
|
55
|
-
|
56
|
-
#---
|
57
|
-
|
58
29
|
def self.read(file_name, options = {})
|
59
30
|
result = nil
|
60
31
|
options[:mode] = ( options[:mode] ? options[:mode] : 'r' )
|
61
|
-
file = open(file_name, options)
|
62
32
|
|
63
|
-
|
64
|
-
|
65
|
-
file
|
66
|
-
|
33
|
+
@@file_lock.synchronize do
|
34
|
+
begin
|
35
|
+
if file = ::File.open(file_name, options[:mode])
|
36
|
+
result = file.read
|
37
|
+
file.close
|
38
|
+
end
|
39
|
+
rescue # TODO: Only catch error if file is not found.
|
67
40
|
end
|
68
41
|
end
|
69
42
|
return result
|
@@ -72,18 +45,13 @@ class Disk
|
|
72
45
|
#---
|
73
46
|
|
74
47
|
def self.write(file_name, data, options = {})
|
48
|
+
result = nil
|
75
49
|
options[:mode] = ( options[:mode] ? options[:mode] : 'w' )
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if file
|
80
|
-
@@file_lock.synchronize do
|
81
|
-
file.pos = 0 if options[:mode] == 'w'
|
50
|
+
|
51
|
+
@@file_lock.synchronize do
|
52
|
+
if file = ::File.open(file_name, options[:mode])
|
82
53
|
result = file.write(data)
|
83
|
-
|
84
|
-
file.flush
|
85
|
-
rescue # In case the file is already closed
|
86
|
-
end
|
54
|
+
file.close
|
87
55
|
end
|
88
56
|
end
|
89
57
|
return result
|
@@ -103,29 +71,13 @@ class Disk
|
|
103
71
|
|
104
72
|
def self.log(data, options = {})
|
105
73
|
reset = ( options[:file_name] || options[:mode] )
|
106
|
-
|
107
|
-
|
108
|
-
|
74
|
+
|
75
|
+
@@file_lock.synchronize do
|
76
|
+
if file = ::File.open(( options[:file_name] ? options[:file_name] : 'log.txt' ), options[:mode])
|
109
77
|
file.write("--------------------------------------\n") if @@separator
|
110
78
|
file.write("#{@@description}\n") if @@description
|
111
79
|
file.write("#{data}\n")
|
112
|
-
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
#---
|
117
|
-
|
118
|
-
def self.close(file_names = [])
|
119
|
-
file_names = @@files.keys unless file_names && ! file_names.empty?
|
120
|
-
|
121
|
-
unless file_names.is_a?(Array)
|
122
|
-
file_names = [ file_names ]
|
123
|
-
end
|
124
|
-
|
125
|
-
file_names.each do |file_name|
|
126
|
-
@@file_lock.synchronize do
|
127
|
-
@@files[file_name][:file].close if @@files[file_name] && @@files[file_name][:file]
|
128
|
-
@@files.delete(file_name)
|
80
|
+
file.close
|
129
81
|
end
|
130
82
|
end
|
131
83
|
end
|
@@ -57,31 +57,21 @@ class Github < Git
|
|
57
57
|
ssh_key = public_key_str
|
58
58
|
|
59
59
|
if private_key && ssh_key
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
keys_match = true
|
60
|
+
deploy_keys = client.deploy_keys(plugin_name)
|
61
|
+
github_id = nil
|
62
|
+
keys_match = true
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
client.remove_deploy_key(myself.plugin_name, github_id) if github_id && ! keys_match
|
74
|
-
client.add_deploy_key(myself.plugin_name, key_id, ssh_key)
|
75
|
-
verify_key
|
76
|
-
|
77
|
-
|
78
|
-
rescue Exception => error
|
79
|
-
logger.error(error.inspect)
|
80
|
-
logger.error(error.message)
|
81
|
-
logger.error(Util::Data.to_yaml(error.backtrace))
|
82
|
-
|
83
|
-
ui.error(error.message, { :prefix => false }) if error.message
|
64
|
+
deploy_keys.each do |key_resource|
|
65
|
+
if key_resource.title == key_id
|
66
|
+
github_id = key_resource.id
|
67
|
+
keys_match = false if key_resource.key != ssh_key
|
68
|
+
break
|
69
|
+
end
|
84
70
|
end
|
71
|
+
|
72
|
+
client.remove_deploy_key(myself.plugin_name, github_id) if github_id && ! keys_match
|
73
|
+
client.add_deploy_key(myself.plugin_name, key_id, ssh_key)
|
74
|
+
verify_key
|
85
75
|
end
|
86
76
|
end
|
87
77
|
end
|
data/nucleon.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nucleon 0.1.
|
5
|
+
# stub: nucleon 0.1.15 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nucleon"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.15"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Adrian Webb"]
|
14
|
-
s.date = "2014-04-
|
14
|
+
s.date = "2014-04-24"
|
15
15
|
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"
|
16
16
|
s.email = "adrian.webb@coralnexus.com"
|
17
17
|
s.executables = ["nucleon"]
|
@@ -21,11 +21,13 @@ Gem::Specification.new do |s|
|
|
21
21
|
]
|
22
22
|
s.files = [
|
23
23
|
".document",
|
24
|
+
"ARCHITECTURE.rdoc",
|
24
25
|
"Gemfile",
|
25
26
|
"Gemfile.lock",
|
26
27
|
"LICENSE.txt",
|
27
28
|
"README.rdoc",
|
28
29
|
"Rakefile",
|
30
|
+
"TODO.rdoc",
|
29
31
|
"VERSION",
|
30
32
|
"bin/nucleon",
|
31
33
|
"lib/core/codes.rb",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nucleon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Webb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log4r
|
@@ -280,11 +280,13 @@ extra_rdoc_files:
|
|
280
280
|
- README.rdoc
|
281
281
|
files:
|
282
282
|
- ".document"
|
283
|
+
- ARCHITECTURE.rdoc
|
283
284
|
- Gemfile
|
284
285
|
- Gemfile.lock
|
285
286
|
- LICENSE.txt
|
286
287
|
- README.rdoc
|
287
288
|
- Rakefile
|
289
|
+
- TODO.rdoc
|
288
290
|
- VERSION
|
289
291
|
- bin/nucleon
|
290
292
|
- lib/core/codes.rb
|