pod-builder 1.9.2 → 2.0.0.beta.21

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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/Example/PodBuilder/.gitignore +6 -0
  4. data/Example/PodBuilder/.pod_builder/pod_builder +0 -0
  5. data/Example/{Frameworks → PodBuilder}/PodBuilder.json +10 -4
  6. data/Example/PodBuilder/Podfile +23 -0
  7. data/Example/PodBuilder/Podfile.restore +40 -0
  8. data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
  9. data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist → PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
  10. data/Example/PodBuilderExample/AppDelegate.swift +4 -0
  11. data/Example/Podfile +42 -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 +50 -13
  16. data/exe/pod_builder +39 -28
  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 +44 -161
  20. data/lib/pod_builder/command/build_all.rb +2 -2
  21. data/lib/pod_builder/command/clean.rb +34 -55
  22. data/lib/pod_builder/command/clear_lldbinit.rb +7 -3
  23. data/lib/pod_builder/command/deintegrate.rb +29 -7
  24. data/lib/pod_builder/command/generate_lfs.rb +3 -3
  25. data/lib/pod_builder/command/generate_podspec.rb +3 -2
  26. data/lib/pod_builder/command/info.rb +1 -1
  27. data/lib/pod_builder/command/init.rb +37 -14
  28. data/lib/pod_builder/command/install_sources.rb +21 -14
  29. data/lib/pod_builder/command/none.rb +2 -2
  30. data/lib/pod_builder/command/restore_all.rb +4 -4
  31. data/lib/pod_builder/command/switch.rb +137 -95
  32. data/lib/pod_builder/command/sync_podfile.rb +5 -3
  33. data/lib/pod_builder/command/update.rb +5 -6
  34. data/lib/pod_builder/command/update_lldbinit.rb +11 -9
  35. data/lib/pod_builder/configuration.rb +88 -13
  36. data/lib/pod_builder/core.rb +93 -12
  37. data/lib/pod_builder/info.rb +32 -98
  38. data/lib/pod_builder/install.rb +255 -195
  39. data/lib/pod_builder/licenses.rb +4 -4
  40. data/lib/pod_builder/podfile.rb +287 -73
  41. data/lib/pod_builder/podfile/post_actions.rb +9 -15
  42. data/lib/pod_builder/podfile_cp.rb +93 -0
  43. data/lib/pod_builder/podfile_item.rb +181 -82
  44. data/lib/pod_builder/podspec.rb +144 -135
  45. data/lib/pod_builder/rome/post_install.rb +240 -0
  46. data/lib/pod_builder/rome/pre_install.rb +6 -0
  47. data/lib/pod_builder/templates/build_podfile.template +3 -3
  48. data/lib/pod_builder/version.rb +1 -1
  49. data/pod-builder.gemspec +4 -4
  50. metadata +34 -65
  51. data/Example/Pods/Alamofire/LICENSE +0 -19
  52. data/Example/Pods/Alamofire/README.md +0 -242
  53. data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
  54. data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
  55. data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
  56. data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
  57. data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
  58. data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
  59. data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
  60. data/Example/Pods/Alamofire/Source/Request.swift +0 -654
  61. data/Example/Pods/Alamofire/Source/Response.swift +0 -567
  62. data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
  63. data/Example/Pods/Alamofire/Source/Result.swift +0 -300
  64. data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
  65. data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
  66. data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
  67. data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
  68. data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
  69. data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
  70. data/Example/Pods/Manifest.lock +0 -16
  71. data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
  72. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
  73. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
  74. data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
  75. data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
  76. data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
  77. data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
  78. data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
  79. data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
  80. data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
  81. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
  82. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
  83. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
  84. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
  85. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
  86. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
  87. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
  88. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
  89. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
  90. data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
  91. data/lib/pod_builder/cocoapods/specification.rb +0 -27
@@ -3,12 +3,12 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class BuildAll
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
10
10
  ARGV << "*"
11
- return Command::Build::call(options)
11
+ return Command::Build::call
12
12
  end
13
13
  end
14
14
  end
@@ -4,92 +4,71 @@ require 'highline/import'
4
4
  module PodBuilder
5
5
  module Command
6
6
  class Clean
7
- def self.call(options)
7
+ def self.call
8
8
  Configuration.check_inited
9
9
  PodBuilder::prepare_basepath
10
10
 
11
- install_update_repo = options.fetch(:update_repos, true)
11
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
12
12
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
13
13
  all_buildable_items = Analyze.podfile_items(installer, analyzer)
14
14
 
15
- podspec_names = all_buildable_items.map(&:podspec_name)
16
- rel_paths = all_buildable_items.map(&:prebuilt_rel_path)
17
-
18
- base_path = PodBuilder::basepath("Rome")
19
- framework_files = Dir.glob("#{base_path}/**/*.framework")
20
- puts "Looking for unused frameworks".yellow
21
- clean(framework_files, base_path, rel_paths)
22
-
23
- rel_paths.map! { |x| "#{x}.dSYM"}
24
-
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)
34
-
35
- puts "Looking for unused sources".yellow
36
- clean_sources(podspec_names)
15
+ prebuilt_items(all_buildable_items)
16
+ install_sources(all_buildable_items)
37
17
 
38
18
  puts "\n\n🎉 done!\n".green
39
19
  return 0
40
20
  end
41
-
42
- def self.clean_sources(podspec_names)
43
- base_path = PodBuilder::basepath("Sources")
44
-
45
- repo_paths = Dir.glob("#{base_path}/*")
46
-
47
- paths_to_delete = []
48
- repo_paths.each do |path|
49
- podspec_name = File.basename(path)
50
-
51
- unless !podspec_names.include?(podspec_name)
52
- next
21
+
22
+ def self.prebuilt_items(buildable_items)
23
+ puts "Cleaning prebuilt folder".yellow
24
+
25
+ root_names = buildable_items.map(&:root_name).uniq
26
+ Dir.glob(File.join(PodBuilder::prebuiltpath, "*")).each do |path|
27
+ basename = File.basename(path)
28
+ unless root_names.include?(basename)
29
+ puts "Cleanining up `#{basename}`, no longer found among dependencies".blue
30
+ PodBuilder::safe_rm_rf(path)
53
31
  end
54
-
55
- paths_to_delete.push(path)
56
32
  end
57
33
 
58
- paths_to_delete.flatten.each do |path|
59
- confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
60
- if confirm.downcase == 'y'
34
+ puts "Cleaning dSYM folder".yellow
35
+ module_names = buildable_items.map(&:module_name).uniq
36
+ Dir.glob(File.join(PodBuilder::dsympath, "**/*.dSYM")).each do |path|
37
+ dsym_basename = File.basename(path, ".*")
38
+ dsym_basename.gsub!(/\.framework$/, "")
39
+ unless module_names.include?(dsym_basename)
40
+ puts "Cleanining up `#{dsym_basename}`, no longer found among dependencies".blue
61
41
  PodBuilder::safe_rm_rf(path)
62
42
  end
63
43
  end
44
+
64
45
  end
65
46
 
66
- private
47
+ def self.install_sources(buildable_items)
48
+ puts "Looking for unused sources".yellow
49
+
50
+ podspec_names = buildable_items.map(&:root_name).uniq
67
51
 
68
- def self.clean(files, base_path, rel_paths)
69
- files = files.map { |x| [Pathname.new(x).relative_path_from(Pathname.new(base_path)).to_s, x] }.to_h
52
+ base_path = PodBuilder::basepath("Sources")
70
53
 
71
54
  paths_to_delete = []
72
- files.each do |rel_path, path|
73
- unless !rel_paths.include?(rel_path)
55
+ repo_paths = Dir.glob("#{base_path}/*")
56
+ repo_paths.each do |path|
57
+ podspec_name = File.basename(path)
58
+
59
+ if podspec_names.include?(podspec_name)
74
60
  next
75
61
  end
76
62
 
77
63
  paths_to_delete.push(path)
78
64
  end
79
65
 
80
- paths_to_delete.each do |path|
81
- confirm = ask("\n#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
66
+ paths_to_delete.flatten.each do |path|
67
+ confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
82
68
  if confirm.downcase == 'y'
83
69
  PodBuilder::safe_rm_rf(path)
84
70
  end
85
71
  end
86
-
87
- Dir.chdir(base_path) do
88
- # Before deleting anything be sure we're in a git repo
89
- h = `git rev-parse --show-toplevel`.strip()
90
- raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
91
- system("find . -type d -empty -delete") # delete empty folders
92
- end
93
72
  end
94
73
  end
95
74
  end
@@ -4,7 +4,11 @@ require 'digest'
4
4
  module PodBuilder
5
5
  module Command
6
6
  class ClearLldbInit
7
- def self.call(options)
7
+ def self.call
8
+ Configuration.check_inited
9
+ if Configuration.build_using_repo_paths
10
+ raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
11
+ end
8
12
 
9
13
  argument_pods = ARGV.dup
10
14
 
@@ -16,7 +20,7 @@ module PodBuilder
16
20
  end
17
21
 
18
22
  lldbinit_path = File.expand_path(argument_pods[0])
19
- lldbinit_content = File.exists?(lldbinit_path) ? File.read(lldbinit_path) : ""
23
+ lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
20
24
 
21
25
  lldbinit_lines = []
22
26
  skipNext = false
@@ -34,7 +38,7 @@ module PodBuilder
34
38
 
35
39
  File.write(lldbinit_path, lldbinit_lines.join())
36
40
 
37
- if options.nil? == false
41
+ if OPTIONS.nil? == false
38
42
  puts "\n\n🎉 done!\n".green
39
43
  end
40
44
  return 0
@@ -3,11 +3,11 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Deintegrate
6
- def self.call(options)
6
+ def self.call
7
7
  raise "\n\nPodBuilder not initialized!\n".red if !Configuration.exists
8
8
 
9
- prebuilt_podfile = File.join(Configuration.base_path, "Podfile")
10
- restored_podfile = File.join(PodBuilder::project_path, "Podfile")
9
+ prebuilt_podfile = PodBuilder::basepath("Podfile")
10
+ restored_podfile = PodBuilder::project_path("Podfile")
11
11
 
12
12
  FileUtils.cp(prebuilt_podfile, restored_podfile)
13
13
 
@@ -32,14 +32,20 @@ module PodBuilder
32
32
  end
33
33
 
34
34
  FileUtils.rm_f(restored_podfile)
35
- File.write(restored_podfile, podfile_lines.join)
36
- Podfile.update_path_entires(restored_podfile, false)
37
- Podfile.update_project_entries(restored_podfile, false)
35
+
36
+ podfile_content = podfile_lines.join
37
+
38
+ podfile_content = Podfile.update_path_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
39
+ podfile_content = Podfile.update_project_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
40
+ podfile_content = Podfile.update_require_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
41
+
42
+ File.write(restored_podfile, podfile_content)
38
43
 
39
44
  PodBuilder::safe_rm_rf(Configuration.base_path)
40
45
 
41
46
  Dir.chdir(PodBuilder::project_path)
42
- system("pod install;")
47
+ bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
48
+ system("#{bundler_prefix}pod install;")
43
49
 
44
50
  license_base = PodBuilder::project_path(Configuration.license_filename)
45
51
  FileUtils.rm_f("#{license_base}.plist")
@@ -53,6 +59,22 @@ module PodBuilder
53
59
 
54
60
  private
55
61
 
62
+ def self.podfile_path_transform(path)
63
+ use_absolute_paths = false
64
+ podfile_path = PodBuilder::project_path("Podfile")
65
+ original_basepath = PodBuilder::basepath
66
+
67
+ podfile_base_path = Pathname.new(File.dirname(podfile_path))
68
+
69
+ original_path = Pathname.new(File.join(original_basepath, path))
70
+ replace_path = original_path.relative_path_from(podfile_base_path)
71
+ if use_absolute_paths
72
+ replace_path = replace_path.expand_path(podfile_base_path)
73
+ end
74
+
75
+ return replace_path
76
+ end
77
+
56
78
  def self.update_gemfile
57
79
  gemfile_path = File.join(PodBuilder::home, "Gemfile")
58
80
  unless File.exist?(gemfile_path)
@@ -3,7 +3,7 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class GenerateLFS
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
 
9
9
  unless Configuration.lfs_update_gitattributes
@@ -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"]
@@ -3,13 +3,14 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class GeneratePodspec
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
8
  PodBuilder::prepare_basepath
9
9
 
10
10
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, false)
11
+ all_buildable_items = Analyze.podfile_items(installer, analyzer)
11
12
 
12
- Podspec::generate(analyzer)
13
+ Podspec::generate(all_buildable_items, analyzer)
13
14
 
14
15
  puts "\n\n🎉 done!\n".green
15
16
  return 0
@@ -4,7 +4,7 @@ require 'json'
4
4
  module PodBuilder
5
5
  module Command
6
6
  class Info
7
- def self.call(options)
7
+ def self.call
8
8
  Configuration.check_inited
9
9
 
10
10
  info = PodBuilder::Info.generate_info()
@@ -3,24 +3,24 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class Init
6
- def self.call(options)
6
+ def self.call
7
7
  raise "\n\nAlready initialized\n".red if Configuration.exists
8
8
 
9
9
  xcworkspace = Dir.glob("*.xcworkspace")
10
- raise "\n\nNo xcworkspace found in current folder\n" if xcworkspace.count == 0
11
- raise "\n\nToo many xcworkspaces found in current folder\n#{xcworkspace}\n" if xcworkspace.count > 1
10
+ raise "\n\nNo xcworkspace found in current folder\n".red if xcworkspace.count == 0
11
+ raise "\n\nToo many xcworkspaces found in current folder\n#{xcworkspace}\n".red if xcworkspace.count > 1
12
12
 
13
13
  Configuration.project_name = File.basename(xcworkspace.first, ".*")
14
14
 
15
- options[:prebuild_path] ||= Configuration.base_path
15
+ OPTIONS[:prebuild_path] ||= Configuration.base_path
16
16
 
17
- if File.expand_path(options[:prebuild_path]) != options[:prebuild_path] # if not absolute
18
- options[:prebuild_path] = File.expand_path(PodBuilder::project_path(options[:prebuild_path]))
17
+ if File.expand_path(OPTIONS[:prebuild_path]) != OPTIONS[:prebuild_path] # if not absolute
18
+ OPTIONS[:prebuild_path] = File.expand_path(PodBuilder::project_path(OPTIONS[:prebuild_path]))
19
19
  end
20
20
 
21
- FileUtils.mkdir_p(options[:prebuild_path])
22
- FileUtils.mkdir_p("#{options[:prebuild_path]}/.pod_builder")
23
- FileUtils.touch("#{options[:prebuild_path]}/.pod_builder/pod_builder")
21
+ FileUtils.mkdir_p(OPTIONS[:prebuild_path])
22
+ FileUtils.mkdir_p("#{OPTIONS[:prebuild_path]}/.pod_builder")
23
+ FileUtils.touch("#{OPTIONS[:prebuild_path]}/.pod_builder/pod_builder")
24
24
 
25
25
  source_path_rel_path = "Sources"
26
26
  development_pods_config_rel_path = Configuration.dev_pods_configuration_filename
@@ -32,15 +32,22 @@ module PodBuilder
32
32
  source_path_rel_path,
33
33
  development_pods_config_rel_path]
34
34
 
35
- File.write("#{options[:prebuild_path]}/.gitignore", git_ignores.join("\n"))
35
+ File.write("#{OPTIONS[:prebuild_path]}/.gitignore", git_ignores.join("\n"))
36
36
 
37
37
  project_podfile_path = PodBuilder::project_path("Podfile")
38
- prebuilt_podfile_path = File.join(options[:prebuild_path], "Podfile")
38
+ prebuilt_podfile_path = File.join(OPTIONS[:prebuild_path], "Podfile")
39
39
  FileUtils.cp(project_podfile_path, prebuilt_podfile_path)
40
+
41
+ podfile_content = File.read(prebuilt_podfile_path)
40
42
 
41
- Podfile.add_install_block(prebuilt_podfile_path)
42
- Podfile.update_path_entires(prebuilt_podfile_path, false, PodBuilder::project_path(""))
43
- Podfile.update_project_entries(prebuilt_podfile_path, false, PodBuilder::project_path(""))
43
+ podfile_content = Podfile.add_install_block(podfile_content)
44
+ podfile_content = Podfile.update_path_entries(podfile_content, Init.method(:podfile_path_transform))
45
+ podfile_content = Podfile.update_project_entries(podfile_content, Init.method(:podfile_path_transform))
46
+ podfile_content = Podfile.update_require_entries(podfile_content, Init.method(:podfile_path_transform))
47
+
48
+ podfile_content = Podfile.prepare_for_react_native(podfile_content)
49
+
50
+ File.write(prebuilt_podfile_path, podfile_content)
44
51
 
45
52
  Configuration.write
46
53
 
@@ -52,6 +59,22 @@ module PodBuilder
52
59
 
53
60
  private
54
61
 
62
+ def self.podfile_path_transform(path)
63
+ use_absolute_paths = false
64
+ podfile_path = File.join(OPTIONS[:prebuild_path], "Podfile")
65
+ original_basepath = PodBuilder::project_path
66
+
67
+ podfile_base_path = Pathname.new(File.dirname(podfile_path))
68
+
69
+ original_path = Pathname.new(File.join(original_basepath, path))
70
+ replace_path = original_path.relative_path_from(podfile_base_path)
71
+ if use_absolute_paths
72
+ replace_path = replace_path.expand_path(podfile_base_path)
73
+ end
74
+
75
+ return replace_path
76
+ end
77
+
55
78
  def self.update_gemfile
56
79
  gemfile_path = File.join(PodBuilder::home, "Gemfile")
57
80
  unless File.exist?(gemfile_path)
@@ -3,30 +3,33 @@ require 'pod_builder/core'
3
3
  module PodBuilder
4
4
  module Command
5
5
  class InstallSources
6
- def self.call(options)
6
+ def self.call
7
7
  Configuration.check_inited
8
+ if Configuration.build_using_repo_paths
9
+ raise "\n\nSource cannot be installed because lldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
10
+ end
11
+
8
12
  PodBuilder::prepare_basepath
9
13
 
10
- install_update_repo = options.fetch(:update_repos, true)
14
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
11
15
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
12
- framework_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt }
13
- podspec_names = framework_items.map(&:podspec_name)
16
+ podfile_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt }
17
+ podspec_names = podfile_items.map(&:podspec_name)
14
18
 
15
- base_path = PodBuilder::basepath("Rome")
19
+ base_path = PodBuilder::prebuiltpath
16
20
  framework_files = Dir.glob("#{base_path}/**/*.framework")
17
21
 
18
22
  framework_files.each do |path|
19
23
  rel_path = Pathname.new(path).relative_path_from(Pathname.new(base_path)).to_s
20
24
 
21
- if framework_spec = framework_items.detect { |x| x.prebuilt_rel_path == rel_path }
22
- update_repo(framework_spec)
25
+ if podfile_spec = podfile_items.detect { |x| x.prebuilt_rel_path == rel_path }
26
+ update_repo(podfile_spec)
23
27
  end
24
28
  end
25
29
 
26
- Command::Clean::clean_sources()
30
+ Command::Clean::clean_sources(podspec_names)
27
31
 
28
32
  ARGV << PodBuilder::basepath("Sources")
29
- Command::UpdateLldbInit::call(options)
30
33
 
31
34
  puts "\n\n🎉 done!\n".green
32
35
  return 0
@@ -35,6 +38,10 @@ module PodBuilder
35
38
  private
36
39
 
37
40
  def self.update_repo(spec)
41
+ if spec.path != nil || spec.podspec_path != nil
42
+ return
43
+ end
44
+
38
45
  dest_path = PodBuilder::basepath("Sources")
39
46
  FileUtils.mkdir_p(dest_path)
40
47
 
@@ -43,25 +50,25 @@ module PodBuilder
43
50
 
44
51
  repo_dir = File.join(dest_path, spec.podspec_name)
45
52
  if !File.directory?(repo_dir)
46
- raise "Failed cloning #{spec.name}" if !system("git clone #{spec.repo} #{spec.podspec_name}")
53
+ raise "\n\nFailed cloning #{spec.name}".red if !system("git clone #{spec.repo} #{spec.podspec_name}")
47
54
  end
48
55
 
49
56
  Dir.chdir(repo_dir)
50
57
  puts "Checking out #{spec.podspec_name}".yellow
51
- raise "Failed cheking out #{spec.name}" if !system(git_hard_checkout_cmd(spec))
58
+ raise "\n\nFailed cheking out #{spec.name}".red if !system(git_hard_checkout_cmd(spec))
52
59
 
53
60
  Dir.chdir(current_dir)
54
61
  end
55
62
 
56
63
  def self.git_hard_checkout_cmd(spec)
57
64
  prefix = "git fetch --all --tags --prune; git reset --hard"
58
- if @tag
65
+ if spec.tag
59
66
  return "#{prefix} tags/#{spec.tag}"
60
67
  end
61
- if @commit
68
+ if spec.commit
62
69
  return "#{prefix} #{spec.commit}"
63
70
  end
64
- if @branch
71
+ if spec.branch
65
72
  return "#{prefix} origin/#{spec.branch}"
66
73
  end
67
74