Module: Wrongdoc::NewsRdoc

Includes:
History
Included in:
Prepare
Defined in:
lib/wrongdoc/news_rdoc.rb

Instance Method Summary collapse

Methods included from History

#initialize_history, #old_summaries, #tag_uri, #tags

Instance Method Details

#news_rdocObject

generates a NEWS file in the top-level directory based on git tags



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wrongdoc/news_rdoc.rb', line 16

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

#puts_tag(fp, tag) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/wrongdoc/news_rdoc.rb', line 5

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