Skip to content

Release/0.9.5 #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fcc916f
Adding --csv option to search and retrieve (Issue #4 )
sideresearch Nov 21, 2018
21560a2
Fixed the Buildinfo placeholder
nguyenLisa Nov 21, 2018
20427e6
Fixing code style issues.
sideresearch Nov 22, 2018
72add90
Fixing last code style issue
sideresearch Nov 22, 2018
655272a
Merge pull request #28 from delphi-hub/csv-option
bhermann Nov 24, 2018
40e8743
Catch the TimeoutException in the search command.
sideresearch Nov 24, 2018
d398c5b
Fixing code style.
sideresearch Nov 24, 2018
fb14f37
Fixed last style issues
sideresearch Nov 24, 2018
6ee305e
Merge pull request #30 from delphi-hub/search-timeout
bhermann Nov 28, 2018
96f1842
Refactoring delphi cli sttp dependency for native image generation
Jan 15, 2019
3972bd4
Refactored retrieve command to sttp
Jan 15, 2019
1de2c18
Fixing encoded url issue for retrieve command
Jan 23, 2019
b252d4e
Refactoring search command to sttp
Jan 24, 2019
0724269
Implementing codacy suggestions
Jan 25, 2019
cc33060
Fixing codacy issue
Mar 7, 2019
7d8068a
Renaming the project to delphi
Mar 7, 2019
1396373
Merge pull request #32 from delphi-hub/Feature/27/NativeExe
bhermann Mar 9, 2019
e179a15
Merge branch 'master' into develop
Nov 19, 2019
2ee1c51
Upgrading akka to 2.5.16
Nov 20, 2019
f1fcde7
Upgrading sbt-codacy to 1.3.14
Nov 20, 2019
4e6e968
Merge pull request #33 from delphi-hub/vulnerability_fix
bhermann Nov 21, 2019
b0d3e8d
Updated sbt file
bhermann Nov 21, 2019
37db71e
Merge branch 'develop' of github.com:delphi-hub/delphi-cli into develop
bhermann Nov 21, 2019
2835ad1
- Switching back scala version to Scala 2.12
Nov 22, 2019
d0d4452
Merge pull request #35 from delphi-hub/vulnerability_fix
bhermann Nov 26, 2019
8e7a377
Made scala 2.12 default
bhermann Dec 24, 2019
4062a33
Merge branch 'develop' of github.com:delphi-hub/delphi-cli into develop
bhermann Dec 24, 2019
f4c3e58
Update README.md
bhermann Jan 7, 2020
f78e63e
Removed coverage for now
bhermann Jan 7, 2020
066f666
SBT version bumped to 1.3.5
bhermann Jan 7, 2020
d9af2e3
Bumped dependencies, moved to Scala 2.13
bhermann Jan 7, 2020
32a45f0
Deactivated GraalVM specific lines. Bugfix for help text
bhermann Jan 7, 2020
0351ee8
Changes to reflect 0.9.5 API
bhermann Jan 7, 2020
f3b1a07
Changes to reflect 0.9.5 API
bhermann Jan 7, 2020
d48bf52
Added features command. Closes #25
bhermann Jan 7, 2020
70cad00
Updated README to new console parameters
bhermann Jan 7, 2020
568818e
Made a helpful runnable docker container possible
bhermann Jan 8, 2020
b7d5950
Bumped sbt and project version
bhermann Jan 8, 2020
518f76a
Reverted to sbt 1.2.8 because of travis *sigh*
bhermann Jan 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/scala/de/upb/cs/swt/delphi/cli/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ case class Config(server: String = sys.env.getOrElse("DELPHI_SERVER", "https://d
query : String = "",
limit : Option[Int] = None,
id : String = "",
timeout : Option[Int] = None,
args: List[String] = List(),
opts: List[String] = List()) {

Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/de/upb/cs/swt/delphi/cli/DelphiCLI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package de.upb.cs.swt.delphi.cli

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
import de.upb.cs.swt.delphi.cli.commands.{RetrieveCommand, SearchCommand, TestCommand}

import scala.concurrent.duration.Duration
Expand Down Expand Up @@ -53,18 +52,19 @@ object DelphiCLI extends App {
.text("Retrieve a project's description, specified by ID.")
.children(
arg[String]("id").action((x, c) => c.copy(id = x)).text("The ID of the project to retrieve"),
opt[String]("csv").action((x, c) => c.copy(csv = x)).text("Path to the output .csv file (overwrites existing file)"),
opt[Unit]('f', "file").action((_, c) => c.copy(opts = List("file"))).text("Use to load the ID from file, " +
"with the filepath given in place of the ID"),
opt[String]("csv").action((x, c) => c.copy(csv = x)).text("Path to the output .csv file (overwrites existing file)")
"with the filepath given in place of the ID")
)

cmd("search").action((s, c) => c.copy(mode = "search"))
.text("Search artifact using a query.")
.children(
arg[String]("query").action((x,c) => c.copy(query = x)).text("The query to be used."),
opt[String]("csv").action((x, c) => c.copy(csv = x)).text("Path to the output .csv file (overwrites existing file)"),
opt[Int]("limit").action((x, c) => c.copy(limit = Some(x))).text("The maximal number of results returned."),
opt[Unit](name="list").action((_, c) => c.copy(list = true)).text("Output results as list (raw option overrides this)"),
opt[String]("csv").action((x, c) => c.copy(csv = x)).text("Path to the output .csv file (overwrites existing file)")
opt[Int]("timeout").action((x, c) => c.copy(timeout = Some(x))).text("Timeout in seconds.")
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package de.upb.cs.swt.delphi.cli.commands

import java.util.concurrent.TimeUnit
import java.util.concurrent.{TimeUnit, TimeoutException}

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
Expand All @@ -29,14 +29,16 @@ import akka.util.ByteString
import de.upb.cs.swt.delphi.cli.Config
import de.upb.cs.swt.delphi.cli.artifacts.SearchResult
import de.upb.cs.swt.delphi.cli.artifacts.SearchResultJson._
import de.upb.cs.swt.delphi.cli.commands.RetrieveCommand.information
import spray.json.DefaultJsonProtocol

import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import scala.util.{Failure, Success}
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
import scala.util.{Failure, Success, Try}

object SearchCommand extends Command with SprayJsonSupport with DefaultJsonProtocol {

val searchTimeout: Int = 10

/**
* Executes the command implementation
*
Expand All @@ -59,7 +61,20 @@ object SearchCommand extends Command with SprayJsonSupport with DefaultJsonProto
Http().singleRequest(HttpRequest(uri = searchUri, method = HttpMethods.POST, entity = entity))
}

val response = Await.result(responseFuture, 10 seconds)
Try(Await.result(responseFuture, Duration(config.timeout.getOrElse(searchTimeout) + " seconds"))).
map(response => parseResponse(response, config, start)(ec, materializer)).
recover {
case e : TimeoutException => {
error(config)("The query timed out after " + (System.nanoTime() - start).nanos.toUnit(TimeUnit.SECONDS) +
" seconds. To set a longer timeout, use the --timeout option.")
Failure(e)
}
}
}

private def parseResponse(response: HttpResponse, config: Config, start: Long)
(implicit ec: ExecutionContextExecutor, materializer: ActorMaterializer): Unit = {

val resultFuture: Future[String] = response match {
case HttpResponse(StatusCodes.OK, headers, entity, _) =>
entity.dataBytes.runFold(ByteString(""))(_ ++ _).map { body =>
Expand Down