From 03f4ddccbfe2b7c266b9e1131067c422a23ff6f0 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Thu, 21 Feb 2019 07:32:36 -0800 Subject: [PATCH] Add h2 db activemodel tests, where, find by id (#11) * Add h2 db activemodel tesdts * add find by id, DRY * code cleanup * moar tests * Add show view * Update the readme --- README.md | 30 +++++--- activemodel/build.gradle | 1 + .../main/kotlin/kales/ApplicationRecord.kt | 75 ++++++++++++++++--- .../kotlin/kales/ApplicationRecordTest.kt | 56 ++++++++++++++ .../src/test/kotlin/kales/TestModel.kt | 16 ++++ activemodel/src/test/resources/database.yml | 6 ++ .../src/main/kotlin/kales/KalesApplication.kt | 10 +++ .../app/controllers/ExampleController.kt | 9 ++- .../kotlin/kales/sample/app/models/Video.kt | 4 + .../sample/app/views/example/ShowView.kt | 19 +++++ .../sample/app/views/example/ShowViewModel.kt | 8 ++ 11 files changed, 211 insertions(+), 23 deletions(-) create mode 100644 activemodel/src/test/kotlin/kales/ApplicationRecordTest.kt create mode 100644 activemodel/src/test/kotlin/kales/TestModel.kt create mode 100644 activemodel/src/test/resources/database.yml create mode 100644 sampleapp/src/main/kotlin/kales/sample/app/views/example/ShowView.kt create mode 100644 sampleapp/src/main/kotlin/kales/sample/app/views/example/ShowViewModel.kt diff --git a/README.md b/README.md index 4ab695c..0876482 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ # Kales -Let's see how hard it would be to create web framework -like Ruby on Rails but in Kotlin. -Kales run on top of [Ktor](https://ktor.io/). +A modern web framework built for developer productivity and safety. +Kales run on top of [Ktor](https://ktor.io/) and uses a Model-View-Controller architecture. -It uses a Model-View-Controller architecture. Database access is -done via [JDBI](http://jdbi.org/) and configured from a `database.yml` resource file (similar to Rails). +Database access is done via [JDBI](http://jdbi.org/) and configured from a `database.yml` resource +file (similar to Rails). -## Running +More documentation coming soon! + +## Usage + +Kales comes with a command line application `kales-cli` that can generate most of the boilerplate +needed to bootstrap a new web app using Kales. More details about this coming soon! + +## Running the example app ``` ./gradlew sampleapp:run @@ -36,8 +42,11 @@ data class Video( val title: String ) : ApplicationRecord() { companion object { - // Returns all records in the table fun all() = allRecords