File: ronn.rb

package info (click to toggle)
ruby-ronn 0.7.3-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 512 kB
  • sloc: ruby: 1,405; makefile: 2
file content (50 lines) | stat: -rwxr-xr-x 1,625 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Ronn is a humane text format and toolchain for authoring manpages (and
# things that appear as manpages from a distance). Use it to build /
# install standard UNIX roff(7) formatted manpages or to generate
# beautiful HTML manpages.
module Ronn
  autoload :Document, 'ronn/document'
  autoload :Index,    'ronn/index'
  autoload :Template, 'ronn/template'
  autoload :Roff,     'ronn/roff'
  autoload :Server,   'ronn/server'

  # Create a new Ronn::Document for the given ronn file. See
  # Ronn::Document.new for usage information.
  def self.new(filename, attributes={}, &block)
    Document.new(filename, attributes, &block)
  end

  # truthy when this a release (\d.\d.\d) version.
  def self.release?
    revision != '' && !revision.include?('-')
  end

  # version: 0.6.11
  #
  # A semantic version number based on the git revision. The third element
  # of the version is incremented by the commit offset, such that version
  # 0.6.6-5-gdacd74b => 0.6.11
  def self.version
    ver = revision[/^[0-9.-]+/].split(/[.-]/).map { |p| p.to_i }
    ver[2] += ver.pop while ver.size > 3
    ver.join('.')
  end

  # revision: 0.6.6-5-gdacd74b
  # revision: 0.6.25
  #
  # The string revision as reported by: git-describe --tags. This is just the
  # tag name when a tag references the HEAD commit (0.6.25). When the HEAD
  # commit is not tagged, this is a "<tag>-<offset>-<sha1>" string:
  #   <tag>    - closest tag name
  #   <offset> - number of commits ahead of <tag>
  #   <sha1>   - 7c short SHA1 for HEAD
  def self.revision
    REV
  end

  # value generated by: rake rev
  REV = '0.7.3'
  VERSION = version
end