thecore_ftp_helpers 1.1.24 → 1.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thecore_ftp_helpers/version.rb +1 -1
- data/lib/thecore_ftp_helpers.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0724069ef55a0e43e228572d1657c7f77b18555f'
|
4
|
+
data.tar.gz: d6c2363ec32dc697dafebc14f7d052a197b9968e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 325592396743860e8ffcf10145608b72cc7f393bf30fddfda907553c8610f68ca2285a62128e0f23a0df95204e48a1fdd61ed891adc4aed757959d16aed046a2
|
7
|
+
data.tar.gz: bbe3c156bd7389e9fb38ad0ab6af144c6a99e49d667e8e583f7b0b4fc66775386312979d6fbde6983feb0fbbd77ab728de7197255c013645381f43ae3e2fd92a
|
data/lib/thecore_ftp_helpers.rb
CHANGED
@@ -10,11 +10,19 @@ module ThecoreFtpHelpers
|
|
10
10
|
def self.list_most_recent_file address, username, password, directory, pattern, close = true, from = nil
|
11
11
|
puts "Connecting to FTP"
|
12
12
|
ftp = Net::FTP.open address, username, password
|
13
|
-
ftp.passive = false
|
13
|
+
# ftp.passive = false
|
14
14
|
puts "Entering directory: #{directory}"
|
15
15
|
ftp.chdir(directory)
|
16
16
|
puts "Listing all files which respond to this pattern: #{pattern}"
|
17
|
-
|
17
|
+
begin
|
18
|
+
files = ftp.nlist(pattern)
|
19
|
+
rescue => exception
|
20
|
+
# If we are here, maybe it's beacause of passive mode and the network too secure
|
21
|
+
# let's switch to active mode and try again
|
22
|
+
ftp.passive = false
|
23
|
+
files = ftp.nlist(pattern)
|
24
|
+
end
|
25
|
+
|
18
26
|
puts "Last import time: #{from.strftime('%Y-%m-%d %H:%M:%S.%N')}"
|
19
27
|
files = files.select {|f|
|
20
28
|
puts "For file: #{f}"
|