Thanks - I understand that part now!
I put scraper.rb in my Libs folder
I put scraper.rake in my libs/tasks
I took the end portion of scraper.rb and removed it placing it in my
rake file:
desc "This task will parse data from ncaa.org and upload the data to our
db"
task :scraper => :environment do
# In our search we are supplying the website url to parse, the type of
element (ex: table), the class name of that element
# and the child element that contains the data we wish to retrieve.
offensive_rushing =
Scraper.new('http://web1.ncaa.org/mfb/natlRank.jsp?year=2008&rpt=IA_teamrush&site=org',
'table', 'statstable', '//tr')
offensive_rushing.scrape_data
offensive_rushing.clean_celldata
offensive_rushing.print_values
end
And it did a print out when I called the rake.. So, now I'll have to
test this with the database and see how it works...
Thanks a ton (I understand it now)..
The part that was => environment do was telling my rake task to make
sure that the environment was fully loaded before running it.
So, if I wanted to run another rake task in the same rake file and I
wanted to make sure the first was done, I'd do something like:
task: next_task => :scraper do
# code
end
which would make it run only after the scraper task had finished..
--
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---