Class: Pod::Command::Deploy
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Deploy
- Includes:
- ProjectDirectory
- Defined in:
- lib/cocoapods-deploy/command/deploy.rb
Instance Method Summary collapse
-
#apply_external_sources_patch ⇒ Object
Applies patch to external sources to add a no_validate option which can be used to disable validation of downloaded podspecs.
-
#apply_resolver_patch ⇒ Object
Applies patch to resolver as it needs help being pointed to use the local podspecs due to limitations in CocoaPods.
-
#install(podfile) ⇒ Object
Triggers the CocoaPods install process.
-
#install_sources_for_lockfile ⇒ Object
Installs required sources for lockfile - TODO: Simplify code.
-
#install_sources_for_pod(pod) ⇒ Object
Installs required sources for pod.
- #run ⇒ Object
-
#setup_environment ⇒ Object
This method sets up the environment to be optimised for CocoaPod Deployment.
-
#transform_podfile ⇒ Object
This prepares the Podfile and Lockfile for deployment by transforming Repo depedencies to Poddpec based dependencies and making sure we have eveything we need for Subspecs which typially don’t work with Podspec based depedencies.
-
#verify_environment ⇒ Object
Verify the environment is ready for deployment i.e Do we have a podfile and lockfile.
Instance Method Details
#apply_external_sources_patch ⇒ Object
Applies patch to external sources to add a no_validate option which can be used to disable validation of downloaded podspecs. A normal install doesn’t validate the podspecs of non-external pods even though certain podspecs are not entirely valid (for example an invalid license file type). This would mean the normal install command can install certain pods that deploy doesn’t because of the validation. This patch makes sure validation doesn’t happen when deploy is being used.
TODO: BDD
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 90 def apply_external_sources_patch ExternalSources::AbstractExternalSource.class_eval do attr_accessor :no_validate old_validate_podspec = instance_method(:validate_podspec) def validate_podspec(podspec) return if no_validate old_validate_podspec(podspec) end end end |
#apply_resolver_patch ⇒ Object
Applies patch to resolver as it needs help being pointed to use the local podspecs due to limitations in CocoaPods. We may be able to remove this in the future.
In the future passing the lockfile into the resolve is hacked potentially we could have a special deploy subclass.
TODO: BDD
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 47 def apply_resolver_patch Resolver.class_eval do def find_cached_set(dependency) name = dependency.root_name unless cached_sets[name] spec = sandbox.specification(name) set = Specification::Set::External.new(spec) cached_sets[name] = set unless set raise Molinillo::NoSuchDependencyError.new(dependency) # rubocop:disable Style/RaiseArgs end end cached_sets[name] end def dependencies_for(specification) dependencies = specification.all_dependencies.select { |dep| Config.instance.lockfile.version(dep.root_name) != nil } dependencies.map do |dependency| if dependency.root_name == Specification.root_name(specification.name) dependency.dup.tap { |d| d.specific_version = specification.version } else dependency end end end end end |
#install(podfile) ⇒ Object
Triggers the CocoaPods install process
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 120 def install(podfile) installer = DeployInstaller.new(config.sandbox, podfile, nil) # Disable updating of the CocoaPods Repo since we are directly # deploying using Podspecs installer.repo_update = false # Disable cleaning of the source file since we are deploying # and we don't need to keep things clean. installer..clean = false installer.install! end |
#install_sources_for_lockfile ⇒ Object
Installs required sources for lockfile - TODO: Simplify code
104 105 106 107 108 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 104 def install_sources_for_lockfile config.lockfile.pod_names.each do |pod| install_sources_for_pod(pod) end end |
#install_sources_for_pod(pod) ⇒ Object
Installs required sources for pod.
111 112 113 114 115 116 117 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 111 def install_sources_for_pod(pod) transformer = DeployTransformer.new(config.lockfile, config.sandbox) dep = transformer.transform_dependency_name(pod) downloader = DeployDownloader.new(dep) downloader.download(config) end |
#run ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 134 def run setup_environment verify_environment # TODO: BDD Patch apply_resolver_patch apply_external_sources_patch install_sources_for_lockfile install(transform_podfile) end |
#setup_environment ⇒ Object
This method sets up the environment to be optimised for CocoaPod Deployment.
Turning off things like repo cloning, clean-up and statistics.
17 18 19 20 21 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 17 def setup_environment # Disable Cocoapods Stats - Due to # https://github.com/CocoaPods/cocoapods-stats/issues/28 ENV['COCOAPODS_DISABLE_STATS'] = "1" end |
#transform_podfile ⇒ Object
This prepares the Podfile and Lockfile for deployment by transforming Repo depedencies to Poddpec based dependencies and making sure we have eveything we need for Subspecs which typially don’t work with Podspec based depedencies.
34 35 36 37 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 34 def transform_podfile transformer = DeployTransformer.new(config.lockfile, config.sandbox) transformer.transform_podfile(config.podfile) end |
#verify_environment ⇒ Object
Verify the environment is ready for deployment i.e Do we have a podfile and lockfile.
25 26 27 28 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 25 def verify_environment verify_podfile_exists! verify_lockfile_exists! end |