initial commit

This commit is contained in:
Will Freeman
2024-09-30 17:33:30 -05:00
commit acfff6bb40
26 changed files with 2815 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
{"name":"sbt","version":"1.9.1","bspVersion":"2.1.0-M1","languages":["scala"],"argv":["/Users/willfreeman/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.10%252B7/OpenJDK17U-jdk_x64_mac_hotspot_17.0.10_7.tar.gz/jdk-17.0.10+7/Contents/Home/bin/java","-Xms100m","-Xmx100m","-classpath","/Users/willfreeman/Library/Caches/Coursier/arc/https/github.com/sbt/sbt/releases/download/v1.8.2/sbt-1.8.2.zip/sbt/bin/sbt-launch.jar","-Dsbt.script=/Users/willfreeman/Library/Caches/Coursier/arc/https/github.com/sbt/sbt/releases/download/v1.8.2/sbt-1.8.2.zip/sbt/bin/sbt","xsbt.boot.Boot","-bsp"]}
+70
View File
@@ -0,0 +1,70 @@
#
# Are you tempted to edit this file?
#
# First consider if the changes make sense for all,
# or if they are specific to your workflow/system.
# If it is the latter, you can augment this list with
# entries in .git/info/excludes
#
# see also test/files/.gitignore
#
#
# JARs aren't checked in, they are fetched by sbt
#
/lib/*.jar
/test/files/codelib/*.jar
/test/files/lib/*.jar
/test/files/speclib/instrumented.jar
/tools/*.jar
# Developer specific properties
/build.properties
/buildcharacter.properties
# might get generated when testing Jenkins scripts locally
/jenkins.properties
# target directory for build
/build/
# other
/out/
/bin/
/sandbox/
# intellij
/src/intellij*/*.iml
/src/intellij*/*.ipr
/src/intellij*/*.iws
**/.cache
/.idea
/.settings
# vscode
/.vscode
# Standard symbolic link to build/quick/bin
/qbin
# sbt's target directories
/target/
/project/**/target/
/test/macro-annot/target/
/test/files/target/
/test/target/
/build-sbt/
local.sbt
jitwatch.out
# Used by the restarr/restarrFull commands as target directories
/build-restarr/
/target-restarr/
# metals
.metals
.bloop
project/**/metals.sbt
.bsp
.history
+20
View File
@@ -0,0 +1,20 @@
import Dependencies._
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "me.deflock"
ThisBuild / organizationName := "DeFlock"
lazy val root = (project in file("."))
.settings(
name := "shotgun",
libraryDependencies += scalaTest % Test,
)
val PekkoVersion = "1.0.3"
val PekkoHttpVersion = "1.0.1"
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-actor-typed" % PekkoVersion,
"org.apache.pekko" %% "pekko-stream" % PekkoVersion,
"org.apache.pekko" %% "pekko-http" % PekkoHttpVersion
)
+5
View File
@@ -0,0 +1,5 @@
import sbt._
object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.5"
}
+1
View File
@@ -0,0 +1 @@
sbt.version=1.9.1
@@ -0,0 +1,37 @@
package me.deflock.shotgun
import org.apache.pekko
import pekko.actor.typed.ActorSystem
import pekko.actor.typed.scaladsl.Behaviors
import pekko.http.scaladsl.Http
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.server.Directives._
import scala.concurrent.ExecutionContextExecutor
import scala.io.StdIn
object ShotgunServer {
def main(args: Array[String]): Unit = {
implicit val system: ActorSystem[Any] = ActorSystem(Behaviors.empty, "my-system")
implicit val executionContext: ExecutionContextExecutor = system.executionContext
val route =
path("oauth2" / "callback") {
get {
parameters(Symbol("code").?) { (code) =>
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to Pekko HTTP</h1><p><b>Code: " + code.getOrElse("None") + "</b></p>"))
}
}
}
val bindingFuture = Http().newServerAt("localhost", 8080).bind(route)
println(s"Server now online. Please navigate to http://localhost:8080\nPress RETURN to stop...")
StdIn.readLine() // let it run until user presses return
bindingFuture
.flatMap(_.unbind()) // trigger unbinding from the port
.onComplete(_ => system.terminate()) // and shutdown when done
}
}
@@ -0,0 +1,9 @@
package example
import org.scalatest._
class HelloSpec extends FlatSpec with Matchers {
"The Hello object" should "say hello" in {
Hello.greeting shouldEqual "hello"
}
}