Module: Roda::Project::Helpers::Template
- Included in:
- CLI
- Defined in:
- lib/roda/project/helpers/template.rb
Instance Method Summary collapse
-
#cp_dir(type, path) ⇒ Object
For copy without parse ERB files.
-
#cp_file(type, path) ⇒ Object
For copy without parse ERB files.
- #erb_cp_dir(type, path) ⇒ Object
- #erb_cp_file(type, path) ⇒ Object
Instance Method Details
#cp_dir(type, path) ⇒ Object
For copy without parse ERB files
22 23 24 25 26 27 |
# File 'lib/roda/project/helpers/template.rb', line 22 def cp_dir(type, path) FileUtils.cp_r( File.("../../templates/#{type}/#{path}", __dir__), "#{@dir}#{@context.project_name}/#{path}" ) end |
#cp_file(type, path) ⇒ Object
For copy without parse ERB files
30 31 32 33 34 35 |
# File 'lib/roda/project/helpers/template.rb', line 30 def cp_file(type, path) File.write( "#{@dir}#{@context.project_name}/#{path}", File.read(File.("../../templates/#{type}/#{path}", __dir__)) ) end |
#erb_cp_dir(type, path) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/roda/project/helpers/template.rb', line 5 def erb_cp_dir(type, path) TTY::File.copy_directory( File.("../../templates/#{type}/#{path}", __dir__), "#{@dir}#{@context.project_name}/#{path}", context: @context ) end |
#erb_cp_file(type, path) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/roda/project/helpers/template.rb', line 13 def erb_cp_file(type, path) TTY::File.copy_file( File.("../../templates/#{type}/#{path}", __dir__), "#{@dir}#{@context.project_name}/#{path}", context: @context ) end |