Sha256: 4abba75b77e2a028580f122c75358fe0363d2ea7160ee3d328fa6a86fc4f0303

Contents?: true

Size: 1.87 KB

Versions: 15

Compression:

Stored size: 1.87 KB

Contents

namespace :gluttonberg do 
  
  desc "Generate default locale (en-au)"
  task :generate_default_locale => :environment do
    Gluttonberg::Locale.generate_default_locale
  end
  
  desc "Generate or update default settings"
  task :generate_or_update_default_settings => :environment do
    Gluttonberg::Setting.generate_common_settings
  end
  
  desc "Update page descriptions"
  task :update_page_descriptions => :environment do
    Gluttonberg::Page.repair_pages_structure
  end
  
  
  desc "Copies missing assets from Railties (e.g. plugins, engines). You can specify Railties to use with FROM=railtie1,railtie2"
  task :copy_assets => :rails_env do
    begin
      Rails.application.initialize!
      app_root_path = Rails.root
      engine_root_path = Gluttonberg::Engine.root

      ["images" , "stylesheets", "javascripts"].each do |assets_dir|
        FileUtils.mkdir_p File.join(app_root_path , "app/assets/")
        FileUtils.cp_r File.join(engine_root_path , "app/assets/#{assets_dir}"), File.join(app_root_path , "vendor/assets")
      end # loop
      puts "Completed"
    rescue => e
      puts "#{e}"
    end
  end #task
  
  desc "Clean Html for all models"
  task :clean_html_for_all_models => :environment do
    Rails.application.initialize!
    [Gluttonberg::HtmlContentLocalization , Gluttonberg::Page , Gluttonberg::Article , Gluttonberg::Blog , Gluttonberg::Article , Theme , Idea , User , Speaker ].each do |constant|
      if not constant.nil? and constant.is_a? Class and constant.superclass == ActiveRecord::Base
        puts constant
        begin
          constant.all.each do |v|
            v.save
          end
        rescue => e
          puts e
        end  
        
      end
    end
    
    Gluttonberg::HtmlContentLocalization.all.each do |l|
      l.text = Gluttonberg::HtmlContentLocalization.clean_tags(l.text)
      l.save_without_revision
    end  
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gluttonberg-core-2.6.4 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.6.3 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.6.2 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.6.1 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.6.0 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.9 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.8 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.7 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.6 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.5 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.4 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.3 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.2 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5.1 lib/gluttonberg/tasks/gluttonberg.rake
gluttonberg-core-2.5 lib/gluttonberg/tasks/gluttonberg.rake