def initialize_variables!
      @root        = destination_root
      @project_dir = File.basename(@root)
      @name        = (options.name || @project_dir)

      @scm = if    File.directory?(File.join(@root,'.git')) then :git
             elsif File.directory?(File.join(@root,'.hg'))  then :hg
             elsif File.directory?(File.join(@root,'.svn')) then :svn
             elsif options.hg?                              then :hg
             elsif options.git?                             then :git
             end

      case @scm
      when :git
        @scm_user  = `git config user.name`.chomp
        @scm_email = `git config user.email`.chomp

        @github_user = `git config github.user`.chomp
      when :hg
        user_email = `hg showconfig ui.username`.chomp
        user_email.scan(/([^<]+)\s+<([^>]+)>/) do |(user,email)|
          @scm_user, @scm_email = user, email
        end
      end

      @modules      = modules_of(@name)
      @module_depth = @modules.length
      @module       = @modules.last

      @namespace      = options.namespace || namespace_of(@name)
      @namespace_dirs = namespace_dirs_of(@name)
      @namespace_path = namespace_path_of(@name)
      @namespace_dir  = @namespace_dirs.last

      @version     = options.version
      @summary     = options.summary
      @description = options.description

      @authors     = if options.author || options.author
                       [*options.author, *options.authors]
                     else
                       [@scm_user || ENV['USERNAME'] || ENV['USER'].capitalize]
                     end
      @author      = @authors.first

      @email       = (options.email || @scm_email)
      @safe_email  = @email.sub('@',' at ') if @email

      @homepage    = if options.homepage
                       options.homepage
                     elsif !(@github_user.nil? || @github_user.empty?)
                       "https://github.com/#{@github_user}/#{@name}#readme"
                     else
                       "https://rubygems.org/gems/#{@name}"
                     end
      @uri         = URI(@homepage)
      @bug_tracker = case @uri.host
                     when 'github.com'
                       "https://#{@uri.host}#{@uri.path}/issues"
                     end

      @markup = if    options.markdown? then :markdown
                elsif options.textile?  then :textile
                elsif options.markup?   then options.markup.to_sym
                end

      @markup_ext = Template::Markup::EXT.fetch(@markup) do
        say "Unknown markup: #{@markup}", :red
        exit -1
      end

      @date  = Date.today
      @year  = @date.year
      @month = @date.month
      @day   = @date.day

      @ignore                   = SortedSet[]
      @dependencies             = {}
      @development_dependencies = {}

      @templates.each do |template|
        @ignore.merge(template.ignore)

        @dependencies.merge!(template.dependencies)
        @development_dependencies.merge!(template.development_dependencies)

        template.variables.each do |name,value|
          instance_variable_set("@#{name}",value)
        end
      end

      @generated_dirs  = {}
      @generated_files = {}
    end
def initialize_variables!
      @root        = destination_root
      @project_dir = File.basename(@root)
      @name        = (options.name || @project_dir)

      @scm = if    File.directory?(File.join(@root,'.git')) then :git
             elsif File.directory?(File.join(@root,'.hg'))  then :hg
             elsif File.directory?(File.join(@root,'.svn')) then :svn
             elsif options.hg?                              then :hg
             elsif options.git?                             then :git
             end

      case @scm
      when :git
        @scm_user  = `git config user.name`.chomp
        @scm_email = `git config user.email`.chomp

        @github_user = `git config github.user`.chomp
      when :hg
        user_email = `hg showconfig ui.username`.chomp
        user_email.scan(/([^<]+)\s+<([^>]+)>/) do |(user,email)|
          @scm_user, @scm_email = user, email
        end
      end

      @modules      = modules_of(@name)
      @module_depth = @modules.length
      @module       = @modules.last

      @namespace      = options.namespace || namespace_of(@name)
      @namespace_dirs = namespace_dirs_of(@name)
      @namespace_path = namespace_path_of(@name)
      @namespace_dir  = @namespace_dirs.last

      @version     = options.version
      @summary     = options.summary
      @description = options.description

      @authors     = if options.author || options.author
                       [*options.author, *options.authors]
                     else
                       [@scm_user || ENV['USERNAME'] || ENV['USER'].capitalize]
                     end
      @author      = @authors.first

      @email       = (options.email || @scm_email)
      @safe_email  = @email.sub('@',' at ') if @email

      @homepage    = if options.homepage
                       options.homepage
                     elsif !(@github_user.nil? || @github_user.empty?)
                       "https://github.com/#{@github_user}/#{@name}#readme"
                     else
                       "https://rubygems.org/gems/#{@name}"
                     end
      @uri         = URI(@homepage)
      @bug_tracker = case @uri.host
                     when 'github.com'
                       "https://#{@uri.host}#{@uri.path}/issues"
                     end

      @markup = if    options.markdown? then :markdown
                elsif options.textile?  then :textile
                elsif options.markup?   then options.markup.to_sym
                end

      @markup_ext = Template::Markup::EXT.fetch(@markup) do
        say "Unknown markup: #{@markup}", :red
        exit -1
      end

      @date  = Date.today
      @year  = @date.year
      @month = @date.month
      @day   = @date.day

      @ignore                   = SortedSet[]
      @dependencies             = {}
      @development_dependencies = {}

      @templates.each do |template|
        @ignore.merge(template.ignore)

        @dependencies.merge!(template.dependencies)
        @development_dependencies.merge!(template.development_dependencies)

        template.variables.each do |name,value|
          instance_variable_set("@#{name}",value)
        end
      end

      @generated_dirs  = {}
      @generated_files = {}
    end
Initializes variables for the templates.