Hey, I have two applications I''d like to combine using a wrapper application. I thought about using engines but that turned out to be rather difficult. Does anyone know of a solution how to do this? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6a33df7c629a222dba68bcc1d1d37b68%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
On Jul 17, 2013, at 12:06 AM, Patrick Bartels <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have two applications I''d like to combine using a wrapper application. > I thought about using engines but that turned out to be rather > difficult. > > Does anyone know of a solution how to do this?The simplest way I can think of doing this is just have an app that wraps the other two apps in iframes…. More complex ways involve Rails engines, but integrating two existing apps into that could be difficult, I can see… Another way is treat your two existing apps as services that your wrapper app makes API calls to… but that means your existing apps need to have APIs…. What is it you hope to achieve with this? What will you and your users get by having these two apps combined into one? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0A0F24E9-0BE2-4CC6-B3C9-EC3EFEA82796%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Iframes isn''t really an option and the apps don''t have APIs. What I need is have the routes and their functionality in one app. The wrapper app wouldn''t need to have any functionality at all. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/446c7124eb9701002a93d560d27eb676%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Another question to help clarify -- are both of the other apps hosted on your server? Do you control them in any way? If not, then you''re well into the realm of "screen scraping", which is a fragile way to build an app. Walter On Jul 18, 2013, at 5:07 AM, Patrick Bartels wrote:> Iframes isn''t really an option and the apps don''t have APIs. What I need > is have the routes and their functionality in one app. The wrapper app > wouldn''t need to have any functionality at all. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/446c7124eb9701002a93d560d27eb676%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4C862EA6-5343-4F12-9ED5-26EBBC044EB3%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.
Yes, both are my applications. I own the repositories and the server they''re gonna be hosted on. Is proxying maybe a solution? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/336965d484e4d46789beb2507e59a3e1%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
You could create data objects in your wrapper app that are just proxies for the other services then. Since you know they won''t change underneath you, you can literally scrape the HTML and use it as a poor man''s API. Nokogiri is where I would start with this, since it can turn any janky HTML into a clean object tree. But I am curious -- what made adding an API to the two other apps such an ordeal? Are they older Rails versions? Not your work and too much hassle to untwist? (Not critical to your answer, just asking.) Walter On Jul 18, 2013, at 6:45 AM, Patrick Bartels wrote:> Yes, both are my applications. I own the repositories and the server > they''re gonna be hosted on. > > Is proxying maybe a solution? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/336965d484e4d46789beb2507e59a3e1%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/08E02562-B28C-4800-9454-423D29F478BC%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.
I knew I just read about this: http://blog.rlmflores.me/blog/2013/07/16/ruby-patterns-webservice-object/ Now that''s dealing with a proper API, using Faraday. Depending on the HTML you are consuming (assuming -- big leap here -- that there are some defined IDs or classnames that can be used to get to the data you want), you can get similar data by parsing the HTML instead: require ''open-uri'' require ''nokogiri'' src = open(''http://example.com'') doc = Nokogiri::HTML.parse(src) # now you can use either Xpath or css to get to your data data = doc.css(''#data_table tbody tr'') data.each do | row | fields = row.css(''td'').map(&:text) # do what you will with the data, etc. end Walter On Jul 18, 2013, at 6:54 AM, Walter Lee Davis wrote:> You could create data objects in your wrapper app that are just proxies for the other services then. Since you know they won''t change underneath you, you can literally scrape the HTML and use it as a poor man''s API. Nokogiri is where I would start with this, since it can turn any janky HTML into a clean object tree. But I am curious -- what made adding an API to the two other apps such an ordeal? Are they older Rails versions? Not your work and too much hassle to untwist? (Not critical to your answer, just asking.) > > Walter > > On Jul 18, 2013, at 6:45 AM, Patrick Bartels wrote: > >> Yes, both are my applications. I own the repositories and the server >> they''re gonna be hosted on. >> >> Is proxying maybe a solution? >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> -- >> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/336965d484e4d46789beb2507e59a3e1%40ruby-forum.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/08E02562-B28C-4800-9454-423D29F478BC%40wdstudio.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5BD3F6CF-C7E6-4649-9BFC-67FB286F7B54%40wdstudio.com. For more options, visit https://groups.google.com/groups/opt_out.
What makes it an ordeal is that the first app is massive with hundreds of views etc., the second one is rather small with only a couple of dozen views. Creating APIs or even scraping it with nokogiri. In fact I''ve kind of transformed the big one into an engine already and added it to the wrapper app as a gem. However, my current problem is: when I run rake routes, I get all routes from the app turned into an engine however, login_path etc. doesn''t work in the views. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7c3cc8c739fd54c26f075857121bc13d%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
I think you''re on the right track. It sounds like your views are not properly scoped to the engine, or you''re trying to call routes from the engine that it doesn''t know about. Can you try qualifying the routes with the application/engine they came from? See here: http://guides.rubyonrails.org/engines.html#routes On Thursday, July 18, 2013 7:12:02 AM UTC-4, Ruby-Forum.com User wrote:> > What makes it an ordeal is that the first app is massive with hundreds > of views etc., the second one is rather small with only a couple of > dozen views. > > Creating APIs or even scraping it with nokogiri. > > In fact I''ve kind of transformed the big one into an engine already and > added it to the wrapper app as a gem. However, my current problem is: > when I run rake routes, I get all routes from the app turned into an > engine however, login_path etc. doesn''t work in the views. > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c2d78086-5d9c-455d-ba2f-c2b8854f5fdc%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
andreo-FdlSlcb4kYpknbxzx/v8hQ@public.gmane.org
2013-Jul-22 12:11 UTC
Re: Combine two apps into one? Engines?
What about an approach where you publish both applications as gems? wouldn''t that work? a setup like spree where you have spree_social and stuff like that? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6c957625-c7b5-4f64-8193-1575eba13e6a%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
That''s exactly what I''m trying but routes etc. are not working hence this post :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b75b1767f17ba1acc2fc097df39ee9ca%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
andreo-FdlSlcb4kYpknbxzx/v8hQ@public.gmane.org
2013-Jul-22 21:20 UTC
Re: Combine two apps into one? Engines?
1.So what is that happens on the views? 2.When you try to visit the login path, what happens? 3.Do you have tests for it? where does it fail in the tests? 4.Whats the output on the logs? 5.Have you tried to use something like ruby-debugger to go through the code and see what happens on the views? all the best, Andre -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/278cdf2d-7c4b-4998-9d69-145698cb5cea%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.