Class: Fastlane::Apprepo::Uploader
- Inherits:
-
Object
- Object
- Fastlane::Apprepo::Uploader
- Defined in:
- lib/fastlane/plugin/apprepo/uploader.rb,
lib/fastlane/plugin/apprepo/helper/uploader.rb
Overview
Responsible for performing the SFTP operation
Instance Attribute Summary collapse
-
#appcode ⇒ Object
Returns the value of attribute appcode.
-
#host ⇒ Object
These want to be an input parameters:.
-
#ipa_path ⇒ Object
Returns the value of attribute ipa_path.
-
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
-
#options ⇒ Object
Returns the value of attribute options.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#rsa_keypath ⇒ Object
Returns the value of attribute rsa_keypath.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#download_manifest_only ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
-
#initialize(options) ⇒ Uploader
constructor
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
-
#upload ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(options) ⇒ Uploader
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 35 def initialize() self. = unless .nil? self.host = [:repo_url] self.port = [:repo_port] self.user = [:repo_user] self.password = [:repo_password] self.rsa_keypath = [:repo_key] # '../assets/circle.key' self.ipa_path = [:ipa] # '../sampleapp.ipa' self.manifest_path = [:manifest_path] # '../assets/example_manifest.json' self.appcode = [:appcode] # Apprepo::Uploader.new.run! # FastlaneCore::PrintTable.print_values(config: nil , hide_keys: [:app], # mask_keys: ['app_review_information.demo_password'], # title: "deliver #{Apprepo::VERSION} Summary") # options end |
Instance Attribute Details
#appcode ⇒ Object
Returns the value of attribute appcode.
31 32 33 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 31 def appcode @appcode end |
#host ⇒ Object
These want to be an input parameters:
24 25 26 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 24 def host @host end |
#ipa_path ⇒ Object
Returns the value of attribute ipa_path.
29 30 31 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 29 def ipa_path @ipa_path end |
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
30 31 32 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 30 def manifest_path @manifest_path end |
#options ⇒ Object
Returns the value of attribute options.
18 19 20 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 18 def @options end |
#password ⇒ Object
Returns the value of attribute password.
27 28 29 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 27 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
25 26 27 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 25 def port @port end |
#rsa_keypath ⇒ Object
Returns the value of attribute rsa_keypath.
28 29 30 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 28 def rsa_keypath @rsa_keypath end |
#user ⇒ Object
Returns the value of attribute user.
26 27 28 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 26 def user @user end |
Instance Method Details
#download_manifest_only ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 97 def download_manifest_only FastlaneCore::UI.('download_manifest_only...') rsa_key = load_rsa_key(rsa_keypath) success = true if !rsa_key.nil? FastlaneCore::UI.('Logging in with RSA key for download...') Net::SSH.start(host, user, port: port, key_data: rsa_key, keys_only: true) do |ssh| FastlaneCore::UI.('Uploading UPA & Manifest...') success = ssh_sftp_download(ssh, manifest_path) end else FastlaneCore::UI.('Logging in for download...') Net::SSH.start(host, user, port: port, password: password) do |ssh| FastlaneCore::UI.('Uploading UPA & Manifest...') success = ssh_sftp_download(ssh, manifest_path) end end success end |
#upload ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fastlane/plugin/apprepo/uploader.rb', line 58 def upload # Login & Upload IPA with metadata using RSA key or username/password FastlaneCore::UI.('upload...') if host.nil? || user.nil? FastlaneCore::UI.user_error('repo_url, repo_port, repo_user and repo_password or repo_key must be set on upload') return false end if rsa_keypath rsa_key = load_rsa_key(rsa_keypath) if rsa_key.nil? FastlaneCore::UI.user_error('Failed to load RSA key... ' + [:rsa_keypath]) end end success = false if !rsa_key.nil? FastlaneCore::UI.('Logging in with RSA key...') Net::SSH.start(host, user, port: port, key_data: rsa_key, keys_only: true) do |ssh| FastlaneCore::UI.('Uploading IPA & Manifest...') success = ssh_sftp_upload(ssh, ipa_path, manifest_path) end else FastlaneCore::UI.('Logging in with username/password...') Net::SSH.start(host, user, port: port, password: password) do |ssh| FastlaneCore::UI.('Uploading IPA & Manifest...') success = ssh_sftp_upload(ssh, ipa_path, manifest_path) end end success end |