Module: Pod::Specification::DSL
- Extended by:
- AttributeSupport
- Included in:
- Pod::Specification
- Defined in:
- lib/cocoapods-core/specification/dsl.rb,
lib/cocoapods-core/specification/dsl/attribute.rb,
lib/cocoapods-core/specification/dsl/deprecations.rb,
lib/cocoapods-core/specification/dsl/platform_proxy.rb,
lib/cocoapods-core/specification/dsl/attribute_support.rb,
lib/cocoapods-core/specification/root_attribute_accessors.rb
Overview
A specification describes a version of Pod library. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.
A stub specification file can be generated by the pod spec create command.
The specification DSL provides great flexibility and dynamism. Moreover, the DSL adopts the convention over configuration and thus it can be very simple:
Pod::Spec.new do |spec|
spec.name = 'Reachability'
spec.version = '3.1.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/tonymillion/Reachability'
spec. = { 'Tony Million' => '[email protected]' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
spec.source_files = 'Reachability.{h,m}'
spec.framework = 'SystemConfiguration'
end
Or it can be quite detailed:
Pod::Spec.new do |spec|
spec.name = 'Reachability'
spec.version = '3.1.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/tonymillion/Reachability'
spec. = { 'Tony Million' => '[email protected]' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
spec.module_name = 'Rich'
spec.swift_version = '4.0'
spec.ios.deployment_target = '9.0'
spec.osx.deployment_target = '10.10'
spec.source_files = 'Reachability/common/*.swift'
spec.ios.source_files = 'Reachability/ios/*.swift', 'Reachability/extensions/*.swift'
spec.osx.source_files = 'Reachability/osx/*.swift'
spec.framework = 'SystemConfiguration'
spec.ios.framework = 'UIKit'
spec.osx.framework = 'AppKit'
spec.dependency 'SomeOtherPod'
end
Defined Under Namespace
Modules: AttributeSupport, Deprecations, RootAttributesAccessors Classes: Attribute, PlatformProxy
Root specification A ‘root’ specification stores the information about the specific version of a library. The attributes in this group can only be written to on the ‘root’ specification, **not** on the ‘sub-specifications’. --- The attributes listed in this group are the only one which are required by a podspec. The attributes of the other groups are offered to refine the podspec and follow a convention over configuration approach. A root specification can describe these attributes either directly of through ‘[sub-specifications](#subspec)’. collapse
- LICENSE_KEYS =
The keys accepted by the license attribute.
[:type, :file, :text].freeze
- SOURCE_KEYS =
The keys accepted by the hash of the source attribute.
{ :git => [:tag, :branch, :commit, :submodules].freeze, :svn => [:folder, :tag, :revision].freeze, :hg => [:revision].freeze, :http => [:flatten, :type, :sha256, :sha1, :headers].freeze, }.freeze
Platform A specification should indicate the platform and the correspondent deployment targets on which the library is supported. If not defined in a subspec the attributes of this group inherit the value of the parent. collapse
- PLATFORMS =
The names of the platforms supported by the specification class.
[:osx, :ios, :tvos, :visionos, :watchos].freeze
Build settings In this group are listed the attributes related to the configuration of the build environment that should be used to build the library. If not defined in a subspec the attributes of this group inherit the value of the parent. collapse
- SCRIPT_PHASE_REQUIRED_KEYS =
------------------#
[:name, :script].freeze
- SCRIPT_PHASE_OPTIONAL_KEYS =
[:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists, :show_env_vars_in_log, :execution_position, :dependency_file, :always_out_of_date].freeze
- EXECUTION_POSITION_KEYS =
[:before_compile, :after_compile, :before_headers, :after_headers, :any].freeze
- ALL_SCRIPT_PHASE_KEYS =
(SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
File patterns Podspecs should be located at the **root** of the repository, and paths to files should be specified **relative** to the root of the repository as well. File patterns do not support traversing the parent directory ( `..` ). File patterns may contain the following wildcard patterns: --- ### Pattern: * Matches any file. Can be restricted by other values in the glob. * `*` will match all files * `c*` will match all files beginning with `c` * `*c` will match all files ending with `c` * `*c*` will match all files that have `c` in them (including at the beginning or end) Equivalent to `/.*/x` in regexp. **Note** this will not match Unix-like hidden files (dotfiles). In order to include those in the match results, you must use something like `{*,.*}`. --- ### Pattern: ** Matches directories recursively. --- ### Pattern: ? Matches any one character. Equivalent to `/.{1}/` in regexp. --- ### Pattern: [set] Matches any one character in set. Behaves exactly like character sets in Regexp, including set negation (`[^a-z]`). --- ### Pattern: {p,q} Matches either literal `p` or literal `q`. Matching literals may be more than one character in length. More than two literals may be specified. Equivalent to pattern alternation in regexp. --- ### Pattern: \ Escapes the next meta-character. --- ### Examples Consider these to be evaluated in the source root of [JSONKit](https://github.com/johnezang/JSONKit). "JSONKit.?" #=> ["JSONKit.h", "JSONKit.m"] "*.[a-z][a-z]" #=> ["CHANGELOG.md", "README.md"] "*.[^m]*" #=> ["JSONKit.h"] "*.{h,m}" #=> ["JSONKit.h", "JSONKit.m"] "*" #=> ["CHANGELOG.md", "JSONKit.h", "JSONKit.m", "README.md"] collapse
- ON_DEMAND_RESOURCES_CATEGORY_KEYS =
The keys accepted by the category attribute for each on demand resource entry.
[:download_on_demand, :prefetched, :initial_install].freeze
Subspecs A library can specify a dependency on either another library, a subspec of another library, or a subspec of itself. collapse
- SUPPORTED_TEST_TYPES =
The list of the test types currently supported.
[:unit, :ui].freeze
- SCHEME_KEYS =
[:launch_arguments, :environment_variables, :code_coverage, :parallelizable, :build_configurations].freeze
Class Attribute Summary collapse
-
.attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Root specification A ‘root’ specification stores the information about the specific version of a library. The attributes in this group can only be written to on the ‘root’ specification, **not** on the ‘sub-specifications’. --- The attributes listed in this group are the only one which are required by a podspec. The attributes of the other groups are offered to refine the podspec and follow a convention over configuration approach. A root specification can describe these attributes either directly of through ‘[sub-specifications](#subspec)’. collapse
-
#authors=(authors) ⇒ Object
The name and email addresses of the library maintainers, not the Podspec maintainer.
-
#changelog=(changelog) ⇒ Object
The URL for the CHANGELOG markdown file for this pod version.
-
#cocoapods_version=(cocoapods_version) ⇒ Object
The version of CocoaPods that the specification supports.
-
#deprecated=(flag) ⇒ Object
Whether the library has been deprecated.
-
#deprecated_in_favor_of=(deprecated_in_favor_of) ⇒ Object
The name of the Pod that this one has been deprecated in favor of.
-
#description=(description) ⇒ Object
A description of the Pod more detailed than the summary.
-
#documentation_url=(documentation_url) ⇒ Object
An optional URL for the documentation of the Pod which will be honoured by CocoaPods web properties.
-
#homepage=(homepage) ⇒ Object
The URL of the homepage of the Pod.
-
#license=(license) ⇒ Object
The license of the Pod.
-
#name=(name) ⇒ Object
The name of the Pod.
-
#prepare_command=(command) ⇒ Object
A bash script that will be executed after the Pod is downloaded.
-
#readme=(readme) ⇒ Object
The URL for the README markdown file for this pod version.
-
#screenshots=(screenshots) ⇒ Object
A list of URLs to images showcasing the Pod.
-
#social_media_url=(social_media_url) ⇒ Object
The URL for the social media contact of the Pod, CocoaPods web services can use this.
-
#source=(source) ⇒ Object
The location from where the library should be retrieved.
-
#static_framework=(flag) ⇒ Object
Indicates, that if use_frameworks! is specified, the pod should include a static library framework.
-
#summary=(summary) ⇒ Object
A short (maximum 140 characters) description of the Pod.
-
#swift_versions=(version) ⇒ Object
The versions of Swift that the specification supports.
-
#version=(version) ⇒ Object
The version of the Pod.
Platform A specification should indicate the platform and the correspondent deployment targets on which the library is supported. If not defined in a subspec the attributes of this group inherit the value of the parent. collapse
-
#deployment_target=(*_args) ⇒ Object
The minimum deployment targets of the supported platforms.
-
#platform=(args) ⇒ Object
The platform on which this Pod is supported.
Build settings In this group are listed the attributes related to the configuration of the build environment that should be used to build the library. If not defined in a subspec the attributes of this group inherit the value of the parent. collapse
-
#compiler_flags=(flags) ⇒ Object
A list of flags which should be passed to the compiler.
-
#dependency(*args) ⇒ Object
Any dependency on other Pods or to a ‘sub-specification’.
- #dependency=(args) ⇒ Object
-
#frameworks=(*frameworks) ⇒ Object
A list of system frameworks that the user’s target needs to link against.
-
#header_dir=(dir) ⇒ Object
The directory where to store the headers files so they don't break includes.
-
#header_mappings_dir=(dir) ⇒ Object
A directory from where to preserve the folder structure for the headers files.
-
#info_plist=(info_plist) ⇒ Object
Key-Value pairs to add to the generated
Info.plist
. -
#libraries=(*libraries) ⇒ Object
A list of system libraries that the user’s target (application) needs to link against.
-
#module_name=(name) ⇒ Object
The name to use for the framework / clang module which will be generated for this specification instead of the default (header_dir if set, otherwise the specification name).
-
#pod_target_xcconfig=(value) ⇒ Object
Any flag to add to the final private pod target xcconfig file.
-
#prefix_header_contents=(content) ⇒ Object
Any content to inject in the prefix header of the pod project.
-
#prefix_header_file=(path) ⇒ Object
A path to a prefix header file to inject in the prefix header of the pod project.
-
#requires_arc=(flag) ⇒ Object
requires_arc
allows you to specify which source_files use ARC. -
#script_phases=(*script_phases) ⇒ Object
This attribute allows to define a script phase to execute as part of compilation of the Pod.
-
#user_target_xcconfig=(value) ⇒ Object
Specifies flags to add to the final aggregate target xcconfig file, which propagates to non-overridden and inheriting build settings to the integrated user targets.
-
#weak_frameworks=(*frameworks) ⇒ Object
A list of frameworks that the user’s target needs to weakly link against.
File patterns Podspecs should be located at the **root** of the repository, and paths to files should be specified **relative** to the root of the repository as well. File patterns do not support traversing the parent directory ( `..` ). File patterns may contain the following wildcard patterns: --- ### Pattern: * Matches any file. Can be restricted by other values in the glob. * `*` will match all files * `c*` will match all files beginning with `c` * `*c` will match all files ending with `c` * `*c*` will match all files that have `c` in them (including at the beginning or end) Equivalent to `/.*/x` in regexp. **Note** this will not match Unix-like hidden files (dotfiles). In order to include those in the match results, you must use something like `{*,.*}`. --- ### Pattern: ** Matches directories recursively. --- ### Pattern: ? Matches any one character. Equivalent to `/.{1}/` in regexp. --- ### Pattern: [set] Matches any one character in set. Behaves exactly like character sets in Regexp, including set negation (`[^a-z]`). --- ### Pattern: {p,q} Matches either literal `p` or literal `q`. Matching literals may be more than one character in length. More than two literals may be specified. Equivalent to pattern alternation in regexp. --- ### Pattern: \ Escapes the next meta-character. --- ### Examples Consider these to be evaluated in the source root of [JSONKit](https://github.com/johnezang/JSONKit). "JSONKit.?" #=> ["JSONKit.h", "JSONKit.m"] "*.[a-z][a-z]" #=> ["CHANGELOG.md", "README.md"] "*.[^m]*" #=> ["JSONKit.h"] "*.{h,m}" #=> ["JSONKit.h", "JSONKit.m"] "*" #=> ["CHANGELOG.md", "JSONKit.h", "JSONKit.m", "README.md"] collapse
-
#exclude_files=(exclude_files) ⇒ Object
A list of file patterns that should be excluded from the other file patterns.
-
#module_map=(module_map) ⇒ Object
The module map file that should be used when this pod is integrated as a framework.
-
#on_demand_resources=(on_demand_resources) ⇒ Object
A hash of on demand resources that should be copied into the target bundle.
-
#preserve_paths=(preserve_paths) ⇒ Object
Any file that should not be removed after being downloaded.
-
#private_header_files=(private_header_files) ⇒ Object
A list of file patterns that should be used to mark private headers.
-
#project_header_files=(project_header_files) ⇒ Object
A list of file patterns that should be used to mark project headers.
-
#public_header_files=(public_header_files) ⇒ Object
A list of file patterns that should be used as public headers.
-
#resource_bundles=(*resource_bundles) ⇒ Object
This attribute allows to define the name and the file of the resource bundles which should be built for the Pod.
-
#resources=(resources) ⇒ Object
A list of resources that should be copied into the target bundle.
-
#source_files=(source_files) ⇒ Object
The source files of the Pod.
-
#vendored_frameworks=(*frameworks) ⇒ Object
The paths of the framework bundles that come shipped with the Pod.
-
#vendored_libraries=(*frameworks) ⇒ Object
The paths of the libraries that come shipped with the Pod.
Subspecs A library can specify a dependency on either another library, a subspec of another library, or a subspec of itself. collapse
-
#app_host_name=(name) ⇒ Object
The app specification to use as an app host, if necessary.
-
#app_spec(name = 'App', &block) ⇒ Object
Represents an app specification for the library.
-
#default_subspecs=(subspec_array) ⇒ Object
An array of subspecs names that should be used as preferred dependency.
-
#requires_app_host=(flag) ⇒ Object
Whether a test specification requires an app host to run tests.
-
#scheme=(flag) ⇒ Object
Specifies the scheme configuration to be used for this specification.
-
#subspec(name, &block) ⇒ Object
Represents specification for a module of the library.
-
#test_spec(name = 'Tests', &block) ⇒ Object
Represents a test specification for the library.
Multi-Platform support A specification can store values which are specific to only one platform. --- For example one might want to store resources which are specific to only iOS projects. spec.resources = 'Resources/**/*.png' spec.ios.resources = 'Resources_ios/**/*.png' collapse
-
#ios ⇒ PlatformProxy
Provides support for specifying iOS attributes.
-
#osx ⇒ PlatformProxy
(also: #macos)
Provides support for specifying OS X attributes.
-
#tvos ⇒ PlatformProxy
Provides support for specifying tvOS attributes.
-
#visionos ⇒ PlatformProxy
Provides support for specifying visionOS attributes.
-
#watchos ⇒ PlatformProxy
Provides support for specifying watchOS attributes.
Methods included from AttributeSupport
attribute, root_attribute, store_attribute
Class Attribute Details
.attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/cocoapods-core/specification/dsl/attribute_support.rb', line 7 def attributes @attributes end |
Instance Method Details
#app_host_name=(name) ⇒ Object
The app specification to use as an app host, if necessary.
1717 1718 1719 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1717 attribute :app_host_name, :types => [String], :spec_types => [:test] |
#app_spec(name = 'App', &block) ⇒ Object
Represents an app specification for the library. Here you can place all your app source files for your podspec along with the app dependencies.
1783 1784 1785 1786 1787 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1783 def app_spec(name = 'App', &block) appspec = Specification.new(self, name, :app_specification => true, &block) @subspecs << appspec appspec end |
#authors=(authors) ⇒ Object
The name and email addresses of the library maintainers, not the Podspec maintainer.
201 202 203 204 205 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 201 root_attribute :authors, :types => [String, Array, Hash], :container => Hash, :required => true, :singularize => true |
#changelog=(changelog) ⇒ Object
The URL for the CHANGELOG markdown file for this pod version.
328 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 328 root_attribute :changelog |
#cocoapods_version=(cocoapods_version) ⇒ Object
The version of CocoaPods that the specification supports.
176 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 176 root_attribute :cocoapods_version |
#compiler_flags=(flags) ⇒ Object
A list of flags which should be passed to the compiler.
905 906 907 908 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 905 attribute :compiler_flags, :container => Array, :singularize => true, :inherited => true |
#default_subspecs=(subspec_array) ⇒ Object
An array of subspecs names that should be used as preferred dependency. If not specified, a specification requires all of its subspecs as dependencies.
You may use the value :none
to specify that none of the subspecs are
required to compile this pod and that all subspecs are optional.
A Pod should make available the full library by default. Users can fine tune their dependencies, and exclude unneeded subspecs, once their requirements are known. Therefore, this attribute is rarely needed. It is intended to be used to select a default if there are ‘sub-specifications’ which provide alternative incompatible implementations, or to exclude modules rarely needed (especially if they trigger dependencies on other libraries).
1826 1827 1828 1829 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1826 root_attribute :default_subspecs, :container => Array, :types => [Array, String, Symbol], :singularize => true |
#dependency(*args) ⇒ Object
Any dependency on other Pods or to a ‘sub-specification’.
Dependencies can specify versions requirements. The use of the optimistic
version indicator ~>
is recommended because it provides good
control over the version without being too restrictive. For example,
~> 1.0.1
is equivalent to >= 1.0.1
combined with < 1.1
. Similarly,
~> 1.0
will match 1.0
, 1.0.1
, 1.1
, but will not upgrade to 2.0
.
Pods with overly restrictive dependencies limit their compatibility with other Pods.
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 697 def dependency(*args) name, *version_requirements = args if name == self.name raise Informative, "A specification can't require itself as a " \ 'subspec' end if @parent composed_name = '' @parent.name.split('/').each do |component| composed_name << component if name == composed_name raise Informative, "A subspec can't require one of its " \ 'parents specifications' else composed_name << '/' end end end configurations_option = version_requirements.find { |option| option.is_a?(Hash) && option.key?(:configurations) } whitelisted_configurations = if configurations_option version_requirements.delete(configurations_option) Array(configurations_option.delete(:configurations)).map { |c| c.to_s.downcase } end = version_requirements.reject { |req| req.is_a?(String) } .each do |dependency_option| if dependency_option.is_a?(Hash) if !dependency_option[:path].nil? raise Informative, 'Podspecs cannot specify the source of dependencies. The `:path` option is not supported.'\ ' `:path` can be used in the Podfile instead to override global dependencies.' elsif !dependency_option[:git].nil? raise Informative, 'Podspecs cannot specify the source of dependencies. The `:git` option is not supported.'\ ' `:git` can be used in the Podfile instead to override global dependencies.' end end raise Informative, "Unsupported version requirements. #{version_requirements.inspect} is not valid." end attributes_hash['dependencies'] ||= {} attributes_hash['dependencies'][name] = version_requirements unless whitelisted_configurations.nil? if (extras = whitelisted_configurations - %w(debug release)) && !extras.empty? raise Informative, "Only `Debug` & `Release` are allowed under configurations for dependency on `#{name}`. " \ "Found #{extras.map { |configuration| "`#{configuration}`" }.to_sentence}." end attributes_hash['configuration_pod_whitelist'] ||= {} attributes_hash['configuration_pod_whitelist'][name] = whitelisted_configurations end end |
#dependency=(args) ⇒ Object
750 751 752 753 754 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 750 def dependency=(args) joined = args.join('\', \'') arguments = "\'#{joined}\'" raise Informative, "Cannot assign value to `dependency`. Did you mean: `dependency #{arguments}`?" end |
#deployment_target=(*_args) ⇒ Object
The minimum deployment targets of the supported platforms.
As opposed to the platform
attribute, the deployment_target
attribute allows to specify multiple platforms on which this pod
is supported — specifying a different deployment target for each.
646 647 648 649 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 646 def deployment_target=(*_args) raise Informative, 'The deployment target can be declared only per ' \ 'platform.' end |
#deprecated=(flag) ⇒ Object
Whether the library has been deprecated.
554 555 556 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 554 root_attribute :deprecated, :types => [TrueClass, FalseClass], :default_value => false |
#deprecated_in_favor_of=(deprecated_in_favor_of) ⇒ Object
The name of the Pod that this one has been deprecated in favor of.
570 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 570 root_attribute :deprecated_in_favor_of |
#description=(description) ⇒ Object
A description of the Pod more detailed than the summary.
448 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 448 root_attribute :description |
#documentation_url=(documentation_url) ⇒ Object
An optional URL for the documentation of the Pod which will be honoured by CocoaPods web properties. Leaving it blank will default to a CocoaDocs generated URL for your library.
488 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 488 root_attribute :documentation_url |
#exclude_files=(exclude_files) ⇒ Object
A list of file patterns that should be excluded from the other file patterns.
1501 1502 1503 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1501 attribute :exclude_files, :container => Array, :file_patterns => true |
#frameworks=(*frameworks) ⇒ Object
A list of system frameworks that the user’s target needs to link against.
841 842 843 844 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 841 attribute :frameworks, :container => Array, :singularize => true, :inherited => true |
#header_dir=(dir) ⇒ Object
The directory where to store the headers files so they don't break includes.
1053 1054 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1053 attribute :header_dir, :inherited => true |
#header_mappings_dir=(dir) ⇒ Object
A directory from where to preserve the folder structure for the headers files. If not provided the headers files are flattened.
1070 1071 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1070 attribute :header_mappings_dir, :inherited => true |
#homepage=(homepage) ⇒ Object
The URL of the homepage of the Pod.
297 298 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 297 root_attribute :homepage, :required => true |
#info_plist=(info_plist) ⇒ Object
Key-Value pairs to add to the generated Info.plist
.
The values will be merged with the default values that CocoaPods generates, overriding any duplicates.
For library specs, the values will be merged into the generated Info.plist for libraries that are integrated using frameworks. It will have no effect for static libraries.
Subspecs (other than app and test specs) are not supported.
For app specs, the values will be merged into the application host's Info.plist
.
For test specs, the values will be merged into the test bundle's Info.plist
.
785 786 787 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 785 attribute :info_plist, :container => Hash, :inherited => false |
#ios ⇒ PlatformProxy
Provides support for specifying iOS attributes.
1855 1856 1857 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1855 def ios PlatformProxy.new(self, :ios) end |
#libraries=(*libraries) ⇒ Object
A list of system libraries that the user’s target (application) needs to link against.
887 888 889 890 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 887 attribute :libraries, :container => Array, :singularize => true, :inherited => true |
#license=(license) ⇒ Object
The license of the Pod.
Unless the source contains a file named LICENSE.*
or LICENCE.*
,
the path of the license file or the integral text of the notice
commonly used for the license type must be specified.
If a license file is specified, it either must be without a file
extensions or be one of txt
, md
, or markdown
.
This information is used by CocoaPods to generate acknowledgement files (markdown and plist) which can be used in the acknowledgements section of the final application.
279 280 281 282 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 279 root_attribute :license, :container => Hash, :keys => LICENSE_KEYS, :required => true |
#module_map=(module_map) ⇒ Object
The module map file that should be used when this pod is integrated as a framework.
false
indicates that the default CocoaPods modulemap
file should not
be generated.
true
is the default and indicates that the default CocoaPods
modulemap
file should be generated.
By default, CocoaPods creates a module map file based upon the public headers in a specification.
1562 1563 1564 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1562 attribute :module_map, :types => [TrueClass, FalseClass, String], :root_only => true |
#module_name=(name) ⇒ Object
The name to use for the framework / clang module which will be generated for this specification instead of the default (header_dir if set, otherwise the specification name).
1037 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1037 root_attribute :module_name |
#name=(name) ⇒ Object
The name of the Pod.
108 109 110 111 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 108 attribute :name, :required => true, :inherited => false, :multi_platform => false |
#on_demand_resources=(on_demand_resources) ⇒ Object
A hash of on demand resources that should be copied into the target bundle. Resources specified here will automatically become part of the resources build phase of the target this pod is integrated into.
If no category is specified then :download_on_demand
is used as the default.
Tags specified by pods are always managed by CocoaPods. If a tag is renamed, changed or deleted then CocoaPods will update the tag within the targets the pod was integrated into. It is highly recommended not to share the same tags for your project as the ones used by the pods your project consumes.
1408 1409 1410 1411 1412 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1408 attribute :on_demand_resources, :types => [String, Array, Hash], :container => Hash, :file_patterns => true, :singularize => true |
#osx ⇒ PlatformProxy Also known as: macos
Provides support for specifying OS X attributes.
1866 1867 1868 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1866 def osx PlatformProxy.new(self, :osx) end |
#platform=(args) ⇒ Object
The platform on which this Pod is supported. Leaving this blank means the Pod is supported on all platforms. When supporting multiple platforms you should use deployment_target below instead.
617 618 619 620 621 622 623 624 625 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 617 def platform=(args) name, deployment_target = args name = :osx if name.to_s == 'macos' attributes_hash['platforms'] = if name { name.to_s => deployment_target } else {} end end |
#pod_target_xcconfig=(value) ⇒ Object
Any flag to add to the final private pod target xcconfig file.
923 924 925 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 923 attribute :pod_target_xcconfig, :container => Hash, :inherited => true |
#prefix_header_contents=(content) ⇒ Object
Any content to inject in the prefix header of the pod project.
This attribute is not recommended as Pods should not pollute the prefix header of other libraries or of the user project.
984 985 986 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 984 attribute :prefix_header_contents, :types => [Array, String], :inherited => true |
#prefix_header_file=(path) ⇒ Object
A path to a prefix header file to inject in the prefix header of the
pod project.
false
indicates that the default CocoaPods prefix header should not
be generated.
true
is the default and indicates that the default CocoaPods prefix
header should be generated.
The file path options is not recommended as Pods should not pollute the prefix header of other libraries or of the user project.
1017 1018 1019 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1017 attribute :prefix_header_file, :types => [TrueClass, FalseClass, String], :inherited => true |
#prepare_command=(command) ⇒ Object
A bash script that will be executed after the Pod is downloaded. This command can be used to create, delete and modify any file downloaded and will be ran before any paths for other file attributes of the specification are collected.
This command is executed before the Pod is cleaned and before the Pods project is created. The working directory is the root of the Pod.
If the pod is installed with the :path
option this command will not
be executed.
520 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 520 root_attribute :prepare_command |
#preserve_paths=(preserve_paths) ⇒ Object
Any file that should not be removed after being downloaded.
By default, CocoaPods removes all files that are not matched by any of the other file pattern.
1527 1528 1529 1530 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1527 attribute :preserve_paths, :container => Array, :file_patterns => true, :singularize => true |
#private_header_files=(private_header_files) ⇒ Object
A list of file patterns that should be used to mark private headers.
These patterns are matched against the public headers (or all the headers if no public headers have been specified) to exclude those headers which should not be exposed to the user project and which should not be used to generate the documentation. When the library is built, these headers will appear in the build directory.
Header files that are not listed as neither public nor project or private will be treated as private, but in addition will not appear in the build directory at all.
1312 1313 1314 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1312 attribute :private_header_files, :container => Array, :file_patterns => true |
#project_header_files=(project_header_files) ⇒ Object
A list of file patterns that should be used to mark project headers.
These patterns are matched against the public headers (or all the headers if no public headers have been specified) to exclude those headers which should not be exposed to the user project and which should not be used to generate the documentation. When the library is built, these headers will not appear in the build directory.
1282 1283 1284 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1282 attribute :project_header_files, :container => Array, :file_patterns => true |
#public_header_files=(public_header_files) ⇒ Object
A list of file patterns that should be used as public headers.
These patterns are matched against the source files to include headers that will be exposed to the user’s project and from which documentation will be generated. When the library is built, these headers will appear in the build directory. If no public headers are specified then all the headers in source_files are considered public.
1256 1257 1258 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1256 attribute :public_header_files, :container => Array, :file_patterns => true |
#readme=(readme) ⇒ Object
The URL for the README markdown file for this pod version.
313 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 313 root_attribute :readme |
#requires_app_host=(flag) ⇒ Object
Whether a test specification requires an app host to run tests. This only applies to test specifications.
1683 1684 1685 1686 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1683 attribute :requires_app_host, :types => [TrueClass, FalseClass], :default_value => false, :spec_types => [:test] |
#requires_arc=(flag) ⇒ Object
requires_arc
allows you to specify which source_files use ARC.
This can either be the files which support ARC, or true to indicate
all of the source_files use ARC.
Files which do not use ARC will have the -fno-objc-arc
compiler
flag.
The default value of this attribute is true
.
817 818 819 820 821 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 817 attribute :requires_arc, :types => [TrueClass, FalseClass, String, Array], :file_patterns => true, :default_value => true, :inherited => true |
#resource_bundles=(*resource_bundles) ⇒ Object
This attribute allows to define the name and the file of the resource bundles which should be built for the Pod. They are specified as a hash where the keys represent the name of the bundles and the values the file patterns that they should include.
For building the Pod as a static library, we strongly recommend library developers to adopt resource bundles as there can be name collisions using the resources attribute.
The names of the bundles should at least include the name of the Pod to minimise the chance of name collisions.
To provide different resources per platform namespaced bundles must be used.
1448 1449 1450 1451 1452 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1448 attribute :resource_bundles, :types => [String, Array], :container => Hash, :file_patterns => true, :singularize => true |
#resources=(resources) ⇒ Object
A list of resources that should be copied into the target bundle.
For building the Pod as a static library, we strongly recommend library developers to adopt resource bundles as there can be name collisions using the resources attribute. Moreover, resources specified with this attribute are copied directly to the client target and therefore they are not optimised by Xcode.
1478 1479 1480 1481 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1478 attribute :resources, :container => Array, :file_patterns => true, :singularize => true |
#scheme=(flag) ⇒ Object
Specifies the scheme configuration to be used for this specification.
1740 1741 1742 1743 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1740 attribute :scheme, :types => [Hash], :container => Hash, :keys => SCHEME_KEYS |
#screenshots=(screenshots) ⇒ Object
A list of URLs to images showcasing the Pod. Intended for UI oriented
libraries. CocoaPods recommends the usage of the gif
format.
469 470 471 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 469 root_attribute :screenshots, :singularize => true, :container => Array |
#script_phases=(*script_phases) ⇒ Object
This attribute allows to define a script phase to execute as part of compilation of the Pod.
Unlike a prepare command, script phases execute as part of xcodebuild
they can also utilize all environment
variables that are set during compilation.
A Pod can provide multiple script phases to execute and they will be added in the order they were declared and after taking into consideration their execution position setting.
Note In order to provide visibility and awareness of the contents of all script phases, a warning will be presented to the user upon installing your pod if it includes any script phases.
1130 1131 1132 1133 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1130 attribute :script_phases, :types => [Hash], :container => Array, :singularize => true |
#social_media_url=(social_media_url) ⇒ Object
The URL for the social media contact of the Pod, CocoaPods web services can use this.
For example, the @CocoaPodsFeed notifications will include the Twitter handle (shortening the description) if the URL is relative to Twitter. This does not necessarily have to be a Twitter URL, but only those are included in the Twitter @CocoaPodsFeed notifications.
230 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 230 root_attribute :social_media_url |
#source=(git) ⇒ Object #source=(svn) ⇒ Object #source=(hg) ⇒ Object #source=(http) ⇒ Object
The location from where the library should be retrieved.
399 400 401 402 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 399 root_attribute :source, :container => Hash, :keys => SOURCE_KEYS, :required => true |
#source_files=(source_files) ⇒ Object
The source files of the Pod.
1230 1231 1232 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1230 attribute :source_files, :container => Array, :file_patterns => true |
#static_framework=(flag) ⇒ Object
Indicates, that if use_frameworks! is specified, the pod should include a static library framework.
537 538 539 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 537 root_attribute :static_framework, :types => [TrueClass, FalseClass], :default_value => false |
#subspec(name, &block) ⇒ Object
Represents specification for a module of the library.
Subspecs participate on a dual hierarchy.
On one side, a specification automatically inherits as a dependency all it children ‘sub-specifications’ (unless a default subspec is specified).
On the other side, a ‘sub-specification’ inherits the value of the attributes of the parents so common values for attributes can be specified in the ancestors.
Although it sounds complicated in practice it means that subspecs in general do what you would expect:
pod 'ShareKit', '2.0'
Installs ShareKit with all the sharers like ShareKit/Evernote
,
ShareKit/Facebook
, etc, as they are defined as subspecs.
pod 'ShareKit/Twitter', '2.0'
pod 'ShareKit/Pinboard', '2.0'
Installs ShareKit with only the source files for ShareKit/Twitter
,
ShareKit/Pinboard
. Note that, in this case, the ‘sub-specifications’
to compile need the source files, the dependencies, and the other
attributes defined by the root specification. CocoaPods is smart enough
to handle any issues arising from duplicate attributes.
1642 1643 1644 1645 1646 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1642 def subspec(name, &block) subspec = Specification.new(self, name, &block) @subspecs << subspec subspec end |
#summary=(summary) ⇒ Object
A short (maximum 140 characters) description of the Pod.
The description should be short, yet informative. It represents the tag line of the Pod and there is no need to specify that a Pod is a library (they always are).
The summary is expected to be properly capitalised and containing the correct punctuation.
426 427 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 426 root_attribute :summary, :required => true |
#swift_versions=(version) ⇒ Object
The versions of Swift that the specification supports. A version of '4' will be treated as '4.0' by CocoaPods and not '4.1' or '4.2'.
Note The Swift compiler mostly accepts major versions and sometimes will honor minor versions. While CocoaPods allows specifying a minor or patch version it might not be honored fully by the Swift compiler.
158 159 160 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 158 root_attribute :swift_versions, :container => Array, :singularize => true |
#test_spec(name = 'Tests', &block) ⇒ Object
Represents a test specification for the library. Here you can place all your tests for your podspec along with the test dependencies.
1761 1762 1763 1764 1765 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1761 def test_spec(name = 'Tests', &block) subspec = Specification.new(self, name, true, &block) @subspecs << subspec subspec end |
#tvos ⇒ PlatformProxy
Provides support for specifying tvOS attributes.
1879 1880 1881 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1879 def tvos PlatformProxy.new(self, :tvos) end |
#user_target_xcconfig=(value) ⇒ Object
Specifies flags to add to the final aggregate target xcconfig file, which propagates to non-overridden and inheriting build settings to the integrated user targets.
This attribute is not recommended as Pods should not pollute the build settings of the user project and this can cause conflicts.
Multiple definitions for build settings that take multiple values will be merged. The user is warned on conflicting definitions for custom build settings and build settings that take only one value.
Typically clang compiler flags or precompiler macro definitions go
in here if they are required when importing the pod in the user
target. Note that, this influences not only the compiler view of the
public interface of your pod, but also all other integrated pods
alongside to yours. You should always prefer pod_target_xcconfig
,
which can contain the same settings, but only influence the
toolchain when compiling your pod target.
958 959 960 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 958 attribute :user_target_xcconfig, :container => Hash, :inherited => true |
#vendored_frameworks=(*frameworks) ⇒ Object
The paths of the framework bundles that come shipped with the Pod. Supports both .framework
and .xcframework
bundles.
The frameworks will be made available to the Pod and to the consumers of the pod.
1334 1335 1336 1337 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1334 attribute :vendored_frameworks, :container => Array, :file_patterns => true, :singularize => true |
#vendored_libraries=(*frameworks) ⇒ Object
The paths of the libraries that come shipped with the Pod. The libraries will be available to the Pod and the consumers of the Pod.
1357 1358 1359 1360 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1357 attribute :vendored_libraries, :container => Array, :file_patterns => true, :singularize => true |
#version=(version) ⇒ Object
The version of the Pod. CocoaPods follows semantic versioning.
127 128 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 127 root_attribute :version, :required => true |
#visionos ⇒ PlatformProxy
Provides support for specifying visionOS attributes.
1890 1891 1892 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1890 def visionos PlatformProxy.new(self, :visionos) end |
#watchos ⇒ PlatformProxy
Provides support for specifying watchOS attributes.
1901 1902 1903 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1901 def watchos PlatformProxy.new(self, :watchos) end |
#weak_frameworks=(*frameworks) ⇒ Object
A list of frameworks that the user’s target needs to weakly link against.
864 865 866 867 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 864 attribute :weak_frameworks, :container => Array, :singularize => true, :inherited => true |