Re: Relations on Camping
you need to add `has_many :people` to your Group class On 2010-06-25 4:03 AM, Raimon Fernandez co...@montx.com wrote: Hi, it's me again ... :-) I have one table called people and another one called groups. Each person from people belongs to ONE group. module List::Models class Person Base belongs_to :group end class Group Base end end When I get all persons from people, I expect, like in RoR, the access to related records, like: module List::Views def people(xml) xml.posts do @posts.each do |person| xml.person do xml.id(person.id) xml.name(person.name) xml.surname_01(person.surname_01) xml.surname_02(person.surname_02) xml.has_come(person.has_come) xml.group(person.group.name) # Here I'm asking for related information about the group name end end end end end and I'm getting = NoMethodError at /people/list undefined method `name' for nil:NilClass also, I'm trying to test it on Console: MacBook-ProII-2:Test montx$ camping -C list.rb ** Starting console Person.find(1) NameError: uninitialized constant Person from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing' from (irb):1 but it seems that the model hasn't been loaded ... thanks again for your help, regards, r. ps. yes, I have in the db the relation between two tables: list_group_id in the list_people table. ___ 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
Re: Updated version of RESTstop and RESTr plus bonus blog post
P.S. really nice write up. I think you know more about Reststop now than I do :) On Wed, Jun 23, 2010 at 9:27 AM, Matt Zukowski m...@roughest.net wrote: Awesome! Nice to see restr getting used. I always thought it was a better solution than rest-client, but I guess I'm biased :) On Wed, Jun 23, 2010 at 9:11 AM, Philippe Monnet r...@monnet-usa.comwrote: After last week's thread with Raimon, I made a couple changes to RESTstop and RESTr (added JSON support). Both GitHub and RubyGems are up-to-date now. I also ended up writing a blog post on how to implement REST services with RESTstop. See http://bit.ly/tareststop - Philippe (@techarch) ___ 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
Re: First time on Camping
Something's not right with your rubygems install maybe try `gem update --system` first? On Tue, Jun 8, 2010 at 3:33 PM, Raimon Fernandez co...@montx.com wrote: On 8jun, 2010, at 21:18 , David Susco wrote: Is the hoe gem installed? no, the same error as before: Last login: Tue Jun 8 18:43:33 on ttys002 MacBook-ProII-2:~ montx$ sudo gem install hoe Password: ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SocketError: getaddrinfo: nodename nor servname provided, or not known ( http://gems.rubyforge.org/gems/json_pure-1.4.3.gem) MacBook-ProII-2:~ montx$ we have to wait ... thanks, r. Dave On Tue, Jun 8, 2010 at 1:01 PM, Raimon Fernandez co...@montx.com wrote: On 8jun, 2010, at 18:43 , David Susco wrote: I don't believe the gem has been updated to include Matt's or Philippe's latest changes. You could clone it from GitHub though and rake and install it yourself. I think it requieres 'hoe' and I can't install without rubygems working or once again, find where the repo is and start digging again ... :-) MacBook-ProII-2:reststop montx$ sudo rake Rakefile (in /Users/montx/Documents/Camping/reststop) rake aborted! no such file to load -- hoe /Users/montx/Documents/Camping/reststop/rakefile:10 thanks! r. ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list -- Dave ___ 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 ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Camping 2.0.RC0
Okay everything's been moved to camping/reststop. Any future commits on my part will go there. Philippe, I believe you have access too. Thanks Magnus! On Wed, Apr 7, 2010 at 6:57 PM, Matt Zukowski m...@roughest.net wrote: Magnus, create a new one and I'll delete my copy and fork off yours. On Wed, Apr 7, 2010 at 5:05 PM, Magnus Holm judo...@gmail.com wrote: Oh, I totally forgot about that! Yes, I agree that this would be nice to have at github.com/camping. Should I fork Matt's repo or create a new one? // Magnus Holm On Wed, Apr 7, 2010 at 19:18, Matt Zukowski m...@roughest.net wrote: Hey Philippe, thanks for that. I've gone ahead and created a github repo for reststop at https://github.com/zuk/reststop Your changes have been pushed up. I've also added you as a collaborator so you can freely commit to my copy of the repo. Next step is to create a gemspec for this and push it up to gemcutter/rubyforge. Matt. On Wed, Apr 7, 2010 at 9:02 AM, Philippe Monnet r...@monnet-usa.com wrote: Successfully tested the updated RESTstop restful blog too. Started to test my own app (mySkillsMap.com) locally but will need to continue tonight. On 4/7/2010 5:33 AM, Philippe Monnet wrote: I tested 2 new apps I wrote to test OAuth so far with success. I sill have to test my main web app and the recent RESTstop blog app I had updated. On Sat, Apr 3, 2010 at 4:23 PM, Magnus Holm judo...@gmail.com wrote: Ladies and gentlemen: gem install camping --prerelease (Look, no --source!) I'm not a big fan of betas/RCs, but this is a rather big change and I want to make sure we release something that actually works. I don't have any apps that runs on Camping (neither 1.5 nor 1.9/2.0), so I was hoping if some of you could verify that it works as expected? I'll give it a week or so, and if everything seems fine I'll… * Copy the documentation at http://stuff.judofyr.net/camping-docs/ to http://camping.rubyforge.org/ * Make sure all the links in the wiki points to the right place * Release the gem as 2.0 at rubygems.org * Write an announcement which I'll post to ruby-core, rack-devel and camping-list * Submit the announcement to Rubyflow and ruby.reddit * Write a patch which removes Rack::Adapters::Camping from Rack * (Possibly write a little blog post comparing Camping and Sinatra from an objective point of view) * Start hacking on Camping 2.1! Puh. What'd ya think? Oh, and busbey has been playing a bit with the code: http://github.com/busbey/camping. Some awesome migrations ideas in there. Looking forward to merge them into 2.1! // Magnus Holm ___ 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 ___ 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 ___ 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
Re: Camping 2.0.RC0
Hey Philippe, thanks for that. I've gone ahead and created a github repo for reststop at https://github.com/zuk/reststop Your changes have been pushed up. I've also added you as a collaborator so you can freely commit to my copy of the repo. Next step is to create a gemspec for this and push it up to gemcutter/rubyforge. Matt. On Wed, Apr 7, 2010 at 9:02 AM, Philippe Monnet r...@monnet-usa.com wrote: Successfully tested the updated RESTstop restful blog too. Started to test my own app (mySkillsMap.com) locally but will need to continue tonight. On 4/7/2010 5:33 AM, Philippe Monnet wrote: I tested 2 new apps I wrote to test OAuth so far with success. I sill have to test my main web app and the recent RESTstop blog app I had updated. On Sat, Apr 3, 2010 at 4:23 PM, Magnus Holm judo...@gmail.com judo...@gmail.com wrote: Ladies and gentlemen: gem install camping --prerelease (Look, no --source!) I'm not a big fan of betas/RCs, but this is a rather big change and I want to make sure we release something that actually works. I don't have any apps that runs on Camping (neither 1.5 nor 1.9/2.0), so I was hoping if some of you could verify that it works as expected? I'll give it a week or so, and if everything seems fine I'll… * Copy the documentation at http://stuff.judofyr.net/camping-docs/ to http://camping.rubyforge.org/ * Make sure all the links in the wiki points to the right place * Release the gem as 2.0 at rubygems.org * Write an announcement which I'll post to ruby-core, rack-devel and camping-list * Submit the announcement to Rubyflow and ruby.reddit * Write a patch which removes Rack::Adapters::Camping from Rack * (Possibly write a little blog post comparing Camping and Sinatra from an objective point of view) * Start hacking on Camping 2.1! Puh. What'd ya think? Oh, and busbey has been playing a bit with the code: http://github.com/busbey/camping. Some awesome migrations ideas in there. Looking forward to merge them into 2.1! // Magnus Holm ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing listcamping-l...@rubyforge.orghttp://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
Re: Camping 2.0.RC0
Magnus, create a new one and I'll delete my copy and fork off yours. On Wed, Apr 7, 2010 at 5:05 PM, Magnus Holm judo...@gmail.com wrote: Oh, I totally forgot about that! Yes, I agree that this would be nice to have at github.com/camping. Should I fork Matt's repo or create a new one? // Magnus Holm On Wed, Apr 7, 2010 at 19:18, Matt Zukowski m...@roughest.net wrote: Hey Philippe, thanks for that. I've gone ahead and created a github repo for reststop at https://github.com/zuk/reststop Your changes have been pushed up. I've also added you as a collaborator so you can freely commit to my copy of the repo. Next step is to create a gemspec for this and push it up to gemcutter/rubyforge. Matt. On Wed, Apr 7, 2010 at 9:02 AM, Philippe Monnet r...@monnet-usa.com wrote: Successfully tested the updated RESTstop restful blog too. Started to test my own app (mySkillsMap.com) locally but will need to continue tonight. On 4/7/2010 5:33 AM, Philippe Monnet wrote: I tested 2 new apps I wrote to test OAuth so far with success. I sill have to test my main web app and the recent RESTstop blog app I had updated. On Sat, Apr 3, 2010 at 4:23 PM, Magnus Holm judo...@gmail.com wrote: Ladies and gentlemen: gem install camping --prerelease (Look, no --source!) I'm not a big fan of betas/RCs, but this is a rather big change and I want to make sure we release something that actually works. I don't have any apps that runs on Camping (neither 1.5 nor 1.9/2.0), so I was hoping if some of you could verify that it works as expected? I'll give it a week or so, and if everything seems fine I'll… * Copy the documentation at http://stuff.judofyr.net/camping-docs/ to http://camping.rubyforge.org/ * Make sure all the links in the wiki points to the right place * Release the gem as 2.0 at rubygems.org * Write an announcement which I'll post to ruby-core, rack-devel and camping-list * Submit the announcement to Rubyflow and ruby.reddit * Write a patch which removes Rack::Adapters::Camping from Rack * (Possibly write a little blog post comparing Camping and Sinatra from an objective point of view) * Start hacking on Camping 2.1! Puh. What'd ya think? Oh, and busbey has been playing a bit with the code: http://github.com/busbey/camping. Some awesome migrations ideas in there. Looking forward to merge them into 2.1! // Magnus Holm ___ 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 ___ 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 ___ 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
Re: restful camping with reststop
Nicely done! Also glad you're using restr... seems like rest-client is getting all the love nowdays. I'm happy to start a full-fledged githup repo for reststop. Although maybe a better place for it would be the general 'camping' github account? Matt. On Fri, Mar 26, 2010 at 11:42 PM, Philippe Monnet r...@monnet-usa.comwrote: 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 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 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 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 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.comwrote: 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.netwrote: 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
Re: restful camping with reststop
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.comwrote: 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 http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: restful camping with reststop
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 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 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.comwrote: 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 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 ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: restful camping with reststop
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 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 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 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 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.comwrote: 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 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 ___ 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 ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: restful camping with reststop
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 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 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 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 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.comwrote: 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.netwrote: 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 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
Re: restful camping with reststop
Sorry that link should be: http://gist.github.com/341555#file_reststop2.rb On Tue, Mar 23, 2010 at 3:49 PM, Matt Zukowski m...@roughest.net 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 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 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 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 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.comwrote: 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.netwrote: 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 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
Re: deployment
Maybe have a look at http://code.google.com/p/camping-picnic/ http://code.google.com/p/camping-picnic/Among other functionality, Picnic gives you a myapp-ctl wrapper script around your camping app that takes care of starting and stopping mongrel. Writing an init.d script around the myapp-ctl script is pretty trivial. Otherwise using mongrel_cluster to start up your app is probably your best choice. That's what we did before we switched to passenger. On Wed, Jun 3, 2009 at 10:24 AM, David Susco dsu...@gmail.com wrote: I have a few camping apps I'd like to start automatically if my server ever restarts. There's an init.d file that comes with mongrel_cluster that you can use for rails apps, is there anything out there for camping apps though? With the postamble containing all the configuration for the app, it seems that all the init.d file would have to do is execute the camping file. Has anyone done this/have any pointers? -- Dave ___ 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