problem building Twine

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

problem building Twine

Gregg
I'm getting a dependency problem building Twine - just downloaded and ran the self-executing jar:

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] ::          UNRESOLVED DEPENDENCIES         ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: net.databinder#dispatch-twitter_2.7.6;0.7.6: not found
[warn] :: net.lag#configgy;1.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

Does this build OK for others? I blew away my local ivy cache and still no dice. Any ideas? Thanks!

Gregg
Reply | Threaded
Open this post in threaded view
|

Re: problem building Twine

n8han
Administrator
On 11/14/10 3:27 PM, Gregg [via Databinder] wrote:
> Does this build OK for others? I blew away my local ivy cache and
> still no dice. Any ideas? Thanks!

Sorry about that, I haven't looked at Twine in a while and I probably
broke it in the last release or so. I should probably make it its own
separate project on github. I liked the idea of self extracting apps
like twine, but in practice it's kind of a dead end for the user. You'll
probably want to install sbt very soon if you haven't already, so the
structure that twine gives you with an sbt jar in the directory is just
kind of weird.

Any thoughts about that?

Nathan
Reply | Threaded
Open this post in threaded view
|

Re: problem building Twine

Gregg
Yep I have sbt installed, use it, love it.

I was mostly looking for example code using dispatch. I'd like to use it to write functional tests for REST services. I'd like to bring Scala in at work, and some nice cut/paste demos usually help.

For example, I was trying to figure out the "right" way to get the status code and came up with:

  "GETing google.com returns a 200 status" in {
    val http = new Http
    val req = :/("google.com")
    http x (req as_source) {
      case x => x._1
    } must_==200
  }

I think that code might seem a bit weird to my Java co-workers vs just using HttpClient.

It looks like a nice library, and I'm going to continue trying to get the hang of it. The ability to concisely make HTTP calls, get/set headers and parse/create json/xml is what I am looking for. I do think a larger set of simple examples would be great and if I get some good ones figured out, I'm happy to contribute. Cheers!

Gregg
Reply | Threaded
Open this post in threaded view
|

Re: problem building Twine

n8han
Administrator
On 11/16/10 12:57 AM, Gregg [via Databinder] wrote:
> I was mostly looking for example code using dispatch. I'd like to use
> it to write functional tests for REST services. I'd like to bring
> Scala in at work, and some nice cut/paste demos usually help.

HttpSpec.scala [1] is essentially this, though it may be hard to follow
as it's trying to hit edge cases in Dispatch. A straightforward test of
a REST API should be easier to read and write than HttpSpec is.

> For example, I was trying to figure out the "right" way to get the
> status code and came up with:
>
>   "GETing google.com returns a 200 status" in {
>     val http = new Http
>     val req = :/("google.com")
>     http x (req as_source) {
>       case x => x._1
>     } must_==200
>   }
>
> I think that code might seem a bit weird to my Java co-workers vs just
> using HttpClient.

I think you would have to write the same test out with HttpClient to
compare.

We can make this a little less mysterious by naming the values:

   "GETing google.com returns a 200 status" in {
     val http = new Http
     val req = :/("google.com")
     (http x req) {
       case (status, resp, optEntity) => status
     } must_==200
   }

And of course if we're writing a lot of these we'll want to have
factored out the http creation, leaving:

   "GETing google.com returns a 200 status" in {
     (http x :/("google.com") ) {
       case (status, resp, optEntity) => status
     } must_==200
   }

> It looks like a nice library, and I'm going to continue trying to get
> the hang of it. The ability to concisely make HTTP calls, get/set
> headers and parse/create json/xml is what I am looking for. I do think
> a larger set of simple examples would be great and if I get some good
> ones figured out, I'm happy to contribute. Cheers!

Yeah, I want to make examples happen, I'm just stumped on how to
distribute the workload. github... project tagging... something or other
will work.

Nathan

[1]:
http://sourced.implicit.ly/net.databinder/dispatch-http.test/0.7.7/HttpSpec.scala.html