Class: Alchemy::Upgrader::FivePointZero

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

Constant Summary

Constants included from Shell

Shell::COLORS

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

.install_gutentag_migrationsObject


8
9
10
11
12
13
# File 'lib/alchemy/upgrader/five_point_zero.rb', line 8

def install_gutentag_migrations
  desc "Install Gutentag migrations"
  Rake::Task["gutentag:install:migrations"].invoke
  Alchemy::Upgrader::Tasks::HardenGutentagMigrations.new.patch_migrations
  Rake::Task["db:migrate"].invoke
end

.remove_layout_rootsObject


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/alchemy/upgrader/five_point_zero.rb', line 15

def remove_layout_roots
  desc "Remove layout root pages"
  layout_roots = Alchemy::Page.where(layoutpage: true).where("name LIKE 'Layoutroot for%'")
  if layout_roots.size.positive?
    log "Removing #{layout_roots.size} layout root pages."
    layout_roots.delete_all
    Alchemy::Page.where(layoutpage: true).update_all(parent_id: nil)
    log "Done.", :success
  else
    log "No layout root pages found.", :skip
  end
end

.remove_root_pageObject


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/alchemy/upgrader/five_point_zero.rb', line 28

def remove_root_page
  desc "Remove root page"
  root_page = Alchemy::Page.find_by(parent_id: nil, name: "Root")
  if root_page
    Alchemy::Page.where(parent_id: root_page.id).update_all(parent_id: nil)
    root_page.delete
    log "Done.", :success
  else
    log "Root page not found.", :skip
  end
end