Module: QCloudHive::Config
- Defined in:
- lib/qcloudhive/config.rb
Constant Summary collapse
- SHARE_CONFIG =
"Share"- USE_FRAMEWORKS =
"use_framework"- @@projectRootDirectory =
nil- @@reporoot =
nil- @@manifest =
nil- @@setuped =
false
Class Attribute Summary collapse
-
.bitcodeEnable ⇒ Object
Returns the value of attribute bitcodeEnable.
-
.buildFromCommit ⇒ Object
Returns the value of attribute buildFromCommit.
-
.cmdPath ⇒ Object
Returns the value of attribute cmdPath.
-
.namespaceID ⇒ Object
Returns the value of attribute namespaceID.
-
.runPath ⇒ Object
Returns the value of attribute runPath.
-
.scriptesDirectory ⇒ Object
Returns the value of attribute scriptesDirectory.
-
.team ⇒ Object
Returns the value of attribute team.
-
.templateManifestPath ⇒ Object
Returns the value of attribute templateManifestPath.
-
.templatesPath ⇒ Object
Returns the value of attribute templatesPath.
-
.useFrameworks ⇒ Object
Returns the value of attribute useFrameworks.
Class Method Summary collapse
- .dumpShareConfig ⇒ Object
- .loadShareConfig ⇒ Object
- .manifest ⇒ Object
- .podSource ⇒ Object
- .projectRootDirectory ⇒ Object
- .repoRoot ⇒ Object
- .setup ⇒ Object
- .version ⇒ Object
Class Attribute Details
.bitcodeEnable ⇒ Object
Returns the value of attribute bitcodeEnable.
26 27 28 |
# File 'lib/qcloudhive/config.rb', line 26 def bitcodeEnable @bitcodeEnable end |
.buildFromCommit ⇒ Object
Returns the value of attribute buildFromCommit.
27 28 29 |
# File 'lib/qcloudhive/config.rb', line 27 def buildFromCommit @buildFromCommit end |
.cmdPath ⇒ Object
Returns the value of attribute cmdPath.
20 21 22 |
# File 'lib/qcloudhive/config.rb', line 20 def cmdPath @cmdPath end |
.namespaceID ⇒ Object
Returns the value of attribute namespaceID.
22 23 24 |
# File 'lib/qcloudhive/config.rb', line 22 def namespaceID @namespaceID end |
.runPath ⇒ Object
Returns the value of attribute runPath.
21 22 23 |
# File 'lib/qcloudhive/config.rb', line 21 def runPath @runPath end |
.scriptesDirectory ⇒ Object
Returns the value of attribute scriptesDirectory.
25 26 27 |
# File 'lib/qcloudhive/config.rb', line 25 def scriptesDirectory @scriptesDirectory end |
.team ⇒ Object
Returns the value of attribute team.
19 20 21 |
# File 'lib/qcloudhive/config.rb', line 19 def team @team end |
.templateManifestPath ⇒ Object
Returns the value of attribute templateManifestPath.
23 24 25 |
# File 'lib/qcloudhive/config.rb', line 23 def templateManifestPath @templateManifestPath end |
.templatesPath ⇒ Object
Returns the value of attribute templatesPath.
24 25 26 |
# File 'lib/qcloudhive/config.rb', line 24 def templatesPath @templatesPath end |
.useFrameworks ⇒ Object
Returns the value of attribute useFrameworks.
28 29 30 |
# File 'lib/qcloudhive/config.rb', line 28 def useFrameworks @useFrameworks end |
Class Method Details
.dumpShareConfig ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/qcloudhive/config.rb', line 40 def Config.dumpShareConfig conf = "[#{SHARE_CONFIG}] #{USE_FRAMEWORKS} = #{useFrameworks}" file = Pathname(repoRoot()).join("share.conf").to_path File.open(file, "w") { |f| f.write conf } end |
.loadShareConfig ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/qcloudhive/config.rb', line 48 def Config.loadShareConfig configFilePath = Pathname(repoRoot()).join("share.conf").to_path if File.exist?(configFilePath) != true return end config = ParseConfig.new(configFilePath) L.info("config #{config} #{config.class}") if not config.nil? shareConfig = config[SHARE_CONFIG] L.info("shareConfig #{shareConfig} #{shareConfig.class}") if not shareConfig.nil? useFramework = config[SHARE_CONFIG][USE_FRAMEWORKS] if useFramework == "true" Config.useFrameworks = true elsif useFramework == "false" Config.useFrameworks = false end L.info("#{useFramework} #{useFramework.class}") end end end |
.manifest ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/qcloudhive/config.rb', line 83 def Config.manifest() if @@manifest == nil manifestPath = repoRoot+ "manifests/default.xml" L.debug "manifestPath #{manifestPath}" @@manifest = Manifest.new(manifestPath) end return @@manifest end |
.podSource ⇒ Object
79 80 81 |
# File 'lib/qcloudhive/config.rb', line 79 def Config.podSource() Pod::Config::instance.sources_manager.aggregate end |
.projectRootDirectory ⇒ Object
69 70 71 72 73 74 |
# File 'lib/qcloudhive/config.rb', line 69 def Config.projectRootDirectory() if @@projectRootDirectory.nil? @@projectRootDirectory = Pathname(repoRoot).parent.to_path end return @@projectRootDirectory end |
.repoRoot ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/qcloudhive/config.rb', line 31 def Config.repoRoot() if @@reporoot == nil @@reporoot = QCloudHive.FindRepoRoot(Dir.pwd) if @@reporoot == nil Error "当前不再任何项目目录下面,请确认!!!" end end return @@reporoot end |
.setup ⇒ Object
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 |
# File 'lib/qcloudhive/config.rb', line 92 def Config.setup() if @@setuped == true return end @@setuped = true Config.useFrameworks = true configFilePath = Pathname("~/.hiveconfig"). if File.exist?(configFilePath) != true raise "Hive 配置文件不存在,请检查" end config = ParseConfig.new(configFilePath) if config[CODE_OA_GROUDP].nil? Error "没有CodeOA的配置信息,请检查" end private_token = config[CODE_OA_GROUDP][CODE_OA_CONFIG_PRIVATE_TOKEN] if private_token == nil raise "没有设置CodeOA的private_token请检查并设置" end team = config[CODE_OA_GROUDP][CODE_OA_TEAM_NAME] if team == nil raise "没有设置Team Name请设置" end #log level config hiveGroup = config["Hive"] if not hiveGroup.nil? logLevel = hiveGroup["loglevel"] if logLevel.nil? L.level = Logger::ERROR elsif logLevel == "INFO" L.level = Logger::INFO elsif logLevel == "DEBUG" L.level = Logger::DEBUG elsif logLevel == "ERROR" L.level = Logger::ERROR end end puts "LogLevel ........ #{L.level} logLevel" #code OA CodeOA.setup(private_token) Config.team = team Config.cmdPath = Pathname.new(__FILE__).realpath.parent.parent.parent.to_path+"/" Config.runPath = Dir.pwd + "/" Config.templatesPath = Config.cmdPath+"resources/templates/" Config.templateManifestPath = Config.templatesPath+"manifests/" Config.scriptesDirectory = Config.cmdPath+"resources/shellscriptes/" L.info "manifest path is #{Config.templateManifestPath}" codeGroup = Gitlab.groups.select{|g| g.name == team}.first if codeGroup == nil Error("您不属于Group #{team}") end Config.namespaceID = codeGroup.id @@reporoot = nil @@manifest = nil @@projectRootDirectory = nil @@bitcodeEnable = false @@buildFromCommit = false end |
.version ⇒ Object
75 76 77 |
# File 'lib/qcloudhive/config.rb', line 75 def Config.version() return QCloudHive::VERSION end |