Class: CocoapodsEntitlementsStatistics::ProjectInfo
- Includes:
- Xcodeproj::Project::Object
- Defined in:
- lib/cocoapods-entitlements-statistics/project_info.rb
Instance Attribute Summary collapse
-
#load_success ⇒ Object
readonly
Returns the value of attribute load_success.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#tagret_name ⇒ Object
readonly
Returns the value of attribute tagret_name.
Instance Method Summary collapse
- #entitlements_plist ⇒ Object
- #info_plist ⇒ Object
-
#initialize ⇒ ProjectInfo
constructor
A new instance of ProjectInfo.
- #load_xcodeproj ⇒ Object
- #load_xcodeproj_success? ⇒ Boolean
- #marketing_version ⇒ Object
- #product_bundle_identifier ⇒ Object
- #project_release_config ⇒ Object
- #system_capabilities ⇒ Object
Constructor Details
#initialize ⇒ ProjectInfo
Returns a new instance of ProjectInfo.
13 14 15 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 13 def initialize load_xcodeproj end |
Instance Attribute Details
#load_success ⇒ Object (readonly)
Returns the value of attribute load_success.
10 11 12 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 10 def load_success @load_success end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
9 10 11 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 9 def project @project end |
#tagret_name ⇒ Object (readonly)
Returns the value of attribute tagret_name.
11 12 13 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 11 def tagret_name @tagret_name end |
Instance Method Details
#entitlements_plist ⇒ Object
41 42 43 44 45 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 41 def entitlements_plist entitlements_files = Pathname.glob("**/#{@tagret_name}.entitlements").reject { |path| !path.to_s.start_with?("#{@tagret_name}/") } entitlements_path = entitlements_files.length > 0 ? entitlements_files.first.realpath : "" entitlements_path end |
#info_plist ⇒ Object
35 36 37 38 39 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 35 def info_plist info_plists = Pathname.glob('**/info.plist').reject { |path| !path.to_s.start_with?("#{@tagret_name}/") } info_plist_path = info_plists.length > 0 ? info_plists.first.realpath : "" info_plist_path end |
#load_xcodeproj ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 21 def load_xcodeproj xcodeprojects = Pathname.glob('**/*.xcodeproj').reject { |path| path.to_s.start_with?('Pods/') } if xcodeprojects.length == 1 @tagret_name = Pathname(xcodeprojects.first).basename('.xcodeproj') @project = Xcodeproj::Project.open(xcodeprojects.first.realpath) @load_success = true else @load_success = false = xcodeprojects.length > 1 ? 'found too many' : "couldn't find any" projects = xcodeprojects.map(&:basename).join(' ') Pod::UI.notice 'CocoaPods-Keys ' + + ' Xcode projects (' + projects + '). Please give a name for this project.' end end |
#load_xcodeproj_success? ⇒ Boolean
17 18 19 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 17 def load_xcodeproj_success? return @load_success end |
#marketing_version ⇒ Object
57 58 59 60 61 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 57 def marketing_version return nil unless !project_release_config.nil? marketing_version = project_release_config.build_settings["MARKETING_VERSION"] marketing_version end |
#product_bundle_identifier ⇒ Object
63 64 65 66 67 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 63 def product_bundle_identifier return nil unless !project_release_config.nil? product_bundle_identifier = project_release_config.build_settings["PRODUCT_BUNDLE_IDENTIFIER"] product_bundle_identifier end |
#project_release_config ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 47 def project_release_config return @release_configurations unless @release_configurations.nil? @project.targets[0].build_configurations.each do |config| if config.name == 'Release' @release_configurations = config end end @release_configurations end |
#system_capabilities ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cocoapods-entitlements-statistics/project_info.rb', line 69 def system_capabilities target_attr_hash = @project.root_object.attributes["TargetAttributes"] system_capabilities = Hash.new target_attr_hash.each do |_,value| if value.class == Hash && value.keys.include?("SystemCapabilities") system_capabilities = value["SystemCapabilities"] end end system_capabilities end |