On the linking thing, could you invoke a method in the main app from a sub-app which takes a sub-app name and a route as variables? The method could then just return R() from the appropriate sub-app.
Dave On Sat, Feb 18, 2012 at 4:55 PM, Isak Andersson <icepa...@lavabit.com> wrote: > http://pastebin.com/JuHhW0R > > Not sure what went wrong there :/ > > The app is over here https://github.com/MilkshakePanda/Penguin > > I have no idea what that had to do with my config.ru file.. > > > > On Sat, 18 Feb 2012 21:35:39 +0100, Magnus Holm <judo...@gmail.com> wrote: > >> On Fri, Feb 17, 2012 at 22:13, Isak Andersson <icepa...@lavabit.com> >> wrote: >>> >>> Hi, sorry if I'm repeating is email or something, Cinnamon crashed as I >>> was >>> sending the mail and >>> the result in the sent folder was completely empty, so I'm just gonna >>> have >>> to write it all over >>> again, wee! >>> >>> Anyways, my question was about new camping and if we still have the >>> ability >>> to mount multiple smaller >>> apps as the bigger app. I'm creating an app to host my blog and a bunch >>> of >>> other stuff using the new >>> Camping version that comes with Mab + Riak. I want to be able to divide >>> each >>> part of the website into >>> it's own app, but I still want them to share some things, like the >>> public/ >>> folder so that they have the >>> same look. I also want them to share Riak node which they will do. >>> >>> Let's say that my project structure looks something like this >>> >>> app/ >>> app.rb >>> blog.rb >>> forum.rb # Not actually having a forum though, probably >>> public/ >>> Style.css >>> Coolpic.png >>> blog/ >>> controllers.rb >>> views.rb >>> forum/ >>> controllers.rb >>> views.rb >>> config/ >>> ripple.yml >>> foo.yml >>> >>> First off, what is the correct command to mount these parts, and how does >>> it >>> work? The Camping site says: >>> camping apps/**/*.rb. >>> >>> I'm not sure what it does though, and if it would still work in the new >>> version. >> >> >> In the newest (pre-release) version of Camping you solve this by using >> a config.ru-file: >> >> # in config.ru >> require 'app' >> require 'blog' >> require 'forum' >> >> map '/' do >> run App >> end >> >> map '/blog' do >> run Blog >> end >> >> map '/forum' do >> run Forum >> end >> >> You can then run `camping config.ru` to start the server. >> >>> One thing that I would like, would be if all sub-apps for app.rb like >>> blog >>> or forum inherited some of the >>> settings of app.rb. I'm using rack_csrf for csrf protection (obviously) >>> and >>> I find it kind of strange to have to set >>> it up for each and every app instead of just app.rb. >> >> >> The simplest solution is to define something like this: >> >> def App.setup(app) >> app.class_eval do >> set :foo, 123 >> include Bar >> use Baz >> end >> end >> >> And then: >> >> module App >> App.setup(self) >> end >> >> module Blog >> App.setup(self) >> end >> >> module Forum >> App.setup(self) >> end >> >>> >>> Another thing, how do I make app.rb the root of the entire site so it's >>> mounted at foobar.com and not >>> foobar.com/blog like the other ones should be mounted. Also, how do I >>> link >>> between the different apps? >>> Like how do I make app link to the blog or a part of the forum link to a >>> certain part of app? >> >> >> Linking is indeed a hard problem. By default, Camping+Mab prepends the >> mount path to all links. So if you generate "/user/1" inside a >> Forum-template, the link will actually come out as "/forum/user/1". Of >> course, this means that linking to "/blog/post/1" does actually link >> to "/forum/blog/post/1" which probably wasn't what you intended. >> >> I'm really not sure what's the best solution is here… >> >>> I guess that was all the questions I had about this. I'm starting to feel >>> like this would be the ultimate >>> way to build a larger Camping app :) >>> >> >> Have fun :D >> _______________________________________________ >> Camping-list mailing list >> Camping-list@rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> >> ____________________________________________________________________________________ >> Delivering best online results. Get better, different Relevant results >> fast ! >> Searching the best of online online. >> >> http://click.lavabit.com/4ehcpqntnpwdsxdqu4axg6a3o453mwgxeoghwyzarmthtqqeyhwb/ >> >> ____________________________________________________________________________________ > > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > > _______________________________________________ > 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