Class: Maglev::Sections::RenameCommand
- Inherits:
-
Rails::Command::Base
- Object
- Rails::Command::Base
- Maglev::Sections::RenameCommand
- Defined in:
- lib/commands/maglev/sections/rename_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(_command = nil) ⇒ Object
10 11 12 |
# File 'lib/commands/maglev/sections/rename_command.rb', line 10 def self.(_command = nil, *) 'bin/rails maglev:sections:rename OLD_TYPE NEW_TYPE' end |
Instance Method Details
#perform(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/commands/maglev/sections/rename_command.rb', line 14 def perform(*args) require File.('config/environment', Rails.root) old_type, new_type = args site = fetch_site theme = fetch_theme return if site.blank? || theme.blank? rename_sections(site, theme, old_type, new_type) say "Successfully renamed all '#{old_type}' sections to '#{new_type}' 🎉", :green end |