class Generators::Avo::EjectGenerator

def eject(path)

def eject(path)
  copy_file ::Avo::Engine.root.join(path), ::Rails.root.join(path)
end

def handle

def handle
  if @filename.starts_with?(":")
    template_id = path_to_sym @filename
    template_path = TEMPLATES[template_id]
    if path_exists? template_path
      eject template_path
    else
      say("Failed to find the `#{template_id.to_sym}` template.", :yellow)
    end
  elsif path_exists? @filename
    eject @filename
  else
    say("Failed to find the `#{@filename}` template.", :yellow)
  end
end

def path_exists?(path)

def path_exists?(path)
  path.present? && File.file?(::Avo::Engine.root.join(path))
end

def path_to_sym(filename)

def path_to_sym(filename)
  template_id = filename.dup
  template_id[0] = ""
  template_id.to_sym
end