class Rocketwheel::Command::CLI::New::NoTemplateDirectory

Protected Instance Methods

execute!() click to toggle source
# File lib/rocketwheel/command/cli/new.rb, line 33
def execute!
  lookup = Thor::Util.escape_globs(source)
  lookup = config[:recursive] ? File.join(lookup, '**') : lookup
  lookup = file_level_lookup(lookup)

  files(lookup).sort.each do |file_source|
    next if File.directory?(file_source)
    next if config[:exclude_pattern] && file_source.match(config[:exclude_pattern])
    file_destination = File.join(given_destination, file_source.gsub(source, '.'))
    file_destination.gsub!('/./', '/')

    case file_source
    when /\.empty_directory$/
      dirname = File.dirname(file_destination).gsub(/\/\.$/, '')
      next if dirname == given_destination
      base.empty_directory(dirname, config)
    when /\.ignore$/
      destination = base.copy_file(file_source, file_destination[0..-8], config, &@block)
    when /\.tt$/
      destination = base.template(file_source, file_destination[0..-4], config, &@block)
    else
      destination = base.copy_file(file_source, file_destination, config, &@block)
    end
  end
end