Class: Deliver::DetectValues
- Inherits:
-
Object
- Object
- Deliver::DetectValues
- Defined in:
- deliver/lib/deliver/detect_values.rb
Instance Method Summary collapse
- #ensure_folders_created(options) ⇒ Object
- #find_app(options) ⇒ Object
- #find_app_identifier(options) ⇒ Object
- #find_folders(options) ⇒ Object
- #find_platform(options) ⇒ Object
- #find_version(options) ⇒ Object
- #run!(options, skip_params = {}) ⇒ Object
- #verify_languages!(options) ⇒ Object
Instance Method Details
#ensure_folders_created(options) ⇒ Object
61 62 63 64 |
# File 'deliver/lib/deliver/detect_values.rb', line 61 def ensure_folders_created() FileUtils.mkdir_p([:screenshots_path]) FileUtils.mkdir_p([:metadata_path]) end |
#find_app(options) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'deliver/lib/deliver/detect_values.rb', line 38 def find_app() app_identifier = [:app_identifier] app_id = [:app] if app_identifier.to_s.empty? if !app_identifier.to_s.empty? app = Spaceship::ConnectAPI::App.find(app_identifier) elsif !app_id.kind_of?(Spaceship::ConnectAPI::App) && !app_id.to_s.empty? app = Spaceship::ConnectAPI::App.get(app_id: app_id) end if app [:app] = app else UI.user_error!("Could not find app with app identifier '#{[:app_identifier]}' in your App Store Connect account (#{[:username]} - Team: #{Spaceship::Tunes.client.team_id})") end end |
#find_app_identifier(options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'deliver/lib/deliver/detect_values.rb', line 22 def find_app_identifier() return if [:app_identifier] if [:ipa] identifier = FastlaneCore::IpaFileAnalyser.fetch_app_identifier([:ipa]) elsif [:pkg] identifier = FastlaneCore::PkgFileAnalyser.fetch_app_identifier([:pkg]) end [:app_identifier] = identifier if identifier.to_s.length > 0 [:app_identifier] ||= UI.input("The Bundle Identifier of your App: ") rescue => ex UI.error("#{ex.}\n#{ex.backtrace.join('\n')}") UI.user_error!("Could not infer your App's Bundle Identifier") end |
#find_folders(options) ⇒ Object
55 56 57 58 59 |
# File 'deliver/lib/deliver/detect_values.rb', line 55 def find_folders() containing = Helper.fastlane_enabled? ? FastlaneCore::FastlaneFolder.path : '.' [:screenshots_path] ||= File.join(containing, 'screenshots') [:metadata_path] ||= File.join(containing, 'metadata') end |
#find_platform(options) ⇒ Object
79 80 81 82 83 84 85 |
# File 'deliver/lib/deliver/detect_values.rb', line 79 def find_platform() if [:ipa] [:platform] ||= FastlaneCore::IpaFileAnalyser.fetch_app_platform([:ipa]) elsif [:pkg] [:platform] = 'osx' end end |
#find_version(options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'deliver/lib/deliver/detect_values.rb', line 66 def find_version() return if [:app_version] if [:ipa] [:app_version] ||= FastlaneCore::IpaFileAnalyser.fetch_app_version([:ipa]) elsif [:pkg] [:app_version] ||= FastlaneCore::PkgFileAnalyser.fetch_app_version([:pkg]) end rescue => ex UI.error("#{ex.}\n#{ex.backtrace.join('\n')}") UI.user_error!("Could not infer your app's version") end |
#run!(options, skip_params = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'deliver/lib/deliver/detect_values.rb', line 11 def run!(, skip_params = {}) find_platform() find_app_identifier() find_app() find_folders() ensure_folders_created() find_version() unless skip_params[:skip_version] verify_languages!() end |
#verify_languages!(options) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'deliver/lib/deliver/detect_values.rb', line 87 def verify_languages!() languages = [:languages] return unless languages all_languages = Spaceship::Tunes.client.available_languages diff = languages - all_languages unless diff.empty? UI.user_error!("The following languages are invalid and cannot be activated: #{diff.join(',')}\n\nValid languages are: #{all_languages}") end end |