diff --git a/Gemfile.lock b/Gemfile.lock index 776d0b32..e21da804 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -168,6 +168,7 @@ GEM rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) + rb-readline (0.4.2) rdoc (3.12) json (~> 1.4) redis (2.2.2) @@ -301,6 +302,7 @@ DEPENDENCIES radius rails (>= 3.1.0, < 3.2.0) rake + rb-readline resque resque-restriction resque-scheduler diff --git a/app/jobs/backup_server.rb b/app/jobs/backup_server.rb index f76eaac8..f600d342 100644 --- a/app/jobs/backup_server.rb +++ b/app/jobs/backup_server.rb @@ -3,6 +3,10 @@ class BackupServer def self.perform() CronMail.time_check("Going to backup Orbit").deliver + dbhost = Mongoid.config.database.connection.primary.join ':' + dbname = Mongoid.config.database.name + dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M") + %x[mongodump -h dbhost -d dbname -o dbdirectory ] # %x[touch #{Rails.root}/tmp/restart] end end diff --git a/app/jobs/nccu_calendar.rb b/app/jobs/nccu_calendar.rb index ffd89ca8..e0676627 100644 --- a/app/jobs/nccu_calendar.rb +++ b/app/jobs/nccu_calendar.rb @@ -5,11 +5,17 @@ class NccuCalendar @queue = :high def self.perform() - temp_file = Tempfile.new('new_cal') - temp_file << open('http://events.nccu.edu.tw/Month').read + # temp_file = Tempfile.new('new_cal') + # open('http://events.nccu.edu.tw/Month').read{|data| + # temp_file << data + # } - FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml')) +open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo| + fo.print open('http://events.nccu.edu.tw/Month').read +end - puts "NccuCalendar Synced" + # FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml')) + + puts "NccuCalendar Synced4" end end diff --git a/app/views/shared/_addthis_toolbox b/app/views/shared/_addthis_toolbox new file mode 100644 index 00000000..c58ff2eb --- /dev/null +++ b/app/views/shared/_addthis_toolbox @@ -0,0 +1,14 @@ + +
+<%= t("addthis_tools.add_to_bookmark")%> +| + + + + + +
+ + + diff --git a/config/dump.rdb b/config/dump.rdb deleted file mode 100644 index 3e3002a9..00000000 Binary files a/config/dump.rdb and /dev/null differ diff --git a/config/locales/en.yml b/config/locales/en.yml index cb638475..fd08be49 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -46,7 +46,8 @@ en: view: View view_count: View count yes_: "Yes" - + addthis_tools: + add_to_bookmark: Add this to bookmark all_content: All Content all_file: All File all_member: All Member diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 0b06f844..0eb12ba1 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -44,6 +44,8 @@ zh_tw: view_count: 查看次數 yes_: "Yes" + addthis_tools: + add_to_bookmark: 加入書籤 all_content: 全部內容有 all_file: 全部檔案有 all_member: 成員總數 diff --git a/config/mongoid.yml b/config/mongoid.yml index f333e2e6..16405831 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -8,7 +8,7 @@ defaults: &defaults development: <<: *defaults - database: prototype_r4_development + database: prototype_r4_ldap0229 test: <<: *defaults @@ -22,4 +22,4 @@ production: # password: <%= ENV['MONGOID_PASSWORD'] %> # database: <%= ENV['MONGOID_DATABASE'] %> <<: *defaults - database: prototype_r4_development + database: prototype_r4_ldap0229 diff --git a/config/resque.god b/config/resque.god index 6c4e4bde..6f331dd8 100644 --- a/config/resque.god +++ b/config/resque.god @@ -1,5 +1,5 @@ rails_env = 'development' #ENV['RAILS_ENV'] || "production" -rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/orbit/orbit" +rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/NCCU" num_workers = rails_env == 'production' ? 5 : 2 num_workers.times do |num| diff --git a/dump.rdb b/dump.rdb deleted file mode 100644 index 748293b8..00000000 Binary files a/dump.rdb and /dev/null differ diff --git a/lib/resque_ext.rb b/lib/resque_ext.rb new file mode 100644 index 00000000..9717aa9c --- /dev/null +++ b/lib/resque_ext.rb @@ -0,0 +1,8 @@ +module ResqueExt + # + # ResqueExt.unregister_workers_for_host("ec210-250-192-51") + # + def self.unregister_workers_for_host(host) + Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker) + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb index 2ece4b02..24c61043 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -39,5 +39,5 @@ <% end %>
- + <%= render "shared/addthis_toolbox"%>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb index df391c54..32660567 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb @@ -40,5 +40,5 @@
- + <%= render "shared/addthis_toolbox"%>