Sha256: 337a621696500c8d8e2860732062633824dc079db6b77057979a5387f05ae953

Contents?: true

Size: 1.81 KB

Versions: 62

Compression:

Stored size: 1.81 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      READ_PODSPEC_JSON = :READ_PODSPEC_JSON
    end

    class ReadPodspecAction < Action
      def self.run(params)
        Actions.verify_gem!('cocoapods')

        path = params[:path]

        require 'cocoapods-core'
        spec = Pod::Spec.from_file(path).to_hash

        Helper.log.info "Reading podspec from file #{path}".green

        Actions.lane_context[SharedValues::READ_PODSPEC_JSON] = spec
        return spec
      end

      #####################################################
      # @!group Documentation
      #####################################################

      def self.description
        "Loads a CocoaPods spec as JSON"
      end

      def self.details
        [
          "This can be used for only specifying a version string in your podspec",
          "- and during your release process you'd read it from the podspec by running",
          "`version = read_podspec['version']` at the beginning of your lane"
        ].join("\n")
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :path,
                                       env_name: "FL_READ_PODSPEC_PATH",
                                       description: "Path to the podspec to be read",
                                       default_value: Dir['*.podspec*'].first,
                                       verify_block: proc do |value|
                                         raise "File #{value} not found".red unless File.exist?(value)
                                       end)
        ]
      end

      def self.output
        [
          ['READ_PODSPEC_JSON', 'Podspec JSON payload']
        ]
      end

      def self.authors
        ["czechboy0"]
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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