Fixed site build rake and added default design package
This commit is contained in:
parent
9b10703283
commit
2a5aef4362
|
@ -10,24 +10,32 @@ namespace :new_site do
|
||||||
username = "#{args.username}"
|
username = "#{args.username}"
|
||||||
password = "#{args.password}"
|
password = "#{args.password}"
|
||||||
email = "#{args.email}"
|
email = "#{args.email}"
|
||||||
|
|
||||||
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' ], :frontend_open => true)
|
Site.create( :school => "#{website_name}", :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ], :frontend_open => true, :enable_language_detection => "true")
|
||||||
|
|
||||||
upload_package
|
upload_package
|
||||||
User.create!(:email=>"#{email}",:admin=>true,:user_id=>"#{username}",:password=>"#{password}")
|
|
||||||
puts @user = User.last
|
User.create!(:email=>"#{email}",:admin=>true,:user_id=>"#{username}",:password=>"#{password}", :confirmation_token => nil, :confirmed_at => Time.now, :approved => true)
|
||||||
`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 => 'en', :en => 'English', :zh_tw => '英文' )
|
||||||
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)
|
||||||
|
|
||||||
|
design = Design.first
|
||||||
|
site = Site.first
|
||||||
|
site.title = "#{website_name}"
|
||||||
|
site.design = design
|
||||||
|
site.save
|
||||||
|
theme = design.themes.first
|
||||||
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
|
||||||
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
|
home.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_package
|
def upload_package
|
||||||
temp_file = Tempfile.new("temp_file")
|
temp_file = Tempfile.new("temp_file")
|
||||||
path = File.expand_path('~')
|
puts original_file = File.open("#{Rails.root}/orbitdefault.zip")
|
||||||
puts original_file = File.open("#{path}/orbitdefault.zip")
|
|
||||||
#if original_file.content_type == 'application/zip'
|
#if original_file.content_type == 'application/zip'
|
||||||
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
||||||
temp_file.rewind
|
temp_file.rewind
|
||||||
|
@ -81,22 +89,4 @@ def unzip_design(file, zip_name)
|
||||||
temp_file
|
temp_file
|
||||||
end
|
end
|
||||||
|
|
||||||
task :necessary_data, [:website_name] => :environment do |t, args|
|
|
||||||
site = Site.first
|
|
||||||
puts website_name = "#{args.website_name}"
|
|
||||||
puts site.title = "#{website_name}"
|
|
||||||
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 => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
|
|
||||||
|
|
||||||
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
|
||||||
home.save
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -6,8 +6,8 @@ namespace :site do
|
||||||
Site.destroy_all
|
Site.destroy_all
|
||||||
Purchase.destroy_all
|
Purchase.destroy_all
|
||||||
|
|
||||||
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ], :enable_language_detection => "true")
|
||||||
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
|
User.create!(:email=>'rulingcom@rulingcom.com',:admin=>true,:user_id=>'rulingcom',:password=>'bjo4xjp6', :confirmation_token => nil, :confirmed_at => Time.now, :approved => true)
|
||||||
`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'
|
||||||
|
|
Binary file not shown.
Reference in New Issue