Class: PodBuilder::Command::InstallSources
- Inherits:
-
Object
- Object
- PodBuilder::Command::InstallSources
- Defined in:
- lib/pod_builder/command/install_sources.rb
Class Method Summary collapse
Class Method Details
.call(options) ⇒ Object
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 32 |
# File 'lib/pod_builder/command/install_sources.rb', line 6 def self.call() Configuration.check_inited PodBuilder::prepare_basepath update_repo = [:update_repos] || false installer, analyzer = Analyze.installer_at(PodBuilder::basepath) framework_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt } podspec_names = framework_items.map(&:podspec_name) base_path = PodBuilder::basepath("Rome") framework_files = Dir.glob("#{base_path}/**/*.framework") framework_files.each do |path| rel_path = Pathname.new(path).relative_path_from(Pathname.new(base_path)).to_s if framework_spec = framework_items.detect { |x| x.prebuilt_rel_path == rel_path } update_repo(framework_spec) end end Command::Clean::clean_sources() rewrite_lldinit puts "\n\nš done!\n".green return true end |
.rewrite_lldinit ⇒ Object
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 |
# File 'lib/pod_builder/command/install_sources.rb', line 55 def self.rewrite_lldinit puts "Writing ~/.lldbinit-Xcode".yellow lldbinit_path = File.('~/.lldbinit-Xcode') FileUtils.touch(lldbinit_path) lldbinit_lines = [] File.read(lldbinit_path).each_line do |line| if lldbinit_lines.include?(line.strip()) || line.start_with?("settings set target.source-map") || line.strip() == "" then next end lldbinit_lines.push(line) end build_path = "#{PodBuilder::Configuration.build_path}/Pods" source_path = PodBuilder::basepath("Sources") lldbinit_lines.push("settings set target.source-map '#{build_path}' '#{source_path}'") lldbinit_lines.push("") File.write(lldbinit_path, lldbinit_lines.join("\n")) end |
.update_repo(spec) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pod_builder/command/install_sources.rb', line 36 def self.update_repo(spec) dest_path = PodBuilder::basepath("Sources") FileUtils.mkdir_p(dest_path) current_dir = Dir.pwd Dir.chdir(dest_path) repo_dir = File.join(dest_path, spec.podspec_name) if !File.directory?(repo_dir) raise "Failed cloning #{spec.name}" if !system("git clone #{spec.repo} #{spec.podspec_name}") end Dir.chdir(repo_dir) puts "Checking out #{spec.podspec_name}".yellow raise "Failed cheking out #{spec.name}" if !system(spec.git_hard_checkout) Dir.chdir(current_dir) end |