Class: Pod::Installer::PodSourceInstaller
- Inherits:
-
Object
- Object
- Pod::Installer::PodSourceInstaller
- Defined in:
- lib/cocoapods-jxedt/binary/Intergation.rb
Instance Method Summary collapse
- #install_for_prebuild!(standard_sanbox) ⇒ Object
- #make_link(source, target) ⇒ Object
- #mirror_with_symlink(source, basefolder, target_folder) ⇒ Object
- #walk(path, &action) ⇒ Object
Instance Method Details
#install_for_prebuild!(standard_sanbox) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 80 81 82 |
# File 'lib/cocoapods-jxedt/binary/Intergation.rb', line 20 def install_for_prebuild!(standard_sanbox) check_sandbox = Jxedt::Sandbox.from_sandbox(standard_sanbox) target_names = check_sandbox.existed_target_names(self.name) def walk(path, &action) return unless path.exist? path.children.each do |child| result = action.call(child, &action) if child.directory? walk(child, &action) if result end end end def make_link(source, target) source = Pathname.new(source) target = Pathname.new(target) target.parent.mkpath unless target.parent.exist? relative_source = source.relative_path_from(target.parent) FileUtils.ln_sf(relative_source, target) end def mirror_with_symlink(source, basefolder, target_folder) relative_path = source.relative_path_from(basefolder) match_configuration = Jxedt.config.support_configurations.join('|') if relative_path.to_s =~ /^(#{match_configuration})\/.*/ new_relative_path = relative_path.to_s.gsub!(/^(#{match_configuration})/) { |match| "#{Jxedt.config.xcconfig_configuration_alias}-#{match}" } target = Pathname.new("#{target_folder}/#{new_relative_path}") make_link(source, target) else target = Pathname.new("#{target_folder}/#{relative_path}") make_link(source, target) end end target_names.each do |name| # symbol link copy all substructure real_file_folder = check_sandbox.framework_folder_path_for_target_name(name) # If have only one platform, just place int the root folder of this pod. # If have multiple paths, we use a sperated folder to store different # platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework target_folder = standard_sanbox.pod_dir(self.name) + "_Prebuild" target_folder.rmtree if target_folder.exist? target_folder.mkpath walk(real_file_folder) do |child| source = child # only make symlink to file and `.framework` folder if child.directory? and [".framework", ".xcframework", ".bundle", ".dSYM"].include? child.extname mirror_with_symlink(source, real_file_folder, target_folder) next false # return false means don't go deeper elsif child.file? mirror_with_symlink(source, real_file_folder, target_folder) if child.extname != '.checksum' next true else next true end end end # of for each end |
#make_link(source, target) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/cocoapods-jxedt/binary/Intergation.rb', line 33 def make_link(source, target) source = Pathname.new(source) target = Pathname.new(target) target.parent.mkpath unless target.parent.exist? relative_source = source.relative_path_from(target.parent) FileUtils.ln_sf(relative_source, target) end |
#mirror_with_symlink(source, basefolder, target_folder) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cocoapods-jxedt/binary/Intergation.rb', line 40 def mirror_with_symlink(source, basefolder, target_folder) relative_path = source.relative_path_from(basefolder) match_configuration = Jxedt.config.support_configurations.join('|') if relative_path.to_s =~ /^(#{match_configuration})\/.*/ new_relative_path = relative_path.to_s.gsub!(/^(#{match_configuration})/) { |match| "#{Jxedt.config.xcconfig_configuration_alias}-#{match}" } target = Pathname.new("#{target_folder}/#{new_relative_path}") make_link(source, target) else target = Pathname.new("#{target_folder}/#{relative_path}") make_link(source, target) end end |
#walk(path, &action) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/cocoapods-jxedt/binary/Intergation.rb', line 24 def walk(path, &action) return unless path.exist? path.children.each do |child| result = action.call(child, &action) if child.directory? walk(child, &action) if result end end end |