This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
2012-05-08 03:31:35 +00:00
|
|
|
class NccuCalendar
|
2012-05-08 08:08:41 +00:00
|
|
|
require 'open-uri'
|
2012-05-15 06:03:54 +00:00
|
|
|
require 'tempfile'
|
|
|
|
|
2012-05-08 03:31:35 +00:00
|
|
|
@queue = :high
|
|
|
|
|
|
|
|
def self.perform()
|
2012-06-04 08:51:29 +00:00
|
|
|
# temp_file = Tempfile.new('new_cal')
|
|
|
|
# open('http://events.nccu.edu.tw/Month').read{|data|
|
|
|
|
# temp_file << data
|
|
|
|
# }
|
2012-05-15 06:03:54 +00:00
|
|
|
|
2012-06-04 08:51:29 +00:00
|
|
|
open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo|
|
|
|
|
fo.print open('http://events.nccu.edu.tw/Month').read
|
|
|
|
end
|
|
|
|
|
|
|
|
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
|
2012-05-15 06:03:54 +00:00
|
|
|
|
2012-06-04 08:51:29 +00:00
|
|
|
puts "NccuCalendar Synced4"
|
2012-05-08 03:31:35 +00:00
|
|
|
end
|
|
|
|
end
|