Sha256: 80407c807466c4dd6280ba522900ef4dd425a013793bd010793d37f984e09972

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

# -*- encoding: utf-8 -*-
module Wrongdoc::NewsRdoc
  include Wrongdoc::History

  def puts_tag(fp, tag)
    time = tag[:time].tr('T', ' ').gsub!(/:\d\dZ/, ' UTC')
    fp.puts "=== #{tag[:subject]} / #{time}"
    fp.puts ""

    body = tag[:body]
    fp.puts tag[:body].gsub(/^/smu, "  ").gsub(/[ \t]+$/smu, "")
    fp.puts ""
  end

  # generates a NEWS file in the top-level directory based on git tags
  def news_rdoc
    news = Tempfile.new('NEWS', '.')
    tags.each { |tag| puts_tag(news, tag) }
    File.open("LATEST", "wb") { |latest|
      if tags.empty?
        latest.puts "Currently unreleased"
        news.puts "No news yet."
      else
        puts_tag(latest, tags[0])
      end
    }
    news.chmod(0666 & ~File.umask)
    File.rename(news.path, 'NEWS')
    news.close!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wrongdoc-1.8.1 lib/wrongdoc/news_rdoc.rb
wrongdoc-1.8.0 lib/wrongdoc/news_rdoc.rb
wrongdoc-1.7.0 lib/wrongdoc/news_rdoc.rb
wrongdoc-1.6.2 lib/wrongdoc/news_rdoc.rb