From f081a9a4445df59aff8077f21b78c608fb15a88b Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 21 Jan 2013 18:06:04 +0000 Subject: [PATCH] Fix up to be getting started a little easier --- README.md | 29 +++++++++++++++++++ .../bleedingwolf/ratpack/RatpackMain.groovy | 1 + .../src/ratpack/ratpack.groovy | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce4dc2c7a9..0b6aaa69dd 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,35 @@ This project is the core Ratpack code. It is of interest to developers wanting t If you just want to use Ratpack to build a small, Groovy-based web app, then you want the [Ratpack Template](https://github.com/tlberglund/ratpack-template). Go clone that, write your code, and come on back here when you want to hack on the framework. +## Running With Groovy + +Put some route definitions in `ratpack.groovy` (in any empty directory), e.g. + + get("/") { + renderString "Hello World" + } + +and then run this program (after `gradle install` in the root of the ratpack directory) + + #!/usr/bin/env groovy + + @Grab("com.augusttechgroup:ratpack-core:0.7.0-SNAPSHOT") + @Grab("javax.servlet:javax.servlet-api:3.0.1") + @GrabExclude("org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016") + import com.bleedingwolf.ratpack.RatpackMain + RatpackMain.main() + +This program will pick up route definitions in "ratpack.groovy": + +## Running with Gradle Plugin + +Ratpack can also be run as a gradle task using the plugin. There is a +test project with `ratpack.groovy` in a sub directory. To test the +plugin (from the root directory): + + $ gradle -DincTestProject=true :ratpack-gradle-plugin-test:run + +Then (in a browser) visit http://localhost:5050. ## Release Notes diff --git a/ratpack-core/src/main/groovy/com/bleedingwolf/ratpack/RatpackMain.groovy b/ratpack-core/src/main/groovy/com/bleedingwolf/ratpack/RatpackMain.groovy index f6d3dd944f..30cc97c04a 100644 --- a/ratpack-core/src/main/groovy/com/bleedingwolf/ratpack/RatpackMain.groovy +++ b/ratpack-core/src/main/groovy/com/bleedingwolf/ratpack/RatpackMain.groovy @@ -29,6 +29,7 @@ class RatpackMain { } new RatpackAppFactory().create(configFile.canonicalFile).start() + Thread.sleep(Long.MAX_VALUE) // This is needed on the vertx branch } } diff --git a/ratpack-gradle-plugin-test/src/ratpack/ratpack.groovy b/ratpack-gradle-plugin-test/src/ratpack/ratpack.groovy index edf872fbbc..f12a618b93 100644 --- a/ratpack-gradle-plugin-test/src/ratpack/ratpack.groovy +++ b/ratpack-gradle-plugin-test/src/ratpack/ratpack.groovy @@ -1,3 +1,3 @@ get("/") { - response.renderString "foo" + renderString "foo" } \ No newline at end of file