Class: Abide::CLI::PuppetFixClassNamesCommand
- Inherits:
 - 
      AbideCommand
      
        
- Object
 - CmdParse::Command
 - AbideCommand
 - Abide::CLI::PuppetFixClassNamesCommand
 
 
- Defined in:
 - lib/abide_dev_utils/cli/puppet.rb
 
Constant Summary collapse
- CMD_NAME =
 'fix-class-names'- CMD_SHORT =
 'Fixes Puppet class names that are mismatched'- CMD_LONG =
 'Fixes Puppet class names that are mismatched'- CMD_MODE_ARG =
 '"file" or "class". If "file", the file names will be changed to match their class declarations. If "class", the class declarations will be changed to match the file names.'- CMD_DIR_ARG =
 'The directory containing the Puppet class files'
Constants included from AbideDevUtils::Config
AbideDevUtils::Config::DEFAULT_PATH
Instance Method Summary collapse
- #execute(mode, dir) ⇒ Object
 - 
  
    
      #initialize  ⇒ PuppetFixClassNamesCommand 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of PuppetFixClassNamesCommand.
 
Methods inherited from AbideCommand
Methods included from AbideDevUtils::Config
config_section, #config_section, fetch, #fetch, to_h, #to_h
Constructor Details
#initialize ⇒ PuppetFixClassNamesCommand
Returns a new instance of PuppetFixClassNamesCommand.
      155 156 157 158 159 160 161 162 163 164 165 166 167 168  | 
    
      # File 'lib/abide_dev_utils/cli/puppet.rb', line 155 def initialize super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false) argument_desc(MODE: CMD_MODE_ARG, DIR: CMD_DIR_ARG) .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(mode, dir) ⇒ Object
      170 171 172 173 174 175 176 177 178 179  | 
    
      # File 'lib/abide_dev_utils/cli/puppet.rb', line 170 def execute(mode, dir) case mode when /^f.*/ AbideDevUtils::Ppt.fix_class_names_file_rename(dir, **@data) when /^c.*/ AbideDevUtils::Ppt.fix_class_names_class_rename(dir, **@data) else raise ::ArgumentError, "Invalid mode. Mode:#{mode}" end end  |