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 = <<-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 #设置pod库统计时,查询的repos、Excel中sheet的名字 end EOF f.write(demo) end |
.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 |