Sha256: 7f8f40d28dceebc219fad40e980c635b5ffed0225ef4fe4e4a34b86c6cb4e20f

Contents?: true

Size: 1.68 KB

Versions: 21

Compression:

Stored size: 1.68 KB

Contents

require 'plist'

module Fastlane
  module Actions
    class UpdateUrlSchemesAction < Action
      def self.run(params)
        path = params[:path]
        url_schemes = params[:url_schemes]

        hash = Plist.parse_xml(path)
        hash['CFBundleURLTypes'].first['CFBundleURLSchemes'] = url_schemes
        File.write(path, hash.to_plist)
      end

      def self.description
        'Updates the URL schemes in the given Info.plist'
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(
            key: :path,
            env_name: 'FL_UPDATE_URL_SCHEMES_PATH',
            description: 'The Plist file\'s path',
            is_string: true,
            optional: false,
            verify_block: proc do |path|
              UI.user_error!("Could not find plist at path '#{path}'") unless File.exist?(path)
            end
          ),

          FastlaneCore::ConfigItem.new(
            key: :url_schemes,
            env_name: "FL_UPDATE_URL_SCHEMES_SCHEMES",
            description: 'The new URL schemes',
            is_string: false,
            optional: false,
            verify_block: proc do |url_schemes|
              string = "The URL schemes must be an array of strings, got '#{url_schemes}'."
              UI.user_error!(string) unless url_schemes.kind_of?(Array)

              url_schemes.each do |url_scheme|
                UI.user_error!(string) unless url_scheme.kind_of?(String)
              end
            end
          )
        ]
      end

      def self.output
        []
      end

      def self.authors
        ['kmikael']
      end

      def self.is_supported?(platform)
        [:ios, :mac].include? platform
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fastlane-1.104.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.103.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.102.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.101.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.100.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.99.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.98.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.97.2 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.97.1 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.97.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.96.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.95.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.94.1 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.94.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.93.1 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.93.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.92.0 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.92.0.beta2 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.92.0.beta1 lib/fastlane/actions/update_url_schemes.rb
fastlane-1.91.0 lib/fastlane/actions/update_url_schemes.rb