Class: Maglev::Sections::ResetCommand

Inherits:
Rails::Command::Base
  • Object
show all
Defined in:
lib/commands/maglev/sections/reset_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



10
11
12
# File 'lib/commands/maglev/sections/reset_command.rb', line 10

def self.banner(_command = nil, *)
  'bin/rails maglev:sections:reset TYPE'
end

Instance Method Details

#perform(type) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/commands/maglev/sections/reset_command.rb', line 14

def perform(type)
  require File.expand_path('config/environment', Rails.root)

  site = fetch_site
  theme = fetch_theme

  return if site.blank? || theme.blank?

  count = Maglev::ResetSectionContent.call(
    site: site,
    theme: theme,
    type: type
  )

  display_final_message(count, type)
end