Sha256: 0ddcbb831856a837dcbf7f87aeb9af84ae88af2133a0964f810939c299e19950

Contents?: true

Size: 957 Bytes

Versions: 3

Compression:

Stored size: 957 Bytes

Contents

require 'rake'

namespace :ecm do
  namespace :cms_core_engine do
    desc 'Create home pages for all locales'
    task :create_home_pages => :environment do
      p "Creating pages for locales: #{I18n.available_locales.join(', ')}"
      I18n.available_locales.each do |locale|
        p "Adding home page for locale #{locale}"
        lf = Ecm::CmsCore::Folder.create!(:basename => locale)
        f = Ecm::CmsCore::Folder.create!(:basename => "home", :parent => lf)
        t = f.templates.create!(:basename => 'index',
                                :body => "h1. Home [#{locale}]", 
                                :format => '', 
                                :handler => 'texterb',                                
                                :locale => locale,
                                :partial => false, 
                                :title => "Home [#{locale}]"
        )
        p " -> Created #{t}"
      end  
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ecm_cms_core-0.0.8 lib/tasks/ecm_cms_core_tasks.rake
ecm_cms_core-0.0.7 lib/tasks/ecm_cms_core_tasks.rake
ecm_cms_core-0.0.6 lib/tasks/ecm_cms_core_tasks.rake