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
Returns a new instance of 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 = <<-EOF #stool 配置 Config.new do |c| #添加一个本地lib pool,池中是你clone下来的各个pod #name - 随意取 #path - lib pool的本地路径 c.addPool do |p| p.name = '本地lib池 - 1' p.path = '' end #再添加一个本地lib pool # c.addPool do |p| # p.name = '本地lib池 - 2' # p.path = '' # end #添加一个主工程,iOS-workspace工程 #name - 随意取 #tag - 命令操作需要,工程的唯一标识 #path - 路径目下要有workspace/podfile文件 #addLocalLib - 项目使用的本地lib(再无需手动修改Podfile),默认都是源码 #addOtherLibUseCode - 非本地lib,配置使用源码 #allLibsUseCode - 是否所有lib都使用源码,默认false c.addTask do |t| t.name = 'workspace主工程-1' t.tag = '1' t.path = '' t.addLocalLib(['pod1', 'pod2', 'pod3']) t.addOtherLibUseCode(['pod4']) #t.allLibsUseCode end end EOF f.write(demo) end |
.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 |