Class: Pod::Installer::PodSourceInstaller
- Inherits:
-
Object
- Object
- Pod::Installer::PodSourceInstaller
- Defined in:
- lib/cocoapods/installer/pod_source_installer.rb
Overview
This class needs to consider all the activated specs of a Pod.
Controller class responsible of installing the activated specifications of a single Pod.
Constant Summary collapse
- UNENCRYPTED_PROTOCOLS =
%w(http git).freeze
Instance Attribute Summary collapse
-
#can_cache ⇒ Boolean
(also: #can_cache?)
readonly
Whether the installer is allowed to touch the cache.
-
#podfile ⇒ Podfile
readonly
The podfile that should be integrated with the user projects.
-
#sandbox ⇒ Sandbox
readonly
The installation target.
-
#specs_by_platform ⇒ Hash{Symbol=>Array}
readonly
The specifications that need to be installed grouped by platform.
Installation collapse
-
#clean! ⇒ void
Cleans the installations if appropriate.
-
#install! ⇒ void
Creates the target in the Pods project and the relative support files.
-
#lock_files!(file_accessors) ⇒ void
Locks the source files if appropriate.
-
#unlock_files!(file_accessors) ⇒ void
Unlocks the source files if appropriate.
Instance Method Summary collapse
-
#initialize(sandbox, podfile, specs_by_platform, can_cache: true) ⇒ PodSourceInstaller
constructor
Initialize a new instance.
-
#inspect ⇒ String
A string suitable for debugging.
-
#name ⇒ String
The name of the pod this installer is installing.
Constructor Details
#initialize(sandbox, podfile, specs_by_platform, can_cache: true) ⇒ PodSourceInstaller
Initialize a new instance
39 40 41 42 43 44 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 39 def initialize(sandbox, podfile, specs_by_platform, can_cache: true) @sandbox = sandbox @podfile = podfile @specs_by_platform = specs_by_platform @can_cache = can_cache end |
Instance Attribute Details
#can_cache ⇒ Boolean (readonly) Also known as: can_cache?
Returns Whether the installer is allowed to touch the cache.
29 30 31 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 29 def can_cache @can_cache end |
#podfile ⇒ Podfile (readonly)
Returns the podfile that should be integrated with the user projects.
20 21 22 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 20 def podfile @podfile end |
#sandbox ⇒ Sandbox (readonly)
Returns The installation target.
15 16 17 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 15 def sandbox @sandbox end |
#specs_by_platform ⇒ Hash{Symbol=>Array} (readonly)
Returns The specifications that need to be installed grouped by platform.
25 26 27 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 25 def specs_by_platform @specs_by_platform end |
Instance Method Details
#clean! ⇒ void
This method returns an undefined value.
Cleans the installations if appropriate.
Cleaning the installation will remove any files that are not used during the build process, based on the podspec and platforms of the target that the pod is integrated into.
83 84 85 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 83 def clean! clean_installation unless local? end |
#inspect ⇒ String
Returns A string suitable for debugging.
48 49 50 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 48 def inspect "<#{self.class} sandbox=#{sandbox.root} pod=#{root_spec.name}" end |
#install! ⇒ void
This method returns an undefined value.
Creates the target in the Pods project and the relative support files.
68 69 70 71 72 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 68 def install! download_source unless predownloaded? || local? PodSourcePreparer.new(root_spec, root).prepare! if local? sandbox.remove_local_podspec(name) unless predownloaded? || local? || external? end |
#lock_files!(file_accessors) ⇒ void
This method returns an undefined value.
Locks the source files if appropriate.
91 92 93 94 95 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 91 def lock_files!(file_accessors) return if local? unlocked_files = source_files(file_accessors).reject { |f| (File.stat(f).mode & 0o200).zero? } FileUtils.chmod('u-w', unlocked_files) end |
#name ⇒ String
Returns The name of the pod this installer is installing.
54 55 56 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 54 def name root_spec.name end |
#unlock_files!(file_accessors) ⇒ void
This method returns an undefined value.
Unlocks the source files if appropriate.
101 102 103 104 |
# File 'lib/cocoapods/installer/pod_source_installer.rb', line 101 def unlock_files!(file_accessors) return if local? FileUtils.chmod('u+w', source_files(file_accessors)) end |