This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/lib/tasks/dev.rake

35 lines
2.1 KiB
Ruby
Raw Normal View History

2010-01-18 08:23:33 +00:00
namespace :dev do
task :build => :environment do
User.delete_all
2010-03-08 09:14:59 +00:00
UserAttribute.delete_all
2010-03-08 09:14:59 +00:00
User.create!( :email => 'ihower@rulingcom.com', :password => 'password', :password_confirmation => 'password', :use_attributes => ["teacher"] )
2010-03-08 09:14:59 +00:00
UserAttribute.create!( :key => "teacher", :name => "Teacher", :attrs => [ { :name => "Name", :key => "name", :type => "text_field" }, { :name => "Title", :key => "title", :type => 'text_field' } ] )
UserAttribute.create!( :key => "staff", :name => "Staff", :attrs => [ { :name => "Name", :key => "name", :type => "text_field" }, { :name => "Duty", :key => "duty", :type => 'text_field' } ] )
2010-01-18 08:23:33 +00:00
[Announcement, Item, Snippet, Layout].each { |m| m.delete_all }
2010-02-05 08:59:41 +00:00
Layout.create!( :name => 'root', :description => 'root', :content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/root.layout.zh_tw").read,
2010-01-18 08:23:33 +00:00
:content_en => File.open("#{RAILS_ROOT}/lib/template/root.layout.en").read)
Page.create!( :name => "root", :title => I18n.t(:homepage), :layout_name => "root", :parent_name => nil,
:content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/root.page.zh_tw").read,
:content_en => File.open("#{RAILS_ROOT}/lib/template/root.page.en").read )
["about"].each do |page_name|
Page.create!( :name => page_name, :title => page_name, :layout_name => "root", :parent_name => "root",
:content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.page.zh_tw").read,
:content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.page.en").read )
end
2010-03-01 06:57:21 +00:00
["nav", "footer", "locale"].each do |page_name|
2010-01-18 08:23:33 +00:00
Snippet.create!( :name => page_name, :parent_name => "root",
:content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.zh_tw").read,
:content_en => File.open("#{RAILS_ROOT}/lib/template/#{page_name}.snippet.en").read )
end
end
end