Sha256: 99a2c65918acb1204e16b2144b134b25f83fe2a7fe4cdfec15cab6679c0bb58f

Contents?: true

Size: 1.85 KB

Versions: 35

Compression:

Stored size: 1.85 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      GET_INFO_PLIST_VALUE_CUSTOM_VALUE = :GET_INFO_PLIST_VALUE_CUSTOM_VALUE
    end

    class GetInfoPlistValueAction < Action
      def self.run(params)
        require "plist"

        begin
          path = File.expand_path(params[:path])
          plist = Plist.parse_xml(path)

          value = plist[params[:key]]
          Actions.lane_context[SharedValues::GET_INFO_PLIST_VALUE_CUSTOM_VALUE] = value

          return value
        rescue => ex
          UI.error(ex)
          UI.error("Unable to find plist file at '#{path}'")
        end
      end

      def self.description
        "Returns value from Info.plist of your project as native Ruby data structures"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :key,
                                       env_name: "FL_GET_INFO_PLIST_PARAM_NAME",
                                       description: "Name of parameter",
                                       optional: false),
          FastlaneCore::ConfigItem.new(key: :path,
                                       env_name: "FL_GET_INFO_PLIST_PATH",
                                       description: "Path to plist file you want to read",
                                       optional: false,
                                       verify_block: proc do |value|
                                         UI.user_error!("Couldn't find plist file at path '#{value}'") unless File.exist?(value)
                                       end)
        ]
      end

      def self.output
        [
          ['GET_INFO_PLIST_VALUE_CUSTOM_VALUE', 'The value of the last plist file that was parsed']
        ]
      end

      def self.authors
        ["kohtenko"]
      end

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

Version data entries

35 entries across 35 versions & 1 rubygems

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