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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b82f64f09f258cb58e9e40523c40f3deaaedb8f5
4
- data.tar.gz: 9ad5ae0673d36a64640c42b03525b036430f3191
3
+ metadata.gz: '0724069ef55a0e43e228572d1657c7f77b18555f'
4
+ data.tar.gz: d6c2363ec32dc697dafebc14f7d052a197b9968e
5
5
  SHA512:
6
- metadata.gz: 8e94c2b290c00bd8fc0f180da72060e7c6270e764d46547b646da049ed75e338118bbd98b9ebb5a1532b953d1c99302e28195ae7b36a9d604aca48ec8e7ba282
7
- data.tar.gz: 1b7ad392d249f0dee55ec5fb24bc62814913aa737c3e071280380f63d476846ca8a182cebe6deeaaaa13644fa19fb7afe1492338d966087f60990ac9a084b9c5
6
+ metadata.gz: 325592396743860e8ffcf10145608b72cc7f393bf30fddfda907553c8610f68ca2285a62128e0f23a0df95204e48a1fdd61ed891adc4aed757959d16aed046a2
7
+ data.tar.gz: bbe3c156bd7389e9fb38ad0ab6af144c6a99e49d667e8e583f7b0b4fc66775386312979d6fbde6983feb0fbbd77ab728de7197255c013645381f43ae3e2fd92a
@@ -1,3 +1,3 @@
1
1
  module ThecoreFtpHelpers
2
- VERSION = '1.1.24'
2
+ VERSION = '1.1.25'
3
3
  end
@@ -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
- files = ftp.list(pattern)
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}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ftp_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.24
4
+ version: 1.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni