pod-builder 1.9.4 ā†’ 2.0.0.beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/Example/Frameworks/.gitignore +6 -0
  4. data/Example/Frameworks/.pod_builder/pod_builder +0 -0
  5. data/Example/Frameworks/PodBuilder.json +10 -4
  6. data/Example/Frameworks/Podfile +23 -0
  7. data/Example/Frameworks/Podfile.restore +40 -0
  8. data/Example/PodBuilderExample/AppDelegate.swift +4 -0
  9. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
  10. data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist ā†’ PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
  11. data/Example/Podfile +44 -1
  12. data/Example/Podfile.lock +426 -7
  13. data/Example/Pods-acknowledgements.md +210 -0
  14. data/Example/Pods-acknowledgements.plist +206 -0
  15. data/README.md +38 -1
  16. data/exe/pod_builder +14 -14
  17. data/lib/pod_builder/analyze.rb +32 -7
  18. data/lib/pod_builder/analyzer.rb +16 -0
  19. data/lib/pod_builder/command/build.rb +110 -109
  20. data/lib/pod_builder/command/clean.rb +9 -11
  21. data/lib/pod_builder/command/clear_lldbinit.rb +1 -1
  22. data/lib/pod_builder/command/deintegrate.rb +2 -1
  23. data/lib/pod_builder/command/generate_lfs.rb +2 -2
  24. data/lib/pod_builder/command/install_sources.rb +1 -1
  25. data/lib/pod_builder/command/switch.rb +99 -99
  26. data/lib/pod_builder/command/sync_podfile.rb +2 -1
  27. data/lib/pod_builder/command/update.rb +1 -1
  28. data/lib/pod_builder/command/update_lldbinit.rb +2 -2
  29. data/lib/pod_builder/configuration.rb +61 -7
  30. data/lib/pod_builder/core.rb +60 -5
  31. data/lib/pod_builder/info.rb +24 -90
  32. data/lib/pod_builder/install.rb +148 -82
  33. data/lib/pod_builder/podfile/post_actions.rb +0 -1
  34. data/lib/pod_builder/podfile.rb +83 -14
  35. data/lib/pod_builder/podfile_item.rb +152 -74
  36. data/lib/pod_builder/podspec.rb +125 -133
  37. data/lib/pod_builder/rome/post_install.rb +248 -0
  38. data/lib/pod_builder/rome/pre_install.rb +6 -0
  39. data/lib/pod_builder/templates/build_podfile.template +1 -1
  40. data/lib/pod_builder/version.rb +1 -1
  41. data/pod-builder.gemspec +3 -3
  42. metadata +28 -60
  43. data/Example/Pods/Alamofire/LICENSE +0 -19
  44. data/Example/Pods/Alamofire/README.md +0 -242
  45. data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
  46. data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
  47. data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
  48. data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
  49. data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
  50. data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
  51. data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
  52. data/Example/Pods/Alamofire/Source/Request.swift +0 -654
  53. data/Example/Pods/Alamofire/Source/Response.swift +0 -567
  54. data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
  55. data/Example/Pods/Alamofire/Source/Result.swift +0 -300
  56. data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
  57. data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
  58. data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
  59. data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
  60. data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
  61. data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
  62. data/Example/Pods/Manifest.lock +0 -16
  63. data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
  64. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
  65. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
  66. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
  67. data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
  68. data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
  69. data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
  70. data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
  71. data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
  72. data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
  73. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
  74. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
  75. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
  76. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
  77. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
  78. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
  79. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
  80. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
  81. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
  82. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
  83. data/lib/pod_builder/cocoapods/specification.rb +0 -27
@@ -3,7 +3,7 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Build
6
- def self.call(options)
6
+ def self.call(options)
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
@@ -18,6 +18,8 @@ module PodBuilder
18
18
  Podfile.sanity_check()
19
19
  check_not_building_subspecs(argument_pods)
20
20
 
21
+ puts "Loading Podfile".yellow
22
+
21
23
  install_update_repo = options.fetch(:update_repos, true)
22
24
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
23
25
 
@@ -25,8 +27,11 @@ module PodBuilder
25
27
  prebuilt_items = all_buildable_items.select { |x| x.is_prebuilt }
26
28
  buildable_items = all_buildable_items - prebuilt_items
27
29
 
28
- if argument_pods.first == "*"
29
- argument_pods = buildable_items.map(&:root_name)
30
+ build_all = argument_pods.first == "*"
31
+ if build_all
32
+ argument_pods = analyzer.explicit_pods().map(&:root_name).uniq
33
+ else
34
+ argument_pods = Podfile::resolve_pod_names(argument_pods, all_buildable_items)
30
35
  end
31
36
 
32
37
  available_argument_pods = argument_pods.select { |x| all_buildable_items.map(&:root_name).include?(x) }
@@ -73,8 +78,10 @@ module PodBuilder
73
78
  licenses = []
74
79
 
75
80
  podfiles_items.select { |x| x.count > 0 }.each do |podfile_items|
76
- podfile_items = add_dependencies(podfile_items, all_buildable_items)
77
- podfile_content = Podfile.from_podfile_items(podfile_items, analyzer)
81
+ build_configuration = podfile_items.map(&:build_configuration).uniq.first
82
+
83
+ podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
84
+ podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration)
78
85
 
79
86
  Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
80
87
 
@@ -92,7 +99,10 @@ module PodBuilder
92
99
  Podspec::generate(all_buildable_items, analyzer)
93
100
 
94
101
  builded_pods = podfiles_items.flatten
95
- builded_pods_and_deps = add_dependencies(builded_pods, all_buildable_items).select { |x| !x.is_prebuilt }
102
+
103
+ builded_pods_and_deps = podfiles_items.flatten.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
104
+ builded_pods_and_deps.select! { |x| !x.is_prebuilt }
105
+
96
106
  Podfile::write_restorable(builded_pods_and_deps + prebuilt_pods_to_install, all_buildable_items, analyzer)
97
107
  if !options.has_key?(:skip_prebuild_update)
98
108
  Podfile::write_prebuilt(all_buildable_items, analyzer)
@@ -126,86 +136,74 @@ module PodBuilder
126
136
  return []
127
137
  end
128
138
 
129
- def self.add_dependencies(pods, buildable_items)
130
- pods.dup.each do |pod|
131
- build_configuration = pods.first.build_configuration
132
-
133
- dependencies = pod.dependencies(buildable_items).select { |x| !pods.include?(x) && !pod.has_common_spec(x.name) }
134
- dependencies.each { |x| x.build_configuration = build_configuration }
135
- pods = dependencies + pods # dependencies should come first
136
- end
137
-
138
- return pods
139
- end
140
-
141
- def self.buildable_dependencies(pod, buildable_items)
142
- deps = []
143
-
144
- pod.dependency_names.each do |dependency|
145
- buildable_pods = buildable_items.select { |t| t.root_name == dependency }
146
- if buildable_pods.any? { |t| t.source_files.count > 0 }
147
- deps.push(dependency)
148
- end
149
- end
150
-
151
- return deps
152
- end
153
-
154
- def self.expected_common_dependencies(pods_to_build, buildable_items, options)
155
- warned_expected_pod_list = []
156
- expected_pod_list = []
157
- errors = []
158
-
159
- pods_to_build.each do |pod_to_build|
160
- buildable_dependencies(pod_to_build, buildable_items).each do |dependency|
161
- unless buildable_items.detect { |x| x.root_name == dependency || x.name == dependency } != nil
162
- next
163
- end
164
-
165
- buildable_items.each do |buildable_pod|
166
- unless !buildable_dependencies(pod_to_build, buildable_items).include?(buildable_pod.name)
167
- next
168
- end
169
-
170
- if buildable_dependencies(buildable_pod, buildable_items).include?(dependency) && !buildable_pod.has_subspec(dependency) && !buildable_pod.has_common_spec(dependency) then
171
- expected_pod_list += pods_to_build.map(&:root_name) + [buildable_pod.root_name]
172
- expected_pod_list.uniq!
173
-
174
- expected_list = expected_pod_list.join(" ")
175
- if !warned_expected_pod_list.include?(expected_list)
176
- errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_list}` instead or use `pod_builder build -a #{pod_to_build.name}` to automatically resolve missing dependencies\n\n")
177
- errors.uniq!
178
- warned_expected_pod_list.push(expected_list)
179
-
180
- if options.has_key?(:auto_resolve_dependencies)
181
- puts "`#{pod_to_build.name}` has the following dependencies:\n`#{buildable_dependencies(pod_to_build, buildable_items).join("`, `")}`\nWhich are in common with `#{buildable_pod.name}` and requires it to be recompiled\n\n".yellow
182
- end
183
- end
184
- end
185
- end
186
- end
187
- end
188
-
189
- return expected_pod_list, errors
190
- end
191
-
192
- def self.expected_parent_dependencies(pods_to_build, buildable_items, options)
193
- expected_pod_list = []
194
- errors = []
195
-
196
- buildable_items_dependencies = buildable_items.map(&:dependency_names).flatten.uniq
197
- pods_to_build.each do |pod_to_build|
198
- if buildable_items_dependencies.include?(pod_to_build.name)
199
- parent = buildable_items.detect { |x| x.dependency_names.include?(pod_to_build.name) }
200
-
201
- expected_pod_list += (pods_to_build + [parent]).map(&:root_name)
202
- expected_pod_list.uniq!
203
- errors.push("Can't build #{pod_to_build.name} because it is a dependency of #{parent.name}.\n\nUse `pod_builder build #{expected_pod_list.join(" ")}` instead\n\n")
204
- end
205
- end
206
-
207
- return expected_pod_list, errors
208
- end
139
+ # def self.buildable_dependencies(pod, buildable_items)
140
+ # deps = []
141
+
142
+ # pod.dependency_names.each do |dependency|
143
+ # buildable_pods = buildable_items.select { |t| t.root_name == dependency }
144
+ # if buildable_pods.any? { |t| t.source_files.count > 0 }
145
+ # deps.push(dependency)
146
+ # end
147
+ # end
148
+
149
+ # return deps
150
+ # end
151
+
152
+ # def self.expected_common_dependencies(pods_to_build, buildable_items, options)
153
+ # warned_expected_pod_list = []
154
+ # expected_pod_list = []
155
+ # errors = []
156
+
157
+ # pods_to_build.each do |pod_to_build|
158
+ # buildable_dependencies(pod_to_build, buildable_items).each do |dependency|
159
+ # unless buildable_items.detect { |x| x.root_name == dependency || x.name == dependency } != nil
160
+ # next
161
+ # end
162
+
163
+ # buildable_items.each do |buildable_pod|
164
+ # unless !buildable_dependencies(pod_to_build, buildable_items).include?(buildable_pod.name)
165
+ # next
166
+ # end
167
+
168
+ # if buildable_dependencies(buildable_pod, buildable_items).include?(dependency) && !buildable_pod.has_subspec(dependency) && !buildable_pod.has_common_spec(dependency) then
169
+ # expected_pod_list += pods_to_build.map(&:root_name) + [buildable_pod.root_name]
170
+ # expected_pod_list.uniq!
171
+
172
+ # expected_list = expected_pod_list.join(" ")
173
+ # if !warned_expected_pod_list.include?(expected_list)
174
+ # errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_list}` instead or use `pod_builder build -a #{pod_to_build.name}` to automatically resolve missing dependencies\n\n")
175
+ # errors.uniq!
176
+ # warned_expected_pod_list.push(expected_list)
177
+
178
+ # if options.has_key?(:auto_resolve_dependencies)
179
+ # puts "`#{pod_to_build.name}` has the following dependencies:\n`#{buildable_dependencies(pod_to_build, buildable_items).join("`, `")}`\nWhich are in common with `#{buildable_pod.name}` and requires it to be recompiled\n\n".yellow
180
+ # end
181
+ # end
182
+ # end
183
+ # end
184
+ # end
185
+ # end
186
+
187
+ # return expected_pod_list, errors
188
+ # end
189
+
190
+ # def self.expected_parent_dependencies(pods_to_build, buildable_items, options)
191
+ # expected_pod_list = []
192
+ # errors = []
193
+
194
+ # buildable_items_dependencies = buildable_items.map(&:dependency_names).flatten.uniq
195
+ # pods_to_build.each do |pod_to_build|
196
+ # if buildable_items_dependencies.include?(pod_to_build.name)
197
+ # parent = buildable_items.detect { |x| x.dependency_names.include?(pod_to_build.name) }
198
+
199
+ # expected_pod_list += (pods_to_build + [parent]).map(&:root_name)
200
+ # expected_pod_list.uniq!
201
+ # errors.push("Can't build #{pod_to_build.name} because it is a dependency of #{parent.name}.\n\nUse `pod_builder build #{expected_pod_list.join(" ")}` instead\n\n")
202
+ # end
203
+ # end
204
+
205
+ # return expected_pod_list, errors
206
+ # end
209
207
 
210
208
  def self.check_not_building_subspecs(pods_to_build)
211
209
  pods_to_build.each do |pod_to_build|
@@ -291,27 +289,30 @@ module PodBuilder
291
289
  def self.resolve_pods_to_build(argument_pods, buildable_items, options)
292
290
  pods_to_build = []
293
291
 
294
- fns = [method(:expected_common_dependencies), method(:expected_parent_dependencies)]
295
- fns.each do |fn|
296
- loop do
297
- pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
298
- pods_to_build += other_subspecs(pods_to_build, buildable_items)
299
- tmp_buildable_items = buildable_items - pods_to_build
300
-
301
- expected_pods, errors = fn.call(pods_to_build, tmp_buildable_items, options)
302
- if expected_pods.count > 0
303
- if !options.has_key?(:auto_resolve_dependencies) && expected_pods.count > 0
304
- raise "\n\n#{errors.join("\n")}".red
305
- else
306
- argument_pods = expected_pods.uniq
307
- end
308
- end
292
+ # fns = [method(:expected_common_dependencies), method(:expected_parent_dependencies)]
293
+ # fns.each do |fn|
294
+ # loop do
295
+ # pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
296
+ # pods_to_build += other_subspecs(pods_to_build, buildable_items)
297
+ # tmp_buildable_items = buildable_items - pods_to_build
298
+
299
+ # expected_pods, errors = fn.call(pods_to_build, tmp_buildable_items, options)
300
+ # if expected_pods.count > 0
301
+ # if !options.has_key?(:auto_resolve_dependencies) && expected_pods.count > 0
302
+ # raise "\n\n#{errors.join("\n")}".red
303
+ # else
304
+ # argument_pods = expected_pods.uniq
305
+ # end
306
+ # end
309
307
 
310
- if !options.has_key?(:auto_resolve_dependencies) || expected_pods.count == 0
311
- break
312
- end
313
- end
314
- end
308
+ # if !options.has_key?(:auto_resolve_dependencies) || expected_pods.count == 0
309
+ # break
310
+ # end
311
+ # end
312
+ # end
313
+
314
+ pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
315
+ pods_to_build += other_subspecs(pods_to_build, buildable_items)
315
316
 
316
317
  return pods_to_build
317
318
  end
@@ -320,10 +321,10 @@ module PodBuilder
320
321
  puts "Cleaning framework folder".yellow
321
322
 
322
323
  expected_frameworks = buildable_items.map { |x| "#{x.module_name}.framework" }
323
- expected_frameworks += buildable_items.map { |x| x.vendored_items }.flatten.map { |x| File.basename(x) }
324
+ expected_frameworks += buildable_items.map { |x| x.vendored_frameworks }.flatten.map { |x| File.basename(x) }
324
325
  expected_frameworks.uniq!
325
326
 
326
- existing_frameworks = Dir.glob("#{PodBuilder::basepath("Rome")}/*.framework")
327
+ existing_frameworks = Dir.glob(PodBuilder::prebuiltpath("*.framework"))
327
328
 
328
329
  existing_frameworks.each do |existing_framework|
329
330
  existing_framework_name = File.basename(existing_framework)
@@ -333,7 +334,7 @@ module PodBuilder
333
334
  end
334
335
  end
335
336
 
336
- existing_dsyms = Dir.glob("#{PodBuilder::basepath("dSYM")}/**/*.dSYM")
337
+ existing_dsyms = Dir.glob(PodBuilder::dsympath("**/*.dSYM"))
337
338
  existing_dsyms.each do |existing_dsym|
338
339
  existing_dsym_name = File.basename(existing_dsym)
339
340
  if !expected_frameworks.include?(existing_dsym_name.gsub(".dSYM", ""))
@@ -13,24 +13,22 @@ module PodBuilder
13
13
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
14
14
 
15
15
  podspec_names = all_buildable_items.map(&:podspec_name)
16
- rel_paths = all_buildable_items.map(&:prebuilt_rel_path)
16
+ rel_paths = all_buildable_items.map(&:prebuilt_rel_path) + all_buildable_items.map(&:vendored_frameworks).flatten.map { |t| File.basename(t) }
17
+ rel_paths.uniq!
17
18
 
18
- base_path = PodBuilder::basepath("Rome")
19
+ base_path = PodBuilder::prebuiltpath
19
20
  framework_files = Dir.glob("#{base_path}/**/*.framework")
20
21
  puts "Looking for unused frameworks".yellow
21
22
  clean(framework_files, base_path, rel_paths)
22
23
 
23
24
  rel_paths.map! { |x| "#{x}.dSYM"}
24
25
 
25
- base_path = PodBuilder::basepath("dSYM/iphoneos")
26
- dSYM_files_iphone = Dir.glob("#{base_path}/**/*.dSYM")
27
- puts "Looking for iPhoneOS unused dSYMs".yellow
28
- clean(dSYM_files_iphone, base_path, rel_paths)
29
-
30
- base_path = PodBuilder::basepath("dSYM/iphonesimulator")
31
- dSYM_files_sim = Dir.glob("#{base_path}/**/*.dSYM")
32
- puts "Looking for iPhone Simulator unused dSYMs".yellow
33
- clean(dSYM_files_sim, base_path, rel_paths)
26
+ Configuration.supported_platforms.each do |platform|
27
+ base_path = PodBuilder::dsympath(platform)
28
+ dSYM_files = Dir.glob("#{base_path}/**/*.dSYM")
29
+ puts "Looking for #{platform} unused dSYMs".yellow
30
+ clean(dSYM_files, base_path, rel_paths)
31
+ end
34
32
 
35
33
  puts "Looking for unused sources".yellow
36
34
  clean_sources(podspec_names)
@@ -16,7 +16,7 @@ module PodBuilder
16
16
  end
17
17
 
18
18
  lldbinit_path = File.expand_path(argument_pods[0])
19
- lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
19
+ lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
20
20
 
21
21
  lldbinit_lines = []
22
22
  skipNext = false
@@ -39,7 +39,8 @@ module PodBuilder
39
39
  PodBuilder::safe_rm_rf(Configuration.base_path)
40
40
 
41
41
  Dir.chdir(PodBuilder::project_path)
42
- system("pod install;")
42
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
43
+ system("#{bundler_prefix}pod install;")
43
44
 
44
45
  license_base = PodBuilder::project_path(Configuration.license_filename)
45
46
  FileUtils.rm_f("#{license_base}.plist")
@@ -13,8 +13,8 @@ module PodBuilder
13
13
  gitattributes_excludes = ["*.h", "*.hh", "*.m", "*.mm", "*.i", "*.c", "*.cc", "*.cxx", "*.cpp", "*.def", "*.inc", "*.inl", "*.swift", "*.modulemap", "*.strings", "*.png", "*.jpg", "*.gif", "*.html", "*.htm", "*.js", "*.json", "*.xml", "*.txt", "*.md", "*.rb", "*.sh", "*.py", "*.plist", "*.resolved", ".*", "README*", "LICENSE*"]
14
14
 
15
15
  gitattributes_includes_frameworks = ["**/* filter=lfs diff=lfs merge=lfs !text"]
16
- write_attributes(PodBuilder::basepath("Rome"), gitattributes_includes_frameworks, gitattributes_excludes)
17
- write_attributes(PodBuilder::basepath("dSYM"), gitattributes_includes_frameworks, gitattributes_excludes)
16
+ write_attributes(PodBuilder::prebuiltpath, gitattributes_includes_frameworks, gitattributes_excludes)
17
+ write_attributes(PodBuilder::dsympath, gitattributes_includes_frameworks, gitattributes_excludes)
18
18
 
19
19
  if Configuration.lfs_include_pods_folder
20
20
  gitattributes_includes_pods = ["**/*.framework/**/* filter=lfs diff=lfs merge=lfs !text"]
@@ -12,7 +12,7 @@ module PodBuilder
12
12
  framework_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt }
13
13
  podspec_names = framework_items.map(&:podspec_name)
14
14
 
15
- base_path = PodBuilder::basepath("Rome")
15
+ base_path = PodBuilder::prebuiltpath
16
16
  framework_files = Dir.glob("#{base_path}/**/*.framework")
17
17
 
18
18
  framework_files.each do |path|
@@ -12,108 +12,130 @@ module PodBuilder
12
12
  unless argument_pods.count > 0
13
13
  return -1
14
14
  end
15
- unless argument_pods.count == 1
16
- raise "\n\nSpecify a single pod to switch\n\n".red
17
- end
18
-
19
- pod_name_to_switch = argument_pods.first
20
-
21
- check_not_building_subspec(pod_name_to_switch)
22
15
 
23
- installer, analyzer = Analyze.installer_at(PodBuilder::basepath, false)
24
- all_buildable_items = Analyze.podfile_items(installer, analyzer)
25
-
26
- raise "\n\nPod `#{pod_name_to_switch}` wasn't found in Podfile" unless all_buildable_items.map(&:root_name).include?(pod_name_to_switch)
27
-
28
- unless options.has_key?(:switch_mode)
29
- podfile_item = all_buildable_items.detect { |x| x.root_name == pod_name_to_switch }
30
- options[:switch_mode] = request_switch_mode(pod_name_to_switch, podfile_item)
16
+ pod_names_to_switch = []
17
+ argument_pods.each do |pod|
18
+ pod_name_to_switch = pod
19
+ pod_name_to_switch = Podfile::resolve_pod_names_from_podfile([pod_name_to_switch]).first
20
+ raise "\n\nDid not find pod '#{pod}'" if pod_name_to_switch.nil?
21
+
22
+ check_not_building_subspec(pod_name_to_switch)
31
23
 
32
- if options[:switch_mode].nil?
33
- return 0
34
- end
35
- end
36
-
37
- if options[:switch_mode] == "prebuilt"
38
- check_prebuilded(pod_name_to_switch)
24
+ pod_names_to_switch.push(pod_name_to_switch)
39
25
  end
40
-
41
- podfile_path = PodBuilder::project_path("Podfile")
42
- podfile_content = File.read(podfile_path)
43
-
44
- pod_lines = []
45
- podfile_content.each_line do |line|
46
- if pod_name = Podfile.pod_definition_in(line, false)
47
- if pod_name.start_with?("PodBuilder/")
48
- pod_name = pod_name.split("PodBuilder/").last.gsub("_", "/")
49
- end
50
-
51
- unless pod_name.split("/").first == pod_name_to_switch
52
- pod_lines.push(line)
53
- next
54
- end
55
-
56
- if pod_name.include?("/")
57
- podfile_items = all_buildable_items.select { |x| x.name == pod_name }
58
- else
59
- podfile_items = all_buildable_items.select { |x| x.root_name == pod_name }
26
+
27
+ pod_names_to_switch.each do |pod_name_to_switch|
28
+ development_path = ""
29
+ default_entries = Hash.new
30
+
31
+ case options[:switch_mode]
32
+ when "development"
33
+ development_path = find_podspec(pod_name_to_switch)
34
+ when "prebuilt"
35
+ podfile_path = PodBuilder::basepath("Podfile.restore")
36
+ content = File.read(podfile_path)
37
+ if !content.include?("pod '#{pod_name_to_switch}")
38
+ raise "\n\n'#{pod_name_to_switch}' does not seem to be prebuit!"
60
39
  end
61
-
62
- unless podfile_items.count > 0
63
- raise "\n\nPod `#{pod_name_to_switch}` wasn't found in Podfile\n".red
40
+ when "default"
41
+ podfile_path = PodBuilder::basepath("Podfile")
42
+ content = File.read(podfile_path)
43
+
44
+ current_section = ""
45
+ content.each_line do |line|
46
+ stripped_line = line.strip
47
+ if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
48
+ current_section = line.split(" ")[1]
49
+ next
50
+ end
51
+
52
+ matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
53
+ if matches&.size == 3
54
+ if matches[1].split("/").first == pod_name_to_switch
55
+ default_entries[current_section] = line
56
+ end
57
+ end
64
58
  end
59
+
60
+ raise "\n\n'#{pod_name_to_switch}' not found in #{podfile_path}" if default_entries.keys.count == 0
61
+ end
65
62
 
66
- matches = line.match(/(#\s*pb<)(.*?)(>)/)
67
- if matches&.size == 4
68
- default_pod_name = matches[2]
69
- else
70
- puts "āš ļø Did not found pb<> entry, assigning default pod name #{pod_name}"
71
- default_pod_name = pod_name
63
+ podfile_path = PodBuilder::project_path("Podfile")
64
+ content = File.read(podfile_path)
65
+
66
+ lines = []
67
+ current_section = ""
68
+ content.each_line do |line|
69
+ stripped_line = line.strip
70
+ if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
71
+ current_section = line.split(" ")[1]
72
72
  end
73
73
 
74
- unless podfile_item = all_buildable_items.detect { |x| x.name == default_pod_name }
75
- raise "\n\nPod `#{default_pod_name}` wasn't found in Podfile\n".red
74
+ matches = line.gsub("\"", "'").match(/pod '(.*?)',(.*)/)
75
+ if matches&.size == 3
76
+ if matches[1].split("/").first == pod_name_to_switch
77
+ case options[:switch_mode]
78
+ when "prebuilt"
79
+ indentation = line.split("pod '").first
80
+ rel_path = Pathname.new(PodBuilder::prebuiltpath).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
81
+ prebuilt_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
82
+ if line.include?("# pb<") && marker = line.split("# pb<").last
83
+ prebuilt_line = prebuilt_line.chomp("\n") + " # pb<#{marker}"
84
+ end
85
+ lines.append(prebuilt_line)
86
+ next
87
+ when "development"
88
+ indentation = line.split("pod '").first
89
+ rel_path = Pathname.new(development_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
90
+ development_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
91
+ if line.include?("# pb<") && marker = line.split("# pb<").last
92
+ development_line = development_line.chomp("\n") + " # pb<#{marker}"
93
+ end
94
+
95
+ lines.append(development_line)
96
+ next
97
+ when "default"
98
+ if default_line = default_entries[current_section]
99
+ if line.include?("# pb<") && marker = line.split("# pb<").last
100
+ default_line = default_line.chomp("\n") + " # pb<#{marker}"
101
+ end
102
+ lines.append(default_line)
103
+ next
104
+ elsif
105
+ raise "Line for pod '#{matches[1]}' in section '#{current_section}' not found in PodBuilder's Podfile"
106
+ end
107
+ else
108
+ raise "Unsupported mode '#{options[:switch_mode]}'"
109
+ end
110
+ end
76
111
  end
77
- podfile_item = podfile_item.dup
78
112
 
79
- indentation = line.detect_indentation
80
-
81
- case options[:switch_mode]
82
- when "prebuilt"
83
- line = indentation + podfile_item.prebuilt_entry + "\n"
84
- when "development"
85
- podfile_item.path = find_podspec(podfile_item)
86
- podfile_item.is_external = true
87
-
88
- line = indentation + podfile_item.entry + "\n"
89
- when "default"
90
- line = indentation + podfile_item.entry + "\n"
91
- else
92
- break
93
- end
113
+ lines.append(line)
94
114
  end
95
115
 
96
- pod_lines.push(line)
116
+ File.write(podfile_path, lines.join)
97
117
  end
98
118
 
99
- File.write(podfile_path, pod_lines.join)
100
-
101
119
  Dir.chdir(PodBuilder::project_path)
102
- system("pod install")
120
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
121
+ system("#{bundler_prefix}pod install;")
103
122
 
104
123
  return 0
105
124
  end
106
125
 
107
126
  private
108
127
 
109
- def self.find_podspec(podfile_item)
128
+ def self.find_podspec(podname)
110
129
  unless Configuration.development_pods_paths.count > 0
111
130
  raise "\n\nPlease add the development pods path(s) in #{Configuration.dev_pods_configuration_filename} as per documentation\n".red
112
131
  end
113
132
 
114
133
  podspec_path = nil
115
134
  Configuration.development_pods_paths.each do |path|
116
- podspec = Dir.glob(File.expand_path("#{path}/**/#{podfile_item.root_name}*.podspec*"))
135
+ if Pathname.new(path).relative?
136
+ path = PodBuilder::basepath(path)
137
+ end
138
+ podspec = Dir.glob(File.expand_path("#{path}/**/#{podname}*.podspec*"))
117
139
  podspec.select! { |x| !x.include?("/Local Podspecs/") }
118
140
  podspec.select! { |x| Dir.glob(File.join(File.dirname(x), "*")).count > 1 } # exclude podspec folder (which has one file per folder)
119
141
  if podspec.count > 0
@@ -123,39 +145,17 @@ module PodBuilder
123
145
  end
124
146
 
125
147
  if podspec_path.nil?
126
- raise "\n\nCouln't find `#{podfile_item.root_name}` sources in the following specified development pod paths: #{Configuration.development_pods_paths.join("\n")}\n".red
148
+ raise "\n\nCouln't find `#{podname}` sources in the following specified development pod paths:\n#{Configuration.development_pods_paths.join("\n")}\n".red
127
149
  end
128
150
 
129
151
  return podspec_path
130
152
  end
131
-
132
- def self.request_switch_mode(pod_name, podfile_item)
133
- matches = podfile_item.entry.match(/(pod '.*?',)(.*)('.*')/)
134
- unless matches&.size == 4
135
- raise "\n\nFailed matching pod name\n".red
136
- end
137
-
138
- default_entry = matches[3].strip
139
-
140
- modes = ["prebuilt", "development", "default"]
141
- mode_indx = ask("\n\nSwitch #{pod_name} to:\n1) Prebuilt\n2) Development pod\n3) Default (#{default_entry})\n\n") { |x| x.limit = 1, x.validate = /[1-3]/ }
142
-
143
- return modes[mode_indx.to_i - 1]
144
- end
145
-
153
+
146
154
  def self.check_not_building_subspec(pod_to_switch)
147
155
  if pod_to_switch.include?("/")
148
156
  raise "\n\nCan't switch subspec #{pod_to_switch} refer to podspec name.\n\nUse `pod_builder switch #{pod_to_switch.split("/").first}` instead\n\n".red
149
157
  end
150
158
  end
151
-
152
- private
153
-
154
- def self.check_prebuilded(pod_name)
155
- if !Podspec.include?(pod_name)
156
- raise "\n\n#{pod_name} is not prebuilt.\n\nRun 'pod_builder build #{pod_name}'\n".red
157
- end
158
- end
159
159
  end
160
160
  end
161
161
  end
@@ -21,7 +21,8 @@ module PodBuilder
21
21
  Licenses::write([], all_buildable_items)
22
22
 
23
23
  if previous_podfile_content != updated_podfile_content
24
- system("pod install")
24
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
25
+ system("#{bundler_prefix}pod install;")
25
26
  end
26
27
 
27
28
  return 0
@@ -36,7 +36,7 @@ module PodBuilder
36
36
  ARGV.clear
37
37
  pods_to_update.each { |x| ARGV << x }
38
38
 
39
- options[:auto_resolve_dependencies] = true
39
+ # options[:auto_resolve_dependencies] = true
40
40
  return PodBuilder::Command::Build.call(options)
41
41
  end
42
42
  end
@@ -22,7 +22,7 @@ module PodBuilder
22
22
  app_podfile_content = File.read(PodBuilder::project_path("Podfile"))
23
23
 
24
24
  lldbinit_path = File.expand_path(argument_pods[0])
25
- lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
25
+ lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
26
26
  status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
27
27
  if lldbinit_content.include?("# <pb_md5:#{base_path}:#{status_hash}")
28
28
  puts "\n\nšŸŽ‰ already in sync!\n".green
@@ -125,7 +125,7 @@ module PodBuilder
125
125
  puts "Writing #{lldbinit_path}".yellow
126
126
 
127
127
  FileUtils.touch(lldbinit_path)
128
- raise "\n\nDestination file should be a file" unless File.exists?(lldbinit_path)
128
+ raise "\n\nDestination file should be a file" unless File.exist?(lldbinit_path)
129
129
 
130
130
  lldbinit_lines = []
131
131
  skipNext = false