Class: QCloudHive::ProjectFeature

Inherits:
Object
  • Object
show all
Defined in:
lib/qcloudhive/manifest.rb

Instance Method Summary collapse

Constructor Details

#initialize(project, branch) ⇒ ProjectFeature

Returns a new instance of ProjectFeature.



99
100
101
102
103
104
# File 'lib/qcloudhive/manifest.rb', line 99

def initialize(project, branch)
  @project = project
  @branch = branch
  #
  @remoteBranch = nil
end

Instance Method Details

#compareMasterObject



129
130
131
132
133
134
135
136
137
138
# File 'lib/qcloudhive/manifest.rb', line 129

def compareMaster
  if @branch.name == "master"
    return 0
  end
  master = @project.gitRepo.branches["master"]
  localDate = DateTime.parse(@branch.gcommit.committer_date.to_s)
  masterLocalDate = master.gcommit.committer_date
  masterDate =  DateTime.parse(masterLocalDate.to_s)
  localDate <=> masterDate
end

#compareRemoteObject



119
120
121
122
123
124
125
126
127
# File 'lib/qcloudhive/manifest.rb', line 119

def compareRemote
  localSha = @branch.gcommit.sha
  localDate = DateTime.parse(@branch.gcommit.committer_date.to_s)
  remtoeDate = DateTime.parse(self.remoteBranch.commit.committed_date)
  if  self.remoteBranch.commit.id != localSha
    return localDate <=> remtoeDate
  end
  return 0
end

#local?Boolean

Returns:

  • (Boolean)


112
113
114
115
116
117
# File 'lib/qcloudhive/manifest.rb', line 112

def local?
   if @branch.nil?
     return false
   end
   localBranch.local?
end

#remoteBranchObject



105
106
107
108
109
110
# File 'lib/qcloudhive/manifest.rb', line 105

def remoteBranch
  if @remoteBranch.nil?
    @remoteBranch = CodeOA.branch(@project.serverProject.id, @branch.name)
  end
  @remoteBranch
end