class QCloudHive::ManifestProject

Attributes

moduleName[RW]
name[RW]
path[RW]
remote[RW]

Public Class Methods

new(remote, name ,path) click to toggle source
# 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

Public Instance Methods

exsitLocal?() click to toggle source
# File lib/qcloudhive/manifest.rb, line 71
def exsitLocal?
  return self.gitRepo.nil? == false
end
exsitPodRepo?() click to toggle source
# File lib/qcloudhive/manifest.rb, line 74
def exsitPodRepo?
  return self.podStorageSpec.nil? == false
end
exsitServer?() click to toggle source
# File lib/qcloudhive/manifest.rb, line 77
def exsitServer?
  return self.serverProject.nil? == false
end
gitRepo() click to toggle source
# 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() click to toggle source
# 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?() click to toggle source
# File lib/qcloudhive/manifest.rb, line 81
def needReleasePod?
  if exsitLocal?
    return false
  end
  version = self.podspec.version.first
  tag = gitRepo.tags.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
podStorageSpec() click to toggle source
# File lib/qcloudhive/manifest.rb, line 36
def podStorageSpec
  if @podStorageSpec.nil?
    L.info("search module #{moduleName}")
    @podStorageSpec = HivePod.search(moduleName)

  end
  @podStorageSpec
end
podspec() click to toggle source
# 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
serverProject() click to toggle source
# File lib/qcloudhive/manifest.rb, line 30
def serverProject
  if @serverProject.nil?
    @serverProject = CodeOA.existProjectByName?(moduleName)
  end
  @serverProject
end