fastlane-plugin-ftps 0.1.20 → 0.1.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4c1a6c9e85fb0190557d1942eb350eb7047cb8f08dd125ef32813d92e56be74
4
- data.tar.gz: faf1d87828c3ad8fac45731ea32dbefba80fd29a1c4784c0872c26e122ba3b06
3
+ metadata.gz: a02ea6c22ea4bc5911b711048a7c7d8bb6ded8cf2449398d5c87f8f35a4bd98d
4
+ data.tar.gz: e6b101846d991725b14cd9202ac409348ebb7c431ccb842d68f6b0431f66ad98
5
5
  SHA512:
6
- metadata.gz: 7575a424af5a8352f3eed74f0f4338c44591251374585b93d9f1d88238b15ba0ee26250ea9a32744ebe0e1b9534872916dc3f858cab11b62609488a09368d7e7
7
- data.tar.gz: d2f489f74074428db085949b464c217bd133f8c5c7d7fa6b0cc55ad974b905f33114fdb1b5863e607e8c7632843896ac7336f3df06c5db78e8771788ce70d406
6
+ metadata.gz: 35864cbb68b6c7a4f80b257f11f67e580bb3cbc46b195f44ed0c60ca00d32d227faaf116a6fae97ac3dbc4c9b8c2b0988cbba9657aaf9c047963e7ab483c3c17
7
+ data.tar.gz: 182213b47348ad2b9bc86a92a475616c3691ca38d8a7885e3399c1d2c19fc2c6024f48d10b522619903ee1a4e48a3b47a08ffd67e634f59db2d0deacb2d2679d
@@ -5,18 +5,13 @@ 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
- if params[:download]
18
- FtpsAction.get(params)
19
- end
12
+ return unless params[:download]
13
+
14
+ FtpsAction.get(params)
20
15
  end
21
16
 
22
17
  def ensure_remote_path(ftp, folder)
@@ -25,7 +20,7 @@ module Fastlane
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
- ftp = open(params)
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("/").last) do |data|
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
- end
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
- def self.upload_multiple(params)
77
- ftp = connect_ftp(params)
78
-
79
- # Upewniamy się, że ścieżka (folder) do której wgrywamy istnieje.
80
- base_file_path = params[:upload_multiple][:base_file_path]
81
- file_paths = params[:upload_multiple][:src]
82
-
83
- ensure_remote_path(ftp, params[:upload_multiple][:dest])
84
-
85
- total_size = file_paths.reduce(0) { |sum, file_path| sum + File.size(file_path) }
86
- progressbar = ProgressBar.create(
87
- format: '%a |%b>>%i| %p%% %t',
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
- ensure_remote_path(ftp, remote_path)
106
- ftp.chdir(remote_path)
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
- # @!group Documentation
117
- #####################################################
108
+ #####################################################
109
+ # @!group Documentation
110
+ #####################################################
118
111
 
119
- def self.description
120
- "Upload and Download files via FTP"
121
- end
112
+ def self.description
113
+ 'Upload and Download files via FTP'
114
+ end
122
115
 
123
- def self.details
124
- # Optional:
125
- # this is your chance to provide a more detailed description of this action
126
- "Transfer files via FTP, and create recursively folder for upload action"
127
- end
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
- def self.available_options
130
- [
131
- FastlaneCore::ConfigItem.new(key: :username,
132
- short_option: "-u",
133
- env_name: "FL_FTP_USERNAME",
134
- description: "Username",
135
- is_string: true),
136
- FastlaneCore::ConfigItem.new(key: :password,
137
- short_option: "-p",
138
- env_name: "FL_FTP_PASSWORD",
139
- description: "Password",
140
- optional: false,
141
- is_string: true),
142
- FastlaneCore::ConfigItem.new(key: :host,
143
- short_option: "-H",
144
- env_name: "FL_FTP_HOST",
145
- description: "Hostname",
146
- is_string: true),
147
- FastlaneCore::ConfigItem.new(key: :folder,
148
- short_option: "-f",
149
- env_name: "FL_FTP_FOLDER",
150
- description: "repository",
151
- is_string: true),
152
- FastlaneCore::ConfigItem.new(key: :upload,
153
- short_option: "-U",
154
- env_name: "FL_FTP_UPLOAD",
155
- description: "Upload",
156
- optional: true,
157
- is_string: false,
158
- type: Hash),
159
- FastlaneCore::ConfigItem.new(key: :upload_multiple,
160
- short_option: "-I",
161
- env_name: "FL_FTP_UPLOAD_MULTIPLE",
162
- description: "Upload",
163
- optional: true,
164
- is_string: false,
165
- type: Hash),
166
- FastlaneCore::ConfigItem.new(key: :download,
167
- short_option: "-D",
168
- env_name: "FL_FTP_DOWNLOAD",
169
- description: "Download",
170
- optional: true,
171
- is_string: false,
172
- type: Hash),
173
- FastlaneCore::ConfigItem.new(key: :options,
174
- short_option: "-O",
175
- env_name: "FL_FTP_OPTIONS",
176
- description: "options",
177
- optional: true,
178
- is_string: false,
179
- type: Hash),
180
- FastlaneCore::ConfigItem.new(key: :port,
181
- short_option: "-P",
182
- env_name: "FL_FTP_PORT",
183
- description: "Port",
184
- optional: true,
185
- default_value: 21,
186
- is_string: false,
187
- type: Integer),
188
- ]
189
- end
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
- def self.output
192
- end
184
+ def self.output; end
193
185
 
194
- def self.return_value
195
- end
186
+ def self.return_value; end
196
187
 
197
- def self.authors
198
- ["Allan Vialatte, Rafał Dziuryk"]
199
- end
188
+ def self.authors
189
+ ['Allan Vialatte, Rafał Dziuryk']
190
+ end
200
191
 
201
- def self.is_supported?(platform)
202
- true
192
+ def self.is_supported?(_platform)
193
+ true
194
+ end
203
195
  end
204
196
  end
205
197
  end
206
- end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Ftps
3
- VERSION = "0.1.20"
3
+ VERSION = '0.1.21'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-ftps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Dziuryk