Orbit/lib/tasks/site.rake

31 lines
1.1 KiB
Ruby

# 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' ])
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
`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'
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
theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save
end
end