Class: AppRepo::Uploader
- Inherits:
-
Object
- Object
- AppRepo::Uploader
- Defined in:
- lib/apprepo/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.
-
#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
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/apprepo/uploader.rb', line 33 def initialize() self. = unless .nil? self.host = [:repo_url] # 'repo.teacloud.net' 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.
29 30 31 |
# File 'lib/apprepo/uploader.rb', line 29 def appcode @appcode end |
#host ⇒ Object
These want to be an input parameters:
23 24 25 |
# File 'lib/apprepo/uploader.rb', line 23 def host @host end |
#ipa_path ⇒ Object
Returns the value of attribute ipa_path.
27 28 29 |
# File 'lib/apprepo/uploader.rb', line 27 def ipa_path @ipa_path end |
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
28 29 30 |
# File 'lib/apprepo/uploader.rb', line 28 def manifest_path @manifest_path end |
#options ⇒ Object
Returns the value of attribute options.
17 18 19 |
# File 'lib/apprepo/uploader.rb', line 17 def @options end |
#password ⇒ Object
Returns the value of attribute password.
25 26 27 |
# File 'lib/apprepo/uploader.rb', line 25 def password @password end |
#rsa_keypath ⇒ Object
Returns the value of attribute rsa_keypath.
26 27 28 |
# File 'lib/apprepo/uploader.rb', line 26 def rsa_keypath @rsa_keypath end |
#user ⇒ Object
Returns the value of attribute user.
24 25 26 |
# File 'lib/apprepo/uploader.rb', line 24 def user @user end |
Instance Method Details
#download_manifest_only ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/apprepo/uploader.rb', line 94 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, 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, 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
55 56 57 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 |
# File 'lib/apprepo/uploader.rb', line 55 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_user and repo_pasdword 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, 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, password: password) do |ssh| FastlaneCore::UI.('Uploading IPA & Manifest...') success = ssh_sftp_upload(ssh, ipa_path, manifest_path) end end success end |