forked from saurabh/orbit4-5
82 lines
2.1 KiB
Ruby
82 lines
2.1 KiB
Ruby
# Load the Rails application.
|
|
require File.expand_path('../application', __FILE__)
|
|
|
|
# Initialize the Rails application.
|
|
Orbit::Application.initialize!
|
|
|
|
if Site.count == 0
|
|
site = Site.new
|
|
site.title_translations = {:en=>"Orbit",:zh_tw=>"Orbit"}
|
|
site.valid_locales = [:en, :zh_tw]
|
|
site.in_use_locales = site.valid_locales
|
|
site.template = Dir.glob("#{Rails.root}/app/templates/*").last.split('/').last
|
|
site.save
|
|
end
|
|
|
|
if Site.first.template.nil?
|
|
site = Site.first
|
|
site.template = Dir.glob("#{Rails.root}/app/templates/*").last.split('/').last
|
|
site.save
|
|
end
|
|
|
|
if Page.count == 0
|
|
home = Page.new
|
|
home.name_translations = {:en=>"home",:zh_tw=>"首頁"}
|
|
home.url = "/"
|
|
home.save
|
|
end
|
|
|
|
if Page.where(:module=>"sitemap").blank?
|
|
sitemap = Page.new
|
|
sitemap.module = "sitemap"
|
|
sitemap.page_id = "sitemap"
|
|
sitemap.name_translations = {:en=>"Sitemap",:zh_tw=>"Sitemap"}
|
|
sitemap.enabled_for = ["en", "zh_tw"]
|
|
sitemap.menu_enabled_for = []
|
|
sitemap.url = "/sitemap"
|
|
sitemap.parent_page_id = Page.root.id
|
|
sitemap.save
|
|
end
|
|
|
|
if Page.where(:page_id=>'termofuse').blank?
|
|
termofuse = Page.new
|
|
termofuse.module = "page_content"
|
|
termofuse.page_id = "termofuse"
|
|
termofuse.name_translations = {:en=>"Term of use",:zh_tw=>"使用規則"}
|
|
termofuse.enabled_for = ["en", "zh_tw"]
|
|
termofuse.menu_enabled_for = []
|
|
termofuse.url = "/termofuse"
|
|
termofuse.parent_page_id = Page.root.id
|
|
termofuse.save
|
|
|
|
page = PageContext.new
|
|
page.content_translations = {:en=>"", :zh_tw=>""}
|
|
page.version = 1
|
|
page.save
|
|
termofuse.page_contexts << page
|
|
|
|
site = Site.first
|
|
site.terms_of_use_link = "/termofuse"
|
|
site.save
|
|
end
|
|
|
|
if User.count==0
|
|
group = Workgroup.new
|
|
group.title = "Administrator"
|
|
group.key = 'admin'
|
|
group.save
|
|
|
|
profile = MemberProfile.new
|
|
profile.first_name_translations = {:en=>'Digital', :zh_tw=>'Digital'}
|
|
profile.last_name_translations = {:en=>'Ruling', :zh_tw=>'Ruling'}
|
|
profile.email = "orbit@rulingcom.com"
|
|
profile.save
|
|
|
|
user = User.new
|
|
user.workgroup = group
|
|
user.member_profile = profile
|
|
user.user_name = "rulingcom"
|
|
user.password = "bjo4xjp6"
|
|
user.email = "orbit@rulingcom.com"
|
|
user.save
|
|
end |