Skip to content

Commit

Permalink
1.10.0
Browse files Browse the repository at this point in the history
* Move REDIS pool init to after properties are read
* Add guard to make sure that Property values are not read before being initialized
* Rearrnage starting order for assigning Kotlin script variables
* Adjust Property getters to deal with access before init
* Change ReadingBatContent.cacheChallenges to be computed
* Fix Property initialization in tests
* Limit the length of user input strings
* Add dbms.maxLifetimeMins property
* Update HttpClient to use expectSuccess
* Fix cypress issue by resetting dbms
* Fix cypress issue by catch geoinfo exception
* Remove dbreset from cypress script
* Turn off sql error stacktrace in request logging
* Add caller version
* Upgrade jars
  • Loading branch information
pambrose authored Feb 3, 2021
1 parent 59ee758 commit 6c3cb67
Show file tree
Hide file tree
Showing 64 changed files with 344 additions and 313 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
.vscode
.gradle
.idea
.run
out
build
*.iml
*.ipr
*.iws

node_modules/

cypress/videos
cypress/screenshots
cypress/examples
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ depends:
./gradlew dependencies

upgrade-wrapper:
./gradlew wrapper --gradle-version=6.7.1 --distribution-type=bin
./gradlew wrapper --gradle-version=6.8.1 --distribution-type=bin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Release](https://jitpack.io/v/readingbat/readingbat-core.svg)](https://jitpack.io/#readingbat/readingbat-core)
[![Build Status](https://travis-ci.org/readingbat/readingbat-core.svg?branch=master)](https://travis-ci.org/readingbat/readingbat-core)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8a5c67f5892042559490559142af30ec)](https://www.codacy.com/gh/readingbat/readingbat-core?utm_source=github.com&utm_medium=referral&utm_content=readingbat/readingbat-core&utm_campaign=Badge_Grade)
[![ReadingBat](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/g5z7vz/1.9.0&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/g5z7vz/runs)
[![ReadingBat](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/g5z7vz&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/g5z7vz/runs)
[![Kotlin](https://img.shields.io/badge/%20language-Kotlin-red.svg)](https://kotlinlang.org/)

The framework used to render ReadingBat content.
Expand Down
23 changes: 11 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ plugins {
id 'java'
id 'application'
id 'maven' // Required for jitpack.io to do a ./gradlew install
id 'org.jetbrains.kotlin.jvm' version '1.4.21' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.21' apply false
id 'org.jetbrains.kotlin.jvm' version '1.4.30' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.30' apply false
id "com.github.ben-manes.versions" version '0.36.0' apply false
id 'com.github.johnrengelman.shadow' version '6.1.0' apply false
id 'com.github.gmazzo.buildconfig' version '2.0.2' apply false
id "org.flywaydb.flyway" version "7.3.1"
id "org.flywaydb.flyway" version "7.5.2"
}

ext {
libraries = [
kotlin_reflect : "org.jetbrains.kotlin:kotlin-reflect",
kotlinx_coroutines_core: "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version",
//kotlin_scripting_compiler: "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable",

serialization : "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version",

Expand Down Expand Up @@ -90,7 +89,7 @@ ext {
allprojects {
description = 'ReadingBat Core'
group 'com.github.readingbat'
version '1.9.0'
version '1.10.0'

apply plugin: 'application'
apply plugin: 'maven' // required for jitpack.io install
Expand All @@ -101,10 +100,10 @@ allprojects {
apply plugin: 'com.github.gmazzo.buildconfig'

repositories {
maven { url 'https://kotlin.bintray.com/ktor' }
maven { url 'https://kotlin.bintray.com/kotlinx' }
maven { url 'https://kotlin.bintray.com/kotlin-js-wrappers' }
maven { url 'https://maven-central.storage-download.googleapis.com/repos/central/data/' }
maven { url = 'https://kotlin.bintray.com/ktor' }
maven { url = 'https://kotlin.bintray.com/kotlinx' }
maven { url = 'https://kotlin.bintray.com/kotlin-js-wrappers' }
maven { url = 'https://maven-central.storage-download.googleapis.com/repos/central/data/' }
jcenter()
maven { url = 'https://jitpack.io' }
}
Expand All @@ -118,8 +117,9 @@ subprojects {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

// This is required for the ExperimentalCoroutinesApi arg below
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm"
// These are required for the annotation args below
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}"
implementation "io.ktor:ktor-locations:${ktor_version}"

implementation "io.github.microutils:kotlin-logging:$logging_version"
implementation "ch.qos.logback:logback-classic:$logback_version"
Expand Down Expand Up @@ -156,7 +156,6 @@ subprojects {
kotlinOptions.jvmTarget = '1.8'
kotlinOptions.freeCompilerArgs += ['-Xuse-experimental=kotlin.time.ExperimentalTime',
'-Xuse-experimental=io.ktor.util.KtorExperimentalAPI',
'-Xuse-experimental=io.ktor.locations.KtorExperimentalLocationsAPI',
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xuse-experimental=kotlin.ExperimentalStdlibApi',
'-XXLanguage:+InlineClasses']
Expand Down
13 changes: 8 additions & 5 deletions docs/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

## Running from *readingbat-core*
Setup:
* VM Options: -Dlogback.configurationFile=src/test/resources/logback-test.xml
* Program Arguments: -config=src/main/resources/application-dev.conf
* Environment Variables: SENDGRID_API_KEY=**value**
* Main class: TestMain
* VM Options: -Dlogback.configurationFile=testresources/logback-test.xml
* Program Arguments: -config=readingbat-core/src/main/resources/application-dev.conf
* Environment Variables: IPGEOLOCATION_KEY=**value**;GITHUB_OAUTH=**Value**

## Heroku
* Switch shell to Java8 to get jvisualvm to work on an OSX client
Expand Down Expand Up @@ -80,6 +81,8 @@ Setup:
## Cypress.io

* tab plugin: https://github.com/Bkucera/cypress-plugin-tab
* To start locally: ~/node_modules/.bin/cypress open
* To run: ~/node_modules/.bin/cypress run --record --key 5ee5de19-1e84-4807-a199-5c70fda2fe5d
* Start test server with: `./testdata.sh`
* Clear data with: `make dbreset`
* To start locally from repo root: `~/node_modules/.bin/cypress open`
* To run: `~/node_modules/.bin/cypress run --record --key 5ee5de19-1e84-4807-a199-5c70fda2fe5d`
* https://levelup.gitconnected.com/what-ive-learnt-using-cypress-io-for-the-past-three-weeks-c1597999cd2f
24 changes: 12 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
cloud_version=1.2.0
commons_version=1.9
coroutines_version=1.4.2
css_version=1.0.0-pre.131-kotlin-1.4.21
exposed_version=0.28.1
css_version=1.0.0-pre.144-kotlin-1.4.21
exposed_version=0.29.1
flexmark_version=0.62.2
github_api_version=1.117
github_api_version=1.122
gson_version=2.8.6
guava_version=29.0-jre
hikari_version=3.4.5
guava_version=30.0-jre
hikari_version=4.0.1
java_script_version=2.0.0
kotest_version=4.3.2
ktor_version=1.4.2
kotest_version=4.4.0
ktor_version=1.5.0
logback_version=1.2.3
logging_version=2.0.4
pgjdbc_version=0.8.4
postgres_version=42.2.18
prometheus_version=0.9.0
proxy_version=68e629e
redis_version=3.4.0
prometheus_version=0.10.0
proxy_version=1.8.8
redis_version=3.5.1
serialization_version=1.0.1
sendgrid_version=4.7.0
utils_version=1.6.0
sendgrid_version=4.7.1
utils_version=4aa1b9d
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"devDependencies": {
"cypress": "6.2.1"
}
}
11 changes: 5 additions & 6 deletions readingbat-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ application {
dependencies {
implementation libraries.kotlin_reflect
implementation libraries.kotlinx_coroutines_core
//implementation libraries.kotlin_scripting_compiler

implementation libraries.serialization

Expand Down Expand Up @@ -64,6 +63,8 @@ dependencies {
implementation libraries.pgjdbc
implementation libraries.socket

runtimeOnly libraries.postgres

implementation libraries.gson
implementation libraries.guava

Expand All @@ -74,8 +75,6 @@ dependencies {

implementation libraries.github

runtime libraries.postgres

testImplementation libraries.ktor_server_tests
testImplementation libraries.ktor_server_test_host

Expand All @@ -88,9 +87,9 @@ dependencies {
}

buildConfig {
buildConfigField('String', 'APP_NAME', "\"${project.name}\"")
buildConfigField('String', 'APP_VERSION', "\"${project.version}\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"12/15/20\"")
buildConfigField('String', 'CORE_NAME', "\"${project.name}\"")
buildConfigField('String', 'CORE_VERSION', "\"${project.version}\"")
buildConfigField('String', 'CORE_RELEASE_DATE', "\"2/3/21\"")
}

// Include build uberjars in heroku deploy
Expand Down
6 changes: 3 additions & 3 deletions readingbat-core/src/main/kotlin/Content.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ val dslContent =

python {
//repo = GitHubRepo(Organization, "readingbat", "readingbat-core")
//branchName = "1.9.0"
//branchName = "1.10.0"
repo = FileSystemSource("./")
srcPath = "python"

Expand All @@ -125,7 +125,7 @@ val dslContent =
java {
repo = GitHubRepo(Organization, "readingbat", "readingbat-core")
srcPath = "readingbat-core/src/test/java"
branchName = "1.9.0"
branchName = "1.10.0"

group("Java Tests") {
packageName = "com.github.readingbat.test_content"
Expand All @@ -141,7 +141,7 @@ val dslContent =
kotlin {
repo = GitHubRepo(Organization, "readingbat", "readingbat-core")
srcPath = "readingbat-core/src/test/kotlin"
branchName = "1.9.0"
branchName = "1.10.0"

group("Kotlin Tests") {
packageName = "com.github.readingbat.test_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum class EnvVar(val maskFunc: EnvVar.() -> String = { getEnv(UNASSIGNED) }) {

fun getEnv(default: Boolean) = System.getenv(name)?.toBoolean() ?: default

@Suppress("unused")
fun getEnv(default: Int) = System.getenv(name)?.toInt() ?: default

fun getRequiredEnv() = getEnvOrNull() ?: error("Missing $name value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import kotlinx.coroutines.runBlocking

class Limiter(private val maxConcurrencySize: Int = 1) {

@Suppress("unused")
class Token(private val limiter: Limiter)

private val channel = Channel<Token>(maxConcurrencySize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import com.github.readingbat.common.Constants.WRONG_COLOR
val color get() = if (isError) WRONG_COLOR else CORRECT_COLOR

fun isAssigned() = this != EMPTY_MESSAGE

@Suppress("unused")
fun isUnassigned() = this == EMPTY_MESSAGE

override fun toString() = value
Expand Down
Loading

0 comments on commit 6c3cb67

Please sign in to comment.