Class: PodBuilder::Install
- Inherits:
-
Object
- Object
- PodBuilder::Install
- Defined in:
- lib/pod_builder/install.rb
Class Method Summary collapse
- .cleanup_frameworks(podfile_items) ⇒ Object
- .copy_dsyms(podfile_items) ⇒ Object
- .copy_frameworks(podfile_items) ⇒ Object
- .framework_rel_path(framework_path, podfile_items) ⇒ Object
- .init_git(path) ⇒ Object
- .install ⇒ Object
- .podfile(podfile_content, podfile_items, build_configuration) ⇒ Object
Class Method Details
.cleanup_frameworks(podfile_items) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/pod_builder/install.rb', line 61 def self.cleanup_frameworks(podfile_items) Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path| framework_rel_path = framework_rel_path(framework_path, podfile_items) dsym_path = framework_rel_path + ".dSYM" PodBuilder::safe_rm_rf(PodBuilder::basepath("Rome/#{framework_rel_path}")) PodBuilder::safe_rm_rf(PodBuilder::basepath("dSYM/iphoneos/#{dsym_path}")) PodBuilder::safe_rm_rf(PodBuilder::basepath("dSYM/iphonesimulator/#{dsym_path}")) end end |
.copy_dsyms(podfile_items) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/pod_builder/install.rb', line 82 def self.copy_dsyms(podfile_items) Dir.glob("#{Configuration.build_path}/build/*iphoneos/**/*.dSYM") do |dsym_path| framework_rel_path = framework_rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items) destination_path = PodBuilder::basepath("dSYM/iphoneos/#{File.dirname(framework_rel_path)}") FileUtils.mkdir_p(destination_path) FileUtils.cp_r(dsym_path, destination_path) end Dir.glob("#{Configuration.build_path}/build/*iphonesimulator/**/*.dSYM") do |dsym_path| framework_rel_path = framework_rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items) destination_path = PodBuilder::basepath("dSYM/iphonesimulator/#{File.dirname(framework_rel_path)}") FileUtils.mkdir_p(destination_path) FileUtils.cp_r(dsym_path, destination_path) end end |
.copy_frameworks(podfile_items) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/pod_builder/install.rb', line 72 def self.copy_frameworks(podfile_items) Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path| framework_rel_path = framework_rel_path(framework_path, podfile_items) destination_path = PodBuilder::basepath("Rome/#{framework_rel_path}") FileUtils.mkdir_p(File.dirname(destination_path)) FileUtils.cp_r(framework_path, destination_path) end end |
.framework_rel_path(framework_path, podfile_items) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/pod_builder/install.rb', line 51 def self.framework_rel_path(framework_path, podfile_items) framework_name = File.basename(framework_path) framework_name_no_ext = File.basename(framework_name, File.extname(framework_name)) if podfile_item = podfile_items.detect { |x| x.module_name == framework_name_no_ext && Configuration.subspecs_to_split.include?(x.name) } return "#{podfile_item.prebuilt_rel_path}" else return framework_name end end |
.init_git(path) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/pod_builder/install.rb', line 100 def self.init_git(path) current_dir = Dir.pwd Dir.chdir(path) system("git init") Dir.chdir(current_dir) end |
.install ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pod_builder/install.rb', line 35 def self.install CLAide::Command::PluginManager.load_plugins("cocoapods") current_dir = Dir.pwd Dir.chdir(Configuration.build_path) config = Pod::Config.new() installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile) installer.repo_update = false installer.update = false installer.install! Dir.chdir(current_dir) end |
.podfile(podfile_content, podfile_items, build_configuration) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pod_builder/install.rb', line 4 def self.podfile(podfile_content, podfile_items, build_configuration) PodBuilder::safe_rm_rf(Configuration.build_path) FileUtils.mkdir_p(Configuration.build_path) 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 cleanup_frameworks(podfile_items) copy_frameworks(podfile_items) if build_configuration != "debug" copy_dsyms(podfile_items) end rescue Exception => e raise e ensure FileUtils.rm(lock_file) end end |