2013-10-25 13:55:02 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
namespace :new_site do
|
2013-10-28 03:54:14 +00:00
|
|
|
task :build, [:website_name, :username, :password] => :environment do |t, args|
|
|
|
|
website_name = "#{args.website_name}"
|
|
|
|
username = "#{args.username}"
|
|
|
|
password = "#{args.password}"
|
2013-10-25 13:55:02 +00:00
|
|
|
Site.destroy_all
|
|
|
|
Purchase.destroy_all
|
2013-10-28 03:54:14 +00:00
|
|
|
Site.create( :school => "#{website_name}", :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
|
|
|
User.create!(:email=>'admin@rulingcom.com',:admin=>true,:user_id=>'#{username}',:password=>'#{password}')
|
2013-10-25 13:55:02 +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'
|
|
|
|
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
|
2013-10-28 04:17:12 +00:00
|
|
|
task :necessary_data, [:website_name] => :environment do |t, args|
|
2013-10-25 13:55:02 +00:00
|
|
|
site = Site.first
|
2013-10-28 03:54:14 +00:00
|
|
|
puts website_name = "#{args.website_name}"
|
|
|
|
puts site.title = '#{website_name}'
|
2013-10-25 13:55:02 +00:00
|
|
|
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.save
|
|
|
|
theme = design.themes.first
|
|
|
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] )
|
|
|
|
|
|
|
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
|
|
|
home.save
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|