ssh_smart 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -1
- data/lib/ssh_smart.rb +12 -14
- data/lib/ssh_smart/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b93ba06c0a7bfe763f1a498d6e20c645729ba536aa290452b5ddfa9f84d889e
|
4
|
+
data.tar.gz: d53345e99fc58b3c2beab0d5df431b4f5706be468d6b2c1e4af2a4e574f8820e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82483b25f112e99ed91e4a29ef231971cf40b4a90be0acd82f6d5f2ad4eb08854218df4b879ff2d5f812a8d40a155a3c68ef9a516123a2920a32b902438add5f
|
7
|
+
data.tar.gz: dba9aa9b32979b197f70e2cbcb29d4af19a471c9c90b9a7c7a32704c438a498ee5e1a0add6fb4a3e1489723797ec9e2fc4ea66d8f75fa2b8aed616c01dd1c64f
|
data/Gemfile
CHANGED
data/lib/ssh_smart.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ssh_smart/version'
|
4
|
+
require 'net/scp'
|
5
|
+
require 'net/ssh'
|
4
6
|
|
5
7
|
class SSH
|
6
8
|
attr_accessor :host, :login, :password, :inbox, :work, :outbox
|
@@ -16,29 +18,25 @@ class SSH
|
|
16
18
|
|
17
19
|
def copyFileToRemote(fileRemote)
|
18
20
|
method = false
|
19
|
-
Net::SCP.start(@host, @login, :
|
21
|
+
Net::SCP.start(@host, @login, password: @password) do |scp|
|
20
22
|
scp.upload(fileRemote, @inbox)
|
21
23
|
end
|
22
|
-
if checkFolderFile(@outbox, File.basename(fileRemote))
|
23
|
-
method = true
|
24
|
-
end
|
24
|
+
method = true if checkFolderFile(@outbox, File.basename(fileRemote))
|
25
25
|
method
|
26
26
|
end
|
27
27
|
|
28
28
|
def checkFolderFile(dirFile, fileName)
|
29
29
|
returnMethod = false
|
30
|
-
result =
|
30
|
+
result = ''
|
31
31
|
method = false
|
32
|
-
Net::SSH.start(@host, @login, :
|
32
|
+
Net::SSH.start(@host, @login, password: @password) do |ssh|
|
33
33
|
result = ssh.exec!("cd #{dirFile} && ls")
|
34
34
|
end
|
35
|
-
if result.include? fileName
|
36
|
-
method = true
|
37
|
-
end
|
35
|
+
method = true if result.include? fileName
|
38
36
|
method
|
39
37
|
end
|
40
|
-
|
38
|
+
|
41
39
|
def retornar
|
42
|
-
|
40
|
+
puts 'Funcionando!!'
|
43
41
|
end
|
44
42
|
end
|
data/lib/ssh_smart/version.rb
CHANGED