Class: QCloudHive::ManifestProject
- Inherits:
-
Object
- Object
- QCloudHive::ManifestProject
- Defined in:
- lib/qcloudhive/manifest.rb
Instance Attribute Summary collapse
-
#moduleName ⇒ Object
Returns the value of attribute moduleName.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#remote ⇒ Object
Returns the value of attribute remote.
Instance Method Summary collapse
- #exsitLocal? ⇒ Boolean
- #exsitPodRepo? ⇒ Boolean
- #exsitServer? ⇒ Boolean
- #gitRepo ⇒ Object
-
#initialize(remote, name, path) ⇒ ManifestProject
constructor
A new instance of ManifestProject.
- #localPath ⇒ Object
- #needReleasePod? ⇒ Boolean
- #podspec ⇒ Object
- #podStorageSpec ⇒ Object
- #serverProject ⇒ Object
Constructor Details
#initialize(remote, name, path) ⇒ ManifestProject
Returns a new instance of ManifestProject.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/qcloudhive/manifest.rb', line 11 def initialize(remote, name ,path) @remote = remote @name = name @path = path @moduleName = name.split("/").last #private values @serverProject = nil @podspec = nil @git = nil @podStorageSpec = nil @localPath end |
Instance Attribute Details
#moduleName ⇒ Object
Returns the value of attribute moduleName.
10 11 12 |
# File 'lib/qcloudhive/manifest.rb', line 10 def moduleName @moduleName end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/qcloudhive/manifest.rb', line 9 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/qcloudhive/manifest.rb', line 8 def path @path end |
#remote ⇒ Object
Returns the value of attribute remote.
7 8 9 |
# File 'lib/qcloudhive/manifest.rb', line 7 def remote @remote end |
Instance Method Details
#exsitLocal? ⇒ Boolean
71 72 73 |
# File 'lib/qcloudhive/manifest.rb', line 71 def exsitLocal? return self.gitRepo.nil? == false end |
#exsitPodRepo? ⇒ Boolean
74 75 76 |
# File 'lib/qcloudhive/manifest.rb', line 74 def exsitPodRepo? return self.podStorageSpec.nil? == false end |
#exsitServer? ⇒ Boolean
77 78 79 |
# File 'lib/qcloudhive/manifest.rb', line 77 def exsitServer? return self.serverProject.nil? == false end |
#gitRepo ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/qcloudhive/manifest.rb', line 59 def gitRepo if @git.nil? root = Pathname(Config.projectRootDirectory) gitPath = root.join(self.path) begin @git = Git.open(gitPath) rescue => err puts "创建Git工程失败 #{gitPath} #{err}" end end @git end |
#localPath ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/qcloudhive/manifest.rb', line 23 def localPath if @localPath == nil root = Pathname(Config.projectRootDirectory) @localPath = root.join(self.path).to_path end @localPath end |
#needReleasePod? ⇒ Boolean
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/qcloudhive/manifest.rb', line 81 def needReleasePod? if exsitLocal? return false end version = self.podspec.version.first tag = gitRepo..select { |e| e.name == version.to_s }.first if tag.nil? return true end master = gitRepo.branches["master"] if tag.sha != master.gcommit.sha return true end return false end |
#podspec ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/qcloudhive/manifest.rb', line 44 def podspec if @podspec.nil? HivePod.podspecs.each { |pspec| if pspec.name == self.moduleName @podspec = pspec.podspec end } if @podspec.nil? @podspec = self.podStorageSpec end end @podspec end |
#podStorageSpec ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/qcloudhive/manifest.rb', line 36 def podStorageSpec if @podStorageSpec.nil? L.info("search module #{moduleName}") @podStorageSpec = HivePod.search(moduleName) end @podStorageSpec end |
#serverProject ⇒ Object
30 31 32 33 34 35 |
# File 'lib/qcloudhive/manifest.rb', line 30 def serverProject if @serverProject.nil? @serverProject = CodeOA.existProjectByName?(moduleName) end @serverProject end |