diff --git a/.editorconfig b/.editorconfig index 5b389af..c792af2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,5 +6,5 @@ indent_style = space indent_size = 4 insert_final_newline = true -[*.scala] +[*.{scala,sbt}] indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a15029b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea/ + +target/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f5de61a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: scala +sudo: false +jdk: oraclejdk8 +scala: 2.12.3 +script: sbt test diff --git a/Readme.md b/Readme.md index 28b7491..ddac908 100644 --- a/Readme.md +++ b/Readme.md @@ -1,7 +1,43 @@ -Euclid +Euclid [![Build Status (Travis)][badge-travis]][build-travis] [![Build Status (Appveyor)][badge-appveyor]][build-appveyor] ====== Euclid will be a UI framework for terminal environments, like actual desktop terminal emulator or [rot.js][rot-js]. +Build +----- + +To build the project (just a stub for now), install [SBT][sbt] and then execute +the following command in your terminal: + +```console +$ sbt compile +``` + +Test +---- + +To execute the automatic test suite, run the following command in your terminal: + +```console +$ sbt test +``` + +Run +--- + +To run the manual test projects (just stubs for now) for JVM and Scala.js, +execute the following commands in your terminal: + +```console +$ sbt 'project euclidJVM' run +$ sbt 'project euclidJS' run +``` + +[build-appveyor]: https://ci.appveyor.com/project/ForNeVeR/euclid/branch/master +[build-travis]: https://travis-ci.org/codingteam/euclid [rot-js]: http://ondras.github.io/rot.js/hp/ +[sbt]: http://www.scala-sbt.org/ + +[badge-appveyor]: https://ci.appveyor.com/api/projects/status/gr42tg6db572jts6/branch/master?svg=true +[badge-travis]: https://travis-ci.org/codingteam/euclid.svg?branch=master diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..c51e63a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,12 @@ +version: '{build}' +install: + - cmd: choco install sbt --version 1.0.2 + - cmd: set PATH=C:\Program Files (x86)\sbt\bin;%PATH% +build_script: + - sbt compile +test_script: + - sbt test +cache: + - C:\ProgramData\chocolatey\lib -> appveyor.yml + - C:\Program Files (x86)\sbt -> appveyor.yml + - C:\Users\appveyor\.ivy2 diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..b10778c --- /dev/null +++ b/build.sbt @@ -0,0 +1,23 @@ +name := "Euclid root" +scalaVersion in ThisBuild := "2.12.3" + +lazy val root = project.in(file(".")) + .aggregate(euclidJS, euclidJVM) + .settings( + publish := {}, + publishLocal := {} + ) + +lazy val euclid = crossProject.in(file(".")) + .settings( + name := "euclid", + version := "0.0.1-SNAPSHOT", + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.4" % "test" + ) + .jvmSettings() + .jsSettings( + scalaJSUseMainModuleInitializer := true + ) + +lazy val euclidJVM = euclid.jvm +lazy val euclidJS = euclid.js diff --git a/js/src/main/scala/ru/org/codingteam/euclid/EuclidJsApp.scala b/js/src/main/scala/ru/org/codingteam/euclid/EuclidJsApp.scala new file mode 100644 index 0000000..90efced --- /dev/null +++ b/js/src/main/scala/ru/org/codingteam/euclid/EuclidJsApp.scala @@ -0,0 +1,7 @@ +package ru.org.codingteam.euclid + +object EuclidJsApp { + def main(args: Array[String]): Unit = { + Euclid.hello(args) + } +} diff --git a/js/src/test/scala/ru/org/codingteam/euclid/TestJs.scala b/js/src/test/scala/ru/org/codingteam/euclid/TestJs.scala new file mode 100644 index 0000000..3e4477e --- /dev/null +++ b/js/src/test/scala/ru/org/codingteam/euclid/TestJs.scala @@ -0,0 +1,10 @@ +package ru.org.codingteam.euclid + +import collection.mutable.Stack +import org.scalatest._ + +class TestJs extends FlatSpec with Matchers { + "The test" should "pass" in { + 1 should be (1) + } +} diff --git a/jvm/src/main/scala/ru/org/codingteam/euclid/EuclidJvmApp.scala b/jvm/src/main/scala/ru/org/codingteam/euclid/EuclidJvmApp.scala new file mode 100644 index 0000000..90e41e2 --- /dev/null +++ b/jvm/src/main/scala/ru/org/codingteam/euclid/EuclidJvmApp.scala @@ -0,0 +1,7 @@ +package ru.org.codingteam.euclid + +object EuclidJvmApp { + def main(args: Array[String]): Unit = { + Euclid.hello(args) + } +} diff --git a/jvm/src/test/scala/ru/org/codingteam/euclid/TestJvm.scala b/jvm/src/test/scala/ru/org/codingteam/euclid/TestJvm.scala new file mode 100644 index 0000000..e429300 --- /dev/null +++ b/jvm/src/test/scala/ru/org/codingteam/euclid/TestJvm.scala @@ -0,0 +1,10 @@ +package ru.org.codingteam.euclid + +import collection.mutable.Stack +import org.scalatest._ + +class TestJvm extends FlatSpec with Matchers { + "The test" should "pass" in { + 1 should be (1) + } +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..9abea12 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.0.3 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..8483fc5 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21") diff --git a/shared/src/main/scala/ru/org/codingteam/euclid/Euclid.scala b/shared/src/main/scala/ru/org/codingteam/euclid/Euclid.scala new file mode 100644 index 0000000..df018fc --- /dev/null +++ b/shared/src/main/scala/ru/org/codingteam/euclid/Euclid.scala @@ -0,0 +1,7 @@ +package ru.org.codingteam.euclid + +object Euclid { + def hello(args: Array[String]): Unit = { + println("Hello world!") + } +} diff --git a/shared/src/test/scala/ru/org/codingteam/euclid/TestShared.scala b/shared/src/test/scala/ru/org/codingteam/euclid/TestShared.scala new file mode 100644 index 0000000..9ed3d23 --- /dev/null +++ b/shared/src/test/scala/ru/org/codingteam/euclid/TestShared.scala @@ -0,0 +1,10 @@ +package ru.org.codingteam.euclid + +import collection.mutable.Stack +import org.scalatest._ + +class TestShared extends FlatSpec with Matchers { + "The test" should "pass" in { + 1 should be (1) + } +}