Class: QCloudHive::ProjectFeature
- Inherits:
-
Object
- Object
- QCloudHive::ProjectFeature
- Defined in:
- lib/qcloudhive/manifest.rb
Instance Method Summary collapse
- #compareMaster ⇒ Object
- #compareRemote ⇒ Object
-
#initialize(project, branch) ⇒ ProjectFeature
constructor
A new instance of ProjectFeature.
- #local? ⇒ Boolean
- #remoteBranch ⇒ Object
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
#compareMaster ⇒ Object
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 |
#compareRemote ⇒ Object
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
112 113 114 115 116 117 |
# File 'lib/qcloudhive/manifest.rb', line 112 def local? if @branch.nil? return false end localBranch.local? end |