Skip to content

Commit

Permalink
Merge pull request #4 from xavierguihot/2.0.1
Browse files Browse the repository at this point in the history
Style adjustements - light refactoring
  • Loading branch information
xavierguihot authored Apr 15, 2019
2 parents 15773c8 + f4f40e8 commit c75da48
Show file tree
Hide file tree
Showing 18 changed files with 429 additions and 679 deletions.
4 changes: 2 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
newlines.alwaysBeforeElseAfterCurlyIf = true
align.tokens.add = [{code = "%"}, {code = "%%"}, {code = "<-"}]
align.tokens.add = [{code = "%"}, {code = "%%"}, {code = "<-"}, {code = "="}]
align.openParenCallSite = false
align.openParenDefnSite = false
includeCurlyBraceInSelectChains = false
newlines.penalizeSingleSelectMultiArgList = false
maxColumn = 100
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ With sbt:
```scala
resolvers += "jitpack" at "https://jitpack.io"

libraryDependencies += "com.github.xavierguihot" % "geobase" % "2.0.0"
libraryDependencies += "com.github.xavierguihot" % "geobase" % "2.0.1"
```

With maven:
Expand All @@ -106,7 +106,7 @@ With maven:
<dependency>
<groupId>com.github.xavierguihot</groupId>
<artifactId>geobase</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
```

Expand All @@ -120,11 +120,11 @@ allprojects {
}
dependencies {
compile 'com.github.xavierguihot:geobase:2.0.0'
compile 'com.github.xavierguihot:geobase:2.0.1'
}
```

For versions anterior to `2.0.0`, use prefix `v` in the version tag; for
For versions anterior to `2.0.1`, use prefix `v` in the version tag; for
instance `v1.0.0`


Expand Down
16 changes: 4 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "geobase"

version := "2.0.0"
version := "2.0.1"

scalaVersion := "2.11.12"

Expand All @@ -14,24 +14,16 @@ scalacOptions ++= Seq(

assemblyJarName in assembly := name.value + "-" + version.value + ".jar"

assemblyOutputPath in assembly := file(
"./" + name.value + "-" + version.value + ".jar")
assemblyOutputPath in assembly := file("./" + name.value + "-" + version.value + ".jar")

testOptions in Test += Tests.Argument("-oD")
parallelExecution in Test := false

wartremoverWarnings in (Compile, compile) ++= Warts.all
wartremoverWarnings in (Compile, compile) --= Seq(
Wart.DefaultArguments,
Wart.Nothing,
Wart.Equals
)

scalafmtOnCompile := true

val catsVersion = "1.0.1"
val catsVersion = "1.0.1"
val scalatestVersion = "3.0.4"
val sparkVersion = "2.1.0"
val sparkVersion = "2.1.0"
val sparkTestVersion = "2.1.0_0.8.0"

libraryDependencies ++= Seq(
Expand Down
54 changes: 20 additions & 34 deletions docs/com/geobase/GeoBase$$StringExtensions.html

Large diffs are not rendered by default.

182 changes: 71 additions & 111 deletions docs/com/geobase/GeoBase$.html

Large diffs are not rendered by default.

60 changes: 27 additions & 33 deletions docs/com/geobase/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,47 +86,41 @@ <h4 class="signature">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Provides <b>geographical mappings</b> at airport/city/country level mainly
based on <a href="https://github.com/opentraveldata/opentraveldata">
opentraveldata</a> as well as other mappings (airlines, currencies, ...).</a></p><div class="fullcomment"><div class="comment cmt"><p>Provides <b>geographical mappings</b> at airport/city/country level mainly
based on <a href="https://github.com/opentraveldata/opentraveldata">
opentraveldata</a> as well as other mappings (airlines, currencies, ...).
This tool also provides classic time-oriented methods such as the
computation of a trip duration.</p><p>Here are a few examples:</p><pre><span class="kw">import</span> com.geobase.GeoBase

GeoBase.city(<span class="lit">"CDG"</span>) <span class="cmt">// Success("PAR")</span>
GeoBase.country(<span class="lit">"CDG"</span>) <span class="cmt">// Success("FR")</span>
GeoBase.continent(<span class="lit">"JFK"</span>) <span class="cmt">// Success("NA")</span>
GeoBase.iataZone(<span class="lit">"LON"</span>) <span class="cmt">// Success("21")</span>
GeoBase.currency(<span class="lit">"NYC"</span>) <span class="cmt">// Success("USD")</span>
GeoBase.countryForAirline(<span class="lit">"AF"</span>) <span class="cmt">// Success("FR")</span>
GeoBase.timeZone(<span class="lit">"PAR"</span>) <span class="cmt">// Success("Europe/Paris")</span>
<p class="shortcomment cmt">Provides <b>geographical mappings</b> at airport/city/country level mainly based on
<a href="https://github.com/opentraveldata/opentraveldata"> opentraveldata</a> as well as other
mappings (airlines, currencies, ...).</a></p><div class="fullcomment"><div class="comment cmt"><p>Provides <b>geographical mappings</b> at airport/city/country level mainly based on
<a href="https://github.com/opentraveldata/opentraveldata"> opentraveldata</a> as well as other
mappings (airlines, currencies, ...). This tool also provides classic time-oriented methods
such as the computation of a trip duration.</p><p>Here are a few examples:</p><pre><span class="kw">import</span> com.geobase.GeoBase

GeoBase.city(<span class="lit">"CDG"</span>) <span class="cmt">// Success("PAR")</span>
GeoBase.country(<span class="lit">"CDG"</span>) <span class="cmt">// Success("FR")</span>
GeoBase.continent(<span class="lit">"JFK"</span>) <span class="cmt">// Success("NA")</span>
GeoBase.iataZone(<span class="lit">"LON"</span>) <span class="cmt">// Success("21")</span>
GeoBase.currency(<span class="lit">"NYC"</span>) <span class="cmt">// Success("USD")</span>
GeoBase.countryForAirline(<span class="lit">"AF"</span>) <span class="cmt">// Success("FR")</span>
GeoBase.timeZone(<span class="lit">"PAR"</span>) <span class="cmt">// Success("Europe/Paris")</span>
GeoBase.distanceBetween(<span class="lit">"PAR"</span>, <span class="lit">"NCE"</span>) <span class="cmt">// Success(686)</span>
GeoBase.localDateToGMT(<span class="lit">"20160606_2227"</span>, <span class="lit">"NYC"</span>) <span class="cmt">// Success("20160607_0227")</span>
GeoBase.gmtDateToLocal(<span class="lit">"20160607_0227"</span>, <span class="lit">"NYC"</span>) <span class="cmt">// Success("20160606_2227")</span>
GeoBase.offsetForLocalDate(<span class="lit">"20171224"</span>, <span class="lit">"NYC"</span>) <span class="cmt">// Success(-300)</span>
GeoBase.tripDurationFromLocalDates(<span class="lit">"20160606_1627"</span>, <span class="lit">"CDG"</span>, <span class="lit">"20160606_1757"</span>, <span class="lit">"JFK"</span>) <span class="cmt">// Success(7.5d)</span>
GeoBase.geoType(<span class="std">List</span>(<span class="lit">"CDG"</span>, <span class="lit">"TLS"</span>, <span class="lit">"DUB"</span>, <span class="lit">"FRA"</span>)) <span class="cmt">// Success(CONTINENTAL)</span>
GeoBase.nearbyAirports(<span class="lit">"CDG"</span>, <span class="num">50</span>) <span class="cmt">// Success(List("LBG", "ORY", "VIY", "POX"))</span>
GeoBase.nameOfAirline(<span class="lit">"AF"</span>) <span class="cmt">// Success("Air France")</span></pre><p>and by pimping String:</p><pre><span class="kw">import</span> com.geobase.GeoBase.StringExtensions

<span class="lit">"CDG"</span>.city <span class="cmt">// Success("PAR")</span>
<span class="lit">"PAR"</span>.country <span class="cmt">// Success("FR")</span>
<span class="lit">"CDG"</span>.continent <span class="cmt">// Success("EU")</span>
<span class="lit">"CDG"</span>.iataZone <span class="cmt">// Success("21")</span>
<span class="lit">"JFK"</span>.currency <span class="cmt">// Success("USD")</span>
<span class="lit">"AF"</span>.name <span class="cmt">// Success("Air France")</span>
<span class="lit">"CDG"</span>.timeZone <span class="cmt">// Success("Europe/Paris")</span>
GeoBase.nearbyAirports(<span class="lit">"CDG"</span>, <span class="num">50</span>) <span class="cmt">// Success(List("LBG", "ORY", "VIY", "POX"))</span>
GeoBase.nameOfAirline(<span class="lit">"AF"</span>) <span class="cmt">// Success("Air France")</span></pre><p>or using String pimps:</p><pre><span class="kw">import</span> com.geobase.GeoBase._

<span class="lit">"CDG"</span>.city <span class="cmt">// Success("PAR")</span>
<span class="lit">"PAR"</span>.country <span class="cmt">// Success("FR")</span>
<span class="lit">"CDG"</span>.continent <span class="cmt">// Success("EU")</span>
<span class="lit">"CDG"</span>.iataZone <span class="cmt">// Success("21")</span>
<span class="lit">"JFK"</span>.currency <span class="cmt">// Success("USD")</span>
<span class="lit">"AF"</span>.name <span class="cmt">// Success("Air France")</span>
<span class="lit">"CDG"</span>.timeZone <span class="cmt">// Success("Europe/Paris")</span>
<span class="lit">"LON"</span>.distanceWith(<span class="lit">"NYC"</span>) <span class="cmt">// Success(5568)</span>
<span class="lit">"CDG"</span>.nearbyAirports(<span class="num">50</span>) <span class="cmt">// Success(List("LBG", "ORY", "VIY", "POX"))</span></pre><p>The GeoBase object can be used within Spark jobs (in this case, don't forget
to broadcast it.</p><p>Opentraveldata is an accurate and maintained source of various travel
mappings. This scala wrapper uses this file:
<span class="lit">"CDG"</span>.nearbyAirports(<span class="num">50</span>) <span class="cmt">// Success(List("LBG", "ORY", "VIY", "POX"))</span></pre><p>The GeoBase object can be used within Spark jobs (in this case, don't forget to broadcast it.</p><p>Opentraveldata is an accurate and maintained source of various travel mappings. This scala
wrapper uses this file:
<a href="https://github.com/opentraveldata/opentraveldata/tree/master/opentraveldata/optd_por_public.csv">
optd_por_public.csv</a>.</p><p>Getters all have a return type embedded within the Try monad. Throwing
exceptions as is when one might request mappings for non existing locations,
isn't really the scala way, and simply embedding the result in the Option
monad doesn't give the user the possibility to understand what went wrong.
Thus the usage of the Try monad.</p><p>Source <a href="https://github.com/xavierguihot/geobase/blob/master/src/main/scala/com/geobase/GeoBase.scala">
optd_por_public.csv</a>.</p><p>Source <a href="https://github.com/xavierguihot/geobase/blob/master/src/main/scala/com/geobase/GeoBase.scala">
GeoBase</a>
</p></div><dl class="attributes block"> <dt>Since</dt><dd><p>2016-05</p></dd></dl></div>
</li><li name="com.geobase.error" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.4
sbt.version=1.0.4
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.2")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.2.1")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
Loading

0 comments on commit c75da48

Please sign in to comment.