fastlane-plugin-ftp 0.1.3 → 0.1.5

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
- SHA1:
3
- metadata.gz: 60aa163b9a918ea4347d74b7c0aa665fc90cf886
4
- data.tar.gz: e17c2b0b549d1db17d455c5ea63dc5d55bf11131
2
+ SHA256:
3
+ metadata.gz: 916da35f9e907730547f06ae4c49c140419250865e7fa6a42489c4b5f7df5f20
4
+ data.tar.gz: f8498362699f0394872662590adc738dc0ddf853de5d0c5da2b5eb56f62fc25c
5
5
  SHA512:
6
- metadata.gz: dd46cfa93b590e6f9ad0a5ba08146606f36573f0cbc5788f2e6ceb3178635d795775a661a2777210427155a4df1ee8a10af29ce2b2d9b409428f7a7c0231dde5
7
- data.tar.gz: 92dd1e3d3e4e8186e394e583843c7892fb14e6a83e7292f40b4d51e2ab7de5f34f617f1e42a69d5aff9fadac18d2751ce1c3a1ee8a3971678b2d4be0b085bbb8
6
+ metadata.gz: a82a85af69057161b7320605702ab260b9f99deddd73b49351e5dbc0776efaf20a75d03cb893a8ba9c98c6020e51ca6e57e39418e6fcdf530b536cc0dc39b183
7
+ data.tar.gz: f7fbb9011c7497700f98ebc84c07b30474112abffef48735966a8561061ea0be44f92dc972d976f310d8c7830996ed20e6ad247d9c449f21f8c8eacac0a9e4eb
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # ftp plugin
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-ftp)
4
+ [![Build Status](https://travis-ci.org/PoissonBallon/fastlane-ftp-plugin.svg?branch=master)](https://travis-ci.org/PoissonBallon/fastlane-ftp-plugin)
4
5
 
5
6
  ## Getting Started
6
7
 
@@ -1,139 +1,146 @@
1
+ require 'net/ftp'
2
+ require 'ruby-progressbar'
3
+
1
4
  module Fastlane
2
5
  module Actions
3
6
  class FtpAction < Action
4
7
  def self.run(params)
5
- require 'net/ftp'
8
+
6
9
  if params[:upload]
7
10
  FtpAction.open(params, params[:upload][:dest])
8
11
  FtpAction.put(params)
9
12
  end
13
+
10
14
  if params[:download]
11
15
  FtpAction.get(params)
12
16
  end
13
17
  end
14
18
 
15
19
  def self.open(params, folder)
16
- Net::FTP.open(params[:host], params[:username], params[:password]) do |ftp|
17
- UI.success("Successfully connect to #{params[:host]}")
18
- ftp.passive = true
19
- parts = folder.split("/")
20
- growing_path = ""
21
- parts.each do |part|
22
- growing_path += "/" + part
23
- begin
24
- ftp.chdir(growing_path)
25
- rescue
26
- ftp.mkdir(part) unless File.exist?(growing_path)
27
- retry
28
- end
20
+ ftp = Net::FTP.new
21
+ ftp.connect(params[:host], params[:port])
22
+ ftp.login(params[:username], params[:password])
23
+ ftp.passive = true
24
+ UI.success("Successfully Login to #{params[:host]}:#{params[:port]}")
25
+ parts = folder.split("/")
26
+ growing_path = ""
27
+ parts.each do |part|
28
+ growing_path += "/" + part
29
+ begin
30
+ ftp.chdir(growing_path)
31
+ rescue
32
+ ftp.mkdir(part) unless File.exist?(growing_path)
33
+ retry
29
34
  end
30
- UI.success("FTP move in #{growing_path} on #{params[:host]}")
31
- ftp.close
32
35
  end
36
+ ftp.close()
37
+ UI.success("FTP move in #{growing_path} on #{params[:host]}:#{params[:port]}")
33
38
  end
34
39
 
35
40
  def self.put(params)
36
- Net::FTP.open(params[:host], params[:username], params[:password]) do |ftp|
37
- ftp.passive = true
38
- ftp.chdir(params[:upload][:dest])
39
- transferred = 0
40
- filesize = File.size(params[:upload][:src])
41
- ftp.putbinaryfile(params[:upload][:src], params[:upload][:src].split("/").last) do |data|
42
- transferred += data.size
43
- percent = ((transferred.to_f / filesize.to_f) * 100).to_i
44
- finished = ((transferred.to_f / filesize.to_f) * 30).to_i
45
- not_finished = 30 - finished
46
- print "\r"
47
- print "%3i %" % percent
48
- print "["
49
- finished.downto(1) { |n| print "=" }
50
- print ">"
51
- not_finished.downto(1) { |n| print " " }
52
- print "]"
53
- end
54
- print "\n"
55
- UI.success("Successfully uploaded #{params[:upload][:src]}")
56
- ftp.close
41
+ ftp = Net::FTP.new
42
+ progressbar = ProgressBar.create(:format => '%a |%b>>%i| %p%% %t', :starting_at => 0)
43
+ ftp.connect(params[:host], params[:port])
44
+ ftp.login(params[:username], params[:password])
45
+ ftp.passive = true
46
+ ftp.chdir(params[:upload][:dest])
47
+ filesize = File.size(params[:upload][:src])
48
+ progressbar.total = filesize
49
+ ftp.putbinaryfile(params[:upload][:src], params[:upload][:src].split("/").last) do |data|
50
+ progressbar.progress += data.size
57
51
  end
52
+ ftp.close()
53
+ UI.success("Successfully uploaded #{params[:upload][:src]}")
58
54
  end
59
55
 
60
56
  def self.get(params)
61
- Net::FTP.open(params[:host], params[:username], params[:password]) do |ftp|
62
- ftp.passive = true
63
- ftp.getbinaryfile(params[:download][:src], params[:download][:dest]) do |data|
64
- end
65
- UI.success("Successfully download #{params[:download][:dest]}")
66
- ftp.close
57
+ ftp = Net::FTP.new
58
+ ftp.passive = true
59
+ ftp.connect(params[:host], params[:port])
60
+ ftp.login(params[:username], params[:password])
61
+ UI.success("Successfully Login to #{params[:host]}:#{params[:port]}")
62
+ ftp.getbinaryfile(params[:download][:src], params[:download][:dest]) do |data|
67
63
  end
68
- end
64
+ ftp.close()
65
+ UI.success("Successfully download #{params[:download][:dest]}")
66
+ end
69
67
 
70
- #####################################################
71
- # @!group Documentation
72
- #####################################################
68
+ #####################################################
69
+ # @!group Documentation
70
+ #####################################################
73
71
 
74
- def self.description
75
- "Upload and Download files via FTP"
76
- end
72
+ def self.description
73
+ "Upload and Download files via FTP"
74
+ end
77
75
 
78
- def self.details
79
- # Optional:
80
- # this is your chance to provide a more detailed description of this action
81
- "Transfer files via FTP, and create recursively folder for upload action"
82
- end
76
+ def self.details
77
+ # Optional:
78
+ # this is your chance to provide a more detailed description of this action
79
+ "Transfer files via FTP, and create recursively folder for upload action"
80
+ end
83
81
 
84
- def self.available_options
85
- [
86
- FastlaneCore::ConfigItem.new(key: :username,
87
- short_option: "-u",
88
- env_name: "FL_FTP_USERNAME",
89
- description: "Username",
90
- is_string: true),
91
- FastlaneCore::ConfigItem.new(key: :password,
92
- short_option: "-p",
93
- env_name: "FL_FTP_PASSWORD",
94
- description: "Password",
95
- optional: false,
96
- is_string: true),
97
- FastlaneCore::ConfigItem.new(key: :host,
98
- short_option: "-H",
99
- env_name: "FL_FTP_HOST",
100
- description: "Hostname",
101
- is_string: true),
102
- FastlaneCore::ConfigItem.new(key: :folder,
103
- short_option: "-f",
104
- env_name: "FL_FTP_FOLDER",
105
- description: "repository",
106
- is_string: true),
107
- FastlaneCore::ConfigItem.new(key: :upload,
108
- short_option: "-U",
109
- env_name: "FL_FTP_UPLOAD",
110
- description: "Upload",
111
- optional: true,
112
- is_string: false,
113
- type: Hash),
114
- FastlaneCore::ConfigItem.new(key: :download,
115
- short_option: "-D",
116
- env_name: "FL_FTP_DOWNLOAD",
117
- description: "Download",
118
- optional: true,
119
- is_string: false,
120
- type: Hash),
121
- ]
122
- end
82
+ def self.available_options
83
+ [
84
+ FastlaneCore::ConfigItem.new(key: :username,
85
+ short_option: "-u",
86
+ env_name: "FL_FTP_USERNAME",
87
+ description: "Username",
88
+ is_string: true),
89
+ FastlaneCore::ConfigItem.new(key: :password,
90
+ short_option: "-p",
91
+ env_name: "FL_FTP_PASSWORD",
92
+ description: "Password",
93
+ optional: false,
94
+ is_string: true),
95
+ FastlaneCore::ConfigItem.new(key: :host,
96
+ short_option: "-H",
97
+ env_name: "FL_FTP_HOST",
98
+ description: "Hostname",
99
+ is_string: true),
100
+ FastlaneCore::ConfigItem.new(key: :folder,
101
+ short_option: "-f",
102
+ env_name: "FL_FTP_FOLDER",
103
+ description: "repository",
104
+ is_string: true),
105
+ FastlaneCore::ConfigItem.new(key: :upload,
106
+ short_option: "-U",
107
+ env_name: "FL_FTP_UPLOAD",
108
+ description: "Upload",
109
+ optional: true,
110
+ is_string: false,
111
+ type: Hash),
112
+ FastlaneCore::ConfigItem.new(key: :download,
113
+ short_option: "-D",
114
+ env_name: "FL_FTP_DOWNLOAD",
115
+ description: "Download",
116
+ optional: true,
117
+ is_string: false,
118
+ type: Hash),
123
119
 
124
- def self.output
125
- end
120
+ FastlaneCore::ConfigItem.new(key: :port,
121
+ short_option: "-P",
122
+ env_name: "FL_FTP_PORT",
123
+ description: "Port",
124
+ optional: true,
125
+ default_value: 21,
126
+ is_string: false,
127
+ type: Integer),
128
+ ]
129
+ end
126
130
 
127
- def self.return_value
128
- end
131
+ def self.output
132
+ end
129
133
 
130
- def self.authors
131
- ["Allan Vialatte"]
132
- end
134
+ def self.return_value
135
+ end
133
136
 
134
- def self.is_supported?(platform)
135
- true
136
- end
137
+ def self.authors
138
+ ["Allan Vialatte"]
139
+ end
140
+
141
+ def self.is_supported?(platform)
142
+ true
137
143
  end
138
144
  end
139
145
  end
146
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Ftp
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-ftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allan Vialatte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-progressbar
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: pry
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 1.95.0
103
+ version: 2.2.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 1.95.0
110
+ version: 2.2.0
97
111
  description:
98
112
  email: allan.vialatte@icloud.com
99
113
  executables: []
@@ -125,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
139
  - !ruby/object:Gem::Version
126
140
  version: '0'
127
141
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.5.1
142
+ rubygems_version: 3.0.3
130
143
  signing_key:
131
144
  specification_version: 4
132
145
  summary: Simple ftp upload and download for Fastlane