I have a bit of a dilemma that I can''t figure out a suitable method. I have an existing system in production (Rails 1.2.6) that I don''t want to modify as I''ve got lots of modifications in development which will be merged in a 2 or 3 months. I am looking for a way to automate a web browser that can access a couple of reports in the production system and then e-mail them but access requires an active session because of before filter restrictions with a rights/roles mechanism. I''ve been mucking with lynx text browser and I can sort of get there but not the entire way and then the output is text instead of the full html. Anybody doing something like this? Suggestions? Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is what I''m trying to do...(which of course doesn''t work) require "app/models/personnel.rb" File.open("test.html, "w") do |file| @report_name = "Mandatory Requirements Report" @personnel = Personnel.current_by_dept file.write "reports/personnels/mandatory_requirements.rhtml" end file.close obviously this requires a web browser but I can''t use a web browser (at least easily) because of the non-standard method of authentication required to execute the method. Anyone with suggestions? Craig On Fri, 2008-07-18 at 17:57 -0700, Craig White wrote:> I have a bit of a dilemma that I can''t figure out a suitable method. > > I have an existing system in production (Rails 1.2.6) that I don''t want > to modify as I''ve got lots of modifications in development which will be > merged in a 2 or 3 months. > > I am looking for a way to automate a web browser that can access a > couple of reports in the production system and then e-mail them but > access requires an active session because of before filter restrictions > with a rights/roles mechanism. > > I''ve been mucking with lynx text browser and I can sort of get there but > not the entire way and then the output is text instead of the full html. > > Anybody doing something like this? Suggestions? > > Craig > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 Jul 2008, at 00:22, Craig White wrote:> > This is what I''m trying to do...(which of course doesn''t work) > > require "app/models/personnel.rb" > File.open("test.html, "w") do |file| > @report_name = "Mandatory Requirements Report" > @personnel = Personnel.current_by_dept > file.write "reports/personnels/mandatory_requirements.rhtml" > end > file.close > > obviously this requires a web browser but I can''t use a web browser > (at > least easily) because of the non-standard method of authentication > required to execute the method.If you''re just using model classes why would things like session and authentication have any impact (you''d need to load more of the rails framework for it to work though - you''ll need to require config/ boot.rb and config/environment.rb (or in a rake task just make your task depend on :environment. Fred> > > Anyone with suggestions? > > Craig > > On Fri, 2008-07-18 at 17:57 -0700, Craig White wrote: >> I have a bit of a dilemma that I can''t figure out a suitable method. >> >> I have an existing system in production (Rails 1.2.6) that I don''t >> want >> to modify as I''ve got lots of modifications in development which >> will be >> merged in a 2 or 3 months. >> >> I am looking for a way to automate a web browser that can access a >> couple of reports in the production system and then e-mail them but >> access requires an active session because of before filter >> restrictions >> with a rights/roles mechanism. >> >> I''ve been mucking with lynx text browser and I can sort of get >> there but >> not the entire way and then the output is text instead of the full >> html. >> >> Anybody doing something like this? Suggestions? >> >> Craig >> >> >>> > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hey I had the same problem, look into mechanize for ruby. http://rubyforge.org/projects/mechanize/ Reuben On Mon, Jul 21, 2008 at 9:44 AM, Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> > On Sun, 2008-07-20 at 11:38 +0100, Frederick Cheung wrote: > > > > On 20 Jul 2008, at 00:22, Craig White wrote: > > > > > > > > This is what I''m trying to do...(which of course doesn''t work) > > > > > > require "app/models/personnel.rb" > > > File.open("test.html, "w") do |file| > > > @report_name = "Mandatory Requirements Report" > > > @personnel = Personnel.current_by_dept > > > file.write "reports/personnels/mandatory_requirements.rhtml" > > > end > > > file.close > > > > > > obviously this requires a web browser but I can''t use a web browser > > > (at > > > least easily) because of the non-standard method of authentication > > > required to execute the method. > > > > If you''re just using model classes why would things like session and > > authentication have any impact (you''d need to load more of the rails > > framework for it to work though - you''ll need to require config/ > > boot.rb and config/environment.rb (or in a rake task just make your > > task depend on :environment. > ---- > I was trying this to get around session/authentication but this requires > the ability to deliver rhtml content into a file which I was going to > e-mail but clearly I can''t pull this off. I''m trying to get this to work > via script/console which should handle the initial issues of > boot.rb/environment.rb for the time being. > > The point about session/authentication was my earlier efforts (see > below) to automate a text based web browser to retrieve the rhtml. > > What I''m trying to accomplish is to get a fully formatted report to a > file that I can e-mail in an automated way. > ---- > > > > Fred > > > > > > > > > Anyone with suggestions? > > > > > > Craig > > > > > > On Fri, 2008-07-18 at 17:57 -0700, Craig White wrote: > > >> I have a bit of a dilemma that I can''t figure out a suitable method. > > >> > > >> I have an existing system in production (Rails 1.2.6) that I don''t > > >> want > > >> to modify as I''ve got lots of modifications in development which > > >> will be > > >> merged in a 2 or 3 months. > > >> > > >> I am looking for a way to automate a web browser that can access a > > >> couple of reports in the production system and then e-mail them but > > >> access requires an active session because of before filter > > >> restrictions > > >> with a rights/roles mechanism. > > >> > > >> I''ve been mucking with lynx text browser and I can sort of get > > >> there but > > >> not the entire way and then the output is text instead of the full > > >> html. > > >> > > >> Anybody doing something like this? Suggestions? > > >> > > >> Craig > > >> > > >> > > >>> > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
looks interesting...thanks Craig On Mon, 2008-07-21 at 10:46 -0500, reuben doetsch wrote:> hey I had the same problem, look into mechanize for ruby. > http://rubyforge.org/projects/mechanize/ > > Reuben > > On Mon, Jul 21, 2008 at 9:44 AM, Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> > wrote: > > On Sun, 2008-07-20 at 11:38 +0100, Frederick Cheung wrote: > > > > On 20 Jul 2008, at 00:22, Craig White wrote: > > > > > > > > This is what I''m trying to do...(which of course doesn''t > work) > > > > > > require "app/models/personnel.rb" > > > File.open("test.html, "w") do |file| > > > @report_name = "Mandatory Requirements Report" > > > @personnel = Personnel.current_by_dept > > > file.write > "reports/personnels/mandatory_requirements.rhtml" > > > end > > > file.close > > > > > > obviously this requires a web browser but I can''t use a > web browser > > > (at > > > least easily) because of the non-standard method of > authentication > > > required to execute the method. > > > > If you''re just using model classes why would things like > session and > > authentication have any impact (you''d need to load more of > the rails > > framework for it to work though - you''ll need to require > config/ > > boot.rb and config/environment.rb (or in a rake task just > make your > > task depend on :environment. > > ---- > I was trying this to get around session/authentication but > this requires > the ability to deliver rhtml content into a file which I was > going to > e-mail but clearly I can''t pull this off. I''m trying to get > this to work > via script/console which should handle the initial issues of > boot.rb/environment.rb for the time being. > > The point about session/authentication was my earlier efforts > (see > below) to automate a text based web browser to retrieve the > rhtml. > > What I''m trying to accomplish is to get a fully formatted > report to a > file that I can e-mail in an automated way. > ---- > > > > > Fred > > > > > > > > > Anyone with suggestions? > > > > > > Craig > > > > > > On Fri, 2008-07-18 at 17:57 -0700, Craig White wrote: > > >> I have a bit of a dilemma that I can''t figure out a > suitable method. > > >> > > >> I have an existing system in production (Rails 1.2.6) > that I don''t > > >> want > > >> to modify as I''ve got lots of modifications in > development which > > >> will be > > >> merged in a 2 or 3 months. > > >> > > >> I am looking for a way to automate a web browser that can > access a > > >> couple of reports in the production system and then > e-mail them but > > >> access requires an active session because of before > filter > > >> restrictions > > >> with a rights/roles mechanism. > > >> > > >> I''ve been mucking with lynx text browser and I can sort > of get > > >> there but > > >> not the entire way and then the output is text instead of > the full > > >> html. > > >> > > >> Anybody doing something like this? Suggestions? > > >> > > >> Craig > > >> > > >> > > >>> > > > > > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---