fastlane-plugin-ftps 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/ftps/actions/ftps_action.rb +129 -138
- data/lib/fastlane/plugin/ftps/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: 6b4706fd9df654fc7546125d88af5baa2b84182605849e027d40974abb64995f
|
4
|
+
data.tar.gz: 97b4fd28d32452fb85429e2620f64afd4eb91136853c7232f5ef55d230668e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3511691f826bf2a415a64ec998f14089f5768ef47c3d0fcd29b06d4eddcd072cc7cf9efd41beccc79d7ad5c6311956788c556878433ec2107ee15d8a70fda18d
|
7
|
+
data.tar.gz: 934928de126bb6551db73c0ac5d921ddda8a3bdc47f30bae4da076034dc47357c753f1119e69c2fcc62e9707d1a63e2bfaaf229e8d26b1997ead077d9712d0e0
|
@@ -5,27 +5,22 @@ module Fastlane
|
|
5
5
|
module Actions
|
6
6
|
class FtpsAction < Action
|
7
7
|
def self.run(params)
|
8
|
-
|
9
|
-
if params[:upload]
|
10
|
-
FtpsAction.put(params)
|
11
|
-
end
|
8
|
+
FtpsAction.put(params) if params[:upload]
|
12
9
|
|
13
|
-
if params[:upload_multiple]
|
14
|
-
FtpsAction.upload_multiple(params)
|
15
|
-
end
|
10
|
+
FtpsAction.upload_multiple(params) if params[:upload_multiple]
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
return unless params[:download]
|
13
|
+
|
14
|
+
FtpsAction.get(params)
|
20
15
|
end
|
21
16
|
|
22
|
-
def ensure_remote_path(ftp, folder)
|
17
|
+
def self.ensure_remote_path(ftp, folder)
|
23
18
|
parts = folder.split('/')
|
24
19
|
current_path = ''
|
25
20
|
parts.each do |part|
|
26
21
|
# Pomijamy puste elementy (np. jeśli folder zaczyna się od '/')
|
27
22
|
next if part.empty?
|
28
|
-
|
23
|
+
|
29
24
|
current_path = "#{current_path}/#{part}"
|
30
25
|
begin
|
31
26
|
ftp.chdir(current_path)
|
@@ -34,13 +29,11 @@ module Fastlane
|
|
34
29
|
ftp.chdir(current_path)
|
35
30
|
end
|
36
31
|
end
|
37
|
-
end
|
32
|
+
end
|
38
33
|
|
39
34
|
def self.connect_ftp(params)
|
40
|
-
|
41
|
-
ftp
|
35
|
+
open(params)
|
42
36
|
end
|
43
|
-
|
44
37
|
|
45
38
|
def self.open(params)
|
46
39
|
ftp = Net::FTP.new(params[:host], params[:options])
|
@@ -55,12 +48,12 @@ module Fastlane
|
|
55
48
|
ftp = connect_ftp(params)
|
56
49
|
ensure_remote_path(ftp, params[:upload][:dest])
|
57
50
|
ftp.chdir(params[:upload][:dest])
|
58
|
-
filesize = File.size(params[:upload][:src])
|
51
|
+
filesize = File.size(params[:upload][:src])
|
59
52
|
progressbar.total = filesize
|
60
|
-
ftp.putbinaryfile(params[:upload][:src], params[:upload][:src].split(
|
53
|
+
ftp.putbinaryfile(params[:upload][:src], params[:upload][:src].split('/').last) do |data|
|
61
54
|
progressbar.progress += data.size
|
62
55
|
end
|
63
|
-
ftp.close
|
56
|
+
ftp.close
|
64
57
|
UI.success("Successfully uploaded #{params[:upload][:src]}")
|
65
58
|
end
|
66
59
|
|
@@ -69,138 +62,136 @@ module Fastlane
|
|
69
62
|
UI.success("Successfully Login to #{params[:host]}:#{params[:port]}")
|
70
63
|
ftp.getbinaryfile(params[:download][:src], params[:download][:dest]) do |data|
|
71
64
|
end
|
72
|
-
ftp.close
|
65
|
+
ftp.close
|
73
66
|
UI.success("Successfully download #{params[:download][:dest]}")
|
74
|
-
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.upload_multiple(params)
|
70
|
+
ftp = connect_ftp(params)
|
71
|
+
|
72
|
+
# Upewniamy się, że ścieżka (folder) do której wgrywamy istnieje.
|
73
|
+
base_file_path = params[:upload_multiple][:base_file_path]
|
74
|
+
file_paths = params[:upload_multiple][:src]
|
75
|
+
|
76
|
+
ensure_remote_path(ftp, params[:upload_multiple][:dest])
|
77
|
+
|
78
|
+
total_size = file_paths.reduce(0) { |sum, file_path| sum + File.size(file_path) }
|
79
|
+
progressbar = ProgressBar.create(
|
80
|
+
format: '%a |%b>>%i| %p%% %t',
|
81
|
+
total: total_size,
|
82
|
+
starting_at: 0
|
83
|
+
)
|
84
|
+
|
85
|
+
file_paths.each do |local_file|
|
86
|
+
relative_path = local_file.sub(%r{\A#{Regexp.escape(base_file_path)}/?}, '')
|
87
|
+
dir_name = File.dirname(relative_path)
|
88
|
+
file_name = File.basename(relative_path)
|
75
89
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
total: total_size,
|
89
|
-
starting_at: 0
|
90
|
-
)
|
91
|
-
|
92
|
-
file_paths.each do |local_file|
|
93
|
-
relative_path = local_file.sub(%r{\A#{Regexp.escape(base_file_path)}/?}, '')
|
94
|
-
dir_name = File.dirname(relative_path)
|
95
|
-
file_name = File.basename(relative_path)
|
96
|
-
|
97
|
-
dir_name = "" if dir_name == "."
|
98
|
-
|
99
|
-
remote_path = if dir_name.empty?
|
100
|
-
remote_base
|
101
|
-
else
|
102
|
-
File.join(remote_base, dir_name)
|
90
|
+
dir_name = '' if dir_name == '.'
|
91
|
+
|
92
|
+
remote_path = if dir_name.empty?
|
93
|
+
remote_base
|
94
|
+
else
|
95
|
+
File.join(remote_base, dir_name)
|
96
|
+
end
|
97
|
+
|
98
|
+
ensure_remote_path(ftp, remote_path)
|
99
|
+
ftp.chdir(remote_path)
|
100
|
+
ftp.putbinaryfile(local_file, file_name)
|
101
|
+
UI.message("Uploaded #{local_file} -> #{File.join(remote_path, file_name)}")
|
103
102
|
end
|
104
103
|
|
105
|
-
|
106
|
-
|
107
|
-
ftp.putbinaryfile(local_file, file_name)
|
108
|
-
UI.message("Uploaded #{local_file} -> #{File.join(remote_path, file_name)}")
|
104
|
+
ftp.close
|
105
|
+
UI.success("Successfully uploaded all files to #{params[:upload][:dest]}")
|
109
106
|
end
|
110
|
-
|
111
|
-
ftp.close
|
112
|
-
UI.success("Successfully uploaded all files to #{params[:upload][:dest]}")
|
113
|
-
end
|
114
107
|
|
115
|
-
|
116
|
-
|
117
|
-
|
108
|
+
#####################################################
|
109
|
+
# @!group Documentation
|
110
|
+
#####################################################
|
118
111
|
|
119
|
-
|
120
|
-
|
121
|
-
|
112
|
+
def self.description
|
113
|
+
'Upload and Download files via FTP'
|
114
|
+
end
|
122
115
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
116
|
+
def self.details
|
117
|
+
# Optional:
|
118
|
+
# this is your chance to provide a more detailed description of this action
|
119
|
+
'Transfer files via FTP, and create recursively folder for upload action'
|
120
|
+
end
|
128
121
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
122
|
+
def self.available_options
|
123
|
+
[
|
124
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
125
|
+
short_option: '-u',
|
126
|
+
env_name: 'FL_FTP_USERNAME',
|
127
|
+
description: 'Username',
|
128
|
+
is_string: true),
|
129
|
+
FastlaneCore::ConfigItem.new(key: :password,
|
130
|
+
short_option: '-p',
|
131
|
+
env_name: 'FL_FTP_PASSWORD',
|
132
|
+
description: 'Password',
|
133
|
+
optional: false,
|
134
|
+
is_string: true),
|
135
|
+
FastlaneCore::ConfigItem.new(key: :host,
|
136
|
+
short_option: '-H',
|
137
|
+
env_name: 'FL_FTP_HOST',
|
138
|
+
description: 'Hostname',
|
139
|
+
is_string: true),
|
140
|
+
FastlaneCore::ConfigItem.new(key: :folder,
|
141
|
+
short_option: '-f',
|
142
|
+
env_name: 'FL_FTP_FOLDER',
|
143
|
+
description: 'repository',
|
144
|
+
is_string: true),
|
145
|
+
FastlaneCore::ConfigItem.new(key: :upload,
|
146
|
+
short_option: '-U',
|
147
|
+
env_name: 'FL_FTP_UPLOAD',
|
148
|
+
description: 'Upload',
|
149
|
+
optional: true,
|
150
|
+
is_string: false,
|
151
|
+
type: Hash),
|
152
|
+
FastlaneCore::ConfigItem.new(key: :upload_multiple,
|
153
|
+
short_option: '-I',
|
154
|
+
env_name: 'FL_FTP_UPLOAD_MULTIPLE',
|
155
|
+
description: 'Upload',
|
156
|
+
optional: true,
|
157
|
+
is_string: false,
|
158
|
+
type: Hash),
|
159
|
+
FastlaneCore::ConfigItem.new(key: :download,
|
160
|
+
short_option: '-D',
|
161
|
+
env_name: 'FL_FTP_DOWNLOAD',
|
162
|
+
description: 'Download',
|
163
|
+
optional: true,
|
164
|
+
is_string: false,
|
165
|
+
type: Hash),
|
166
|
+
FastlaneCore::ConfigItem.new(key: :options,
|
167
|
+
short_option: '-O',
|
168
|
+
env_name: 'FL_FTP_OPTIONS',
|
169
|
+
description: 'options',
|
170
|
+
optional: true,
|
171
|
+
is_string: false,
|
172
|
+
type: Hash),
|
173
|
+
FastlaneCore::ConfigItem.new(key: :port,
|
174
|
+
short_option: '-P',
|
175
|
+
env_name: 'FL_FTP_PORT',
|
176
|
+
description: 'Port',
|
177
|
+
optional: true,
|
178
|
+
default_value: 21,
|
179
|
+
is_string: false,
|
180
|
+
type: Integer)
|
181
|
+
]
|
182
|
+
end
|
190
183
|
|
191
|
-
|
192
|
-
end
|
184
|
+
def self.output; end
|
193
185
|
|
194
|
-
|
195
|
-
end
|
186
|
+
def self.return_value; end
|
196
187
|
|
197
|
-
|
198
|
-
|
199
|
-
|
188
|
+
def self.authors
|
189
|
+
['Allan Vialatte, Rafał Dziuryk']
|
190
|
+
end
|
200
191
|
|
201
|
-
|
202
|
-
|
192
|
+
def self.is_supported?(_platform)
|
193
|
+
true
|
194
|
+
end
|
203
195
|
end
|
204
196
|
end
|
205
197
|
end
|
206
|
-
end
|