ssh-short 0.3.0 → 0.3.1

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
  SHA512:
3
- data.tar.gz: 013894983677178843ed84e84de179db2646b94851fbb8352bec508d392d0bef9f4473178cf6bb9170f8882ba2dc6173f45cf1673236be8e7794631e81d565cd
4
- metadata.gz: f0950a8ffdcdbcbe3f69fe3b92d34d9be9f69aa713d76d5459f36794c2a87ab43ececc0660b4de31632d5645cb57bfa030e7eb17c650d10038590baa224a4c45
3
+ metadata.gz: 8a9a320436c6e0b8a938afdd293d1858ccd464d573d9b00ed1107968aae483f2d90c0de3951cf9be001aed63d99061a3fd00f8be52ab09cc0330afb35ef42308
4
+ data.tar.gz: 463417fcb7a6d501490505394025a3622d3280a9170012804c99cf791662e7a948ab9f75adbe81c4cda04df55fc65c15e64bd8a24e3eb92f85b64088f7832711
5
5
  SHA1:
6
- data.tar.gz: 31394bed9beb69c61f3cfc15142abe3ed88d1e7f
7
- metadata.gz: 9ae918535b15ed6c1ea250f7b12d9902bdb12820
6
+ metadata.gz: 640dc503747f8c948f83342d6f29f8d803a618b6
7
+ data.tar.gz: caef154ae31d2e1818976f4837ccc4ceb28e83d3
@@ -22,8 +22,7 @@ module SshShort
22
22
  end
23
23
 
24
24
  def update_node(node)
25
- alias_changed = alias_changed? node
26
- if alias_changed
25
+ if alias_changed? node
27
26
  existing_node_with_alias = get_node_by_alias(node[:alias])
28
27
  if existing_node_with_alias
29
28
  puts "Moving alias #{node[:alias]} from #{existing_node_with_alias[:host]} to #{node[:host]}"
@@ -55,6 +54,7 @@ module SshShort
55
54
  private
56
55
 
57
56
  def alias_changed?(node)
57
+ return false unless node[:alias]
58
58
  old_node = get_node_by_host node[:host]
59
59
  old_node ? old_node[:alias] != node[:alias] : true
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module SshShort
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -141,6 +141,23 @@ describe SshShort::NodeMapper do
141
141
 
142
142
  end
143
143
 
144
+ context 'when alias is nil' do
145
+
146
+ let(:node) { {:host => '10.0.0.6', :key => 'key_for_6.pem'} }
147
+ let(:nodemap) {
148
+ [
149
+ {:host => '10.0.0.1', :alias => 'alice', :key => 'key_for_alice.pem'},
150
+ {:host => '10.0.0.2', :key => 'key_for_2.pem'},
151
+ ]
152
+ }
153
+
154
+ it 'does not move the empty alias' do
155
+ expect(nodemapper).to_not receive(:puts).with(/Moving alias/)
156
+ nodemapper.update_node(node)
157
+ end
158
+
159
+ end
160
+
144
161
  end
145
162
 
146
163
  describe 'get_aliases' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh-short
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Poulton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2016-03-15 00:00:00 Z
12
+ date: 2016-04-26 00:00:00 Z
13
13
  dependencies: []
14
14
 
15
15
  description: Easy ssh