sshez 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/sshez/command.rb +2 -0
- data/lib/sshez/exec.rb +17 -11
- data/lib/sshez/printing_manager.rb +13 -2
- data/lib/sshez/version.rb +1 -1
- data/spec/sshez_spec.rb +1 -1
- 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: 5d67f02bfbc4bab3ad5cda1254209ee5f05ed5e7
|
4
|
+
data.tar.gz: 9d16b4baca02436c2fcbfddfd1ddc45a99459d26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff60f9af66f116fdd3842771c9d1213b74689f4348fca1a00ecceb26dcb814b9e3ed4adb0d553e58f33620876bd261f522ebe57e4d760889e0f5e52edcb37f3a
|
7
|
+
data.tar.gz: c52207746a1f31ddc73e85d60b64be011cf8ba9eb2d0856a8bcc81905a9bf9f2f9107443978416fb91bb7c6839f1fcdeb0418df0f8b647bf4e23391c36c6e8bd
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/sshez/command.rb
CHANGED
@@ -33,6 +33,8 @@ module Sshez
|
|
33
33
|
(proc { |alias_name, role_host| [alias_name] + role_host.split('@') })),
|
34
34
|
'remove' => Command.new('remove', (proc { |args| args.length == 1 }),
|
35
35
|
'sshez remove <alias>'),
|
36
|
+
'rm' => Command.new('remove', (proc { |args| args.length == 1 }),
|
37
|
+
'sshez rm <alias>'),
|
36
38
|
'connect' => Command.new('connect', (proc { |args| args.length == 1 }),
|
37
39
|
'sshez connect <alias>'),
|
38
40
|
'reset' => Command.new('reset', (proc { |args| args.length == 0 }),
|
data/lib/sshez/exec.rb
CHANGED
@@ -98,15 +98,17 @@ module Sshez
|
|
98
98
|
#
|
99
99
|
def remove(alias_name, options)
|
100
100
|
file = File.open(FILE_PATH, 'r')
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
101
|
+
servers = all_hosts_in(file)
|
102
|
+
if servers.include?alias_name
|
103
|
+
new_file = File.open(FILE_PATH + 'temp', 'w')
|
104
|
+
remove_alias_name(alias_name, file, new_file)
|
105
|
+
|
106
|
+
File.delete(FILE_PATH)
|
107
|
+
File.rename(FILE_PATH + 'temp', FILE_PATH)
|
108
|
+
# Causes a bug in fedore if permission was not updated to 0600
|
109
|
+
File.chmod(0600, FILE_PATH)
|
110
|
+
PRINTER.print "`#{alias_name}` was successfully removed from your hosts"
|
111
|
+
else
|
110
112
|
PRINTER.print "Could not find host `#{alias_name}`"
|
111
113
|
end
|
112
114
|
finish_exec
|
@@ -154,8 +156,12 @@ module Sshez
|
|
154
156
|
end # list(options)
|
155
157
|
|
156
158
|
def reset(options)
|
157
|
-
|
158
|
-
|
159
|
+
resp = PRINTER.prompt 'Are you sure you want to remove all aliases? [Y/n]'
|
160
|
+
if resp.match(/y/i)
|
161
|
+
file = File.open(FILE_PATH, "w")
|
162
|
+
file.close
|
163
|
+
PRINTER.print 'You have successfully reset your ssh config file.'
|
164
|
+
end
|
159
165
|
end
|
160
166
|
|
161
167
|
#
|
@@ -13,20 +13,31 @@ module Sshez
|
|
13
13
|
@verbose = false
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
16
|
+
#
|
17
|
+
# Adds to output then prints
|
18
|
+
#
|
17
19
|
def print(text)
|
18
20
|
@output += %(#{text}\n)
|
19
21
|
puts text
|
20
22
|
end # print(text)
|
21
23
|
|
22
24
|
#
|
23
|
-
# prints only if verbose set to true
|
25
|
+
# Adds to output and prints only if verbose set to true
|
24
26
|
#
|
25
27
|
def verbose_print(text)
|
26
28
|
@output += %(#{text}\n)
|
27
29
|
puts text if @verbose
|
28
30
|
end
|
29
31
|
|
32
|
+
#
|
33
|
+
# Prompts for user input
|
34
|
+
#
|
35
|
+
def prompt(text)
|
36
|
+
@output += %(#{text}\n)
|
37
|
+
print text
|
38
|
+
STDIN.gets
|
39
|
+
end # print(text)
|
40
|
+
|
30
41
|
#
|
31
42
|
# Did we print anything?
|
32
43
|
#
|
data/lib/sshez/version.rb
CHANGED
data/spec/sshez_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Immortal Friday
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02-
|
12
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|