orbit-4-2/lib/tasks/site.rake

44 lines
7.9 KiB
Ruby
Executable File

# encoding: utf-8
namespace :site do
task :build => :environment do
Site.destroy_all
Purchase.destroy_all
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ], :enable_language_detection => "true")
User.create!(:email=>'rulingcom@rulingcom.com',:admin=>true,:user_id=>'rulingcom',:password=>'bjo4xjp6', :confirmation_token => nil, :confirmed_at => Time.now, :approved => true)
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
puts "Congres you can now login within url"
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
end
task :necessary_data => :environment do
site = Site.first
site.title = 'RulingOrbit Demo Site'
site.save
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
design = Design.first
site = Site.first
site.design = design
site.terms_of_use_translations = {
"en"=>"<h3 style=\"line-height: normal; clear: both; background-image: url(http://www.forex.ntu.edu.tw/css/cssimg/h3_bg.gif); padding: 0.1em 0px 0.1em 1.2em; font-size: 1.1em; margin: 10px 0px 5px; width: 891px; color: rgb(89, 101, 146); font-family: Verdana, 'Lucida Grande', Arial, sans-serif; background-position: 0% 1px; background-repeat: no-repeat no-repeat;\">Terms, Privacy and Security Policy</h3>\r\n\r\n<div id=\"pages_area editor\" style=\"color: rgb(0, 0, 0); font-family: Verdana, 'Lucida Grande', Arial, sans-serif; line-height: normal;\">Welcome to this website maintained by RulingDigital Inc.. We hope you will be able to access the information that you are seeking via this website. Please read the terms of use and the policies regarding privacy and security:<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">Copyright Statement</span><br />\r\nThe copyright and other intellectual property rights existing in and attaching to this website are the property of the RulingDigital Inc. (hereinafter referred to as the RulingDigital), and may not be reproduced or otherwise used without the express written consent of the RulingDigital.<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">Information We Provide to You</span><br />\r\nWe will make every effort to ensure that the information provided on this website is up-to-date and accurate, but the information is provided on an &ldquo;as is&rdquo; and &ldquo;as available&rdquo; basis. By accessing this website, the user hereby agrees that the use of this website is at the user&rsquo;s sole risk. The RulingDigital gives no warranty that the information posted on this website will meet the user&rsquo;s requirements, or that the information posted will be uninterrupted, timely, secure, or error-free.<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">Information You Provide to Us</span><br />\r\nWe are committed to protecting your&nbsp;<span style=\"color: rgb(0, 0, 255);\">privacy</span>. This website does not use cookies nor does it track individual visitors. Personally identifiable information that you voluntarily provide to us via this website will not be used for any purpose other than to respond to your inquiry.&nbsp;<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">Limitation of Liability</span><br />\r\nEvery effort will be made to keep this website virus-free and secure, however, any material downloaded or otherwise obtained through the utilization of this website is done at the user&rsquo;s own risk and the user will therefore be liable for any and all damages of whatsoever nature arising out of such utilization of the website.&nbsp;<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">External Links</span><br />\r\nThis website may provide links to other websites and resources. The RulingDigital&nbsp;is not responsible for the privacy practices or the content of such websites.<br />\r\n<br />\r\n<span style=\"color: rgb(255, 0, 0);\">Changes to this Policy</span><br />\r\nThe&nbsp;RulingDigital&nbsp;reserves the right to modify or change these terms without notice. Please contact the webmaster if you have questions pertaining to these terms and this website.</div>\r\n",
"zh_tw"=>"<p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">1. </span></font></font><font size=\"2\">本網站所刊載資料之著作權,除另有規定外,屬於 銳綸數位股份有限公司(下稱「本單位」)。任何人得為非營利目的自由使用。但使用時,不得變更其內容、詆毀或減損本單位名譽,且必須註明來源為「銳綸數位股份有限公司」。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">2. </span></font></font><font size=\"2\">具有上傳資料權限之使用者,得自行決定其資料之著作權歸屬與授權規則。本網站之使用者,應遵守之,並了解本單位對此資料不負任何法律責任。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">3. </span></font></font><font size=\"2\">本單位盡力維護本網站資料之即時性與正確性,但對此不負任何責任。本單位有權不經事先公告,變更網站內容。因此,凡使用者認為涉及其利益之事項,例如考試資格或日期、畢業學分等,請逕與本單位相關業務人員確認。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">4. </span></font></font><font size=\"2\">本單位盡力維護本網站資料不含任何電腦病毒。但對於任何因下載本網站資料所致電子資訊系統或其他之損害,本單位不負任何責任。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">5. </span></font></font><font size=\"2\">本網站所提供對其他網站之超連結,僅為使用者之便利。該被連結之他網站,並非本網站之一部分。本單位不保證所連結之他網站存在,亦不對該網站之任何內容、超連結等負責。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">6. </span></font></font><font size=\"2\">本網站除為提供個人服務之必要外,不使用 </font><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">cookies </span></font></font><font size=\"2\">,也不追蹤使用者之網路使用。使用者主動提供之個人資料,除指定目的與分析本網站使用習慣外,不作其他用途。</font></p><p style=\"margin-top: 0.49cm; margin-bottom: 0.49cm; widows: 2; orphans: 2\"><font face=\"Times\"><font size=\"2\"><span lang=\"en-US\">7. </span></font></font><font size=\"2\">本使用規則之修改變更,不預先公告。若使用者對於本規則或本網站有任何意見或建議,請與網站管理員聯繫。</font></p>"
}
site.save
theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save
end
end