nucleon 0.2.11 → 0.2.12
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/util/cache.rb +4 -0
- data/lib/core/util/console.rb +8 -3
- data/lib/core/util/ssh.rb +17 -4
- data/lib/nucleon/project/github.rb +1 -1
- data/nucleon.gemspec +3 -3
- data/spec/core/core_spec.rb +1 -1
- data/spec/core/util/console_spec.rb +14 -14
- 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: 13c3e887c66f5bd85d72047d61e46bc174ca5a1f
|
4
|
+
data.tar.gz: 0674201c3ff404e52e32088f12fe31cffd9603fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 143381f6f9f12c2dceb6edb2cdaacf4065ef3baf766a058ae817e303841308afb6186c091d9c41f2733f256649cc9a21f5eb085aed9017dc482c9f4dca932582
|
7
|
+
data.tar.gz: de63e90529ad0b13345fbcd5e67e0df67f07c0745367637769840cb0bd766a40bd9b3586d9e62a0d708a8f56a097cb4293260160ffd9022eeac0290a7dece74e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.12
|
data/lib/core/util/cache.rb
CHANGED
@@ -25,6 +25,10 @@ class Cache < Core
|
|
25
25
|
@cache_filename = "#{id}.#{translator}"
|
26
26
|
@cache_path = File.join(@cache_root, @cache_filename)
|
27
27
|
|
28
|
+
unless File.exist?(file)
|
29
|
+
parser = CORL.translator({}, translator)
|
30
|
+
Disk.write(file, parser.generate({}))
|
31
|
+
end
|
28
32
|
load
|
29
33
|
end
|
30
34
|
|
data/lib/core/util/console.rb
CHANGED
@@ -270,11 +270,12 @@ class Console
|
|
270
270
|
defaults = { :new_line => true, :prefix => true }
|
271
271
|
options = defaults.merge(options)
|
272
272
|
printer = options[:new_line] ? :puts : :print
|
273
|
+
suffix = options[:new_line] ? "\n" : ''
|
273
274
|
|
274
275
|
puts_options = { :printer => printer }
|
275
276
|
puts_options[:channel] = options[:channel] if options.has_key?(:channel)
|
276
277
|
|
277
|
-
safe_puts(format_message(type, message, options), puts_options)
|
278
|
+
safe_puts(format_message(type, message, options) + suffix, puts_options)
|
278
279
|
end
|
279
280
|
|
280
281
|
# Dump an object to an output channel even if quiet specified
|
@@ -336,7 +337,10 @@ class Console
|
|
336
337
|
|
337
338
|
user_input = nil
|
338
339
|
|
339
|
-
say(:info, message, Config.ensure(options).import({
|
340
|
+
say(:info, message, Config.ensure(options).import({
|
341
|
+
:quiet_override => true,
|
342
|
+
:new_line => false
|
343
|
+
}).export)
|
340
344
|
|
341
345
|
if options[:echo]
|
342
346
|
user_input = @input.gets.chomp
|
@@ -386,7 +390,8 @@ class Console
|
|
386
390
|
try_again = false
|
387
391
|
end
|
388
392
|
end
|
389
|
-
password.strip
|
393
|
+
password = password.strip if password
|
394
|
+
password
|
390
395
|
end
|
391
396
|
|
392
397
|
#*****************************************************************************
|
data/lib/core/util/ssh.rb
CHANGED
@@ -10,9 +10,13 @@ class SSH < Core
|
|
10
10
|
|
11
11
|
#---
|
12
12
|
|
13
|
-
def self.key_path
|
13
|
+
def self.key_path(ssh_user = nil)
|
14
14
|
unless @@key_path
|
15
|
-
|
15
|
+
if ssh_user
|
16
|
+
home_path = "/home/#{ssh_user}"
|
17
|
+
else
|
18
|
+
home_path = ( ENV['USER'] == 'root' ? '/root' : ENV['HOME'] ) # In case we are using sudo
|
19
|
+
end
|
16
20
|
@@key_path = File.join(home_path, '.ssh')
|
17
21
|
|
18
22
|
FileUtils.mkdir(@@key_path) unless File.directory?(@@key_path)
|
@@ -374,6 +378,8 @@ class SSH < Core
|
|
374
378
|
|
375
379
|
port = config.get(:port, 22)
|
376
380
|
private_keys = config.get(:private_keys, File.join(ENV['HOME'], '.ssh', 'id_rsa'))
|
381
|
+
key_dir = config.get(:key_dir, nil)
|
382
|
+
key_name = config.get(:key_name, 'default')
|
377
383
|
|
378
384
|
command_options = [
|
379
385
|
"#{user}@#{hostname}",
|
@@ -386,8 +392,15 @@ class SSH < Core
|
|
386
392
|
"-o", "IdentitiesOnly=yes"
|
387
393
|
]
|
388
394
|
|
389
|
-
Util::Data.array(private_keys).each do |
|
390
|
-
|
395
|
+
Util::Data.array(private_keys).each do |private_key|
|
396
|
+
unless ENV['NUCLEON_NO_SSH_KEY_SAVE'] || key_dir.nil?
|
397
|
+
keypair = unlock_private_key(private_key, {
|
398
|
+
:key_dir => key_dir,
|
399
|
+
:key_name => key_name
|
400
|
+
})
|
401
|
+
private_key = keypair.private_key_file(key_dir, key_name) if keypair
|
402
|
+
end
|
403
|
+
command_options += [ "-i", File.expand_path(private_key) ]
|
391
404
|
end
|
392
405
|
|
393
406
|
if config.get(:forward_x11, false)
|
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.12 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.12"
|
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-04-
|
14
|
+
s.date = "2015-04-29"
|
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"]
|
data/spec/core/core_spec.rb
CHANGED
@@ -173,7 +173,7 @@ module Nucleon
|
|
173
173
|
describe "#ui_group" do
|
174
174
|
|
175
175
|
it "prints a colored message with a set prefix to the console" do
|
176
|
-
test_output("[\e\[36mtest string\e\[0m]
|
176
|
+
test_output("[\e\[36mtest string\e\[0m] -----------------------------------------------------\n") do |output|
|
177
177
|
Core.ui_group("test string", :cyan) do |ui|
|
178
178
|
ui.output = output
|
179
179
|
ui.info("-----------------------------------------------------")
|
@@ -23,7 +23,7 @@ module Nucleon
|
|
23
23
|
describe "#say" do
|
24
24
|
|
25
25
|
it "can delegate to another class that contains this method" do
|
26
|
-
test_output(
|
26
|
+
test_output("message\n", :puts) do |output|
|
27
27
|
console({ :output => output }) do |console|
|
28
28
|
console({ :console_delegate => console }).say(:info, 'message')
|
29
29
|
end
|
@@ -31,11 +31,11 @@ module Nucleon
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "prints a message with default options" do
|
34
|
-
test_output(
|
34
|
+
test_output("message\n", :puts) do |output|
|
35
35
|
console({ :output => output }).say(:info, 'message')
|
36
36
|
end
|
37
37
|
|
38
|
-
test_output(
|
38
|
+
test_output("[component] message\n", :puts) do |output|
|
39
39
|
console({
|
40
40
|
:resource => 'component',
|
41
41
|
:output => output,
|
@@ -44,7 +44,7 @@ module Nucleon
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "prints a message with and without newlines included" do
|
47
|
-
test_output(
|
47
|
+
test_output("message\n", :puts) do |output|
|
48
48
|
console({ :output => output }).say(:info, 'message', { :new_line => true })
|
49
49
|
end
|
50
50
|
|
@@ -55,7 +55,7 @@ module Nucleon
|
|
55
55
|
|
56
56
|
it "routes message of different types" do
|
57
57
|
[:info, :warn, :success, :error].each do |type|
|
58
|
-
test_output(
|
58
|
+
test_output("message\n", :puts) do |output|
|
59
59
|
console({ :output => output, :color => false }).say(type, 'message')
|
60
60
|
end
|
61
61
|
end
|
@@ -63,7 +63,7 @@ module Nucleon
|
|
63
63
|
|
64
64
|
it "routes message to output and error channels based on channel given" do
|
65
65
|
[:info, :warn, :success].each do |type|
|
66
|
-
test_output(type.to_s, :puts) do |output|
|
66
|
+
test_output(type.to_s + "\n", :puts) do |output|
|
67
67
|
console({ :color => false }).say(type, type.to_s, { :channel => output })
|
68
68
|
end
|
69
69
|
end
|
@@ -116,7 +116,7 @@ module Nucleon
|
|
116
116
|
describe "#info" do
|
117
117
|
|
118
118
|
it "can delegate to another class that contains this method" do
|
119
|
-
test_output(
|
119
|
+
test_output("message\n", :puts) do |output|
|
120
120
|
console({ :output => output }) do |console|
|
121
121
|
console({ :console_delegate => console }).info('message')
|
122
122
|
end
|
@@ -124,7 +124,7 @@ module Nucleon
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "prints an uncolored information message" do
|
127
|
-
test_output(
|
127
|
+
test_output("message\n", :puts) do |output|
|
128
128
|
console({ :output => output }).info('message')
|
129
129
|
end
|
130
130
|
end
|
@@ -135,7 +135,7 @@ module Nucleon
|
|
135
135
|
describe "#warn" do
|
136
136
|
|
137
137
|
it "can delegate to another class that contains this method" do
|
138
|
-
test_output(
|
138
|
+
test_output("message\n", :puts) do |output|
|
139
139
|
console({ :output => output, :color => false }) do |console|
|
140
140
|
console({ :console_delegate => console }).warn('message')
|
141
141
|
end
|
@@ -143,7 +143,7 @@ module Nucleon
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "prints an uncolored warning message" do
|
146
|
-
test_output(
|
146
|
+
test_output("message\n", :puts) do |output|
|
147
147
|
console({ :output => output, :color => false }).warn('message')
|
148
148
|
end
|
149
149
|
end
|
@@ -160,7 +160,7 @@ module Nucleon
|
|
160
160
|
describe "#error" do
|
161
161
|
|
162
162
|
it "can delegate to another class that contains this method" do
|
163
|
-
test_output(
|
163
|
+
test_output("message\n", :puts) do |output|
|
164
164
|
console({ :output => output, :color => false }) do |console|
|
165
165
|
console({ :console_delegate => console }).error('message')
|
166
166
|
end
|
@@ -168,7 +168,7 @@ module Nucleon
|
|
168
168
|
end
|
169
169
|
|
170
170
|
it "prints an uncolored error message" do
|
171
|
-
test_output(
|
171
|
+
test_output("message\n", :puts) do |output|
|
172
172
|
console({ :output => output, :color => false }).error('message')
|
173
173
|
end
|
174
174
|
end
|
@@ -185,7 +185,7 @@ module Nucleon
|
|
185
185
|
describe "#success" do
|
186
186
|
|
187
187
|
it "can delegate to another class that contains this method" do
|
188
|
-
test_output(
|
188
|
+
test_output("message\n", :puts) do |output|
|
189
189
|
console({ :output => output, :color => false }) do |console|
|
190
190
|
console({ :console_delegate => console }).success('message')
|
191
191
|
end
|
@@ -193,7 +193,7 @@ module Nucleon
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it "prints an uncolored success message" do
|
196
|
-
test_output(
|
196
|
+
test_output("message\n", :puts) do |output|
|
197
197
|
console({ :output => output, :color => false }).success('message')
|
198
198
|
end
|
199
199
|
end
|
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.12
|
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-04-
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log4r
|