diff --git a/check-publication.sh b/check-publication.sh new file mode 100755 index 0000000..adf3557 --- /dev/null +++ b/check-publication.sh @@ -0,0 +1,27 @@ +read -p "version to check > " version +echo "entered version = $version" +url="https://repo1.maven.org/maven2/me/bvn13/sdk/android/gpx/GpxAndroidSdk/${version}/" +echo "checking $url" + +check(){ + echo $(curl -sL -w "%{http_code}\\n" "$url" -o /dev/null) +} + +count=0 +until [ $count -gt 1000 ] || [ "$(check)" == "200" ] +do + code=$(check) + echo "try $count - response $code" + ping -c 2 127.0.0.1 > /dev/null + count=$((count+1)) +done + +code=$(check) +if [ "$code" == "200" ] +then + echo "$code is 200" + notify-send -a MAVEN -t 500 'GpxAndroidSdk' "version $version is published" +else + echo "$code is not 200" + notify-send -a MAVEN -t 500 -u critical 'GpxAndroidSdk' "failed to publish $version version" +fi \ No newline at end of file diff --git a/src/main/kotlin/me/bvn13/sdk/android/gpx/GpxWriter.kt b/src/main/kotlin/me/bvn13/sdk/android/gpx/GpxWriter.kt index 67cc664..38095a1 100644 --- a/src/main/kotlin/me/bvn13/sdk/android/gpx/GpxWriter.kt +++ b/src/main/kotlin/me/bvn13/sdk/android/gpx/GpxWriter.kt @@ -195,7 +195,7 @@ fun TrksegType.toXmlString() = """ """.trim().removeEmptyStrings() -fun List.toXmlString(nodeName: String?) = this.joinToString(prefix = "\n", postfix = "", separator = "") { +fun List.toXmlString(nodeName: String?) = this.joinToString(prefix = "\n", postfix = "", separator = "\n") { it.toXmlString(nodeName) } diff --git a/src/test/kotlin/me/bvn13/sdk/android/gpx/GpxWriterTest.kt b/src/test/kotlin/me/bvn13/sdk/android/gpx/GpxWriterTest.kt index ce1807e..21a683f 100644 --- a/src/test/kotlin/me/bvn13/sdk/android/gpx/GpxWriterTest.kt +++ b/src/test/kotlin/me/bvn13/sdk/android/gpx/GpxWriterTest.kt @@ -277,6 +277,49 @@ class GpxWriterTest { trkseg = listOf( TrksegType( listOf( + WptType( + lat = 14.64736838389662, + lon = 7.93212890625, + ele = 10.toDouble(), + time = OffsetDateTime.now(clock), + magvar = 3.toDouble(), + geoidheight = 45.toDouble(), + name = "test point 1", + cmt = "comment 1", + desc = "description of point 1", + link = listOf( + LinkType( + href = "http://link-to.site.href", + text = "text", + type = "hyperlink" + ), + LinkType( + href = "http://link2-to.site.href", + text = "text2", + type = "hyperlink2" + ) + ), + src = "source 1", + sym = "sym 1", + type = "type 1", + fix = FixType.DGPS, + sat = 1, + hdop = 55.toDouble(), + vdop = 66.toDouble(), + pdop = 77.toDouble(), + ageofgpsdata = 44, + dgpsid = 88, + extensions = listOf( + ExtensionType( + "extension1", + parameters = mapOf(Pair("first", "second"), Pair("third", "fours")) + ), + ExtensionType( + "extension2", + parameters = mapOf(Pair("aa", "bb"), Pair("cc", "dd")) + ) + ) + ), WptType( lat = 14.64736838389662, lon = 7.93212890625, @@ -460,6 +503,37 @@ class GpxWriterTest { + + 10.0 + + 3.0 + 45.0 + test point 1 + comment 1 + description of point 1 + source 1 + + text + hyperlink + + + text2 + hyperlink2 + + sym 1 + type 1 + dgps + 1 + 55.0 + 66.0 + 77.0 + 44 + 88 + + + + +