ssh-short 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA512:
3
- data.tar.gz: 57d071b428d1f9cd7c1d4d35468d3ab0aed81826f7958a234b49f29b3a5b31ba9a996daf921846b4c137140a9c40c9d13a707036f8fa1abe7242091b6476985f
4
- metadata.gz: d78446918da032b69cef111cc5fd1ad863b9998d3c7d000aea20f509a54448fbf47d9b1a95f182c2ea5220e51c43e002b887ca26ac0bb462dc4e9f4c907a16f7
3
+ metadata.gz: bbe973b7717c28b471aabdc48d745b426a06ca643b5e73917718d3a82e56fb21b80a4ac4c673777cf43c06889b029e56ea3d44fe778ae6a15e0850666c3471ac
4
+ data.tar.gz: 76944a2e2c54ec68e1ce484fe8aea6dc45ed5e46267a5d4ce7f8e339345b1456ab0e31f2f8e7e5e8bb4cbba0292bc491553d04181a9ea296207e45b56cb2852c
5
5
  SHA1:
6
- data.tar.gz: a104fd336517f5d569c8910c44e9a9cbf9090c11
7
- metadata.gz: 92180626001f2978d271f23f00d4b48abab2bd97
6
+ metadata.gz: 20e9987e3c98a5143b9e66939a19eab801e22e7d
7
+ data.tar.gz: f7e8835fb92e1f2f930755a26b2eaec005e1f4b3
data/lib/ssh_short/cli.rb CHANGED
@@ -29,6 +29,10 @@ module SshShort
29
29
  if node[:key].nil? or args[:force_key_prompt]
30
30
  node[:key] = key_set.prompt_for_key
31
31
  end
32
+ if node[:user].nil?
33
+ abort 'No user was provided and no default is set' unless config[:default_user]
34
+ node[:user] = config[:default_user]
35
+ end
32
36
  node = CLI.add_options_if_present(node, args, [:alias, :user])
33
37
 
34
38
  node_mapper.update_node(node)
@@ -18,7 +18,7 @@ module SshShort
18
18
  options = self.key_options args, {}
19
19
  options = self.alias_option args, options
20
20
  options = self.action_options args, options
21
- options = self.user_options args, options, config[:default_user]
21
+ options = self.user_options args, options
22
22
  options = self.node_options args, options, config[:ip_mask]
23
23
  options
24
24
  end
@@ -40,14 +40,11 @@ module SshShort
40
40
  options
41
41
  end
42
42
 
43
- def self.user_options(args, options, default_user)
43
+ def self.user_options(args, options)
44
44
  user_index = args.index('-u')
45
45
  if user_index
46
46
  options[:user] = args[user_index + 1]
47
47
  2.times { args.delete_at user_index }
48
- else
49
- abort 'No user was provided and no default is set' unless default_user
50
- options[:user] = default_user
51
48
  end
52
49
  options
53
50
  end
@@ -1,3 +1,3 @@
1
1
  module SshShort
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -91,23 +91,11 @@ describe SshShort::Parser do
91
91
 
92
92
  context 'when no user is provided' do
93
93
 
94
- it 'uses the default user from config' do
94
+ it 'leaves the user unset' do
95
95
  options = SshShort::Parser.parse_input(config, standard_args)
96
- expect(options[:user]).to eq 'user'
96
+ expect(options).to_not include(:user)
97
97
  end
98
98
 
99
- context 'and when config user is null' do
100
-
101
- let(:no_user_config) { config.delete_if{|k, v| k == :default_user} }
102
-
103
- it 'aborts with error message' do
104
- expect {
105
- expect {
106
- SshShort::Parser.parse_input(no_user_config, standard_args)
107
- }.to raise_error SystemExit
108
- }.to output(/No user was provided/).to_stderr
109
- end
110
- end
111
99
  end
112
100
 
113
101
  context 'when a user is provided' 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.1.0
4
+ version: 0.1.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: 2015-09-23 00:00:00 Z
12
+ date: 2015-09-25 00:00:00 Z
13
13
  dependencies: []
14
14
 
15
15
  description: Easy ssh