Sha256: ed40f4cc562d5725a9578867b2b6169388ea229d6ec7eb13688e8039478099b1

Contents?: true

Size: 1.19 KB

Versions: 45

Compression:

Stored size: 1.19 KB

Contents

namespace :alchemy do
  namespace :convert do
    namespace :urlnames do
      desc "Converts the urlname of all pages to nested url paths."
      task to_nested: [:environment] do
        unless Alchemy::Config.get(:url_nesting)
          raise "\nURL nesting is disabled! Please enable url_nesting in `config/alchemy/config.yml` first.\n\n"
        end
        puts "Converting..."
        pages = Alchemy::Page.contentpages
        count = pages.count
        pages.each_with_index do |page, n|
          puts "Updating page #{n + 1} of #{count}"
          page.update_urlname!
        end
        puts "Done."
      end

      desc "Converts the urlname of all pages to contain the slug only."
      task to_slug: [:environment] do
        if Alchemy::Config.get(:url_nesting)
          raise "\nURL nesting is enabled! Please disable url_nesting in `config/alchemy/config.yml` first.\n\n"
        end
        puts "Converting..."
        pages = Alchemy::Page.contentpages
        count = pages.count
        pages.each_with_index do |page, n|
          puts "Updating page #{n + 1} of #{count}"
          page.update_attribute :urlname, page.slug
        end
        puts "Done."
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
alchemy_cms-4.0.6 lib/tasks/alchemy/convert.rake
alchemy_cms-3.6.7 lib/tasks/alchemy/convert.rake
alchemy_cms-3.6.6 lib/tasks/alchemy/convert.rake
alchemy_cms-4.3.2 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.4 lib/tasks/alchemy/convert.rake
alchemy_cms-4.3.1 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.3 lib/tasks/alchemy/convert.rake
alchemy_cms-4.3.0 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.2 lib/tasks/alchemy/convert.rake
alchemy_cms-4.1.2 lib/tasks/alchemy/convert.rake
alchemy_cms-4.1.1 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.1 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.0 lib/tasks/alchemy/convert.rake
alchemy_cms-4.2.0.rc1 lib/tasks/alchemy/convert.rake
alchemy_cms-4.1.0 lib/tasks/alchemy/convert.rake
alchemy_cms-4.0.5 lib/tasks/alchemy/convert.rake
alchemy_cms-4.0.4 lib/tasks/alchemy/convert.rake
alchemy_cms-4.1.0.rc1 lib/tasks/alchemy/convert.rake
alchemy_cms-4.0.3 lib/tasks/alchemy/convert.rake
alchemy_cms-3.6.5 lib/tasks/alchemy/convert.rake