Sha256: ff0c238c0cdf725bba7a2126e6b008b99a24343274839e99ab7a0c857723ba13

Contents?: true

Size: 1.21 KB

Versions: 46

Compression:

Stored size: 1.21 KB

Contents

require "alchemy/tasks/usage"

namespace :alchemy do
  desc "List Alchemy elements and pages usage"
  task usage: [:page_usage, :element_usage]

  desc "List Alchemy elements usage"
  task page_usage: :environment do
    include ActionView::Helpers::NumberHelper
    puts "\n  Alchemy pages usage"
    results = Alchemy::Tasks::Usage.pages_count_by_type
    if results.any?
      puts "  ----------------------"
      puts "\n"
      results.each do |row|
        puts "  #{number_with_delimiter(row["count"])} 𝗑 #{row["page_layout"]}"
      end
      puts "\n  = #{number_with_delimiter(Alchemy::Page.count)} pages in total."
    else
      puts "  > No pages found!"
    end
  end

  desc "List Alchemy elements usage"
  task element_usage: :environment do
    include ActionView::Helpers::NumberHelper
    puts "\n  Alchemy elements usage"
    results = Alchemy::Tasks::Usage.elements_count_by_name
    if results.any?
      puts "  ----------------------"
      puts "\n"
      results.each do |row|
        puts "  #{number_with_delimiter(row["count"])} 𝗑 #{row["name"]}"
      end
      puts "\n  = #{number_with_delimiter(Alchemy::Element.count)} elements in total."
    else
      puts "  > No elements found!"
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
alchemy_cms-7.0.3 lib/tasks/alchemy/usage.rake
alchemy_cms-7.0.2 lib/tasks/alchemy/usage.rake
alchemy_cms-6.1.8 lib/tasks/alchemy/usage.rake
alchemy_cms-6.1.7 lib/tasks/alchemy/usage.rake
alchemy_cms-7.0.1 lib/tasks/alchemy/usage.rake
alchemy_cms-7.0.0 lib/tasks/alchemy/usage.rake