aboutsummaryrefslogtreecommitdiff
path: root/package.go
diff options
context:
space:
mode:
Diffstat (limited to 'package.go')
-rw-r--r--package.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/package.go b/package.go
index 56521cc..8b27e54 100644
--- a/package.go
+++ b/package.go
@@ -110,8 +110,8 @@ func (pkg *Package) CompareVersion(newPkg *Package) (err error) {
}
//
-// FetchLatestVersion will try to update the package and get the latest version (tag or
-// commit).
+// FetchLatestVersion will try to update the package and get the latest
+// version (tag or commit).
//
func (pkg *Package) FetchLatestVersion() (err error) {
switch pkg.vcsMode {
@@ -210,6 +210,18 @@ func (pkg *Package) IsEqual(other *Package) bool {
}
//
+// IsNewer will return true if current package is using tag and have newer
+// version that other package. If current package is not using tag, it's
+// always return true.
+//
+func (pkg *Package) IsNewer(older *Package) bool {
+ if !pkg.isTag {
+ return true
+ }
+ return pkg.Version >= older.Version
+}
+
+//
// Remove package installed binaries, archives, and source.
//
func (pkg *Package) Remove() (err error) {