module CocoapodsSoulComponentPlugin
Constants
- VERSION
Public Class Methods
component_file_path()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 56 def self.component_file_path root_path + '/devops/component.json' end
podfile_path()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 52 def self.podfile_path root_path + '/Podfile' end
post_run()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 70 def self.post_run return if use_components == false Pod::UI.puts '添加component.json文件引用' project = Xcodeproj::Project.open(Pod::Config.instance.sandbox.project_path) # 获取主group group = project.main_group group.set_source_tree('SOURCE_ROOT') # 向group中添加 文件引用 file_ref = group.new_reference(Pod::Config.instance.sandbox.root + '../devops/component.json') # podfile_local排序 podfile_local_group = group.children.last group.children.pop group.children.unshift(podfile_local_group) project.save end
pre_run()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 87 def self.pre_run time = Time.now.to_i json = File.read(self.component_file_path) obj = JSON.parse(json) dependencies = obj['dependencies'] dependencies.each do |each| $components.push(Soul_Component.new(each[0], each[1]['local'], each[1]['submodule'], each[1]['version'], each[1]['git'], each[1]['branch'], each[1]['path'])) end $components.each do |each| if each.path == nil if each.submodule == false if each.local == true local_path = each.name + each.branch.to_s + each.commit.to_s target_path = root_path + '/LocalPods/' + local_path each.path = target_path if File.exist?(target_path) == false options = { git: each.git, commit: each.commit, branch: each.branch } options = Pod::Downloader.preprocess_options(options) downloader = Pod::Downloader.for_target(target_path, options) downloader.download downloader.checkout_options #=> { :git => 'example.com', :commit => 'd7f410490dabf7a6bde665ba22da102c3acf1bd9' } end end else if each.local == true each.path = "SOPods/#{each.name}" end end end end end
root_path()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 48 def self.root_path Pod::Config.instance.installation_root.to_s end
use_components()
click to toggle source
# File lib/cocoapods-soul-component-plugin/command/soul-component-plugin.rb, line 44 def self.use_components File.exist?(component_file_path) end