Class: SubPod::UserProjectIntegrator
- Inherits:
-
Pod::Installer::UserProjectIntegrator
- Object
- Pod::Installer::UserProjectIntegrator
- SubPod::UserProjectIntegrator
- Defined in:
- lib/subpod/user_project_integrator.rb
Instance Method Summary collapse
- #add_pods_project ⇒ Object
- #integrate! ⇒ Object
- #integrate_user_targets ⇒ Object
- #pods_abs_path ⇒ Object
- #pods_added?(user_project, path) ⇒ Boolean
- #pods_rel_path(path) ⇒ Object
Instance Method Details
#add_pods_project ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/subpod/user_project_integrator.rb', line 15 def add_pods_project user_project_paths.each do |path| proj = Xcodeproj::Project.new(path) unless pods_added?(proj, path) group = proj['Pods'] || proj.new_group('Pods') relative_path = pods_rel_path(path) group.new_file(relative_path) proj.save_as(path) end end end |
#integrate! ⇒ Object
3 4 5 6 7 |
# File 'lib/subpod/user_project_integrator.rb', line 3 def integrate! add_pods_project integrate_user_targets warn_about_empty_podfile end |
#integrate_user_targets ⇒ Object
9 10 11 12 13 |
# File 'lib/subpod/user_project_integrator.rb', line 9 def integrate_user_targets targets_to_integrate.sort_by(&:name).each do |target| TargetIntegrator.new(target).integrate! end end |
#pods_abs_path ⇒ Object
41 42 43 |
# File 'lib/subpod/user_project_integrator.rb', line 41 def pods_abs_path sandbox.project_path end |
#pods_added?(user_project, path) ⇒ Boolean
27 28 29 30 31 32 33 34 35 |
# File 'lib/subpod/user_project_integrator.rb', line 27 def pods_added?(user_project, path) abs_path = pods_abs_path rel_path = pods_rel_path(path) user_project.files.each do |file| path = file.pathname return true if path == abs_path || path == rel_path end false end |
#pods_rel_path(path) ⇒ Object
37 38 39 |
# File 'lib/subpod/user_project_integrator.rb', line 37 def pods_rel_path(path) pods_abs_path.relative_path_from(path.parent) end |