Reloading Static Files

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Reloading Static Files

Tim Stearn
Totally new to Ratpack.  I've read where classes can be reloaded via SpringLoaded.  What about static asset files though (HTML, JavaScript, etc)?  When changes are made to these files, they're not reflected in what ratpack serves until you restart the app.  I've read through the doc and Googled quite a bit an can't find anything on this.  If someone can point me in the right direction, it would be much appreciated.

Thanks,

Tim S.
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Luke Daley
Administrator

Hi,

Ratpack isn’t doing anything special here… just shifting the bytes from the filesystem to the socket. This is more likely down to how you are building/running. Can you provide some details on that?
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Tim Stearn
Thanks for the reply.  I’m just getting started and copied a bunch of Angular client files from a Node.js app to src/ratpack/public. I’ve got the most basic config from the lazybones generator (see below).  I start with "gradlew run" from the command line.  Everything is served up fine.  After starting, I’ll make a minor change to a string in an HTML template but don’t see the effect till restart.

build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.ratpack:ratpack-gradle:0.9.16"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.1"
}
}

apply plugin: "io.ratpack.ratpack-groovy"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "idea"
apply plugin: "eclipse"

repositories {
jcenter()
}

dependencies {
// SpringLoaded enables runtime hot reloading.
// It is not part of the app runtime and is not shipped in the distribution.
springloaded "org.springframework:springloaded:1.2.3.RELEASE"

// Default SLF4J binding. Note that this is a blocking implementation.
// See here for a non blocking appender http://logging.apache.org/log4j/2.x/manual/async.html
runtime 'org.slf4j:slf4j-simple:1.7.12'

testCompile "org.spockframework:spock-core:0.7-groovy-2.0"
}


Ratpack.groovy
import ratpack.groovy.template.MarkupTemplateModule

import static ratpack.groovy.Groovy.groovyMarkupTemplate
import static ratpack.groovy.Groovy.ratpack

ratpack {
bindings {
add MarkupTemplateModule
}

handlers {
get {
render groovyMarkupTemplate("index.gtpl", title: "My Ratpack App")
}

assets "public"
}
}
Thanks,

Tim S.

From: "Luke Daley [via Ratpack Forum]" <[hidden email]>
Date: Sunday, May 31, 2015 at 4:07 AM
To: Tim Stearn <[hidden email]>
Subject: Re: Reloading Static Files


Hi,

Ratpack isn’t doing anything special here… just shifting the bytes from the filesystem to the socket. This is more likely down to how you are building/running. Can you provide some details on that?



If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack.io/Reloading-Static-Files-tp1079p1080.html
To unsubscribe from Reloading Static Files, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Luke Daley
Administrator
I can see now that this is a bug in our Gradle plugin.

.17 will be out in about 48 hours, and we'll fix this in that.

FWIW, this problem doesn't arise if you launch the app from with IDEA.
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Luke Daley
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Tim Stearn
Thanks for the quick response.  I should be able to test with it tonight.

From: "Luke Daley [via Ratpack Forum]" <[hidden email]>
Date: Monday, June 1, 2015 at 6:46 AM
To: Tim Stearn <[hidden email]>
Subject: Re: Reloading Static Files

FYI - https://github.com/ratpack/ratpack/issues/688 - fixed for .17.


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack.io/Reloading-Static-Files-tp1079p1086.html
To unsubscribe from Reloading Static Files, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Reloading Static Files

Tim Stearn
In reply to this post by Luke Daley
Thanks Luke.  I finally got some more time to develop the app this weekend and used the new reloading functionality.  Seems to work perfectly.  Makes a huge difference for front end development.

From: "Luke Daley [via Ratpack Forum]" <[hidden email]>
Date: Monday, June 1, 2015 at 6:46 AM
To: Tim Stearn <[hidden email]>
Subject: Re: Reloading Static Files

FYI - https://github.com/ratpack/ratpack/issues/688 - fixed for .17.


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack.io/Reloading-Static-Files-tp1079p1086.html
To unsubscribe from Reloading Static Files, click here.
NAML