Ok, after a few more code changes, I am now able to run through all browser-based scenarios and all *restr*-based scenarios. I have added a comment starting with /@techarch/ on all the lines I have changed. I have also updated *restr.rb* so that the cookie header can be exchanged back and forth.
I created a *test.rb* with a few snippets to use in IRB using Restr.
My gist is available at: http://gist.github.com/343058
Feel free to pick and choose/rewrite/optimize as needed when merging into Reststop. ;-)

Philippe (@techarch on Twitter)

On 3/24/2010 9:37 PM, Philippe Monnet wrote:
Matt,

Thanks for the head start on the port to 2.0.
I have started to finish it and am about 95% there.
At this point I can run through all browser-based scenarios and have started some of the Restr-based scenarios. I am now trying to figure out how to do the authentication bit for the PUT scenarios.
I hope to complete this by the end of the week-end.

Philippe

On 3/23/2010 1:49 PM, Matt Zukowski wrote:
Alright I spent a few hours trying to see if I can make things work with 2.0.

I was able to make some progress (mostly thanks to Magnus' help!) but ran out of time before I could get things runnings.

Here's the result:

http://gist.github.com/341555

I'm not sure when I will get a chance in the near future to play around with this again, but if someone wants to take it and run with it I'd be happy to help.

Matt.

On Tue, Mar 23, 2010 at 12:36 PM, Magnus Holm <judo...@gmail.com <mailto:judo...@gmail.com>> wrote:

    code = %q{
    # This Ruby code will be called everytime Camping.goes is called.
    # And "Camping" is replaced with the app module, so you can do
    stuff like:
    def Camping.foo
      puts "Hello World!"
    end

    # You probably just want to do:
    module Camping
      include MyExtension
    end
    }

    # For Camping.goes
    Camping::S << code
    # For previus Camping.goes
    Camping::Apps.each { |app| app.module_eval(code.gsub("Camping",
    app.to_s)) }

    As for qsp, it's replaced by Rack::Utils.parse_query. This
    creates a regular Hash though, so I've written a Base#n to
    convert it to Camping::H.

    # Before:
    hash = Camping.qsp("hoho=1")
    # Now: (inside an instance of a controller)
    hash = n(Rack::Utils.parse_query("hoho=1"))


    // Magnus Holm



    On Tue, Mar 23, 2010 at 17:23, Matt Zukowski <m...@roughest.net
    <mailto:m...@roughest.net>> wrote:

        Okay got it... but as I look at this a bit more, the
        ridiculous things I had to do to make Reststop work (for
        Camping 1.0) are all coming back to me.

        As I recall, the root of all evil was Camping#goes. I had to
        override it in order to inject the Reststop code into
        Camping. Camping#qsp was the second evil, and I see that it's
        now gone. I'm looking around now to see what you've done to
        replace it (I take it Rack took care of some of that).


        On Tue, Mar 23, 2010 at 12:05 PM, Magnus Holm
        <judo...@gmail.com <mailto:judo...@gmail.com>> wrote:

            @env['REQUEST_METHOD'] is the HTTP method send by the
            client, @method is the method (in lowercase) Camping is
            going to run ("r404" for 404 etc.)

            // Magnus Holm



            On Tue, Mar 23, 2010 at 17:01, Matt Zukowski
            <m...@roughest.net <mailto:m...@roughest.net>> wrote:

                Hey Magnus, while we have your attention, in 2.0 how
                do I get access to e['REQUEST_METHOD'] inside the
                'service' method? Trying to figure this out as we
                speak...


                On Tue, Mar 23, 2010 at 11:50 AM, Magnus Holm
                <judo...@gmail.com <mailto:judo...@gmail.com>> wrote:

                    I find extending Camping apps to be quite easy,
                    since it's all classes and modules, but I can
                    understand that extending Camping itself can be
                    difficult/weird. That said, I think a lot can be
                    solved by defining #included and #extended. It
                    would be great if you could tell us a bit exactly
                    the problems you faced. We still have 1k left.

                    Don't hurry, though. Let's get 2.0 out first.

                    // Magnus Holm



                    On Tue, Mar 23, 2010 at 16:07, Matt Zukowski
                    <m...@roughest.net <mailto:m...@roughest.net>> wrote:

                        I actually have a reststop app up and running
                        fine with Camping 2.0 (check out Taskr at
                        http://github.com/zuk/taskr). Tthe catch is
                        that it's a version of 2.0 that I forked
                        about this time last year, and looking at the
                        github graph, Magnus has committed a whole
                        slew of changes since then. So whatever broke
                        Reststop must have been committed in the last
                        10 months or so.

                        To be honest over the last year I've mostly
                        switched form Camping to Sinatra (and lately
                        to Node.js, which is really really cool by
                        the way). The problem with Camping, for me,
                        is that trying to extend it is a nightmare. I
                        learned this the hard way while writing
                        Reststop and Picnic.

                        Anyway I have a bit of time right now, so
                        since there seems to be some interest, I'll
                        pull down the latest version of Camping and
                        see if I can make it work with Reststop. I
                        should also move Reststop to github while I'm
                        at it.

                        On Mon, Mar 22, 2010 at 11:32 PM, Philippe
                        Monnet <r...@monnet-usa.com
                        <mailto:r...@monnet-usa.com>> wrote:

                            Hi David,

                            I had played with RESTstop on the old
                            Camping maybe six months ago.
                            I have now started to take a look at what
                            the issues are about.
                            So far I have found a few things like:

                            In reststop.rb:
                              - the service method needs to retrieve
                            the REQUEST_METHOD using
                            @env['REQUEST_METHOD']
                              -the condition on the if statement on
                            the last m.capture line of the render
                            method needs to be adjusted (not sure
                            what a[0] should be replaced with. So far
                            I have temporarily replaced the line by:
                                 s = m.capture{send(:layout){s}} if
                            m.respond_to?(:layout)

                            In the blog.rb example
                              - the version number for camping needs
                            to be updated
                              - require 'camping/db' should be
                            removed since now obsolete
                              - require 'markaby' needs to be added

                            So far I can bring up the app in a
                            browser, login, add a post.
                            But if I use Restr I can only do a GET.
                            The PUT currently fails with a 401. I
                            will continue to try figuring it out over
                            the next week or so.
                            It would be great if the initial author
                            could help us out.

                            Philippe


                            On 3/12/2010 8:04 AM, David Susco wrote:
                            Has anyone managed to get camping to work with 
reststop using 1.9.354?



                            _______________________________________________
                            Camping-list mailing list
                            Camping-list@rubyforge.org
                            <mailto:Camping-list@rubyforge.org>
                            http://rubyforge.org/mailman/listinfo/camping-list



                        _______________________________________________
                        Camping-list mailing list
                        Camping-list@rubyforge.org
                        <mailto:Camping-list@rubyforge.org>
                        http://rubyforge.org/mailman/listinfo/camping-list



                    _______________________________________________
                    Camping-list mailing list
                    Camping-list@rubyforge.org
                    <mailto:Camping-list@rubyforge.org>
                    http://rubyforge.org/mailman/listinfo/camping-list



                _______________________________________________
                Camping-list mailing list
                Camping-list@rubyforge.org
                <mailto:Camping-list@rubyforge.org>
                http://rubyforge.org/mailman/listinfo/camping-list



            _______________________________________________
            Camping-list mailing list
            Camping-list@rubyforge.org
            <mailto:Camping-list@rubyforge.org>
            http://rubyforge.org/mailman/listinfo/camping-list



        _______________________________________________
        Camping-list mailing list
        Camping-list@rubyforge.org <mailto:Camping-list@rubyforge.org>
        http://rubyforge.org/mailman/listinfo/camping-list



    _______________________________________________
    Camping-list mailing list
    Camping-list@rubyforge.org <mailto:Camping-list@rubyforge.org>
    http://rubyforge.org/mailman/listinfo/camping-list



_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to