Class: Stool::Config
Constant Summary collapse
- @@cachePath =
cache相关的路径
File.join(Dir.home(),'stool')
- @@configFilePath =
File.join(@@cachePath, 'ConfigFile.rb')
- @@logsDirPath =
File.join(@@cachePath, 'log')
Instance Attribute Summary collapse
-
#checkRepos ⇒ Object
repo pod库的统计.
-
#pools ⇒ Object
本地lib池子.
-
#repoCachePath ⇒ Object
cocoapods的repo缓存路径.
-
#tasks ⇒ Object
主工程.
Class Method Summary collapse
-
.checkConfigFile? ⇒ Boolean
检测config.rb是否存在.
-
.creatConfigFile ⇒ Object
创建一个ConfigFile例子.
-
.loadConfig ⇒ Object
从配置中心读取.
- .logsDirPath ⇒ Object
Instance Method Summary collapse
-
#addPool {|pInfo| ... } ⇒ Object
添加一个本地libPool.
-
#addTask {|tInfo| ... } ⇒ Object
添加一个workspace.
-
#initialize ⇒ Config
constructor
A new instance of Config.
Methods inherited from BaseObj
#doCacheByYAML, fromFile, fromYAML
Constructor Details
#initialize ⇒ Config
24 25 26 27 28 29 30 |
# File 'lib/stool/Core/Config.rb', line 24 def initialize @repoCachePath = File.join(Dir.home,'.cocoapods/repos') @pools = [] @tasks = [] @checkRepos = [] super end |
Instance Attribute Details
#checkRepos ⇒ Object
repo pod库的统计
22 23 24 |
# File 'lib/stool/Core/Config.rb', line 22 def checkRepos @checkRepos end |
#pools ⇒ Object
本地lib池子
16 17 18 |
# File 'lib/stool/Core/Config.rb', line 16 def pools @pools end |
#repoCachePath ⇒ Object
cocoapods的repo缓存路径
20 21 22 |
# File 'lib/stool/Core/Config.rb', line 20 def repoCachePath @repoCachePath end |
#tasks ⇒ Object
主工程
18 19 20 |
# File 'lib/stool/Core/Config.rb', line 18 def tasks @tasks end |
Class Method Details
.checkConfigFile? ⇒ Boolean
检测config.rb是否存在
60 61 62 63 64 65 66 67 68 |
# File 'lib/stool/Core/Config.rb', line 60 def self.checkConfigFile? path = File.join(@@configFilePath) unless File.exist?(path) creatConfigFile puts "*** At first ,you should edit the config file at path<#{@@configFilePath}>!!" `open #{@@configFilePath}` end end |
.creatConfigFile ⇒ Object
创建一个ConfigFile例子
71 72 73 74 75 76 77 78 79 80 81 82 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 |
# File 'lib/stool/Core/Config.rb', line 71 def self.creatConfigFile unless Dir.exist?(@@cachePath) Dir.mkdir(@@cachePath,0777) end File.new(@@configFilePath,'w+') f = File.open(@@configFilePath, "w+") demo = " #stool \u914D\u7F6E\n Config.new do |c|\n #\u6DFB\u52A0\u4E00\u4E2A\u672C\u5730lib pool\uFF0C\u6C60\u4E2D\u662F\u4F60clone\u4E0B\u6765\u7684\u5404\u4E2Apod\n #name - \u968F\u610F\u53D6\n #path - lib pool\u7684\u672C\u5730\u8DEF\u5F84\n c.addPool do |p|\n p.name = '\u672C\u5730lib\u6C60 - 1'\n p.path = ''\n end\n\n #\u518D\u6DFB\u52A0\u4E00\u4E2A\u672C\u5730lib pool\n # c.addPool do |p|\n # p.name = '\u672C\u5730lib\u6C60 - 2'\n # p.path = ''\n # end\n\n #\u6DFB\u52A0\u4E00\u4E2A\u4E3B\u5DE5\u7A0B\uFF0CiOS-workspace\u5DE5\u7A0B\n #name - \u968F\u610F\u53D6\n #tag - \u547D\u4EE4\u64CD\u4F5C\u9700\u8981\uFF0C\u5DE5\u7A0B\u7684\u552F\u4E00\u6807\u8BC6\n #path - \u8DEF\u5F84\u76EE\u4E0B\u8981\u6709workspace/podfile\u6587\u4EF6\n #addLocalLib - \u9879\u76EE\u4F7F\u7528\u7684\u672C\u5730lib(\u518D\u65E0\u9700\u624B\u52A8\u4FEE\u6539Podfile)\uFF0C\u9ED8\u8BA4\u90FD\u662F\u6E90\u7801\n #addOtherLibUseCode - \u975E\u672C\u5730lib\uFF0C\u914D\u7F6E\u4F7F\u7528\u6E90\u7801\n #allLibsUseCode - \u662F\u5426\u6240\u6709lib\u90FD\u4F7F\u7528\u6E90\u7801\uFF0C\u9ED8\u8BA4false\n c.addTask do |t|\n t.name = 'workspace\u4E3B\u5DE5\u7A0B-1'\n t.tag = '1'\n t.path = ''\n t.addLocalLib(['pod1',\n 'pod2',\n 'pod3'])\n t.addOtherLibUseCode(['pod4'])\n #t.allLibsUseCode\n end\n end\n EOF\n\n f.write(demo)\nend\n" |
.loadConfig ⇒ Object
从配置中心读取
37 38 39 40 41 |
# File 'lib/stool/Core/Config.rb', line 37 def self.loadConfig checkConfigFile? cc = Config::fromFile(@@configFilePath) cc end |
.logsDirPath ⇒ Object
32 33 34 |
# File 'lib/stool/Core/Config.rb', line 32 def self.logsDirPath @@logsDirPath end |
Instance Method Details
#addPool {|pInfo| ... } ⇒ Object
添加一个本地libPool
44 45 46 47 48 |
# File 'lib/stool/Core/Config.rb', line 44 def addPool pInfo = PoolInfo.new() @pools.push(pInfo) yield pInfo if block_given? end |
#addTask {|tInfo| ... } ⇒ Object
添加一个workspace
51 52 53 54 55 |
# File 'lib/stool/Core/Config.rb', line 51 def addTask tInfo = TaskInfo.new() @tasks.push(tInfo) yield tInfo if block_given? end |