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



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
# File 'lib/pod_builder/install.rb', line 22

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
    
    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