Skip to content

Commit

Permalink
ready for release 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornregnell committed Mar 19, 2017
1 parent fe8d7d8 commit c5cc221
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/kh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
java -jar "$DIR/keehive-0.2.jar"
java -jar "$DIR/keehive-0.3.jar"
2 changes: 1 addition & 1 deletion bin/kh.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar keehive-0.2.jar
java -jar keehive-0.3.jar
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lazy val appname = "keehive"
lazy val versnum = "0.2"
lazy val versnum = "0.3"

lazy val root = (project in file(".")).
settings(
Expand Down
2 changes: 0 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ sed -i -- "s/versnum = \"[0-9]\.[0-9]\"/versnum = \"$vers\"/g" build.sbt
sed -i -- "s/keehive-[0-9]\.[0-9]\.jar/keehive-$vers.jar/g" run.sh bin/kh bin/kh.bat

sbt assembly
mkdir -p bin
cp "target/scala-2.11/keehive-$vers.jar" bin/.
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
##!/bin/bash

java -jar target/scala-2.11/keehive-0.2.jar "$@"
java -jar target/scala-2.11/keehive-0.3.jar "$@"
16 changes: 13 additions & 3 deletions src/main/scala/keehive/AppController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,22 @@ object AppController {
if (kvs.nonEmpty) Some(Secret(kvsWithId)) else None
}

def notifyIfUpdateAvailable(): Unit =
def notifyIfUpdateAvailable(): Unit = {

def isFirstVersionGreater(vs: Seq[(String, String)]): Boolean =
if (vs.nonEmpty) {
val (first, second) = (toIntOpt(vs.head._1).getOrElse(0), toIntOpt(vs.head._2).getOrElse(0))
if (first == second) isFirstVersionGreater(vs.drop(1))
else first > second
} else false

if (Main.latestVersion.nonEmpty) {
if (Main.latestVersion != Main.version) {
Terminal.put("Version ${Main.latestVersion} is available. Type 'update' to install.")
val vs = Main.latestVersion.split('.') zip Main.version.split('.')
if (isFirstVersionGreater(vs)) {
Terminal.put(s"Keehive version ${Main.latestVersion} is available. Type 'update' to install.")
}
}
}

// ----------------- commands ---------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/keehive/Main.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keehive

object Main {
val version = "0.2"
val version = "0.3"
val isHelp: Set[String] = Set("-h", "?", "--help", "-help", "help")
val isInstall: Set[String] = Set("--install", "-i")
val isVault: Set[String] = Set("--vault", "-v")
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2
0.3

0 comments on commit c5cc221

Please sign in to comment.