From 46519138e107f44bb4a76e1fd5dd79d581109515 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Mon, 5 Aug 2024 11:59:13 +0800 Subject: [PATCH] bump resource-tools to 0.3.1 --- gradle.properties | 2 +- src/main/scala/cc/sukazyo/cono/morny/MornyAbout.scala | 2 +- src/main/scala/cc/sukazyo/cono/morny/MornyAssets.scala | 4 ++-- .../scala/cc/sukazyo/cono/morny/data/TelegramImages.scala | 2 +- src/test/scala/cc/sukazyo/cono/morny/test/MornyTests.scala | 6 +++--- .../sukazyo/cono/morny/test/utils/CommonEncryptTest.scala | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index a1d02e9..8456091 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ lib_spotbugs_v = 4.8.4 lib_scalamodule_xml_v = 2.2.0 lib_messiva_v = 0.2.0 -lib_resourcetools_v = 0.2.2 +lib_resourcetools_v = 0.3.1 lib_slf4j_v = 2.0.13 lib_javatelegramapi_v = 6.9.1 diff --git a/src/main/scala/cc/sukazyo/cono/morny/MornyAbout.scala b/src/main/scala/cc/sukazyo/cono/morny/MornyAbout.scala index d9edc60..25eda6e 100644 --- a/src/main/scala/cc/sukazyo/cono/morny/MornyAbout.scala +++ b/src/main/scala/cc/sukazyo/cono/morny/MornyAbout.scala @@ -5,7 +5,7 @@ import java.io.IOException object MornyAbout { val MORNY_PREVIEW_IMAGE_ASCII: String = - try { MornyAssets.pack getResource "texts/server-hello.txt" readAsString } + try { MornyAssets.pack getFile "texts/server-hello.txt" readString } catch case e: IOException => throw RuntimeException("Cannot read MORNY_PREVIEW_IMAGE_ASCII from assets pack", e) diff --git a/src/main/scala/cc/sukazyo/cono/morny/MornyAssets.scala b/src/main/scala/cc/sukazyo/cono/morny/MornyAssets.scala index c331ea9..1a0727f 100644 --- a/src/main/scala/cc/sukazyo/cono/morny/MornyAssets.scala +++ b/src/main/scala/cc/sukazyo/cono/morny/MornyAssets.scala @@ -1,11 +1,11 @@ package cc.sukazyo.cono.morny -import cc.sukazyo.restools.ResourcesPackage +import cc.sukazyo.restools.{ResourceDirectory, ResourcePackage} object MornyAssets { class AssetsException (caused: Throwable) extends Exception("Cannot read assets file.", caused) - val pack: ResourcesPackage = ResourcesPackage(MornyAssets.getClass, "assets_morny") + val pack: ResourceDirectory = ResourcePackage.get("assets_morny").getDirectory("assets_morny") } diff --git a/src/main/scala/cc/sukazyo/cono/morny/data/TelegramImages.scala b/src/main/scala/cc/sukazyo/cono/morny/data/TelegramImages.scala index ac45039..cf3dd04 100644 --- a/src/main/scala/cc/sukazyo/cono/morny/data/TelegramImages.scala +++ b/src/main/scala/cc/sukazyo/cono/morny/data/TelegramImages.scala @@ -22,7 +22,7 @@ object TelegramImages { @throws[AssetsException] private def read (): Unit = { - Using ((MornyAssets.pack getResource assetsPath)read) { stream => + Using (MornyAssets.pack getFile assetsPath read) { stream => try { this.cache = Some(stream.readAllBytes()) } catch case e: IOException => { throw AssetsException(e) diff --git a/src/test/scala/cc/sukazyo/cono/morny/test/MornyTests.scala b/src/test/scala/cc/sukazyo/cono/morny/test/MornyTests.scala index dd1fc9f..623b616 100644 --- a/src/test/scala/cc/sukazyo/cono/morny/test/MornyTests.scala +++ b/src/test/scala/cc/sukazyo/cono/morny/test/MornyTests.scala @@ -1,13 +1,13 @@ package cc.sukazyo.cono.morny.test -import cc.sukazyo.restools.ResourcesPackage +import cc.sukazyo.restools.{ResourceDirectory, ResourcePackage} import org.scalatest.freespec.AnyFreeSpec import org.scalatest.matchers.should abstract class MornyTests extends AnyFreeSpec with should.Matchers { - val assets: ResourcesPackage = - ResourcesPackage(classOf[MornyTests], "assets_morny_tests") + val assets: ResourceDirectory = + ResourcePackage.get("assets_morny_tests").getDirectory("assets_morny_tests") val pending_val = "[not-implemented]" diff --git a/src/test/scala/cc/sukazyo/cono/morny/test/utils/CommonEncryptTest.scala b/src/test/scala/cc/sukazyo/cono/morny/test/utils/CommonEncryptTest.scala index 06f5c38..c4f6139 100644 --- a/src/test/scala/cc/sukazyo/cono/morny/test/utils/CommonEncryptTest.scala +++ b/src/test/scala/cc/sukazyo/cono/morny/test/utils/CommonEncryptTest.scala @@ -83,7 +83,7 @@ class CommonEncryptTest extends MornyTests with TableDrivenPropertyChecks { if file == null then Array.empty[Byte] else - assets.getResource(file).read.readAllBytes + assets.getFile(file).read.readAllBytes s"while hashing binary $_name :" - {