nucleon 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/core/manager.rb +2 -0
- data/lib/core/plugin/project.rb +20 -14
- data/lib/core/util/ssh.rb +2 -2
- data/lib/nucleon/extension/project.rb +4 -3
- data/lib/nucleon/project/github.rb +27 -27
- data/nucleon.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d10a46930f8caf3251ae8b76d41b6ab9b62d574e
|
4
|
+
data.tar.gz: 985081596d90a480a7ec1db3d632942d22b679af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7955a1fd5c4816170b7aedcbcede162b309bccad724c47a8f502e213ebade046ad8f324283a60acbf2c190de5ff5bfe1018513ccae142aae6ff150582d6a7d0b
|
7
|
+
data.tar.gz: 57d13dce28164b20c48ea994df8c612021f76ad2e61b64a245a60b69188858c259f1c144545d5be6d3cde9f22700642916d23b7cefdbad54c5418894e6409eca
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/lib/core/manager.rb
CHANGED
@@ -529,6 +529,8 @@ class Manager
|
|
529
529
|
type_info = loaded_plugin(namespace, plugin_type, provider)
|
530
530
|
options = translate_type(type_info, options)
|
531
531
|
config = Config.ensure(options)
|
532
|
+
|
533
|
+
provider = config.get(:provider, provider)
|
532
534
|
name = config.get(:name, nil)
|
533
535
|
ensure_new = config.get(:new, false)
|
534
536
|
|
data/lib/core/plugin/project.rb
CHANGED
@@ -28,9 +28,9 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
28
28
|
logger.info("Creating new project at #{directory} with #{provider}")
|
29
29
|
|
30
30
|
return Nucleon.project(config.import({
|
31
|
-
:name
|
32
|
-
:directory
|
33
|
-
:
|
31
|
+
:name => directory,
|
32
|
+
:directory => directory,
|
33
|
+
:nucleon_file => config.get(:nucleon_file, true)
|
34
34
|
}), provider)
|
35
35
|
|
36
36
|
else
|
@@ -74,8 +74,14 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
74
74
|
@cache = Util::Cache.new(directory, Nucleon.sha1(plugin_name), '.project_cache')
|
75
75
|
init_cache
|
76
76
|
|
77
|
-
if get(:
|
78
|
-
self.class.
|
77
|
+
if get(:nucleon_file, true) && ( get(:nucleon_resave, false) || self.class.load_project_info(directory).empty? )
|
78
|
+
self.class.store_project_info(directory, plugin_provider, Util::Data.subset(export, [
|
79
|
+
:provider,
|
80
|
+
:url,
|
81
|
+
:edit,
|
82
|
+
:revision,
|
83
|
+
:manage_ignore
|
84
|
+
]))
|
79
85
|
end
|
80
86
|
end
|
81
87
|
end
|
@@ -523,7 +529,7 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
523
529
|
if add_project
|
524
530
|
logger.debug("Directory #{project_path} is a valid sub project for this #{plugin_provider} project")
|
525
531
|
|
526
|
-
project = myself.class.open(project_path, plugin_provider, { :
|
532
|
+
project = myself.class.open(project_path, plugin_provider, { :nucleon_file => get(:nucleon_file, true) })
|
527
533
|
|
528
534
|
extension(:load_project, { :project => project })
|
529
535
|
subprojects[path] = project
|
@@ -888,18 +894,18 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
888
894
|
# State configurations
|
889
895
|
|
890
896
|
def self.state_file
|
891
|
-
'.
|
897
|
+
'.nucleon'
|
892
898
|
end
|
893
899
|
|
894
900
|
#---
|
895
901
|
|
896
902
|
@@project_data = {}
|
897
903
|
|
898
|
-
def self.
|
904
|
+
def self.store_project_info(directory, provider, options)
|
899
905
|
if File.directory?(directory)
|
900
|
-
@@project_data[directory] = {
|
906
|
+
@@project_data[directory] = Config.ensure(options).import({
|
901
907
|
:provider => provider
|
902
|
-
}
|
908
|
+
}).export
|
903
909
|
json_data = Util::Data.to_json(@@project_data[directory], true)
|
904
910
|
Util::Disk.write(File.join(directory, state_file), json_data)
|
905
911
|
end
|
@@ -907,20 +913,20 @@ class Project < Nucleon.plugin_class(:nucleon, :base)
|
|
907
913
|
|
908
914
|
#---
|
909
915
|
|
910
|
-
def self.
|
916
|
+
def self.clear_project_info(directory)
|
911
917
|
@@project_data.delete(directory)
|
912
918
|
end
|
913
919
|
|
914
920
|
#---
|
915
921
|
|
916
|
-
def self.
|
922
|
+
def self.load_project_info(directory)
|
917
923
|
@@project_data[directory] = {} unless @@project_data.has_key?(directory)
|
918
924
|
|
919
|
-
if
|
925
|
+
if @@project_data[directory].empty?
|
920
926
|
json_data = Util::Disk.read(File.join(directory, state_file))
|
921
927
|
@@project_data[directory] = hash(Util::Data.parse_json(json_data)) if json_data
|
922
928
|
end
|
923
|
-
|
929
|
+
symbol_map(@@project_data[directory])
|
924
930
|
end
|
925
931
|
|
926
932
|
#-----------------------------------------------------------------------------
|
data/lib/core/util/ssh.rb
CHANGED
@@ -162,12 +162,12 @@ class SSH < Core
|
|
162
162
|
:user_known_hosts_file => [ File.join(key_path, 'known_hosts'), File.join(key_path, 'known_hosts2') ],
|
163
163
|
:auth_methods => [ 'publickey' ],
|
164
164
|
:paranoid => :very
|
165
|
-
}, {}, true, false).import(Util::Data.subset(config, config.keys - [ :keypair, :key_dir, :key_name ]))
|
165
|
+
}, {}, true, false).import(Util::Data.subset(config, config.keys - [ :keypair, :key_dir, :key_name, :reset_conn ]))
|
166
166
|
|
167
167
|
if private_key
|
168
168
|
auth_id = [ session_id, private_key ].join('_')
|
169
169
|
|
170
|
-
if ! @@auth[auth_id] && keypair = unlock_private_key(private_key, config)
|
170
|
+
if (config[:reset_conn] || ! @@auth[auth_id]) && keypair = unlock_private_key(private_key, config)
|
171
171
|
@@auth[auth_id] = keypair
|
172
172
|
end
|
173
173
|
config[:keypair] = @@auth[auth_id] # Reset so caller can access updated keypair
|
@@ -2,11 +2,12 @@
|
|
2
2
|
module Nucleon
|
3
3
|
module Extension
|
4
4
|
class Project < Nucleon.plugin_class(:nucleon, :extension)
|
5
|
-
|
5
|
+
|
6
6
|
def manager_plugin_provider(config)
|
7
7
|
if config[:namespace] == :nucleon && config[:type] == :project
|
8
|
-
if config[:directory]
|
9
|
-
|
8
|
+
if config[:directory]
|
9
|
+
project_info = Nucleon::Plugin::Project.load_project_info(config[:directory])
|
10
|
+
return project_info[:provider] unless project_info.empty?
|
10
11
|
end
|
11
12
|
end
|
12
13
|
nil
|
@@ -6,79 +6,79 @@ nucleon_require(File.dirname(__FILE__), :git)
|
|
6
6
|
module Nucleon
|
7
7
|
module Project
|
8
8
|
class Github < Git
|
9
|
-
|
9
|
+
|
10
10
|
#-----------------------------------------------------------------------------
|
11
11
|
# Project plugin interface
|
12
|
-
|
13
|
-
def normalize(reload)
|
12
|
+
|
13
|
+
def normalize(reload)
|
14
14
|
if reference = delete(:reference, nil)
|
15
15
|
myself.plugin_name = normalize_reference(reference)
|
16
16
|
else
|
17
17
|
if url = get(:url, nil)
|
18
18
|
myself.plugin_name = url
|
19
19
|
set(:url, myself.class.expand_url(url, get(:ssh, false)))
|
20
|
-
end
|
21
|
-
end
|
20
|
+
end
|
21
|
+
end
|
22
22
|
super
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
#---
|
26
|
-
|
26
|
+
|
27
27
|
def set_connection
|
28
28
|
require 'octokit'
|
29
|
-
|
29
|
+
|
30
30
|
@client = Octokit::Client.new :netrc => true
|
31
31
|
@client.login
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
#-----------------------------------------------------------------------------
|
35
35
|
# Property accessor / modifiers
|
36
|
-
|
36
|
+
|
37
37
|
def client
|
38
38
|
set_connection unless @client
|
39
39
|
@client
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
#-----------------------------------------------------------------------------
|
43
43
|
# Project operations
|
44
|
-
|
44
|
+
|
45
45
|
def init_auth
|
46
46
|
super do
|
47
47
|
external_ip = Nucleon.ip_address
|
48
48
|
internal_ip = get(:internal_ip, nil)
|
49
|
-
|
49
|
+
|
50
50
|
if internal_ip && internal_ip.to_s != external_ip
|
51
51
|
location = "#{external_ip}[#{internal_ip}]"
|
52
52
|
else
|
53
53
|
location = external_ip
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
key_id = ENV['USER'] + '@' + location
|
57
57
|
ssh_key = public_key_str
|
58
|
-
|
58
|
+
|
59
59
|
if private_key && ssh_key
|
60
60
|
deploy_keys = client.deploy_keys(plugin_name)
|
61
61
|
github_id = nil
|
62
62
|
keys_match = true
|
63
|
-
|
63
|
+
|
64
64
|
deploy_keys.each do |key_resource|
|
65
65
|
if key_resource.title == key_id
|
66
|
-
github_id = key_resource.id
|
66
|
+
github_id = key_resource.id
|
67
67
|
keys_match = false if key_resource.key != ssh_key
|
68
68
|
break
|
69
|
-
end
|
69
|
+
end
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
client.remove_deploy_key(myself.plugin_name, github_id) if github_id && ! keys_match
|
73
73
|
client.add_deploy_key(myself.plugin_name, key_id, ssh_key)
|
74
74
|
verify_key
|
75
75
|
end
|
76
|
-
end
|
76
|
+
end
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
#-----------------------------------------------------------------------------
|
80
80
|
# Utilities
|
81
|
-
|
81
|
+
|
82
82
|
def self.expand_url(path, editable = false)
|
83
83
|
if path =~ /^[a-zA-Z0-9_\-\/]+$/
|
84
84
|
if editable
|
@@ -92,19 +92,19 @@ class Github < Git
|
|
92
92
|
else
|
93
93
|
url = path
|
94
94
|
end
|
95
|
-
url
|
95
|
+
url
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
#---
|
99
|
-
|
99
|
+
|
100
100
|
def verify_key
|
101
101
|
Util::SSH.init_session('github.com', 'git', 22, private_key)
|
102
102
|
Util::SSH.close('github.com', 'git')
|
103
103
|
end
|
104
104
|
protected :verify_key
|
105
|
-
|
105
|
+
|
106
106
|
#---
|
107
|
-
|
107
|
+
|
108
108
|
def normalize_reference(reference)
|
109
109
|
reference.sub(/^(git\@|(https?|git)\:\/\/)[^\/\:]+(\/|\:)?/, '').sub(/\.git$/, '')
|
110
110
|
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.2.
|
5
|
+
# stub: nucleon 0.2.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nucleon"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.7"
|
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 = "2015-01-
|
14
|
+
s.date = "2015-01-19"
|
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"]
|
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.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Webb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log4r
|