Class: XCProject::XcodeprojManager
- Inherits:
-
Object
- Object
- XCProject::XcodeprojManager
- Defined in:
- lib/podfileDep/check/xcodeproj.rb
Constant Summary collapse
- @@instance =
单例方法
XcodeprojManager.new
Instance Attribute Summary collapse
-
#module_frameworks ⇒ Object
readonly
缓存某个的依赖库 module_nameB],}.
Class Method Summary collapse
-
.share_manager ⇒ Object
获取单例.
Instance Method Summary collapse
-
#get_app_targets ⇒ Object
获取主APP target列表 不包含扩展.
-
#get_pods_project ⇒ Object
获取Pods下project对象.
-
#get_shell_project ⇒ Object
获取壳工程的project对象.
-
#get_shell_targets ⇒ Object
获取主APP target列表 包含扩展.
-
#initialize ⇒ XcodeprojManager
constructor
A new instance of XcodeprojManager.
Constructor Details
#initialize ⇒ XcodeprojManager
Returns a new instance of XcodeprojManager.
12 13 14 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 12 def initialize @module_frameworks = {} end |
Instance Attribute Details
#module_frameworks ⇒ Object (readonly)
缓存某个的依赖库module_nameB],}
10 11 12 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 10 def module_frameworks @module_frameworks end |
Class Method Details
.share_manager ⇒ Object
获取单例
20 21 22 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 20 def self.share_manager @@instance end |
Instance Method Details
#get_app_targets ⇒ Object
获取主APP target列表 不包含扩展
58 59 60 61 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 58 def get_app_targets project = self.get_shell_project project.root_object.targets end |
#get_pods_project ⇒ Object
获取Pods下project对象
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 64 def get_pods_project xcodeproj_path = "#{Dir.pwd}/Pods/Pods.xcodeproj" unless File.exist?(xcodeproj_path) return nil end Xcodeproj::Project.open(xcodeproj_path) end |
#get_shell_project ⇒ Object
获取壳工程的project对象
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 27 def get_shell_project xcodeproj_file = nil Dir.foreach(Dir.pwd) do |file| if file.end_with?(".xcodeproj") xcodeproj_file = file break end end xcodeproj_path = "#{Dir.pwd}/#{xcodeproj_file}" unless File.exist?(xcodeproj_path) return nil end Xcodeproj::Project.open(xcodeproj_path) end |
#get_shell_targets ⇒ Object
获取主APP target列表 包含扩展
47 48 49 50 51 52 53 54 55 |
# File 'lib/podfileDep/check/xcodeproj.rb', line 47 def get_shell_targets results = [] project = self.get_shell_project targets = project.root_object.targets targets.each do |target| results << target.name end results end |