Skip to content

Commit 8cfe930

Browse files
committed
Open source the library
1 parent c523d9f commit 8cfe930

File tree

21 files changed

+591
-0
lines changed

21 files changed

+591
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md merge=union

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Scala template
3+
*.class
4+
*.log
5+
### JetBrains template
6+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
7+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
8+
9+
# User-specific stuff:
10+
.idea/**/workspace.xml
11+
.idea/**/tasks.xml
12+
.idea/dictionaries
13+
14+
# Sensitive or high-churn files:
15+
.idea/**/dataSources/
16+
.idea/**/dataSources.ids
17+
.idea/**/dataSources.xml
18+
.idea/**/dataSources.local.xml
19+
.idea/**/sqlDataSources.xml
20+
.idea/**/dynamic.xml
21+
.idea/**/uiDesigner.xml
22+
23+
# Gradle:
24+
.idea/**/gradle.xml
25+
.idea/**/libraries
26+
27+
# CMake
28+
cmake-build-debug/
29+
30+
# Mongo Explorer plugin:
31+
.idea/**/mongoSettings.xml
32+
33+
## File-based project format:
34+
*.iws
35+
36+
## Plugin-specific files:
37+
38+
# IntelliJ
39+
out/
40+
41+
# mpeltonen/sbt-idea plugin
42+
.idea_modules/
43+
44+
# JIRA plugin
45+
atlassian-ide-plugin.xml
46+
47+
# Cursive Clojure plugin
48+
.idea/replstate.xml
49+
50+
# Crashlytics plugin (for Android Studio and IntelliJ)
51+
com_crashlytics_export_strings.xml
52+
crashlytics.properties
53+
crashlytics-build.properties
54+
fabric.properties
55+
### SBT template
56+
# Simple Build Tool
57+
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
58+
59+
dist/*
60+
target/
61+
lib_managed/
62+
src_managed/
63+
project/boot/
64+
project/plugins/project/
65+
.history
66+
.cache
67+
.lib/
68+
/.idea/

.sbtopts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-J-Xms256M
2+
-J-Xmx1024M
3+
-J-Xss2M
4+
-J-XX:MaxMetaspaceSize=512M

.scalafmt.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
style = defaultWithAlign
2+
maxColumn = 140

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
More infos about this file : http://keepachangelog.com/
6+
7+
## [Unreleased] - no_due_date
8+
9+
- **Open source the library**

build.sbt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
organization := "com.guizmaii"
2+
3+
name := "scala-distances"
4+
5+
version := "0.1"
6+
7+
scalaVersion := "2.12.4"
8+
crossScalaVersions := Seq("2.11.12", scalaVersion.value)
9+
10+
scalafmtOnCompile := true
11+
12+
scalacOptions ++= Seq(
13+
"-deprecation",
14+
"-target:jvm-1.8",
15+
"-encoding",
16+
"UTF-8",
17+
"-feature",
18+
"-language:existentials",
19+
"-language:higherKinds",
20+
"-language:implicitConversions",
21+
"-language:postfixOps",
22+
"-unchecked",
23+
// "-Xfatal-warnings",
24+
// "-Ywarn-unused-import"
25+
"-Xlint",
26+
"-Xlint:missing-interpolator",
27+
"-Yno-adapted-args",
28+
"-Ywarn-unused",
29+
"-Ywarn-dead-code",
30+
"-Ywarn-numeric-widen",
31+
"-Ywarn-value-discard",
32+
"-Xfuture"
33+
)
34+
35+
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
36+
37+
val monix = "io.monix" %% "monix" % "3.0.0-M2"
38+
val googleMaps = "com.google.maps" % "google-maps-services" % "0.2.5"
39+
val squants = "org.typelevel" %% "squants" % "1.3.0"
40+
41+
val scalacache = ((version: String) =>
42+
Seq(
43+
"com.github.cb372" %% "scalacache-core" % version,
44+
"com.github.cb372" %% "scalacache-caffeine" % version,
45+
"com.github.cb372" %% "scalacache-redis" % version,
46+
"com.github.cb372" %% "scalacache-monix" % version
47+
))("0.21.0")
48+
49+
val testKit = Seq(
50+
"org.scalacheck" %% "scalacheck" % "1.13.5",
51+
"org.scalatest" %% "scalatest" % "3.0.4"
52+
)
53+
54+
libraryDependencies ++= Seq(
55+
monix % Provided,
56+
squants % Provided,
57+
googleMaps
58+
) ++ scalacache ++ testKit.map(_ % Test)

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version = 1.0.4

project/plugins.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13")
2+
3+
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.3")
4+
5+
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.14")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.guizmaii.distances
2+
3+
import com.guizmaii.distances.Types._
4+
import com.guizmaii.distances.utils.WithCache
5+
import monix.eval.Task
6+
import monix.execution.CancelableFuture
7+
8+
import scala.collection.immutable.Seq
9+
10+
trait DistanceApi extends WithCache[SerializableDistance] {
11+
12+
def distanceT(origin: LatLong, destination: LatLong): Task[Distance]
13+
14+
def distance(origin: LatLong, destination: LatLong): CancelableFuture[Distance]
15+
16+
def distanceFromPostalCodesT(geocoder: Geocoder)(origin: PostalCode, destination: PostalCode): Task[Distance]
17+
18+
def distanceFromPostalCodes(geocoder: Geocoder)(
19+
origin: PostalCode,
20+
destination: PostalCode
21+
): CancelableFuture[Distance]
22+
23+
def distancesT(paths: Seq[DirectedPath]): Task[Seq[DirectedPathWithDistance]]
24+
25+
def distances(paths: Seq[DirectedPath]): CancelableFuture[Seq[DirectedPathWithDistance]]
26+
27+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.guizmaii.distances
2+
3+
import com.guizmaii.distances.Types.{LatLong, PostalCode}
4+
import com.guizmaii.distances.utils.WithCache
5+
import monix.eval.Task
6+
import monix.execution.CancelableFuture
7+
8+
trait Geocoder extends WithCache[LatLong] {
9+
def geocodeT(postalCode: PostalCode): Task[LatLong]
10+
def geocode(postalCode: PostalCode): CancelableFuture[LatLong]
11+
}

0 commit comments

Comments
 (0)