From f827e8429ef0d64b86ebac9bf717d6a4873b52c5 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 8 May 2012 16:08:41 +0800 Subject: [PATCH] Calendar sync done,need Ray's JS change --- Gemfile.lock | 4 ++ app/jobs/nccu_calendar.rb | 8 ++- config/initializers/middle_site_connection.rb | 2 +- config/resque_schedule.yml | 2 +- dump.rdb | Bin 899 -> 816 bytes public/static/nccu_calendar.rss | 64 ++++++++++++++++++ 6 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 public/static/nccu_calendar.rss diff --git a/Gemfile.lock b/Gemfile.lock index a12a663b..2db01455 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,6 +97,7 @@ GEM railties (~> 3.0) thor (~> 0.14) json (1.6.5) + libv8 (3.3.10.4) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mail (2.3.3) @@ -226,6 +227,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + therubyracer (0.9.9) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -293,6 +296,7 @@ DEPENDENCIES sinatra spork sprockets + therubyracer tinymce-rails uglifier watchr diff --git a/app/jobs/nccu_calendar.rb b/app/jobs/nccu_calendar.rb index 724804d4..1848c691 100644 --- a/app/jobs/nccu_calendar.rb +++ b/app/jobs/nccu_calendar.rb @@ -1,8 +1,12 @@ class NccuCalendar + require 'open-uri' @queue = :high def self.perform() -# sleep 10 - puts "NccuCalendar Sync" + File.open(File.join(Rails.root, 'public/static', 'nccu_calendar.rss'),'w') do |file| + file << open('http://events.nccu.edu.tw/Feed').read + CronMail.time_check("NCCU Calendar synced").deliver + end + puts "NccuCalendar Synced" end end diff --git a/config/initializers/middle_site_connection.rb b/config/initializers/middle_site_connection.rb index 4f20995a..5dddcdcb 100644 --- a/config/initializers/middle_site_connection.rb +++ b/config/initializers/middle_site_connection.rb @@ -11,4 +11,4 @@ mid_host = { :database => "RSS23_NCCU_MIDDLE", :encoding => "UTF8" } -MID_CLIENT = Mysql2::Client.new(mid_host) +#MID_CLIENT = Mysql2::Client.new(mid_host) diff --git a/config/resque_schedule.yml b/config/resque_schedule.yml index 10f97f5f..1f491898 100644 --- a/config/resque_schedule.yml +++ b/config/resque_schedule.yml @@ -5,7 +5,7 @@ do_mail_matt: description: Runs the perform method in FetchTime nccu_daily_ldap_sync: - cron: 30 * * * * * + cron: * * [0,12] * * * class: SyncDb args: description: Runs the perform method in SnycDB diff --git a/dump.rdb b/dump.rdb index e5b34fe1d130ce07b54b42b5af7c97f58de85954..a4a56dc0cba0b3124f374e1d3dba72ac23f09bae 100644 GIT binary patch delta 65 zcmZo>-@rCOT8L2~H?gEdH!-uw%FNi*)Y3|8vIDauE0{ewj#-@D)XLb%%GhvY6+a^r S7t3URM#;@f80RoD{s#acUJzIS delta 140 zcmdnM*33RZT9HX0H?gEdH!-uw%GAix%)&|wMZnx(qPDa$RK}{fB(bO@HAT|Mz|ct7 zz*N`3Lc!3$%GAutz+z)2KO++Z%fx?@nVsX diff --git a/public/static/nccu_calendar.rss b/public/static/nccu_calendar.rss new file mode 100644 index 00000000..0a78dc7f --- /dev/null +++ b/public/static/nccu_calendar.rss @@ -0,0 +1,64 @@ + + + 國立政治大學校園活動行事曆 + + 本日最新活動 + zh-tw + + 2012年世界狂歡節-「框」住瞬間「框」住世界 + + + + + 101/05/01-101/05/08 00:00-23:59 + + + 2012年世界狂歡節-環友世界 + + + + + 101/05/01-101/05/10 00:00-23:59 + + + 2012年世界狂歡節-從政大看台灣 + + + + + 101/05/01-101/05/10 08:00-22:00 + + + 2012年世界狂歡節-美食嘉年華 + + + + + 101/05/08-101/05/10 12:00-14:00 + + + 2012年世界狂歡節-「原,夜」晚會 + + + + + 101/05/08 19:00-21:00 + + + 2012年世界狂歡節-開幕式 + + + + + 101/05/08 12:10-13:30 + + + 職場講座「數位文本實務課程」 + + + + + 101/04/24-101/05/15 12:20-13:50 + + +