loginx 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/core.rb +25 -36
- data/lib/loginx/version.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: c17913cf8a33a6bdcb415d76fddf9ab728800bac
|
4
|
+
data.tar.gz: 917dd83345570e64b4a3a303f398427c65b6d4d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd94344833eaedddc6216c5b74c2a611b6c1df6a21679fe228da400c31e5486849d629f339ff31859d3d84b6b2450b3daf278fd258761feb7e1388053ec13d40
|
7
|
+
data.tar.gz: 4e35bfcac705d61497b2d620b9b676437e4fe2d3e62f57ced7609c4c4f5f7a0d6f1d1ad0c20c4fa7f27586b195407e595433572a399596a5a2a1c2a6af60f763
|
data/Gemfile.lock
CHANGED
data/lib/core.rb
CHANGED
@@ -29,49 +29,39 @@ class Core_p
|
|
29
29
|
puts "sorry the server alias does not exist"
|
30
30
|
exit 1
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
cmd = "ssh -p #{port} #{user}@#{ip}"
|
37
|
-
exp = RubyExpect::Expect.spawn("#{cmd}")
|
38
|
-
exp.procedure do
|
39
|
-
any do
|
40
|
-
expect /Permission denied/ do
|
41
|
-
puts "this user is not allowed"
|
42
|
-
end
|
43
|
-
|
44
|
-
expect /Connection refused/ do
|
45
|
-
puts "please check your port setting or password"
|
46
|
-
end
|
47
|
-
|
48
|
-
expect /continue connecting/ do
|
49
|
-
send "yes"
|
50
|
-
end
|
51
|
-
|
52
|
-
expect /\$\s+$/ do
|
53
|
-
puts "login successfully and press return to continue"
|
54
|
-
interact
|
55
|
-
end
|
56
|
-
|
57
|
-
expect /\#\s+$/ do
|
58
|
-
puts "login successfully and press return to continue"
|
59
|
-
interact
|
60
|
-
end
|
32
|
+
user = config['config']['user']
|
33
|
+
port = config['config']['port']
|
34
|
+
ip = info[self.server_alias]['ip']
|
35
|
+
password = info[self.server_alias]['password']
|
61
36
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
37
|
+
puts "do you want to send your ssh key"
|
38
|
+
puts "enter return to skip or 'y' to continue to send your key"
|
39
|
+
flag = STDIN.gets.chomp
|
40
|
+
if flag == 'y'
|
41
|
+
cmd2 = "ssh-copy-id -i #{user}@#{ip}"
|
42
|
+
#exec "#{cmd2}"
|
43
|
+
exp = RubyExpect::Expect.spawn("#{cmd2}")
|
44
|
+
exp.procedure do
|
66
45
|
any do
|
67
46
|
expect /Permission denied/ do
|
68
47
|
puts "this user is not allowed"
|
48
|
+
exit 0
|
69
49
|
end
|
70
50
|
|
71
51
|
expect /continue connecting/ do
|
72
52
|
send "yes"
|
73
53
|
end
|
74
54
|
|
55
|
+
expect /Connection refused/ do
|
56
|
+
puts "please check your port setting or password"
|
57
|
+
exit 0
|
58
|
+
end
|
59
|
+
|
60
|
+
expect /already exist/ do
|
61
|
+
puts "you already added keys before"
|
62
|
+
exit 0
|
63
|
+
end
|
64
|
+
|
75
65
|
expect /assword/ do
|
76
66
|
send "#{password}"
|
77
67
|
sleep 3
|
@@ -84,9 +74,8 @@ class Core_p
|
|
84
74
|
end
|
85
75
|
end
|
86
76
|
|
87
|
-
|
88
|
-
|
89
|
-
end
|
77
|
+
cmd = "ssh -p #{port} #{user}@#{ip}"
|
78
|
+
exec "#{cmd}"
|
90
79
|
else
|
91
80
|
puts "project does not exist"
|
92
81
|
exit 1
|
data/lib/loginx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loginx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- terryshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|