Class: PicoApi::Generators::FileCopier

Inherits:
Object
  • Object
show all
Defined in:
lib/pico_api/generators/file_copier.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_name_data_mapper) ⇒ FileCopier

Returns a new instance of FileCopier.



14
15
16
# File 'lib/pico_api/generators/file_copier.rb', line 14

def initialize(project_name_data_mapper)
  @project_name_data_mapper = project_name_data_mapper
end

Class Method Details

.build(project_name) ⇒ Object



8
9
10
11
12
# File 'lib/pico_api/generators/file_copier.rb', line 8

def self.build(project_name)
  project_name_data_mapper = ProjectNameDataMapper.new(project_name)

  new(project_name_data_mapper)
end

Instance Method Details

#copy(template_file_path, destination_path) ⇒ Object



18
19
20
21
22
# File 'lib/pico_api/generators/file_copier.rb', line 18

def copy(template_file_path, destination_path)
  source_path = template_full_file_path(template_file_path)

  FileUtils.cp(source_path, "#{snakecased_name}#{destination_path}")
end