| 
									
										
										
										
											2011-01-28 06:44:08 +00:00
										 |  |  | # encoding: utf-8 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 08:23:33 +00:00
										 |  |  | namespace :dev do | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |   task :build => :environment do | 
					
						
							| 
									
										
										
										
											2011-01-28 06:44:08 +00:00
										 |  |  |     [Item, Layout, Site, Snippet, User, UserAttributeModel].each { |m| m.delete_all } | 
					
						
							| 
									
										
										
										
											2010-03-04 09:11:18 +00:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2011-01-28 06:44:08 +00:00
										 |  |  |     User.create!( :email => 'chris@rulingcom.com',  | 
					
						
							|  |  |  |       :password => 'password',  | 
					
						
							|  |  |  |       :password_confirmation => 'password',  | 
					
						
							|  |  |  |       :admin => true, | 
					
						
							|  |  |  |       :active_attributes => ["teacher"], | 
					
						
							|  |  |  |       :user_attributes => [ | 
					
						
							|  |  |  |         {:key => 'teacher'}]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Home.create!( :type => "Home", | 
					
						
							|  |  |  |       :content => "This is the home page\r\n{% t bob %}", | 
					
						
							|  |  |  |       :full_name => "home", | 
					
						
							|  |  |  |       :is_published => true,"layout_id" : ObjectId("4d23dadf5b0bad0b1100000e"), "layout_name" : "root", "name" : "home", "parent_id" : null, "parent_name" : null, "position" : 1, "title_en" : "Homepage", "title_zh_tw" : "首頁" | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |       Layout.create!( :name => 'root', :description => 'root', :content_zh_tw => File.open("#{RAILS_ROOT}/lib/template/root.layout.zh_tw").read, | 
					
						
							|  |  |  |                                       :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 | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       ["nav", "footer", "locale"].each do |page_name| | 
					
						
							|  |  |  |       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              | 
					
						
							| 
									
										
										
										
											2010-01-18 08:23:33 +00:00
										 |  |  |   end | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  | end |