Class: DryCrud::FileGenerator

Inherits:
DryCrudGeneratorBase show all
Defined in:
lib/generators/dry_crud/file_generator.rb

Overview

Copies one file of dry_crud to the rails application.

Instance Method Summary collapse

Methods inherited from DryCrudGeneratorBase

gem_root, source_paths, template_root

Instance Method Details

#copy_matching_fileObject

rubocop:disable Rails/Output



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/generators/dry_crud/file_generator.rb', line 16

def copy_matching_file
  files = matching_files
  case files.size
  when 1
    copy_files(@root_folder => files)
  when 0
    puts "No file containing '#{filename}' found in dry_crud."
  else
    puts 'Please be more specific. ' \
         "All the following files match '#{filename}':"
    files.each do |f|
      puts " * #{f}"
    end
  end
end