Skip to content

Commit 4459c17

Browse files
authored
Merge pull request #14 from delphi-hub/develop
Develop
2 parents e02abc2 + b806d16 commit 4459c17

14 files changed

+101
-53
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
*.class
22
*.log
3+
repos
34
project/target
45
target
6+
.idea

.gitmodules

-20
This file was deleted.

LICENSE

+1-12
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,7 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright [yyyy] [name of copyright owner]
178+
Copyright 2018 The Delphi Team (represented by Ben Hermann)
190179

191180
Licensed under the Apache License, Version 2.0 (the "License");
192181
you may not use this file except in compliance with the License.

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,26 @@ This source code repository bundles all of Delphi's components and provides an u
2626
You need a running instance of [ElasticSearch](https://www.elastic.co/downloads/elasticsearch) on your local machine on port 9200.
2727

2828
### Running Delphi locally
29-
After you started ElasticSearch, it is simply a matter of typing
29+
After you started ElasticSearch, you can run delphi by following the below steps
30+
31+
* Cloning the projects. Needs to be done only for the first time.
32+
```
33+
sbt clone-all
34+
```
35+
* After that, just use run command
36+
3037
```
3138
sbt run
3239
```
40+
    
3341
into your terminal. SBT will compile and start all necessary services to run Delphi.
3442

43+
* Delphi components can be deleted in case all cloned components needs to be deleted using
44+
45+
```
46+
sbt delete
47+
```
48+
    
3549
## Components
3650

3751
### delphi-crawler

build.sbt

+65-13
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,82 @@ name := "delphi"
22
version := "1.0.0-SNAPSHOT"
33
scalaVersion := "2.12.4"
44

5+
import sys.process._
6+
import java.io.File
57

68

9+
lazy val repos = List("delphi-webapi", "delphi-crawler", "delphi-cli", "delphi-management")
10+
lazy val delphiRepos = "repos"
11+
12+
def cloneAll = Command.command("clone-all") {
13+
state =>
14+
Process(s"mkdir -p $delphiRepos").!
15+
val currDir = System.getProperty("user.dir")
16+
for (repo <- repos) {
17+
val bash = "/bin/bash"
18+
val op = "-c"
19+
val clone = s"git clone https://github.com/delphi-hub/$repo"
20+
Process(Seq(bash, op, clone), new File(currDir + "/" + delphiRepos)).!
21+
}
22+
state
23+
}
24+
25+
26+
27+
28+
29+
def delete = Command.command("delete") {
30+
state =>
31+
val currDir = System.getProperty("user.dir")
32+
val cmd = "rm -rf " + currDir + "/" + delphiRepos
33+
Process(cmd).!
34+
state
35+
}
36+
37+
38+
lazy val currentBranch = taskKey[String]("Get current git branch")
39+
40+
currentBranch := {
41+
Process("git rev-parse --abbrev-ref HEAD").!!
42+
}
43+
44+
45+
lazy val pull = taskKey[Unit]("Pull Changes")
46+
47+
pull := {
48+
val branch = currentBranch.value
49+
for (repo <- repos) {
50+
BuildUtils.pull(repo, branch)
51+
}
52+
53+
}
54+
55+
Compile / compile := ((Compile / compile) dependsOn pull).value
56+
57+
commands += cloneAll
58+
commands += delete
759
lazy val root = (project in file("."))
8-
.aggregate(cli, crawler, management, webapi, webapp)
60+
.aggregate(crawler,webapi,cli,management,webapp)
961

1062

63+
lazy val webapi = Project(
64+
id = "webapi",
65+
base = file("repos/delphi-webapi"))
66+
1167
lazy val cli = Project(
12-
id = "cli",
13-
base = file("delphi-cli"))
68+
id = "cli",
69+
base = file("repos/delphi-cli"))
1470

1571
lazy val crawler = Project(
16-
id = "crawler",
17-
base = file("delphi-crawler"))
72+
id = "crawler",
73+
base = file("repos/delphi-crawler"))
1874

1975
lazy val management = Project(
20-
id = "management",
21-
base = file("delphi-management"))
76+
id = "management",
77+
base = file("repos/delphi-management"))
2278

2379
lazy val webapp = Project(
24-
id = "webapp",
25-
base = file("delphi-webapp"))
26-
27-
lazy val webapi = Project(
28-
id = "webapi",
29-
base = file("delphi-webapi"))
80+
id = "webapp",
81+
base = file("repos/delphi-webapp"))
3082

3183
addCommandAlias("run", "; all webapi/run crawler/run webapp/run management/run")

delphi-cli

-1
This file was deleted.

delphi-crawler

-1
This file was deleted.

delphi-management

-1
This file was deleted.

delphi-webapi

-1
This file was deleted.

delphi-webapp

-1
This file was deleted.

img/delphi.png

4.37 KB
Loading

project/BuildUtils.scala

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys.process._
2+
import java.io._
3+
object BuildUtils {
4+
def pull(repo: String, branch: String) = {
5+
val bash="/bin/bash"
6+
val op="-c"
7+
val checkout=s"git checkout $branch"
8+
val gitPull="git pull"
9+
Process(Seq(bash,op,checkout,gitPull),new File(repo)).!
10+
}
11+
12+
}

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.1.1
1+
sbt.version=1.1.6

project/plugins.sbt

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releas
1414

1515
// coverage
1616
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
17-
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.12")
17+
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.12")
18+
19+
20+
// scalastyle
21+
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

0 commit comments

Comments
 (0)