Class: Pod::Command::Deploy
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Deploy
- Includes:
- Project
- Defined in:
- lib/cocoapods-deploy/command/deploy.rb
Instance Method Summary collapse
-
#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_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
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 80 81 82 83 84 85 86 87 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 55 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
106 107 108 109 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 106 def install(podfile) installer = DeployInstaller.new(config.sandbox, podfile, nil) installer.install! end |
#install_sources_for_lockfile ⇒ Object
Installs required sources for lockfile - TODO: Simplify code
90 91 92 93 94 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 90 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.
97 98 99 100 101 102 103 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 97 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
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 111 def run setup_environment verify_environment # TODO: BDD Patch apply_resolver_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 22 23 24 25 26 27 28 29 |
# 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" # Disable updating of the CocoaPods Repo since we are directly # deploying using Podspecs config.skip_repo_update = true # Disable cleaning of the source file since we are deploying # and we don't need to keep things clean. config.clean = false 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.
42 43 44 45 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 42 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.
33 34 35 36 |
# File 'lib/cocoapods-deploy/command/deploy.rb', line 33 def verify_environment verify_podfile_exists! verify_lockfile_exists! end |