Class: Pod::Installer::Analyzer::TargetInspector
- Inherits:
 - 
      Object
      
        
- Object
 - Pod::Installer::Analyzer::TargetInspector
 
 
- Defined in:
 - lib/cocoapods/installer/analyzer/target_inspector.rb
 
Constant Summary collapse
- PLATFORM_INFO_URL =
 'https://guides.cocoapods.org/syntax/podfile.html#platform'.freeze
Instance Attribute Summary collapse
- 
  
    
      #installation_root  ⇒ Pathname 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The root of the CocoaPods installation where the Podfile is located.
 - 
  
    
      #target_definition  ⇒ TargetDefinition 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The target definition to inspect.
 
Instance Method Summary collapse
- 
  
    
      #compute_project_path  ⇒ Pathname 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the path of the user project that the #target_definition should integrate.
 - 
  
    
      #compute_results(user_project)  ⇒ TargetInspectionResult 
    
    
  
  
  
  
  
  
  
  
  
    
Inspect the #target_definition.
 - 
  
    
      #initialize(target_definition, installation_root)  ⇒ TargetInspector 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initialize a new instance.
 
Constructor Details
#initialize(target_definition, installation_root) ⇒ TargetInspector
Initialize a new instance
      26 27 28 29  | 
    
      # File 'lib/cocoapods/installer/analyzer/target_inspector.rb', line 26 def initialize(target_definition, installation_root) @target_definition = target_definition @installation_root = installation_root end  | 
  
Instance Attribute Details
#installation_root ⇒ Pathname (readonly)
Returns the root of the CocoaPods installation where the Podfile is located.
      16 17 18  | 
    
      # File 'lib/cocoapods/installer/analyzer/target_inspector.rb', line 16 def installation_root @installation_root end  | 
  
#target_definition ⇒ TargetDefinition (readonly)
Returns the target definition to inspect.
      11 12 13  | 
    
      # File 'lib/cocoapods/installer/analyzer/target_inspector.rb', line 11 def target_definition @target_definition end  | 
  
Instance Method Details
#compute_project_path ⇒ Pathname
Returns the path of the user project that the #target_definition should integrate.
      62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82  | 
    
      # File 'lib/cocoapods/installer/analyzer/target_inspector.rb', line 62 def compute_project_path if target_definition.user_project_path path = installation_root + target_definition.user_project_path path = "#{path}.xcodeproj" unless File.extname(path) == '.xcodeproj' path = Pathname.new(path) unless path.exist? raise Informative, 'Unable to find the Xcode project ' \ "`#{path}` for the target `#{target_definition.label}`." end else xcodeprojs = installation_root.children.select { |e| e.fnmatch('*.xcodeproj') } if xcodeprojs.size == 1 path = xcodeprojs.first else raise Informative, 'Could not automatically select an Xcode project. ' \ "Specify one in your Podfile like so:\n\n" \ " project 'path/to/Project.xcodeproj'\n" end end path end  | 
  
#compute_results(user_project) ⇒ TargetInspectionResult
Inspect the #target_definition
      37 38 39 40 41 42 43 44 45 46 47 48 49 50 51  | 
    
      # File 'lib/cocoapods/installer/analyzer/target_inspector.rb', line 37 def compute_results(user_project) raise ArgumentError, 'Cannot compute results without a user project set' unless user_project targets = compute_targets(user_project) project_target_uuids = targets.map(&:uuid) build_configurations = compute_build_configurations(targets) platform = compute_platform(targets) archs = compute_archs(targets) swift_version = compute_swift_version_from_targets(targets) result = TargetInspectionResult.new(target_definition, user_project, project_target_uuids, build_configurations, platform, archs) result.target_definition.swift_version = swift_version result end  |