def readme(dir = Dir.pwd, options = {})
      info "Bootstrap a README file for this project"
      # get the local configuration
      local_config = FalkorLib::Config.get(dir)
      config = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].clone
      name = get_project_name(dir)
      if local_config[:project]
        config.deep_merge!( local_config[:project])
      else
        config[:name] = ask("\tProject name: ", name) unless options[:name]
      end
      if options[:rake]
        options[:make] = false
        options[:rvm]  = true
      end
      config[:license] = options[:license] if options[:license]
      config[:type] << :rvm if options[:rake]
      # Type of project
      config[:type] << :latex if options[:latex]
      if config[:type].empty?
        t = select_from( FalkorLib::Config::Bootstrap::DEFAULTS[:types],
                         'Select the type of project to describe:', 1)
        config[:type] << t
        config[:type] << [ :ruby, :rvm ] if [ :gem, :rvm, :octopress, :puppet_module ].include?( t )
        config[:type] << :python if t == :pyenv
      end
      config[:type].uniq!
      #ap config
      config[:type] = config[:type].uniq.flatten
      # Apply options (if provided)
      [ :name, :forge ].each do |k|
        config[k.to_sym] = options[k.to_sym] if options[k.to_sym]
      end
      path = normalized_path(dir)
      config[:filename] = (options[:filename]) ? options[:filename] : File.join(path, 'README.md')
      if ( FalkorLib::Git.init?(dir) && FalkorLib::Git.remotes(dir).include?( 'origin' ))
        config[:origin] = FalkorLib::Git.config('remote.origin.url')
        if config[:origin] =~ /((gforge|gitlab|github)[\.\w_-]+)[:\d\/]+(\w*)/
          config[:forge] = Regexp.last_match(2).to_sym
          config[:by]    = Regexp.last_match(3)
        end
      elsif config[:forge].empty?
        config[:forge] = select_forge(config[:forge]).to_sym
      end
      forges = FalkorLib::Config::Bootstrap::DEFAULTS[:forge][ config[:forge].to_sym ]
      #ap config
      default_source = case config[:forge]
                       when :gforge
                         'https://' + forges[:url] + "/projects/" + name.downcase
                       when :github, :gitlab
                         'https://' + forges[:url] + "/" + config[:by] + "/" + name.downcase
                       else
                         ""
                       end
      FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].each do |k, v|
        next if v.is_a?(Array) || [ :license, :forge ].include?( k )
        next if (k == :name) && !config[:name].empty?
        next if (k == :issues_url) && ![ :github, :gitlab ].include?( config[:forge] )
        #next unless [ :name, :summary, :description ].include?(k.to_sym)
        default_answer = case k
                         when :author
                           (config[:by] == 'ULHPC') ? 'UL HPC Team' : config[:author]
                         when :mail
                           (config[:by] == 'ULHPC') ? 'hpc-sysadmins@uni.lu'   : config[:mail]
                         when :description
                           (config[:description].empty?) ? (config[:summary]).to_s : (config[:description]).to_s
                         when :source
                           (config[:source].empty?) ? default_source : (config[:source]).to_s
                         when :project_page
                           (config[:source].empty?) ? v : config[:source]
                         when :issues_url
                           (config[:project_page].empty?) ? v : "#{config[:project_page]}/issues"
                         else
                           (config[k.to_sym].empty?) ? v : config[k.to_sym]
                         end
        config[k.to_sym] = ask( "\t" + Kernel.format("Project %-20s", k.to_s), default_answer)
      end
      tags = ask("\tKeywords (comma-separated list of tags)", config[:tags].join(','))
      config[:tags]    = tags.split(',')
      config[:license] = select_licence if config[:license].empty?
      # stack the ERB files required to generate the README
      templatedir = File.join( FalkorLib.templates, 'README')
      erbfiles = [ 'header_readme.erb' ]
      [ :latex ].each do |type|
        erbfiles << "readme_#{type}.erb" if options[type.to_sym] && File.exist?( File.join(templatedir, "readme_#{type}.erb"))
      end
      erbfiles << "readme_issues.erb"
      erbfiles << "readme_git.erb"     if FalkorLib::Git.init?(dir)
      erbfiles << "readme_gitflow.erb" if FalkorLib::GitFlow.init?(dir)
      erbfiles << "readme_rvm.erb"     if config[:type].include?(:rvm)
      erbfiles << "readme_mkdocs.erb"  if options[:mkdocs]
      erbfiles << "footer_readme.erb"

      content = ""
      ap options
      ap config
      erbfiles.each do |f|
        erbfile = File.join(templatedir, f)
        content += ERB.new(File.read(erbfile.to_s), nil, '<>').result(binding)
      end
      show_diff_and_write(content, config[:filename], options)

      # Force save/upgrade local config
      info "=> saving customization of the FalkorLib configuration in #{FalkorLib.config[:config_files][:local]}"
      # really_continue?
      FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].keys.each do |k|
        local_config[:project] = {} unless local_config[:project]
        local_config[:project][k.to_sym] = config[k.to_sym]
      end
      if FalkorLib::GitFlow.init?(dir)
        local_config[:gitflow] = {} unless local_config[:gitflow]
        local_config[:gitflow][:branches] = FalkorLib.config[:gitflow][:branches].clone unless local_config[:gitflow][:branches]
        [ :master, :develop ].each do |b|
          local_config[:gitflow][:branches][b.to_sym] = FalkorLib::GitFlow.branches(b.to_sym)
        end
      end
      FalkorLib::Config.save(dir, local_config, :local)
      #
    end
def readme(dir = Dir.pwd, options = {})
      info "Bootstrap a README file for this project"
      # get the local configuration
      local_config = FalkorLib::Config.get(dir)
      config = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].clone
      name = get_project_name(dir)
      if local_config[:project]
        config.deep_merge!( local_config[:project])
      else
        config[:name] = ask("\tProject name: ", name) unless options[:name]
      end
      if options[:rake]
        options[:make] = false
        options[:rvm]  = true
      end
      config[:license] = options[:license] if options[:license]
      config[:type] << :rvm if options[:rake]
      # Type of project
      config[:type] << :latex if options[:latex]
      if config[:type].empty?
        t = select_from( FalkorLib::Config::Bootstrap::DEFAULTS[:types],
                         'Select the type of project to describe:', 1)
        config[:type] << t
        config[:type] << [ :ruby, :rvm ] if [ :gem, :rvm, :octopress, :puppet_module ].include?( t )
        config[:type] << :python if t == :pyenv
      end
      config[:type].uniq!
      #ap config
      config[:type] = config[:type].uniq.flatten
      # Apply options (if provided)
      [ :name, :forge ].each do |k|
        config[k.to_sym] = options[k.to_sym] if options[k.to_sym]
      end
      path = normalized_path(dir)
      config[:filename] = (options[:filename]) ? options[:filename] : File.join(path, 'README.md')
      if ( FalkorLib::Git.init?(dir) && FalkorLib::Git.remotes(dir).include?( 'origin' ))
        config[:origin] = FalkorLib::Git.config('remote.origin.url')
        if config[:origin] =~ /((gforge|gitlab|github)[\.\w_-]+)[:\d\/]+(\w*)/
          config[:forge] = Regexp.last_match(2).to_sym
          config[:by]    = Regexp.last_match(3)
        end
      elsif config[:forge].empty?
        config[:forge] = select_forge(config[:forge]).to_sym
      end
      forges = FalkorLib::Config::Bootstrap::DEFAULTS[:forge][ config[:forge].to_sym ]
      #ap config
      default_source = case config[:forge]
                       when :gforge
                         'https://' + forges[:url] + "/projects/" + name.downcase
                       when :github, :gitlab
                         'https://' + forges[:url] + "/" + config[:by] + "/" + name.downcase
                       else
                         ""
                       end
      FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].each do |k, v|
        next if v.is_a?(Array) || [ :license, :forge ].include?( k )
        next if (k == :name) && !config[:name].empty?
        next if (k == :issues_url) && ![ :github, :gitlab ].include?( config[:forge] )
        #next unless [ :name, :summary, :description ].include?(k.to_sym)
        default_answer = case k
                         when :author
                           (config[:by] == 'ULHPC') ? 'UL HPC Team' : config[:author]
                         when :mail
                           (config[:by] == 'ULHPC') ? 'hpc-sysadmins@uni.lu'   : config[:mail]
                         when :description
                           (config[:description].empty?) ? (config[:summary]).to_s : (config[:description]).to_s
                         when :source
                           (config[:source].empty?) ? default_source : (config[:source]).to_s
                         when :project_page
                           (config[:source].empty?) ? v : config[:source]
                         when :issues_url
                           (config[:project_page].empty?) ? v : "#{config[:project_page]}/issues"
                         else
                           (config[k.to_sym].empty?) ? v : config[k.to_sym]
                         end
        config[k.to_sym] = ask( "\t" + Kernel.format("Project %-20s", k.to_s), default_answer)
      end
      tags = ask("\tKeywords (comma-separated list of tags)", config[:tags].join(','))
      config[:tags]    = tags.split(',')
      config[:license] = select_licence if config[:license].empty?
      # stack the ERB files required to generate the README
      templatedir = File.join( FalkorLib.templates, 'README')
      erbfiles = [ 'header_readme.erb' ]
      [ :latex ].each do |type|
        erbfiles << "readme_#{type}.erb" if options[type.to_sym] && File.exist?( File.join(templatedir, "readme_#{type}.erb"))
      end
      erbfiles << "readme_issues.erb"
      erbfiles << "readme_git.erb"     if FalkorLib::Git.init?(dir)
      erbfiles << "readme_gitflow.erb" if FalkorLib::GitFlow.init?(dir)
      erbfiles << "readme_rvm.erb"     if config[:type].include?(:rvm)
      erbfiles << "readme_mkdocs.erb"  if options[:mkdocs]
      erbfiles << "footer_readme.erb"

      content = ""
      ap options
      ap config
      erbfiles.each do |f|
        erbfile = File.join(templatedir, f)
        content += ERB.new(File.read(erbfile.to_s), nil, '<>').result(binding)
      end
      show_diff_and_write(content, config[:filename], options)

      # Force save/upgrade local config
      info "=> saving customization of the FalkorLib configuration in #{FalkorLib.config[:config_files][:local]}"
      # really_continue?
      FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].keys.each do |k|
        local_config[:project] = {} unless local_config[:project]
        local_config[:project][k.to_sym] = config[k.to_sym]
      end
      if FalkorLib::GitFlow.init?(dir)
        local_config[:gitflow] = {} unless local_config[:gitflow]
        local_config[:gitflow][:branches] = FalkorLib.config[:gitflow][:branches].clone unless local_config[:gitflow][:branches]
        [ :master, :develop ].each do |b|
          local_config[:gitflow][:branches][b.to_sym] = FalkorLib::GitFlow.branches(b.to_sym)
        end
      end
      FalkorLib::Config.save(dir, local_config, :local)
      #
    end
motd
 readme 
 Bootstrap a README file for various context
 Supported options:
  * :no_interaction [boolean]: do not interact
  * :force          [boolean] force overwritting
  * :license     [string]  License to use
  * :licensefile [string]  License filename (default: LICENSE)
  * :latex          [boolean] describe a LaTeX project
  * :octopress      [boolean] octopress site