Class: Alchemy::Upgrader::FourPointSix

Inherits:
Alchemy::Upgrader show all
Defined in:
lib/alchemy/upgrader/four_point_six.rb

Class Method Summary collapse

Methods inherited from Alchemy::Upgrader

copy_new_config_file

Methods included from Shell

#add_todo, #desc, #display_todos, #log, silence!, silenced?, #todo, #todos, verbose!

Class Method Details

.alchemy_4_6_todosObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/alchemy/upgrader/four_point_six.rb', line 6

def alchemy_4_6_todos
  notice = <<-NOTE.strip_heredoc

    ℹ️  Page visible attribute is deprecated
    ----------------------------------------

    Page slugs will be visible in URLs of child pages all the time in the future.
    Please use Menus and Tags instead to re-organize your pages if your page tree does not reflect the URL hierarchy.

    A rake task to help with the migration is available.

        bin/rake alchemy:upgrade:4.6:restructure_page_tree

  NOTE
  todo notice, "Alchemy v4.6 TODO"
end

.restructure_page_treeObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/alchemy/upgrader/four_point_six.rb', line 23

def restructure_page_tree
  desc "Move child pages of invisible pages to visible parent."
  Alchemy::Deprecation.silence do
    # All leaves can safely be marked visible
    Alchemy::Page.leaves.update_all(visible: true)
    Alchemy::Page.language_roots.each do |root_page|
      # Root pages are always visible
      root_page.update!(visible: true)
      remove_invisible_children(root_page)
    end
    Alchemy::Page.update_all(visible: true)
  end
end