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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06bdd932957dc7d3f8826e92fe3f442ba4a9282a
4
- data.tar.gz: 24475db3cdf4caeff3cea91f532810fad0d71db9
3
+ metadata.gz: 13c3e887c66f5bd85d72047d61e46bc174ca5a1f
4
+ data.tar.gz: 0674201c3ff404e52e32088f12fe31cffd9603fe
5
5
  SHA512:
6
- metadata.gz: 853934fd92e3040ec8bb6c18568c800c330cf2d17a56537a719740ceb68a2365ed4c11e1d632f12d042bba4f327c47b960c7614cc12a0a5fe47633c91098105d
7
- data.tar.gz: 456532aa926d41a93d363a86c7e9fb41309f1ba819ff34432725a142ca264edd523f895439185fa8192066086274224fbc9ad78de93caef0770d037de99acf92
6
+ metadata.gz: 143381f6f9f12c2dceb6edb2cdaacf4065ef3baf766a058ae817e303841308afb6186c091d9c41f2733f256649cc9a21f5eb085aed9017dc482c9f4dca932582
7
+ data.tar.gz: de63e90529ad0b13345fbcd5e67e0df67f07c0745367637769840cb0bd766a40bd9b3586d9e62a0d708a8f56a097cb4293260160ffd9022eeac0290a7dece74e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.11
1
+ 0.2.12
@@ -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
 
@@ -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({ :quiet_override => true }).export)
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
- home_path = ( ENV['USER'] == 'root' ? '/root' : ENV['HOME'] ) # In case we are using sudo
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 |path|
390
- command_options += [ "-i", File.expand_path(path) ]
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)
@@ -44,7 +44,7 @@ class Github < Git
44
44
 
45
45
  def init_auth
46
46
  super do
47
- external_ip = Nucleon.ip_address
47
+ external_ip = get(: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
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.11 ruby lib
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.11"
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-25"
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"]
@@ -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] -----------------------------------------------------") do |output|
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('message', :puts) do |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('message', :puts) do |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('[component] message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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('message', :puts) do |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.11
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-25 00:00:00.000000000 Z
11
+ date: 2015-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: log4r