-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from KacperFKorban/renames
Some cleanups and renames + runner helpers
- Loading branch information
Showing
24 changed files
with
116 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mon/service/BaseMatchQualityService.scala → .../common/api/BaseMatchQualityService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ine/common/service/BaseMatchService.scala → .../engine/common/api/BaseMatchService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/parser/BaseSignatureParserService.scala → ...mmon/api/BaseSignatureParserService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommon/service/BaseSignatureResolver.scala → ...ne/common/api/BaseSignatureResolver.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
engine/shared/src/main/scala/org/virtuslab/inkuire/engine/common/api/InkuireRunner.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.virtuslab.inkuire.engine.common.api | ||
|
||
import cats.effect.IO | ||
import org.virtuslab.inkuire.engine.common.model._ | ||
import org.virtuslab.inkuire.engine.common.parser.ScalaSignatureParserService | ||
import org.virtuslab.inkuire.engine.common.service.DefaultSignatureResolver | ||
import org.virtuslab.inkuire.engine.common.service.ScalaExternalSignaturePrettifier | ||
import org.virtuslab.inkuire.engine.common.service.SubstitutionMatchService | ||
import org.virtuslab.inkuire.engine.common.service.TopLevelMatchQualityService | ||
|
||
class InkuireRunner( | ||
configReader: ConfigReader, | ||
inputHandler: InputHandler, | ||
outputHandler: OutputHandler, | ||
parser: BaseSignatureParserService, | ||
resolver: InkuireDb => BaseSignatureResolver, | ||
matchService: InkuireDb => BaseMatchService, | ||
matchQualityService: InkuireDb => BaseMatchQualityService, | ||
prettifier: BaseSignaturePrettifier | ||
) { | ||
|
||
def run(args: Seq[String]): IO[Unit] = | ||
configReader | ||
.readConfig(args) | ||
.flatMap { config: AppConfig => | ||
inputHandler | ||
.readInput(config) | ||
.semiflatMap { db: InkuireDb => | ||
outputHandler | ||
.serveOutput() | ||
.runA( | ||
Engine.Env(db, matchService(db), matchQualityService(db), prettifier, parser, resolver(db), config) | ||
) | ||
} | ||
} | ||
.fold(str => println(s"Oooooh man, bad luck. Inkuire encountered an unexpected error. Caused by $str"), identity) | ||
|
||
} | ||
|
||
object InkuireRunner { | ||
def scalaRunner( | ||
configReader: ConfigReader, | ||
inputHandler: InputHandler, | ||
outputHandler: OutputHandler, | ||
parser: BaseSignatureParserService = new ScalaSignatureParserService, | ||
resolver: InkuireDb => BaseSignatureResolver = (db: InkuireDb) => new DefaultSignatureResolver(db), | ||
matchService: InkuireDb => BaseMatchService = (db: InkuireDb) => new SubstitutionMatchService(db), | ||
matchQualityService: InkuireDb => BaseMatchQualityService = (db: InkuireDb) => new TopLevelMatchQualityService(db), | ||
prettifier: BaseSignaturePrettifier = new ScalaExternalSignaturePrettifier | ||
): InkuireRunner = | ||
new InkuireRunner( | ||
configReader, | ||
inputHandler, | ||
outputHandler, | ||
parser, | ||
resolver, | ||
matchService, | ||
matchQualityService, | ||
prettifier | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
.../common/service/SignaturePrettifier.scala → ...gine/common/api/SignaturePrettifier.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package org.virtuslab.inkuire.engine.common.service | ||
package org.virtuslab.inkuire.engine.common.api | ||
|
||
import org.virtuslab.inkuire.engine.common.model.ExternalSignature | ||
|
||
trait SignaturePrettifier { | ||
trait BaseSignaturePrettifier { | ||
def prettify(sgns: Seq[ExternalSignature]): String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...shared/src/main/scala/org/virtuslab/inkuire/engine/common/service/ExactMatchService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...in/scala/org/virtuslab/inkuire/engine/common/service/IsomorphismMatchQualityService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...scala/org/virtuslab/inkuire/engine/common/service/KotlinExternalSignaturePrettifier.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...e/shared/src/main/scala/org/virtuslab/inkuire/engine/common/service/OutputFormatter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
engine/shared/src/main/scala/org/virtuslab/inkuire/engine/common/service/PrettyPrint.scala
This file was deleted.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
.../scala/org/virtuslab/inkuire/engine/common/service/ScalaExternalSignaturePrettifier.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../main/scala/org/virtuslab/inkuire/engine/common/service/TopLevelMatchQualityService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 8 additions & 28 deletions
36
http/src/main/scala/org/virtuslab/inkuire/engine/http/Main.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,18 @@ | ||
package org.virtuslab.inkuire.engine.http | ||
|
||
import org.virtuslab.inkuire.engine.common.model.AppConfig | ||
import org.virtuslab.inkuire.engine.common.model.Engine.Env | ||
import org.virtuslab.inkuire.engine.common.model.InkuireDb | ||
import org.virtuslab.inkuire.engine.common.parser.ScalaSignatureParserService | ||
import org.virtuslab.inkuire.engine.common.service._ | ||
import org.virtuslab.inkuire.engine.common.api.InkuireRunner | ||
import org.virtuslab.inkuire.engine.http.cli.Cli | ||
import org.virtuslab.inkuire.engine.http.http.HttpServer | ||
|
||
object Main extends App { | ||
|
||
val configReader = new Cli | ||
val in = new Cli | ||
val out = new HttpServer | ||
val matchService: InkuireDb => FluffMatchService = (db: InkuireDb) => new FluffMatchService(db) | ||
val matchQualityService: InkuireDb => TopLevelMatchQualityService = (db: InkuireDb) => | ||
new TopLevelMatchQualityService(db) | ||
val prettifier = new ScalaExternalSignaturePrettifier | ||
val resolver: InkuireDb => DefaultSignatureResolver = (db: InkuireDb) => new DefaultSignatureResolver(db) | ||
val parser = new ScalaSignatureParserService | ||
|
||
configReader | ||
.readConfig(args) | ||
.flatMap { config: AppConfig => | ||
in.readInput(config) | ||
.semiflatMap { db: InkuireDb => | ||
out | ||
.serveOutput() | ||
.runA( | ||
Env(db, matchService(db), matchQualityService(db), prettifier, parser, resolver(db), config) | ||
) | ||
} | ||
} | ||
.fold(str => println(s"Oooooh man, bad luck. Inkuire encountered an unexpected error. Caused by $str"), identity) | ||
InkuireRunner | ||
.scalaRunner( | ||
configReader = new Cli, | ||
inputHandler = new Cli, | ||
outputHandler = new HttpServer | ||
) | ||
.run(args) | ||
.unsafeRunSync() | ||
|
||
} |
Oops, something went wrong.