Class: PodBuilder::Install

Inherits:
Object
  • Object
show all
Defined in:
lib/pod_builder/install.rb

Class Method Summary collapse

Class Method Details

.podfile(podfile_content, podfile_items, build_configuration) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/pod_builder/install.rb', line 83

def self.podfile(podfile_content, podfile_items, build_configuration)
  PodBuilder::safe_rm_rf(Configuration.build_path)
  FileUtils.mkdir_p(Configuration.build_path)

  # Copy the repo to extract license (and potentially other files in the future)
  podfile_items.select { |x| x.is_development_pod }.each do |podfile_item|
    destination_path = "#{Configuration.build_path}/Pods/#{podfile_item.module_name}"
    FileUtils.mkdir_p(destination_path)

    if Pathname.new(podfile_item.path).absolute?
      FileUtils.cp_r("#{podfile_item.path}/.", destination_path)
    else 
      FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
    end

    # It is important that CocoaPods compiles the files under Configuration.build_path in order that DWARF
    # debug info reference to this path. Doing otherwise breaks the assumptions that make the `update_lldbinit`
    # command work
    podfile_content.gsub!(podfile_item.path, destination_path)
    
    license_files = Dir.glob("#{destination_path}/**/*acknowledgements.plist").each { |f| File.delete(f) }
  end
  
  init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf

  podfile_path = "#{Configuration.build_path}/Podfile"
  File.write(podfile_path, podfile_content)
  Podfile.update_path_entires(podfile_path, true)
  Podfile.update_project_entries(podfile_path, true)

  begin  
    lock_file = "#{Configuration.build_path}/pod_builder.lock"
    FileUtils.touch(lock_file)
  
    install

    add_framework_plist_info(podfile_items)
    cleanup_frameworks(podfile_items)
    copy_frameworks(podfile_items)
    copy_libraries(podfile_items)
    if build_configuration != "debug"
      copy_dsyms(podfile_items)
    end
  rescue Exception => e
    raise e
  ensure
    FileUtils.rm(lock_file)
  end
end