Class: Fastlane::Actions::GetAppStoreVersionNumberAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GetAppStoreVersionNumberAction
- Defined in:
- lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
69 70 71 |
# File 'lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb', line 69 def self. ["SiarheiFedartsou"] end |
.available_options ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb', line 39 def self. [ FastlaneCore::ConfigItem.new(key: :bundle_id, env_name: "FL_APPSTORE_VERSION_NUMBER_BUNDLE_ID", description: "Bundle ID of the application", optional: true, conflicting_options: [:xcodeproj, :target, :build_configuration_name], is_string: true), FastlaneCore::ConfigItem.new(key: :xcodeproj, env_name: "FL_VERSION_NUMBER_PROJECT", description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory", optional: true, conflicting_options: [:bundle_id], verify_block: proc do |value| UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace" UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test? end), FastlaneCore::ConfigItem.new(key: :target, env_name: "FL_VERSION_NUMBER_TARGET", optional: true, conflicting_options: [:bundle_id], description: "Specify a specific target if you have multiple per project, optional"), FastlaneCore::ConfigItem.new(key: :build_configuration_name, optional: true, conflicting_options: [:bundle_id], description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration") ] end |
.description ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb', line 35 def self.description "Get the version number of your app in the App Store" end |
.is_supported?(platform) ⇒ Boolean
73 74 75 |
# File 'lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb', line 73 def self.is_supported?(platform) [:ios, :mac].include? platform end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fastlane/plugin/versioning/actions/get_app_store_version_number.rb', line 7 def self.run(params) if params[:bundle_id] bundle_id = params[:bundle_id] else if Helper.test? plist = "/tmp/fastlane/tests/fastlane/Info.plist" else plist = GetInfoPlistPathAction.run(params) end bundle_id = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleIdentifier') end uri = URI("http://itunes.apple.com/lookup?bundleId=#{bundle_id}") Net::HTTP.get(uri) response = Net::HTTP.get_response(uri) UI.crash!("Unexpected status code from iTunes Search API") unless response.kind_of?(Net::HTTPSuccess) response_body = JSON.parse(response.body) UI.user_error!("Cannot find app with #{bundle_id} bundle ID in the App Store") if response_body["resultCount"] == 0 response_body["results"][0]["version"] end |