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库的统计.
-
#checkReposSheets ⇒ Object
Returns the value of attribute checkReposSheets.
-
#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
Returns a new instance of Config.
26 27 28 29 30 31 32 33 |
# File 'lib/stool/Core/Config.rb', line 26 def initialize @repoCachePath = File.join(Dir.home,'.cocoapods/repos') @pools = [] @tasks = [] @checkRepos = [] @checkReposSheets = [] super end |
Instance Attribute Details
#checkRepos ⇒ Object
repo pod库的统计
23 24 25 |
# File 'lib/stool/Core/Config.rb', line 23 def checkRepos @checkRepos end |
#checkReposSheets ⇒ Object
Returns the value of attribute checkReposSheets.
24 25 26 |
# File 'lib/stool/Core/Config.rb', line 24 def checkReposSheets @checkReposSheets 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是否存在
63 64 65 66 67 68 69 70 71 |
# File 'lib/stool/Core/Config.rb', line 63 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例子
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 119 120 121 122 123 124 125 126 127 |
# File 'lib/stool/Core/Config.rb', line 74 def self.creatConfigFile unless Dir.exist?(@@cachePath) Dir.mkdir(@@cachePath,0777) end File.new(@@configFilePath,'w+') f = File.open(@@configFilePath, "w+") demo = "\n #stool \u914D\u7F6E\n\n Config.new do |c|\n\n #\u6DFB\u52A0\u4E00\u4E2A\u672C\u5730lib pool\uFF0C\u6C60\u4E2D\u662F\u4F60clone\u4E0B\u6765\u7684\u5404\u4E2Apod\n #name - \u6839\u636E\u7231\u597D\uFF0C\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\u9879\u76EE\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\n #\u8BBE\u7F6Epod\u5E93\u7EDF\u8BA1\u65F6\uFF0C\u67E5\u8BE2\u7684repos\u3001Excel\u4E2Dsheet\u7684\u540D\u5B57\n\n end\n EOF\n\n f.write(demo)\nend\n" |
.loadConfig ⇒ Object
从配置中心读取
40 41 42 43 44 |
# File 'lib/stool/Core/Config.rb', line 40 def self.loadConfig checkConfigFile? cc = Config::fromFile(@@configFilePath) cc end |
.logsDirPath ⇒ Object
35 36 37 |
# File 'lib/stool/Core/Config.rb', line 35 def self.logsDirPath @@logsDirPath end |
Instance Method Details
#addPool {|pInfo| ... } ⇒ Object
添加一个本地libPool
47 48 49 50 51 |
# File 'lib/stool/Core/Config.rb', line 47 def addPool pInfo = PoolInfo.new() @pools.push(pInfo) yield pInfo if block_given? end |
#addTask {|tInfo| ... } ⇒ Object
添加一个workspace
54 55 56 57 58 |
# File 'lib/stool/Core/Config.rb', line 54 def addTask tInfo = TaskInfo.new() @tasks.push(tInfo) yield tInfo if block_given? end |