Updated rake task to accept right attrbites and generate site
This commit is contained in:
parent
f3b3c94b42
commit
f396493e44
|
@ -1,12 +1,14 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
namespace :new_site do
|
namespace :new_site do
|
||||||
task :build => :environment do |t, args|
|
task :build, [:website_name, :username, :password] => :environment do |t, args|
|
||||||
|
website_name = "#{args.website_name}"
|
||||||
|
username = "#{args.username}"
|
||||||
|
password = "#{args.password}"
|
||||||
Site.destroy_all
|
Site.destroy_all
|
||||||
Purchase.destroy_all
|
Purchase.destroy_all
|
||||||
|
Site.create( :school => "#{website_name}", :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||||
Site.create( :school => "#{args.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}')
|
||||||
User.create!(:email=>'admin@rulingcom.com',:admin=>true,:user_id=>"#{args.username}",:password=>'#{args.password}')
|
|
||||||
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
|
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
|
||||||
puts "Congres you can now login within url"
|
puts "Congres you can now login within url"
|
||||||
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
|
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
|
||||||
|
@ -14,10 +16,10 @@ namespace :new_site do
|
||||||
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :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)
|
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
||||||
end
|
end
|
||||||
|
task :necessary_data, [:website_name] => :environment do
|
||||||
task :necessary_data => :environment do
|
|
||||||
site = Site.first
|
site = Site.first
|
||||||
site.title = "#{args.website_name}"
|
puts website_name = "#{args.website_name}"
|
||||||
|
puts site.title = '#{website_name}'
|
||||||
site.save
|
site.save
|
||||||
|
|
||||||
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||||
|
|
Loading…
Reference in New Issue