read_podspec
Loads a CocoaPods spec as JSON
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.
Loads the specified (or the first found) podspec in the folder as JSON, so that you can inspect itsversion
,files
etc.
This can be useful when basing your release process on the version string only stored in one place - in the podspec.
As one of the first steps you'd read the podspec and its version and the rest of the workflow can use that version string (when e.g. creating a new git tag or a GitHub Release).
read_podspec | |
---|---|
Supported platforms | ios, mac |
Author | @czechboy0 |
2 Examples
spec = read_podspec
version = spec["version"]
puts "Using Version #{version}"
spec = read_podspec(path: "./XcodeServerSDK.podspec")
Parameters
Key | Description | Default |
---|---|---|
path |
Path to the podspec to be read | * |
* = default value is dependent on the user's system
Lane Variables
Actions can communicate with each other using a shared hash lane_context
, that can be accessed in other actions, plugins or your lanes: lane_context[SharedValues:XYZ]
. The read_podspec
action generates the following Lane Variables:
SharedValue | Description |
---|---|
SharedValues::READ_PODSPEC_JSON |
Podspec JSON payload |
To get more information check the Lanes documentation.
Documentation
To show the documentation in your terminal, run
fastlane action read_podspec
CLI
It is recommended to add the above action into your Fastfile
, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal
fastlane run read_podspec
To pass parameters, make use of the :
symbol, for example
fastlane run read_podspec parameter1:"value1" parameter2:"value2"
It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"
). Hashes are not currently supported.
It is recommended to add all fastlane actions you use to your Fastfile
.
Source code
This action, just like the rest of fastlane, is fully open source, view the source code on GitHub