loginx 1.2.1 → 1.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
  SHA1:
3
- metadata.gz: 920a5a937388e313c81e1383cd7594562ee04500
4
- data.tar.gz: de0c3104052e1bcfa1082dc19e83836fee371ecd
3
+ metadata.gz: c17913cf8a33a6bdcb415d76fddf9ab728800bac
4
+ data.tar.gz: 917dd83345570e64b4a3a303f398427c65b6d4d0
5
5
  SHA512:
6
- metadata.gz: 3cb622f48af1a00e465e070310dcfed482201ab7c6a6bdad214b39f426f5d982fdb174db0b5a8ff47bf7a736913b04365f6471714294524ea3ff889ab635511c
7
- data.tar.gz: d49f6806edfa4af9cb4f248c91a8d560a3df34bec9ac2671f90016a9bec4b30b6c20bd9c3e5f8919c0328f0b30d338f4e09c0c7253fb3a425a6cd6599abc7bb5
6
+ metadata.gz: dd94344833eaedddc6216c5b74c2a611b6c1df6a21679fe228da400c31e5486849d629f339ff31859d3d84b6b2450b3daf278fd258761feb7e1388053ec13d40
7
+ data.tar.gz: 4e35bfcac705d61497b2d620b9b676437e4fe2d3e62f57ced7609c4c4f5f7a0d6f1d1ad0c20c4fa7f27586b195407e595433572a399596a5a2a1c2a6af60f763
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- loginx (1.2.1)
4
+ loginx (1.3.1)
5
5
  methadone (>= 1.9.3)
6
6
  ruby_expect
7
7
 
@@ -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
- user = config['config']['user']
33
- port = config['config']['port']
34
- ip = info[self.server_alias]['ip']
35
- password = info[self.server_alias]['password']
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
- expect /assword/ do
63
- cmd = "ssh-copy-id -i #{user}@#{ip}"
64
- exp2 = RubyExpect::Expect.spawn("#{cmd}")
65
- exp2.procedure do
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
- run
88
- end
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
@@ -1,4 +1,4 @@
1
1
  # coding: utf-8
2
2
  module Loginx
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.1"
4
4
  end
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.2.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-01 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler