fastlane-plugin-sftp 1.1.0 → 1.2.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3b2c8f4ce3e0604fc61cc5098dec0ae3d979d8d5e9fbdceb46e57386774bff3
|
4
|
+
data.tar.gz: 472bb98699439418ed7418ffcdb48031fb469fe52dffa7cb60fff755d70100ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a129525e9c2031755cbcff56fdef2195440eb0223e0588c869f83773359ac29f141d7088c4dbe04102adcf6e3512e78a5f1d4daf56a69f526939da8f1f47f6
|
7
|
+
data.tar.gz: 5a3c3dbaa36e97cebd02105dcee4f346b3815632dcc45a5d7a432279daa2d6ccc2922dcb5885c29f1482ad5361eb9be71c6a99c9922fbc171d6e047be1d5bea0
|
@@ -67,6 +67,15 @@ module Fastlane
|
|
67
67
|
def self.available_options_upload
|
68
68
|
return [].concat(general_options).concat(
|
69
69
|
[
|
70
|
+
FastlaneCore::ConfigItem.new(
|
71
|
+
key: :delete_target_dir,
|
72
|
+
short_option: '-b',
|
73
|
+
optional: true,
|
74
|
+
env_name: 'DELETE_TARGET_DIR',
|
75
|
+
type: Boolean,
|
76
|
+
description: 'Specify, if an existing target folder should be deleted prior to uploading files',
|
77
|
+
default_value: false
|
78
|
+
),
|
70
79
|
FastlaneCore::ConfigItem.new(
|
71
80
|
key: :target_dir,
|
72
81
|
short_option: '-x',
|
@@ -90,6 +90,37 @@ module Fastlane
|
|
90
90
|
UI.user_error!("remote folder #{remote_path} does not exist and could not be created") unless folder_exists
|
91
91
|
end
|
92
92
|
|
93
|
+
def self.remote_rmdir(sftp, remote_path)
|
94
|
+
return unless remote_dir_exists?(sftp, remote_path)
|
95
|
+
|
96
|
+
# make sure the remote directory is empty
|
97
|
+
sftp.dir.entries(remote_path).each do |entry|
|
98
|
+
next if entry.name == "." || entry.name == ".."
|
99
|
+
|
100
|
+
path_value = remote_path + File::SEPARATOR + entry.name
|
101
|
+
UI.message("entry #{path_value}")
|
102
|
+
begin
|
103
|
+
if entry.directory?
|
104
|
+
remote_rmdir(sftp, path_value)
|
105
|
+
else
|
106
|
+
sftp.remove!(path_value)
|
107
|
+
end
|
108
|
+
rescue Net::SFTP::StatusException => e
|
109
|
+
UI.user_error!("could not delete file #{path_value}: #{e.message}")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
begin
|
114
|
+
sftp.rmdir!(remote_path)
|
115
|
+
rescue Net::SFTP::StatusException => e
|
116
|
+
UI.user_error!("Could not delete remote directory #{remote_path}: #{e.message}")
|
117
|
+
end
|
118
|
+
|
119
|
+
# check for existence again
|
120
|
+
folder_exists = remote_dir_exists?(sftp, remote_path)
|
121
|
+
UI.user_error!("remote folder #{remote_path} still exists after deletion") if folder_exists
|
122
|
+
end
|
123
|
+
|
93
124
|
def self.remote_dir_exists?(sftp, remote_path)
|
94
125
|
UI.message("Checking remote directory #{remote_path}")
|
95
126
|
attrs = sftp.stat!(remote_path)
|
@@ -25,6 +25,7 @@ module Fastlane
|
|
25
25
|
attr_accessor :target_dir
|
26
26
|
attr_accessor :root_path
|
27
27
|
attr_accessor :files
|
28
|
+
attr_accessor :delete_target_dir
|
28
29
|
|
29
30
|
def initialize(options)
|
30
31
|
self.options = options unless options.nil?
|
@@ -36,6 +37,7 @@ module Fastlane
|
|
36
37
|
self.rsa_keypath_passphrase = options[:server_key_passphrase]
|
37
38
|
self.files = options[:file_paths]
|
38
39
|
self.target_dir = options[:target_dir]
|
40
|
+
self.delete_target_dir = options[:delete_target_dir]
|
39
41
|
end
|
40
42
|
|
41
43
|
#
|
@@ -50,6 +52,7 @@ module Fastlane
|
|
50
52
|
UI.message('Uploading files...')
|
51
53
|
|
52
54
|
session.sftp.connect do |sftp|
|
55
|
+
Helper::SftpHelper.remote_rmdir(sftp, target_dir) if delete_target_dir
|
53
56
|
Helper::SftpHelper.remote_mkdir(sftp, target_dir)
|
54
57
|
uploads = []
|
55
58
|
files.each do |file|
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-sftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Limberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.1'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 5.1.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5.1'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 5.1.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: net-sftp
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,8 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: '0'
|
255
255
|
requirements: []
|
256
|
-
|
257
|
-
rubygems_version: 2.5.2.3
|
256
|
+
rubygems_version: 3.0.3
|
258
257
|
signing_key:
|
259
258
|
specification_version: 4
|
260
259
|
summary: Plugin to upload files via SFTP
|