Skip to content

Commit

Permalink
Prepare repository for next release and SBT build improvements (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpedromoreno authored Jun 18, 2020
1 parent c898492 commit 184c233
Show file tree
Hide file tree
Showing 89 changed files with 843 additions and 583 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.4.2
version=2.6.0
style = defaultWithAlign
maxColumn = 100

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the code. Pull requests are also welcome.

People are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md) when discussing _exercises-stdlib_ on the Github page or other venues.

If you are being harassed, please contact one of [us](AUTHORS.md#maintainers) immediately so that we can support you. In case you cannot get in touch with us please write an email to [47 Degrees](mailto:scala-exercises@47deg.com).
If you are being harassed, please contact one of [us](AUTHORS.md#maintainers) immediately so that we can support you. In case you cannot get in touch with us please write an email to [47 Degrees Open Source](mailto:hello@47deg.com).

## How can I help?

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (C) 2016-2020 47 Degrees <https://47deg.com>
Copyright (C) 2016-2020 47 Degrees Open Source <https://www.47deg.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

exercises-stdlib

Copyright (c) 2016-2020 47 Degrees. All rights reserved.
Copyright (c) 2016-2020 47 Degrees Open Source. All rights reserved.

Licensed under Apache-2.0. See [LICENSE](LICENSE.md) for terms.
31 changes: 23 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
import com.jsuereth.sbtpgp.PgpKeys.publishSigned

ThisBuild / organization := "org.scala-exercises"
ThisBuild / githubOrganization := "47degrees"
ThisBuild / scalaVersion := "2.13.2"

publish / skip := true

// This is required by the exercises compiler:
publishLocal := (publishLocal dependsOn compile).value
publishSigned := (publishSigned dependsOn compile).value

addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; test")
addCommandAlias("ci-docs", "github; project-docs/mdoc; headerCreateAll")
addCommandAlias("ci-docs", "github; documentation/mdoc; headerCreateAll")
addCommandAlias("ci-publish", "github; ci-release")

lazy val exercises = (project in file("."))
.settings(moduleName := "exercises-stdlib")
.settings(exercisesSettings)
.settings(name := "exercises-stdlib")
.settings(
libraryDependencies ++= Seq(
"org.scala-exercises" %% "exercise-compiler" % "0.6.1",
"org.scala-exercises" %% "definitions" % "0.6.1",
"com.chuusai" %% "shapeless" % "2.3.3",
"org.scalatest" %% "scalatest" % "3.1.2",
"org.scalacheck" %% "scalacheck" % "1.14.3",
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.2.0",
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.5"
)
)
.enablePlugins(ExerciseCompilerPlugin)

lazy val `project-docs` = (project in file(".docs"))
.aggregate(exercises)
.settings(moduleName := "exercises-project-docs")
.settings(mdocIn := file(".docs"))
lazy val documentation = project
.settings(mdocOut := file("."))
.settings(skip in publish := true)
.settings(publish / skip := true)
.enablePlugins(MdocPlugin)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 0 additions & 45 deletions project/ProjectPlugin.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.11
sbt.version=1.3.12
18 changes: 9 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.6.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.5")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.4")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("com.alejandrohdezma" %% "sbt-github" % "0.8.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.8.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.8.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % "0.2")
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.6.1")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.5")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
18 changes: 11 additions & 7 deletions src/main/scala/stdlib/Asserts.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 47 Degrees <https://47deg.com>
* Copyright 2016-2020 47 Degrees Open Source <https://www.47deg.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,13 @@ package stdlib
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

/** @param name asserts
/**
* @param name asserts
*/
object Asserts extends AnyFlatSpec with Matchers with org.scalaexercises.definitions.Section {

/** ScalaTest makes three assertions available by default in any style trait. You can use:
/**
* ScalaTest makes three assertions available by default in any style trait. You can use:
*
* - `assert` for general assertions;
* - `assertResult` to differentiate expected from actual values;
Expand All @@ -41,7 +43,6 @@ object Asserts extends AnyFlatSpec with Matchers with org.scalaexercises.definit
* Scala's `assert` will complete abruptly with an `AssertionError`. This behavior is provided by
* the `assert` method defined in object `Predef`, whose members are implicitly imported into every Scala source file.
*
*
* ScalaTest provides a domain specific language (DSL) for expressing assertions in tests
* using the word `should`. ScalaTest matchers provides five different ways to check equality, each designed to address a different need. They are:
*
Expand All @@ -58,16 +59,19 @@ object Asserts extends AnyFlatSpec with Matchers with org.scalaexercises.definit
def scalaTestAsserts(res0: Boolean) =
true should be(res0)

/** Booleans in asserts can test equality:
/**
* Booleans in asserts can test equality:
*/
def booleanAsserts(res0: Int) = {
val v1 = 4
v1 shouldEqual res0

/** `shouldEqual` is an assertion. It is from ScalaTest, not from the Scala language. */
/**
* `shouldEqual` is an assertion. It is from ScalaTest, not from the Scala language. */
}

/** Sometimes we expect you to fill in the values:
/**
* Sometimes we expect you to fill in the values:
*/
def valuesAsserts(res0: Int) =
assert(res0 == 1 + 1)
Expand Down
24 changes: 13 additions & 11 deletions src/main/scala/stdlib/ByNameParameter.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 47 Degrees <https://47deg.com>
* Copyright 2016-2020 47 Degrees Open Source <https://www.47deg.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,20 +19,21 @@ package stdlib
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

/** @param name byname_parameter
/**
* @param name byname_parameter
*/
object ByNameParameter
extends AnyFlatSpec
with Matchers
with org.scalaexercises.definitions.Section {

/** `() => Int` is a Function type that takes a `Unit` type. `Unit` is known as `void` to a Java programmer. The function returns an `Int`. You can place this as a method parameter so that you can you use it as a block, but still it doesn't look quite right:
/**
* `() => Int` is a Function type that takes a `Unit` type. `Unit` is known as `void` to a Java programmer. The function returns an `Int`. You can place this as a method parameter so that you can you use it as a block, but still it doesn't look quite right:
*/
def takesUnitByNameParameter(res0: Either[Throwable, Int]) = {
def calc(x: () => Int): Either[Throwable, Int] = {
try {
Right(x()) // An explicit call of the x function
} catch {
try Right(x()) // An explicit call of the x function
catch {
case b: Throwable => Left(b)
}
}
Expand All @@ -44,14 +45,14 @@ object ByNameParameter
y should be(res0)
}

/** A by-name parameter does the same thing as the previous koan but there is no need to explicitly handle `Unit` or `()`. This is used extensively in Scala to create blocks:
/**
* A by-name parameter does the same thing as the previous koan but there is no need to explicitly handle `Unit` or `()`. This is used extensively in Scala to create blocks:
*/
def byNameParameter(res0: Either[Throwable, Int]) = {
def calc(x: => Int): Either[Throwable, Int] = {
// x is a call by-name parameter
try {
Right(x)
} catch {
try Right(x)
catch {
case b: Throwable => Left(b)
}
}
Expand All @@ -66,7 +67,8 @@ object ByNameParameter
y should be(res0)
}

/** By-name parameters can also be used with `object` and `apply` to make interesting block-like calls:
/**
* By-name parameters can also be used with `object` and `apply` to make interesting block-like calls:
*/
def withApplyByNameParameter(res0: String) = {
object PigLatinizer {
Expand Down
Loading

0 comments on commit 184c233

Please sign in to comment.