static assets

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

static assets

vsajja
This used to work in Ratpack version 0.9.2, I'm now using 1.0.0-rc3. :

ratpack {
  handlers {
    get {
      redirect 'index.html'
    }
    assets 'dist'
  }
}

The dist folder is under the ratpack directory.

groovy.lang.MissingMethodException: No signature of method: ratpack.assets() is applicable for argument types: (java.lang.String) values: [dist]
Possible solutions: getAt(java.lang.String), sleep(long), asType(java.lang.Class), use([Ljava.lang.Object;)
  at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
  at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:163)
  at ratpack$_run_closure1$_closure2.doCall(ratpack.groovy:9)

I've also tried 'files' without luck:

ratpack {
  handlers {
    get {
      redirect 'index.html'
    }
    files 'dist'
  }
}

Any ideas?

Vinod
rus
Reply | Threaded
Open this post in threaded view
|

Re: static assets

rus
'assets' has changed to:

        fileSystem("dist") { f ->
            f.files()
        }
Reply | Threaded
Open this post in threaded view
|

Re: static assets

vsajja
Thanks!
rus
Reply | Threaded
Open this post in threaded view
|

Re: static assets

rus
You can also do:

        files {
            it.dir("dist")
        }

Which is probably better.