sshkit 0.0.26 → 0.0.27

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: cbb3f36f6373d515b4313fc92514655ba7ca36e0
4
- data.tar.gz: 484fd64e12a264d5bdaffe1e0a680194739930c5
3
+ metadata.gz: fa55cb451f47225ec73ee08039769db6d0b94042
4
+ data.tar.gz: 1a518438483ce60cab579ed6e4324048a8026d74
5
5
  SHA512:
6
- metadata.gz: e2d81fb0548c2a2d66763cb9a3ca7afa71753955264da34a8d5c9c6b83cefbaa2a073970f3a4059d87597f3c6998d57c687cdedbf596dbcd6a7efb099725e675
7
- data.tar.gz: 3c2e49e6cff7cc951097ece2084824ea7350a3d36bb34008a82ce3b14af31b420d9019c5e71c6b9a5cae0217f30f0a70cc70264ea437b994345bd3609391798f
6
+ metadata.gz: 02de05f408918db9ce6ea869948200abd85bf732ea87fa92a2ccd12d8a2c96d3f113a3f92b36935050ab949dabca6cd1380f9d7bc262bfdc95c126dc555c7057
7
+ data.tar.gz: 3ccffca30784f05d5fc4cef3db7bb42b2111b1935c178a93e6c95819d275c2fc681731f3d47677056069ce0562dc291fc16c5744beca478a4711034b1cf384e5
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  This file is written in reverse chronological order, newer releases will
4
4
  appear at the top.
5
5
 
6
+ ## 0.0.27
7
+
8
+ * Don't clobber SSH options with empty values. This allows Net::SSH to
9
+ do the right thing most of the time, and look into the SSH configuration
10
+ files.
11
+
6
12
  ## 0.0.26
7
13
 
8
14
  * Pretty output no longer prints white text. ("Command.....")
data/lib/sshkit/host.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'etc'
2
1
  require 'ostruct'
3
2
 
4
3
  module SSHKit
@@ -67,21 +66,17 @@ module SSHKit
67
66
  alias :== :eql?
68
67
  alias :equal? :eql?
69
68
 
70
- def to_key
71
- to_s.to_sym
72
- end
73
-
74
69
  def to_s
75
- sprintf("%s@%s:%d", username, hostname, port)
70
+ hostname
76
71
  end
77
72
 
78
73
  def netssh_options
79
- {
80
- keys: keys,
81
- port: port,
82
- user: user,
83
- password: password
84
- }
74
+ {}.tap do |sho|
75
+ sho[:keys] = keys if keys.any?
76
+ sho[:port] = port if port
77
+ sho[:user] = user if user
78
+ sho[:password] = password if password
79
+ end
85
80
  end
86
81
 
87
82
  def properties
@@ -103,11 +98,11 @@ module SSHKit
103
98
  end
104
99
 
105
100
  def username
106
- Etc.getlogin
101
+
107
102
  end
108
103
 
109
104
  def port
110
- 22
105
+
111
106
  end
112
107
 
113
108
  def hostname
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
@@ -32,11 +32,6 @@ module SSHKit
32
32
  Coordinator.new %w{1.example.com 2.example.com 3.example.com}
33
33
  end
34
34
 
35
- def test_connection_manager_removes_duplicates_after_resolving_hosts
36
- cm = Coordinator.new %w{user@1.example.com:22 user@1.example.com}
37
- assert_equal ['user@1.example.com:22'], cm.hosts.map(&:to_s)
38
- end
39
-
40
35
  def test_the_connection_manager_yields_the_host_to_each_connection_instance
41
36
  spy = lambda do |host|
42
37
  execute "echo #{host.hostname}"
@@ -12,8 +12,6 @@ module SSHKit
12
12
 
13
13
  def test_regular_hosts
14
14
  h = Host.new 'example.com'
15
- assert_equal 22, h.port
16
- assert_equal `whoami`.chomp, h.username
17
15
  assert_equal 'example.com', h.hostname
18
16
  end
19
17
 
@@ -49,12 +47,8 @@ module SSHKit
49
47
  assert_equal '1fff:0:a88:85a3::ac1f', h.hostname
50
48
  end
51
49
 
52
- def testing_host_casting_to_a_key
53
- assert_equal :"user@example.com:1234", Host.new('user@example.com:1234').to_key
54
- end
55
-
56
50
  def testing_host_casting_to_a_string
57
- assert_equal "user@example.com:1234", Host.new('user@example.com:1234').to_s
51
+ assert_equal "example.com", Host.new('user@example.com:1234').to_s
58
52
  end
59
53
 
60
54
  def test_assert_hosts_hash_equally
@@ -99,6 +93,17 @@ module SSHKit
99
93
  end
100
94
  end
101
95
 
96
+ def test_host_ssh_options_are_simply_missing_when_they_have_no_value
97
+ Host.new('my_config_is_in_the_ssh_config_file').tap do |host|
98
+ host.netssh_options.tap do |sho|
99
+ refute sho.has_key?(:port)
100
+ refute sho.has_key?(:password)
101
+ refute sho.has_key?(:keys)
102
+ refute sho.has_key?(:user)
103
+ end
104
+ end
105
+ end
106
+
102
107
  end
103
108
 
104
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Hambley