module New::Interpolate

Constants

FILENAME_RENAME_MATCH

regex to match capital underscored template options names ie [PROJECT_NAME]

Public Instance Methods

dir() click to toggle source
# File lib/new/interpolate.rb, line 19
def dir
  File.file?(@src_path) ? @dest_path : File.join(@dest_path, File.basename(@src_path))
end
dot_options() click to toggle source

Convert options to OpenStruct so we can use dot notation in the templates

# File lib/new/interpolate.rb, line 25
def dot_options
  @dot_options ||= RecursiveOpenStruct.new(@options)
end
interpolate(src_path, options) click to toggle source

Convienance method for processing everything

# File lib/new/interpolate.rb, line 10
def interpolate src_path, options
  @src_path = src_path
  @options = options

  copy_to_tmp
  process_paths
  process_files
end