Class: Pod::Generator::InfoPlistFile
- Inherits:
-
Object
- Object
- Pod::Generator::InfoPlistFile
- Defined in:
- lib/cocoapods/generator/info_plist_file.rb
Overview
Generates Info.plist files. A Info.plist file is generated for each Pod and for each Pod target definition, that requires to be built as framework. It states public attributes.
Constant Summary collapse
- FILE_CONTENTS =
<<-EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIdentifier</key> <string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>${PRODUCT_NAME}</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>${CURRENT_PROJECT_VERSION_STRING}</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>${CURRENT_PROJECT_VERSION}</string> <key>NSPrincipalClass</key> <string></string> </dict> </plist> EOS
Instance Attribute Summary collapse
-
#target ⇒ Target
readonly
The target represented by this Info.plist.
Instance Method Summary collapse
-
#generate ⇒ String
Generates the contents of the Info.plist.
-
#initialize(target) ⇒ InfoPlistFile
constructor
Initialize a new instance.
-
#save_as(path) ⇒ void
Generates and saves the Info.plist to the given path.
-
#target_version ⇒ String
The version associated with the current target.
Constructor Details
#initialize(target) ⇒ InfoPlistFile
Initialize a new instance
16 17 18 |
# File 'lib/cocoapods/generator/info_plist_file.rb', line 16 def initialize(target) @target = target end |
Instance Attribute Details
#target ⇒ Target (readonly)
Returns the target represented by this Info.plist.
10 11 12 |
# File 'lib/cocoapods/generator/info_plist_file.rb', line 10 def target @target end |
Instance Method Details
#generate ⇒ String
Generates the contents of the Info.plist
52 53 54 |
# File 'lib/cocoapods/generator/info_plist_file.rb', line 52 def generate FILE_CONTENTS.sub('${CURRENT_PROJECT_VERSION_STRING}', target_version) end |
#save_as(path) ⇒ void
This method returns an undefined value.
Generates and saves the Info.plist to the given path.
27 28 29 30 31 32 |
# File 'lib/cocoapods/generator/info_plist_file.rb', line 27 def save_as(path) contents = generate path.open('w') do |f| f.write(contents) end end |
#target_version ⇒ String
Note:
Will return 1.0.0 for the AggregateTarget
The version associated with the current target
40 41 42 43 44 45 46 |
# File 'lib/cocoapods/generator/info_plist_file.rb', line 40 def target_version if target && target.respond_to?(:root_spec) target.root_spec.version.to_s else '1.0.0' end end |