2011-08-18 05:43:33 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
namespace :site do
|
|
|
|
|
|
|
|
task :build => :environment do
|
2013-02-05 10:26:45 +00:00
|
|
|
Site.destroy_all
|
|
|
|
Purchase.destroy_all
|
2013-05-14 03:26:35 +00:00
|
|
|
|
2011-11-22 10:54:10 +00:00
|
|
|
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
2013-05-14 02:32:53 +00:00
|
|
|
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
|
2013-05-14 03:26:35 +00:00
|
|
|
`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'
|
2013-05-14 03:48:13 +00:00
|
|
|
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
|
|
|
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
2013-05-15 06:57:11 +00:00
|
|
|
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
2011-08-18 05:43:33 +00:00
|
|
|
end
|
|
|
|
|
2013-05-14 02:32:53 +00:00
|
|
|
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
|
2013-05-23 04:07:43 +00:00
|
|
|
site = Site.first
|
|
|
|
site.design = design
|
|
|
|
site.save
|
2013-05-14 02:32:53 +00:00
|
|
|
theme = design.themes.first
|
2013-10-04 11:17:45 +00:00
|
|
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] )
|
2013-05-14 02:32:53 +00:00
|
|
|
|
|
|
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
|
|
|
home.save
|
|
|
|
end
|
|
|
|
|
2011-08-18 05:43:33 +00:00
|
|
|
end
|