Class: Stool::TaskInfo
- Includes:
- Git_util
- Defined in:
- lib/stool/Core/TaskInfo.rb
Instance Attribute Summary collapse
-
#allUseCode ⇒ Object
Returns the value of attribute allUseCode.
-
#localLibs ⇒ Object
pod时,指定的本地lib name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#otherCode ⇒ Object
其他源码指定.
-
#path ⇒ Object
Returns the value of attribute path.
-
#repos ⇒ Object
指定的repo.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #addLocalLib(libs) ⇒ Object
- #addOtherLibUseCode(libs) ⇒ Object
- #allLibsUseCode ⇒ Object
-
#edit_podfile_use_loaclLibs ⇒ Object
更新podfile,添加使用本地库.
- #info_tos ⇒ Object
-
#initialize ⇒ TaskInfo
constructor
A new instance of TaskInfo.
- #open_task ⇒ Object
- #resetPofile ⇒ Object
-
#task_git_up ⇒ Object
更新主工程.
Methods included from Git_util
#git_checkout, #git_commit_all, #git_st, #git_stash, #git_stash_pop, #git_up
Methods inherited from BaseObj
#doCacheByYAML, fromFile, fromYAML
Constructor Details
#initialize ⇒ TaskInfo
Returns a new instance of TaskInfo.
24 25 26 27 28 29 30 |
# File 'lib/stool/Core/TaskInfo.rb', line 24 def initialize @localLibs = [] @otherCode = [] @repos = [] @allUseCode = false super end |
Instance Attribute Details
#allUseCode ⇒ Object
Returns the value of attribute allUseCode.
19 20 21 |
# File 'lib/stool/Core/TaskInfo.rb', line 19 def allUseCode @allUseCode end |
#localLibs ⇒ Object
pod时,指定的本地lib name
16 17 18 |
# File 'lib/stool/Core/TaskInfo.rb', line 16 def localLibs @localLibs end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/stool/Core/TaskInfo.rb', line 11 def name @name end |
#otherCode ⇒ Object
其他源码指定
18 19 20 |
# File 'lib/stool/Core/TaskInfo.rb', line 18 def otherCode @otherCode end |
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/stool/Core/TaskInfo.rb', line 12 def path @path end |
#repos ⇒ Object
指定的repo
22 23 24 |
# File 'lib/stool/Core/TaskInfo.rb', line 22 def repos @repos end |
#tag ⇒ Object
Returns the value of attribute tag.
13 14 15 |
# File 'lib/stool/Core/TaskInfo.rb', line 13 def tag @tag end |
Instance Method Details
#addLocalLib(libs) ⇒ Object
48 49 50 51 52 |
# File 'lib/stool/Core/TaskInfo.rb', line 48 def addLocalLib(libs) libs.each do |lib| @localLibs.push(lib) end end |
#addOtherLibUseCode(libs) ⇒ Object
54 55 56 57 58 |
# File 'lib/stool/Core/TaskInfo.rb', line 54 def addOtherLibUseCode(libs) libs.each do |lib| @otherCode.push(lib) end end |
#allLibsUseCode ⇒ Object
60 61 62 |
# File 'lib/stool/Core/TaskInfo.rb', line 60 def allLibsUseCode @allUseCode = true end |
#edit_podfile_use_loaclLibs ⇒ Object
更新podfile,添加使用本地库
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/stool/Core/TaskInfo.rb', line 83 def edit_podfile_use_loaclLibs podfilePath = File.join(@path,'Podfile') if File.exist?(podfilePath) arr = @localLibs newStr = '' lastMatch = '' File.open(podfilePath, "r+") do |f| f.each_line do |line| lineNew = line hasFound = [] arr.each do |libName| regx = "pod '#{libName}'" if line[/#{regx}/] config = Config.loadConfig libInfo = nil config.pools.each do |pool| result = pool.searchLib(libName) if result libInfo = result end end if libInfo lineNew = regx + ", :path => '#{libInfo.path}'" + "\n" lastMatch = lineNew hasFound.push(libName) end end end arr = arr - hasFound newStr = newStr + lineNew end end File.open(podfilePath, "w") do |file| # puts newStr file.write(newStr) end if arr.count > 0 newStr = '' File.open(podfilePath, "r+") do |f| f.each_line do |line| lineNew = line regx = "#{lastMatch}" if line[/#{regx}/] arr.map do |libName| config = Config.loadConfig libInfo = nil config.pools.each do |pool| result = pool.searchLib(libName) if result libInfo = result end end if libInfo lineNew = lineNew + "\n" + "pod '#{libName}'" + ", :path => '#{libInfo.path}'" + "\n" end end end newStr = newStr + lineNew end end File.open(podfilePath, "w") do |file| file.write(newStr) end end end end |
#info_tos ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/stool/Core/TaskInfo.rb', line 32 def info_tos puts('--' + 'name:'+ self.name) puts('--' + 'tag:'+ self.tag) puts('--' + 'path:'+ self.path) puts('--' + 'localLibs:') self.localLibs.sort.map do |lib| puts(' ' + lib.to_s) end puts('--' + 'otherCode:') self.otherCode.sort.map do |lib| puts(' ' + lib.to_s) end puts('--' + 'allUseCode:'+ self.allUseCode.to_s) puts('') end |
#open_task ⇒ Object
66 67 68 |
# File 'lib/stool/Core/TaskInfo.rb', line 66 def open_task `open *.xcworkspace` end |
#resetPofile ⇒ Object
70 71 72 |
# File 'lib/stool/Core/TaskInfo.rb', line 70 def resetPofile git_checkout(File.join(@path,'Podfile')) end |
#task_git_up ⇒ Object
更新主工程
75 76 77 78 79 80 |
# File 'lib/stool/Core/TaskInfo.rb', line 75 def task_git_up if @path Dir.chdir(path) git_up end end |