class Fastlane::Actions::GoodifyInfoPlistAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/goodify_info_plist/actions/goodify_info_plist_action.rb, line 78 def self.available_options # options the action supports. [ FastlaneCore::ConfigItem.new(key: :plist, env_name: "FL_GOODIFY_INFO_PLIST_FILEPATH", description: "The file path to the plist that will be compiled to the app's Info.plist for the GoodifyInfoPlistAction", verify_block: proc do |value| UI.user_error!("Invalid plist file path for GoodifyInfoPlistAction given, pass using `plist: 'path/to/plist'`") if value.nil? || value.empty? UI.user_error!("Non-existant plist file for GoodifyInfoPlistAction given") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :good_entitlement_version, env_name: "FL_GOODIFY_INFO_PLIST_ENTITLEMENT_VERSION", description: "The Good app version number for the GoodifyInfoPlistAction", verify_block: proc do |value| pattern = Regexp.new('^(:?[1-9]\d{0,2})(:?\.(:?0|[1-9]\d{0,2})){0,3}$') failed_to_match = pattern.match(value).nil? UI.user_error!("Invalid Good app version for GoodifyInfoPlistAction given, pass using `good_entitlement_version: '1.2.3.4'`") if failed_to_match end, optional: true, default_value: "1.0.0.0"), FastlaneCore::ConfigItem.new(key: :good_entitlement_id, env_name: "FL_GOODIFY_INFO_PLIST_ENTITLEMENT_ID", description: "The Good ID for the GoodifyInfoPlistAction", verify_block: proc do |value| UI.user_error!("No Good ID for GoodifyInfoPlistAction given, pass using `good_entitlement_id: 'com.example.good'`") if value and value.empty? UI.user_error!("Good ID must be 35 characters or fewer in order to work with Windows Phones") if value.length > 35 UI.user_error!("Good ID must have not have any uppercase characters") if value =~ /[A-Z]/ end), # the default value if the user didn't provide one FastlaneCore::ConfigItem.new(key: :export_method, env_name: "FL_GOODIFY_INFO_PLIST_EXPORT_METHOD", description: "The export method, \"app-store\" or \"enterprise\", for the GoodifyInfoPlistAction", verify_block: proc do |value| UI.user_error!("Invalid export method given for GoodifyInfoPlistAction given, pass using `export_method: 'app-store' or 'enterprise'`") if value and value.empty? || !["app-store", "enterprise"].include?(value) end, default_value: "enterprise"), # the default value if the user didn't provide one FastlaneCore::ConfigItem.new(key: :build_simulation_mode, env_name: "FL_GOODIFY_INFO_PLIST_BUILD_FOR_SIMULATOR", description: "True if the app should be built so that it simulates a connection to a Good Control Center server. Defaults to false", optional: true, type: TrueClass, verify_block: proc do |value| UI.user_error!("Invalid value #{value}. It must either be true or false") unless [true, false].include?(value) end, default_value: false) # the default value if the user didn't provide one ] end
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/goodify_info_plist/actions/goodify_info_plist_action.rb, line 74 def self.description "This plugin will update the plist so that the built application can be deployed and managed within BlackBerry's Good Dynamics Control Center for Enterprise Mobility Management." end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/goodify_info_plist/actions/goodify_info_plist_action.rb, line 133 def self.is_supported?(platform) platform == :ios end
run(params)
click to toggle source
# File lib/fastlane/plugin/goodify_info_plist/actions/goodify_info_plist_action.rb, line 7 def self.run(params) UI.error("[Deprecation] check_good_version is deprecated, use the update_info_plist_for_blackberry_mam action from the blackberry_mam plugin instead") # default entitlement version. we rarely, if ever, need to change this plist = Plist.parse_xml(params[:plist]) gd_entitlement_version = "1.0.0.0" if params.values.key?(:good_entitlement_version) gd_entitlement_version = params[:good_entitlement_version] end plist["GDApplicationID"] = params[:good_entitlement_id] plist["GDApplicationVersion"] = gd_entitlement_version plist["GDLibraryMode"] = params[:build_simulation_mode] ? "GDEnterpriseSimulation" : "GDEnterprise" # create a set of url schemes for GD based on app id app_id = plist["CFBundleIdentifier"] url_schemes = [ "#{app_id}.sc2", "#{app_id}.sc2.1.0.0.0", "com.good.gd.discovery" ] # Currently there is a problem if this plugin action is called in # another action. We are already in the fastlane folder, but other_action # is configured to try and go _back_ into the fastlane folder so # we will get an exception thrown from within other_action -> runner's execute_action fastlane_relpath = '.' fastlane_relpath = '..' if !Dir.exist?('./fastlane') && File.basename(Dir.pwd) == 'fastlane' Dir.chdir(fastlane_relpath) do good_sdk_version = Helper::GoodifyInfoPlistVersionHelper.new(other_action.check_good_version) if good_sdk_version.major_version < 3 url_schemes.push("#{app_id}.sc") end end if params.values.fetch(:export_method, "app-store").casecmp("enterprise").zero? url_schemes.push("com.good.gd.discovery.enterprise") end # attempt to replace an existing set of GD url schemes replaced = false if plist.key?("CFBundleURLTypes") plist["CFBundleURLTypes"].each do |entry| next unless entry["CFBundleURLSchemes"].include?("com.good.gd.discovery") entry["CFBundleURLName"] = app_id entry["CFBundleURLSchemes"] = url_schemes replaced = true break end else plist["CFBundleURLTypes"] = [] end unless replaced plist["CFBundleURLTypes"] << { "CFBundleURLName" => app_id, "CFBundleURLSchemes" => url_schemes } end Plist::Emit.save_plist(plist, params[:plist]) end