Class: Fastlane::Actions::FtpAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FtpAction
- Defined in:
- lib/fastlane/plugin/ftp/actions/ftp_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
137 138 139 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 137 def self. ["Allan Vialatte"] end |
.available_options ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 82 def self. [ FastlaneCore::ConfigItem.new(key: :username, short_option: "-u", env_name: "FL_FTP_USERNAME", description: "Username", is_string: true), FastlaneCore::ConfigItem.new(key: :password, short_option: "-p", env_name: "FL_FTP_PASSWORD", description: "Password", optional: false, is_string: true), FastlaneCore::ConfigItem.new(key: :host, short_option: "-H", env_name: "FL_FTP_HOST", description: "Hostname", is_string: true), FastlaneCore::ConfigItem.new(key: :folder, short_option: "-f", env_name: "FL_FTP_FOLDER", description: "repository", is_string: true), FastlaneCore::ConfigItem.new(key: :upload, short_option: "-U", env_name: "FL_FTP_UPLOAD", description: "Upload", optional: true, is_string: false, type: Hash), FastlaneCore::ConfigItem.new(key: :download, short_option: "-D", env_name: "FL_FTP_DOWNLOAD", description: "Download", optional: true, is_string: false, type: Hash), FastlaneCore::ConfigItem.new(key: :port, short_option: "-P", env_name: "FL_FTP_PORT", description: "Port", optional: true, default_value: 21, is_string: false, type: Integer), ] end |
.description ⇒ Object
72 73 74 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 72 def self.description "Upload and Download files via FTP" end |
.details ⇒ Object
76 77 78 79 80 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 76 def self.details # Optional: # this is your chance to provide a more detailed description of this action "Transfer files via FTP, and create recursively folder for upload action" end |
.get(params) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 56 def self.get(params) ftp = Net::FTP.new ftp.passive = true ftp.connect(params[:host], params[:port]) ftp.login(params[:username], params[:password]) UI.success("Successfully Login to #{params[:host]}:#{params[:port]}") ftp.getbinaryfile(params[:download][:src], params[:download][:dest]) do |data| end ftp.close() UI.success("Successfully download #{params[:download][:dest]}") end |
.is_supported?(platform) ⇒ Boolean
141 142 143 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 141 def self.is_supported?(platform) true end |
.open(params, folder) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 19 def self.open(params, folder) ftp = Net::FTP.new ftp.connect(params[:host], params[:port]) ftp.login(params[:username], params[:password]) ftp.passive = true UI.success("Successfully Login to #{params[:host]}:#{params[:port]}") parts = folder.split("/") growing_path = "" parts.each do |part| growing_path += "/" + part begin ftp.chdir(growing_path) rescue ftp.mkdir(part) unless File.exist?(growing_path) retry end end ftp.close() UI.success("FTP move in #{growing_path} on #{params[:host]}:#{params[:port]}") end |
.output ⇒ Object
131 132 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 131 def self.output end |
.put(params) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 40 def self.put(params) ftp = Net::FTP.new = ProgressBar.create(:format => '%a |%b>>%i| %p%% %t', :starting_at => 0) ftp.connect(params[:host], params[:port]) ftp.login(params[:username], params[:password]) ftp.passive = true ftp.chdir(params[:upload][:dest]) filesize = File.size(params[:upload][:src]) .total = filesize ftp.putbinaryfile(params[:upload][:src], params[:upload][:src].split("/").last) do |data| .progress += data.size end ftp.close() UI.success("Successfully uploaded #{params[:upload][:src]}") end |
.return_value ⇒ Object
134 135 |
# File 'lib/fastlane/plugin/ftp/actions/ftp_action.rb', line 134 def self.return_value end |