Class: Abide::CLI::PuppetRenameCommand
- Inherits:
-
AbideCommand
- Object
- CmdParse::Command
- AbideCommand
- Abide::CLI::PuppetRenameCommand
- Defined in:
- lib/abide_dev_utils/cli/puppet.rb
Constant Summary collapse
- CMD_NAME =
'rename'
- CMD_SHORT =
'Renames a Puppet class'
- CMD_LONG =
'Renames a Puppet class. It does this by renaming the file and also the class name in the file. This command can also move class files based on the new class name.'
- CMD_FROM_ARG =
'The current full class name'
- CMD_TO_ARG =
'The new full class name'
Constants included from AbideDevUtils::Config
AbideDevUtils::Config::DEFAULT_PATH
Instance Method Summary collapse
- #execute(from, to) ⇒ Object
-
#initialize ⇒ PuppetRenameCommand
constructor
A new instance of PuppetRenameCommand.
Methods inherited from AbideCommand
Methods included from AbideDevUtils::Config
config_section, #config_section, fetch, #fetch, to_h, #to_h
Constructor Details
#initialize ⇒ PuppetRenameCommand
Returns a new instance of PuppetRenameCommand.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/abide_dev_utils/cli/puppet.rb', line 119 def initialize super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false) argument_desc(FROM: CMD_FROM_ARG, TO: CMD_TO_ARG) .on( '-d', '--declaration-only', 'Will not rename the class file, only the class declaration in the file' ) { @data[:declaration_only] = true } .on( '-t', '--declaration-in-to-file', 'Use the path derived from the TO class name as the existing file path when renaming class declaration' ) { @data[:declaration_in_to_file] = true } .on( '-f', '--force', 'Forces file move operations' ) { @data[:force] = true } .on( '-v', '--verbose', 'Sets verbose mode on file operations' ) { @data[:verbose] = true } end |
Instance Method Details
#execute(from, to) ⇒ Object
144 145 146 |
# File 'lib/abide_dev_utils/cli/puppet.rb', line 144 def execute(from, to) AbideDevUtils::Ppt.rename_puppet_class(from, to, **@data) end |