Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Siddhartha Gadgil
    @siddhartha-gadgil
    I am migrating from cask 0.5.2 and pages are shown as their html source, presumably because of a text/plain header. Can someone please help me fix this.
    Li Haoyi
    @lihaoyi
    you can return a Scalatags Frag or Tag directly and it should have the proper contenttype
    otherwise an explicit Response case class would work too
    Siddhartha Gadgil
    @siddhartha-gadgil
    I am using string interpolation, so I will try the Response case class.
    Siddhartha Gadgil
    @siddhartha-gadgil
    Thanks. It works (but I need more changes to load javascripts etc).
    Li Haoyi
    @lihaoyi
    great!
    Siddhartha Gadgil
    @siddhartha-gadgil
    Thanks again. This is fine now, and an earlier warning of stylesheets having the wrong type is gone too.
    Siddhartha Gadgil
    @siddhartha-gadgil
    @lihaoyi if you are here, I am reading resources using os.read and serving them with cask. This is not working correctly for jpg images. Can you tell me what I should do? Use os.read.bin?
    Li Haoyi
    @lihaoyi
    os.read.bytes
    Siddhartha Gadgil
    @siddhartha-gadgil
    Thanks @lihaoyi . Everything migrated successfully.
    Li Haoyi
    @lihaoyi
    great!
    jodersky
    @jodersky
    @lihaoyi I'm currently porting cask to Dotty and while looking through the macros I noticed this @doc annotation, and AFAICT it's not documented anywhere. What's the plan for this? Can I ignore this for the dotty port? (at least for now)
    Li Haoyi
    @lihaoyi
    @jodersky sure feel free to ignore it for now, we can come back and flesh it out later
    oneengineer
    @oneengineer
    It seems I can only access the cask website from localhost, how can I expose it to public
    Ah, I just figured out, I need to override host to "0.0.0.0"
    jodersky
    @jodersky
    @noelwelsh I have a WIP version of a dotty port working lihaoyi/cask#35. Some features are still missing (see the comments in the PR) but you can already mostly use it for local testing
    argh, looks like scala-requests isn't published to maven yet. You'll need to publish that too if you do plan on using the dotty version of cask locally (latest master works on Dotty, just isn't published to maven yet)
    Noel Welsh
    @noelwelsh
    Nice one! Thanks!
    kurgansoft
    @kurgansoft

    Hi All,

    In my project I'm trying to upgrade cask from 0.6.7 to 0.7.5

    The main entry point for my app looks something like this:

    object Launcher extends cask.Main {
      override def allRoutes: Seq[Routes] = Seq(MyCustomRoute())
    }

    MyCustomRoute (which implements cask.main.Routes) is relatively complex, has several endpoints, static files, static resources, websockets. But it does work with cask 0.6.7.

    But as I am trying to upgrade to 0.7.5, as I launch my application I get the below error:

    Receiver class MyCustomRoute does not define or inherit an implementation of the resolved method 'abstract void cask$main$Routes$setter$actorContext_$eq(castor.Context$Simple)' of interface cask.main.Routes.

    Any idea how to track down where the error could be?

    Li Haoyi
    @lihaoyi
    seems like a classpath version conflict; can you make sure you've upgraded cask to 0.7.5 throughout your application, and that you're doing a clean compile?
    kurgansoft
    @kurgansoft
    It turns out it did work launching it from the command line. After generating the IDEA project again, launching it from IntelliJ works now as well.
    Li Haoyi
    @lihaoyi
    sounds like intellij's caches were stale; wouldn't be the first time
    oneengineer
    @oneengineer
    How can I make paramter id optional ?
      @cask.get("/tasks")
      def taskPage(id:Option[String])
    It tells me lack of id
    Noel Welsh
    @noelwelsh
    @cask.get("/tasks/:id")
    def taskPageWithId(id: String) = ???
    
    @cask.get("/tasks")
    def taskPageWithoutId() = ???
    oneengineer
    @oneengineer
    the doc says I can use option[T]
    I cannot use override, the combination would kill me
    oneengineer
    @oneengineer
    Also is there any to bypass the parameter check? I.e. I can write extra paramter in the URL than parameters in function without causing error?
    Li Haoyi
    @lihaoyi
    how about id: Option[String] = None or id: String = null
    oneengineer
    @oneengineer
    thanks ! it does the trick
    Markus Joschko
    @jocsch
    What is the best strategy to restrict file upload size?
    Alexandros Bantis
    @ambantis
    Hi, please excuse the noob question. Is it possible to have multiple route objects/classes/traits that are mixed together into a single MainRoute?
    Alexandros Bantis
    @ambantis

    ah ... I implemented it as

    object Foo extends cask.Routes { ... }
    object Bar extends cask.Routes { ... }
    object Application extends cask.Main {
      override def allRoutes = Seq(Foo, Bar)
    }

    Would this be the recommended approach?

    Li Haoyi
    @lihaoyi
    yeah
    or case classes if you want to inject things into them
    jodersky
    @jodersky
    FYI: cask 0.7.6 is now available on maven central, for Scala 2.13 and Dotty 0.27.0-RC1 !
    discobaba
    @uncleweirdo_twitter
    Since I'm a Haoyi fan, I thought I'd try Cask, but was disappointed to find the examples on https://www.lihaoyi.com/cask/ don't run ...
    jodersky
    @jodersky
    that's too bad. But without more information it will be hard to help...
    discobaba
    @uncleweirdo_twitter
    Oh, I figured they failed universally.
    ./mill -w app.runBackground
    Compiling /private/tmp/minimalApplication-0.7.6/build.sc
    build.sc:4: object creation impossible. Missing implementation for:
    def crossScalaVersion: String // inherited from trait CrossModuleBase
    object app extends CrossScalaModule{
    ^
    Compilation Failed
    Li Haoyi
    @lihaoyi
    @jodersky looks like your cross-building for Dotty change broke it, probably just need to tweak the example project mangler over here https://github.com/lihaoyi/cask/blob/master/build.sc#L251 to make it mangle the CrossScalaModule back into a normal ScalaModule
    (we could also make it insert a def crossScalaVersion field, but I think for an example project the non-cross module is simpler and more newbie friendly)
    jodersky
    @jodersky
    oh yes, it seems that indeed the addition of cross-building broke it
    I'll fix it
    Li Haoyi
    @lihaoyi
    will need to tag another numbered version in order to update the example downloads
    jodersky
    @jodersky
    This should do it lihaoyi/cask#36
    I checked locally that the generated examples work. Let me know if you'd still like to review, otherwise I'll publish a new release a bit later
    thanks for the pointer about what broke!
    Li Haoyi
    @lihaoyi
    shipit
    discobaba
    @uncleweirdo_twitter
    Wow, thanks for the quick service;-)