Orbit/lib/tasks/pages.rake

67 lines
2.4 KiB
Ruby
Raw Normal View History

2012-01-24 03:38:53 +00:00
# encoding: utf-8
namespace :pages do
task :build => :environment do
2013-02-05 10:26:45 +00:00
Item.destroy_all
2012-01-24 03:38:53 +00:00
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
var_13 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is the homepage', :zh_tw => '這是首頁', :parent_id => var_10.id )
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
2012-10-24 10:40:38 +00:00
design.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
2012-01-24 03:38:53 +00:00
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#
# js = design.javascripts.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js"))
#
theme = design.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/default.css"))
theme_1 = design.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/red.css"))
design.build_layout
design.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
design.layout.save
theme.save
theme_1.save
# image.save
# js.save
design.save
design_1 = Design.new(:title => "Bob", :author => "Me", :intro => "Moran")
2012-10-24 10:40:38 +00:00
design_1.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
2012-01-24 03:38:53 +00:00
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#
# js = design.javascripts.build(:file => File.open("#{Rails.root}/lib/fraisier/inettuts.js"))
#
theme = design_1.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/default.css"))
theme_1 = design_1.themes.build(:file => File.open("#{Rails.root}/lib/fraisier/themes/red.css"))
design_1.build_layout
design_1.layout.file = File.open("#{Rails.root}/lib/fraisier/layout.html")
design_1.layout.save
theme.save
theme_1.save
# image.save
# js.save
design_1.save
home = Page.create!( :i18n_variable_id => var_10.id, :design_id => design_1.id, :name => 'home', :is_published => true, :theme_id => theme.id )
home.page_parts.create!( :name => 'content_1', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
end
end