photocopier 1.3.0.pre2 → 1.3.0.pre3

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: 8d09179ce249ba612eff1014e10d24e16e7bbb73
4
- data.tar.gz: b631249fc13d03e650aa345bb4e134f4e30e384d
3
+ metadata.gz: 72ba7b1c1780d7ffe28bb8f97ed77abff3b238ff
4
+ data.tar.gz: 6a244dab5dd151d0826eb33e55a0bc3962f1af77
5
5
  SHA512:
6
- metadata.gz: efd9347e0a828d143332be5990b1c949053218470d7a97fc23f73cbf41a48db95baeb0a0a52249802aa89fe26cafcabf56008337d6d2f8138afe736dd7bf8b4f
7
- data.tar.gz: b10c5a142ecafb3e3690efada776cdc4b9bb83c26bf3e9e0e1c76946e3ef2e31afd8594d63607b2ad120de09ba611ab3a011e2e90ec0575bbac3538cbeca49c3
6
+ metadata.gz: 550a1ab3dcfe359ae83010d1901376dd631cd9ae0a338e0ad380a6e4d6e30140ab70054c540bb9a2f03b03a6455aed3d54c015e158e40511467c4757b98ec516
7
+ data.tar.gz: 4560202cb98ce2e947bd1f0d3426fef96c3a63cffc7423ef068bd83edc2d8347c0eda88d6750274b93615c5f3a0b623458529c0a008469d4da3afb48e69d2bb7
@@ -29,6 +29,16 @@ module Photocopier
29
29
  lftp(local_path, remote_path, true, exclude, options[:port])
30
30
  end
31
31
 
32
+ def inferred_port
33
+ if options[:port].nil? && options[:scheme] == 'sftp'
34
+ 22
35
+ elsif options[:port].nil?
36
+ 21
37
+ else
38
+ options[:port]
39
+ end
40
+ end
41
+
32
42
  private
33
43
 
34
44
  def session
@@ -36,25 +46,19 @@ module Photocopier
36
46
  end
37
47
 
38
48
  def lftp(local, remote, reverse, exclude, port = nil)
39
- if port.nil? && options[:scheme] == 'sftp'
40
- port = 22
41
- elsif port.nil?
42
- port = 21
43
- end
44
-
45
49
  remote = Shellwords.escape(remote)
46
50
  local = Shellwords.escape(local)
47
51
  command = [
48
52
  "set ftp:list-options -a",
49
53
  "set cmd:fail-exit true",
50
- "open #{remote_ftp_url}",
54
+ "open -p #{port || inferred_port} #{remote_ftp_url}",
51
55
  "find -d 1 #{remote} || mkdir -p #{remote}",
52
56
  "lcd #{local}",
53
57
  "cd #{remote}",
54
58
  lftp_mirror_arguments(reverse, exclude)
55
59
  ].join("; ")
56
60
 
57
- run "lftp -c '#{command}' -p #{port}"
61
+ run "lftp -c '#{command}'"
58
62
  end
59
63
 
60
64
  def remote_ftp_url
@@ -1,5 +1,5 @@
1
1
  # frozen_string_litterla: true
2
2
 
3
3
  module Photocopier
4
- VERSION = "1.3.0.pre2".freeze
4
+ VERSION = "1.3.0.pre3".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photocopier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.pre2
4
+ version: 1.3.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-07-29 00:00:00.000000000 Z
13
+ date: 2018-07-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport