lib/planter/filelist.rb in planter-cli-3.0.5 vs lib/planter/filelist.rb in planter-cli-3.0.7

- old
+ new

@@ -48,10 +48,14 @@ ## ## Perform operations ## ## @param entry [FileEntry] The file entry ## + ## @return [Boolean] success + ## + ## @api private + ## def handle_operator(entry) case entry.operation when :ignore false when :overwrite @@ -70,10 +74,12 @@ # # @param [FileEntry] entry # # @return [Boolean] success # + # @api private + # def apply_tags(entry) return unless Planter.config.preserve_tags Tag.copy(entry.file, entry.target) if File.exist?(entry.target) end @@ -81,10 +87,12 @@ ## ## Copy template files to new directory ## ## @return [Boolean] success ## + ## @api private + ## def prepare_copy @files.each do |entry| if entry.matches_pattern? entry.operation = entry.test_operator propogate_operation(entry) @@ -95,10 +103,14 @@ ## ## Apply a parent operation to children ## ## @param entry [FileEntry] The file entry ## + ## @return [Boolean] success + ## + ## @api private + ## def propogate_operation(entry) @files.each do |file| file.operation = entry.operation if file.file =~ /^#{entry.file}/ end end @@ -109,10 +121,12 @@ ## ## @param entry [FileEntry] The file entry ## ## @return [Boolean] success ## + ## @api private + ## def merge(entry) return copy_file(entry) if File.directory?(entry.file) # Get the file type type = `file #{entry.file}` @@ -161,9 +175,11 @@ ## ## @param file [FileEntry] The file entry ## @param overwrite [Boolean] Force overwrite ## ## @return [Boolean] success + ## + ## @api private ## def copy_file(file, overwrite: false) # If the target file already exists and overwrite is true, # or Planter.overwrite is true, then delete the target file FileUtils.rm_rf(file.target) if (overwrite || Planter.overwrite) && File.exist?(file.target)