Sha256: 164316ce27243b4292348abcbfae4a0c3b31063a8d40ff9f45f39d9bd90fa47b

Contents?: true

Size: 1.95 KB

Versions: 68

Compression:

Stored size: 1.95 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

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

        begin
          path = File.expand_path(params[:path])
          plist = Plist.parse_xml(path)
          plist[params[:key]] = params[:value]
          new_plist = plist.to_plist
          File.write(path, new_plist)

          return params[:value]
        rescue => ex
          Helper.log.error ex
          Helper.log.error "Unable to set value to plist file at '#{path}'".red
        end
      end

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

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :key,
                                       env_name: "FL_SET_INFO_PLIST_PARAM_NAME",
                                       description: "Name of key in plist",
                                       optional: false),
          FastlaneCore::ConfigItem.new(key: :value,
                                       env_name: "FL_SET_INFO_PLIST_PARAM_VALUE",
                                       description: "Value to setup",
                                       optional: false),
          FastlaneCore::ConfigItem.new(key: :path,
                                       env_name: "FL_SET_INFO_PLIST_PATH",
                                       description: "Path to plist file you want to update",
                                       optional: false,
                                       verify_block: proc do |value|
                                         raise "Couldn't find plist file at path '#{value}'".red unless File.exist?(value)
                                       end)
        ]
      end

      def self.output
        []
      end

      def self.authors
        ["kohtenko"]
      end

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

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
fastlane-1.66.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.65.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.64.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.63.1 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.63.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.62.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.61.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.60.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.59.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.58.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.57.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.56.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.55.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.54.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.53.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.52.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.51.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.50.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.49.0 lib/fastlane/actions/set_info_plist_value.rb
fastlane-1.48.0 lib/fastlane/actions/set_info_plist_value.rb