vclog 1.8.2 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.ruby +4 -3
  2. data/.yardopts +7 -0
  3. data/HISTORY.rdoc +207 -0
  4. data/README.rdoc +44 -27
  5. data/bin/vclog +4 -2
  6. data/bin/vclog-autotag +6 -0
  7. data/bin/vclog-bump +6 -0
  8. data/bin/vclog-formats +6 -0
  9. data/bin/vclog-version +6 -0
  10. data/lib/vclog.rb +1 -1
  11. data/lib/vclog.yml +58 -0
  12. data/lib/vclog/adapters.rb +2 -1
  13. data/lib/vclog/adapters/abstract.rb +87 -232
  14. data/lib/vclog/adapters/darcs.rb +72 -67
  15. data/lib/vclog/adapters/git.rb +166 -140
  16. data/lib/vclog/adapters/hg.rb +98 -62
  17. data/lib/vclog/adapters/svn.rb +116 -113
  18. data/lib/vclog/change.rb +110 -81
  19. data/lib/vclog/change_point.rb +77 -0
  20. data/lib/vclog/changelog.rb +58 -296
  21. data/lib/vclog/cli.rb +6 -70
  22. data/lib/vclog/cli/abstract.rb +64 -81
  23. data/lib/vclog/cli/autotag.rb +1 -3
  24. data/lib/vclog/cli/bump.rb +3 -4
  25. data/lib/vclog/cli/formats.rb +4 -4
  26. data/lib/vclog/cli/log.rb +86 -0
  27. data/lib/vclog/cli/version.rb +3 -3
  28. data/lib/vclog/{facets.rb → core_ext.rb} +0 -0
  29. data/lib/vclog/heuristics.rb +112 -38
  30. data/lib/vclog/heuristics/rule.rb +52 -12
  31. data/lib/vclog/heuristics/{label.rb → type.rb} +2 -2
  32. data/lib/vclog/history_file.rb +2 -2
  33. data/lib/vclog/metadata.rb +13 -1
  34. data/lib/vclog/release.rb +26 -12
  35. data/lib/vclog/repo.rb +191 -27
  36. data/lib/vclog/report.rb +187 -0
  37. data/lib/vclog/tag.rb +66 -39
  38. data/lib/vclog/templates/changelog.ansi.rb +9 -26
  39. data/lib/vclog/templates/changelog.atom.erb +3 -3
  40. data/lib/vclog/templates/changelog.gnu.rb +4 -11
  41. data/lib/vclog/templates/changelog.html.erb +11 -2
  42. data/lib/vclog/templates/changelog.markdown.rb +4 -4
  43. data/lib/vclog/templates/changelog.rdoc.rb +4 -4
  44. data/lib/vclog/templates/changelog.rss.erb +2 -6
  45. data/lib/vclog/templates/changelog.xml.erb +14 -2
  46. data/lib/vclog/templates/history.ansi.rb +10 -17
  47. data/lib/vclog/templates/history.atom.erb +4 -4
  48. data/lib/vclog/templates/history.gnu.rb +5 -7
  49. data/lib/vclog/templates/history.html.erb +11 -4
  50. data/lib/vclog/templates/history.json.rb +1 -1
  51. data/lib/vclog/templates/history.markdown.rb +5 -7
  52. data/lib/vclog/templates/history.rdoc.rb +5 -9
  53. data/lib/vclog/templates/history.rss.erb +3 -5
  54. data/lib/vclog/templates/history.xml.erb +15 -3
  55. data/lib/vclog/templates/history.yaml.rb +1 -1
  56. data/man/man1/vclog-autotag.1 +1 -1
  57. data/man/man1/vclog-autotag.1.html +1 -1
  58. data/man/man1/vclog-bump.1 +1 -1
  59. data/man/man1/vclog-bump.1.html +1 -1
  60. data/man/man1/vclog-version.1 +1 -1
  61. data/man/man1/vclog-version.1.html +1 -1
  62. data/man/man1/vclog.1 +25 -13
  63. data/man/man1/vclog.1.html +29 -20
  64. data/man/man1/vclog.1.ronn +31 -18
  65. data/test/unit/case_metadata.rb +1 -1
  66. metadata +48 -34
  67. data/lib/vclog/cli/changelog.rb +0 -33
  68. data/lib/vclog/cli/help.rb +0 -42
  69. data/lib/vclog/cli/history.rb +0 -39
  70. data/lib/vclog/formatter.rb +0 -123
  71. data/lib/vclog/history.rb +0 -131
  72. data/lib/vclog/kernel.rb +0 -12
  73. data/man/man1/vclog-changelog.1 +0 -47
  74. data/man/man1/vclog-changelog.1.html +0 -123
  75. data/man/man1/vclog-changelog.1.ronn +0 -39
  76. data/man/man1/vclog-history.1 +0 -44
  77. data/man/man1/vclog-history.1.html +0 -122
  78. data/man/man1/vclog-history.1.ronn +0 -38
@@ -1,33 +0,0 @@
1
- require 'vclog/cli/abstract'
2
-
3
- module VCLog
4
- module CLI
5
-
6
- class Changelog < Abstract
7
-
8
- #
9
- def self.terms
10
- ['log', 'changelog']
11
- end
12
-
13
- #
14
- def parser
15
- super do |opt|
16
- opt.banner = "Usage: vclog [changelog | log] [options]"
17
- opt.separator(" ")
18
- opt.separator("Print a Change Log.")
19
- template_options(opt)
20
- end
21
- end
22
-
23
- #
24
- def execute
25
- format = options[:format] || 'ansi'
26
- output = repo.display(:changelog, format, options)
27
- puts output
28
- end
29
-
30
- end
31
-
32
- end
33
- end
@@ -1,42 +0,0 @@
1
- require 'vclog/cli/abstract'
2
-
3
- module VCLog
4
- module CLI
5
-
6
- class Help < Abstract
7
-
8
- #
9
- def self.terms
10
- ['help']
11
- end
12
-
13
- #
14
- def parser
15
- super do |opt|
16
- opt.banner = "Usage: vclog help"
17
- end
18
- end
19
-
20
- #
21
- def execute
22
- if cmd = arguments.first
23
- VCLog::CLI.cli(cmd, '--help')
24
- else
25
- puts "Usage: vclog [command] [options]"
26
- puts
27
- puts "COMMANDS:"
28
- puts " changelog produce a Change Log"
29
- puts " history produce a Release History"
30
- puts " formats list available formats"
31
- puts " version display the current version"
32
- puts " bump display next reasonable version"
33
- puts " autotag create tags for history file entries"
34
- puts " help show help information"
35
- puts
36
- end
37
- end
38
-
39
- end
40
-
41
- end
42
- end
@@ -1,39 +0,0 @@
1
- require 'vclog/cli/abstract'
2
-
3
- module VCLog
4
- module CLI
5
-
6
- class History < Abstract
7
-
8
- #
9
- def self.terms
10
- ['history', 'release']
11
- end
12
-
13
- #
14
- def parser
15
- super do |opt|
16
- opt.banner = "Usage: vclog history [options]\n" +
17
- " vclog release [options]"
18
- opt.separator " "
19
- opt.separator("Print a Release History.")
20
- opt.separator(" ")
21
- opt.separator "SPECIAL OPTIONS:"
22
- opt.on('--version', '-v NUM', "use as if current version number") do |num|
23
- options[:version] = num
24
- end
25
- template_options(opt)
26
- end
27
- end
28
-
29
- #
30
- def execute
31
- format = options[:format] || 'ansi'
32
- output = repo.display(:history, format, options)
33
- puts output
34
- end
35
-
36
- end
37
-
38
- end
39
- end
@@ -1,123 +0,0 @@
1
- require 'ostruct'
2
- #require 'ansi'
3
-
4
- module VCLog
5
-
6
- #
7
- class Formatter
8
-
9
- DIR = File.dirname(__FILE__)
10
-
11
- #
12
- attr :vcs
13
-
14
- # New Formmater.
15
- #
16
- # vcs - an instance of a subclass of VCS::Abstract
17
- #
18
- def initialize(vcs)
19
- @vcs = vcs
20
- end
21
-
22
- # Returns a Changelog object taken from the VCS.
23
- def changelog
24
- @vcs.changelog
25
- end
26
-
27
- # Returns a History object garnered form the VCS.
28
- def history
29
- @vcs.history
30
- end
31
-
32
- #
33
- def user
34
- @options.user || @vcs.user
35
- end
36
-
37
- #
38
- def email
39
- @options.email || @vcs.email
40
- end
41
-
42
- #
43
- def repository
44
- @vcs.repository
45
- end
46
-
47
- # TODO
48
- def url
49
- @options.url || @vcs.repository
50
- end
51
-
52
- # TODO
53
- def homepage
54
- @options.homepage
55
- end
56
-
57
- # TODO: let be nil and let template make a default if wanted
58
- def title
59
- return @options.title if @options.title
60
- case @doctype
61
- when :history
62
- "RELEASE HISTORY"
63
- else
64
- "CHANGELOG"
65
- end
66
- end
67
-
68
- #
69
- #--
70
- # NOTE: ERBs trim_mode is broken --it removes an extra space.
71
- # So we can't use it for plain text templates.
72
- #++
73
- def display(doctype, format, options)
74
- options = OpenStruct.new(options) if Hash === options
75
-
76
- @doctype = doctype
77
- @format = format
78
- @options = options
79
-
80
- require_formatter(format)
81
-
82
- tmp_file = Dir[File.join(DIR, 'templates', "#{@doctype}.#{@format}.{erb,rb}")].first
83
-
84
- tmp = File.read(tmp_file)
85
-
86
- case File.extname(tmp_file)
87
- when '.rb'
88
- eval(tmp, binding, tmp_file)
89
- when '.erb'
90
- erb = ERB.new(tmp, nil, '<>')
91
- erb.result(binding)
92
- else
93
- raise "unrecognized template - #{tmp_file}"
94
- end
95
- end
96
-
97
- private
98
-
99
- #
100
- def require_formatter(format)
101
- case format.to_s
102
- when 'yaml'
103
- require 'yaml'
104
- when 'json'
105
- require 'json'
106
- end
107
- end
108
-
109
- #
110
- def h(input)
111
- result = input.to_s.dup
112
- result.gsub!("&", "&amp;")
113
- result.gsub!("<", "&lt;")
114
- result.gsub!(">", "&gt;")
115
- result.gsub!("'", "&apos;")
116
- #result.gsub!("@", "&at;")
117
- result.gsub!("\"", "&quot;")
118
- return result
119
- end
120
-
121
- end
122
-
123
- end
@@ -1,131 +0,0 @@
1
- module VCLog
2
-
3
- require 'vclog/facets'
4
- require 'vclog/changelog'
5
- require 'vclog/tag'
6
- require 'vclog/release'
7
- require 'erb'
8
-
9
- # = Release History Class
10
- #
11
- # A Release History is very similar to a ChangeLog.
12
- # It differs in that it is divided into releases with
13
- # version, release date and release note.
14
- #
15
- # The release version, date and release note can be
16
- # descerened from the underlying SCM by identifying
17
- # the hard tag commits.
18
- #
19
- # TODO: Extract output formating from delta parser. Later---Huh?
20
- #
21
- class History
22
-
23
- # Location of this file in the file system.
24
- DIR = File.dirname(__FILE__)
25
-
26
- #
27
- attr :vcs
28
-
29
- # Alternate title.
30
- attr_accessor :title
31
-
32
- # Current working version.
33
- attr_accessor :version
34
-
35
- # Provide extra information.
36
- attr_accessor :extra
37
-
38
- #
39
- def initialize(vcs)
40
- @vcs = vcs
41
-
42
- #opts = OpenStruct.new(opts) if Hash === opts
43
-
44
- #@title = opts.title || "RELEASE HISTORY"
45
- #@extra = opts.extra
46
- #@version = opts.version
47
- #@level = opts.level || 0
48
- end
49
-
50
- # Tag list from version control system.
51
- def tags
52
- @tags ||= vcs.tags
53
- end
54
-
55
- # Changelog object
56
- def changelog
57
- @changlog ||= vcs.changelog #ChangeLog.new(changes)
58
- end
59
-
60
- # Change list from version control system filter for level setting.
61
- def changes
62
- @changes ||= vcs.changes
63
- end
64
-
65
- #
66
- def releases
67
- @releases ||= (
68
- rel = []
69
-
70
- tags = self.tags
71
-
72
- #ver = vcs.bump(version)
73
- user = vcs.user
74
- time = ::Time.now + (3600 * 24) # one day ahead
75
-
76
- tags << Tag.new(:name=>'HEAD', :id=>'HEAD', :date=>time, :who=>user, :msg=>"Current Development")
77
-
78
- # TODO: Do we need to add a Time.now tag?
79
- # add current verion to release list (if given)
80
- #previous_version = tags[0].name
81
- #if current_version < previous_version # TODO: need to use natural comparision
82
- # raise ArgumentError, "Release version is less than previous version (#{previous_version})."
83
- #end
84
- #rels << [current_version, current_release || Time.now]
85
- #rels = rels.uniq # only uniq releases
86
-
87
- # sort by release date
88
- tags = tags.sort{ |a,b| a.date <=> b.date }
89
-
90
- # organize into deltas
91
- delta = []
92
- last = nil
93
- tags.each do |tag|
94
- delta << [tag, [last, tag.commit_date]]
95
- last = tag.commit_date
96
- end
97
- # gather changes for each delta
98
- delta.each do |tag, (started, ended)|
99
- if started
100
- set = changes.select{ |c| c.date >= started && c.date < ended }
101
- #gt_vers, gt_date = gt.name, gt.date
102
- #lt_vers, lt_date = lt.name, lt.date
103
- #gt_date = Time.parse(gt_date) unless Time===gt_date
104
- #lt_date = Time.parse(lt_date) unless Time===lt_date
105
- #log = changelog.after(gt).before(lt)
106
- else
107
- #lt_vers, lt_date = lt.name, lt.date
108
- #lt_date = Time.parse(lt_date) unless Time===lt_date
109
- #log = changelog.before(lt_date)
110
- set = changes.select{ |c| c.date < ended }
111
- end
112
-
113
- rel << Release.new(tag, set)
114
- end
115
- rel
116
- )
117
- end
118
-
119
- # Group +changes+ by tag type.
120
- def groups(changes)
121
- @groups ||= changes.group_by{ |e| e.type }
122
- end
123
-
124
- #
125
- def to_h
126
- releases.map{ |rel| rel.to_h }
127
- end
128
-
129
- end
130
-
131
- end
@@ -1,12 +0,0 @@
1
- module VCLog
2
-
3
- module Kernel
4
-
5
- #
6
- def heuristics
7
- @heuristics ||= Heuristics.new()
8
- end
9
-
10
- end
11
-
12
- end
@@ -1,47 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "VCLOG\-CHANGELOG" "1" "November 2010" "RubyWorks" "VCLog"
5
- .
6
- .SH "NAME"
7
- \fBvclog\-changelog\fR \- change log
8
- .
9
- .SH "SYNOPSIS"
10
- \fBvclog\fR
11
- .
12
- .br
13
- \fBvclog log\fR
14
- .
15
- .br
16
- \fBvclog changelog\fR
17
- .
18
- .SH "DESCRIPTION"
19
- Produce a Change Log\.
20
- .
21
- .SH "OPTIONS"
22
- .
23
- .IP "\(bu" 4
24
- \fB\-\-version\fR, \fB\-v <VERSION>\fR Set current version number\.
25
- .
26
- .IP "\(bu" 4
27
- \fB\-f\fR, \fB\-\-format <FORMAT>\fR Output format\.
28
- .
29
- .IP "\(bu" 4
30
- \fB\-\-style <URI>\fR Provide a stylesheet URI (css or xsl) for HTML or XML format\.
31
- .
32
- .IP "\(bu" 4
33
- \fB\-t\fR, \fB\-\-title TITLE\fR Document title\.
34
- .
35
- .IP "\(bu" 4
36
- \fB\-s\fR, \fB\-\-summarize\fR Produce summary output\.
37
- .
38
- .IP "\(bu" 4
39
- \fB\-\-id\fR Include revision id in output\.
40
- .
41
- .IP "\(bu" 4
42
- \fB\-l\fR, \fB\-\-level <NUMBER>\fR Lowest level of commit to display [0]\.
43
- .
44
- .IP "" 0
45
- .
46
- .SH "SEE ALSO"
47
- vclog(1), vclog\-history(1)
@@ -1,123 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
- <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
- <title>vclog-changelog(1) - change log</title>
7
- <style type='text/css' media='all'>
8
- /* style: man */
9
- body#manpage {margin:0}
10
- .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
- .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
- .mp h2 {margin:10px 0 0 0}
13
- .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
- .mp h3 {margin:0 0 0 4ex}
15
- .mp dt {margin:0;clear:left}
16
- .mp dt.flush {float:left;width:8ex}
17
- .mp dd {margin:0 0 0 9ex}
18
- .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
- .mp pre {margin-bottom:20px}
20
- .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
- .mp h2+pre,.mp h3+pre {margin-top:5px}
22
- .mp img {display:block;margin:auto}
23
- .mp h1.man-title {display:none}
24
- .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
- .mp h2 {font-size:16px;line-height:1.25}
26
- .mp h1 {font-size:20px;line-height:2}
27
- .mp {text-align:justify;background:#fff}
28
- .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
- .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
- .mp u {text-decoration:underline}
31
- .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
- .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
- .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
- .mp b.man-ref {font-weight:normal;color:#434241}
35
- .mp pre {padding:0 4ex}
36
- .mp pre code {font-weight:normal;color:#434241}
37
- .mp h2+pre,h3+pre {padding-left:0}
38
- ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
- ol.man-decor {width:100%}
40
- ol.man-decor li.tl {text-align:left}
41
- ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
- ol.man-decor li.tr {text-align:right;float:right}
43
- </style>
44
- <style type='text/css' media='all'>
45
- /* style: toc */
46
- .man-navigation {display:block !important;position:fixed;top:0;left:113ex;height:100%;width:100%;padding:48px 0 0 0;border-left:1px solid #dbdbdb;background:#eee}
47
- .man-navigation a,.man-navigation a:hover,.man-navigation a:link,.man-navigation a:visited {display:block;margin:0;padding:5px 2px 5px 30px;color:#999;text-decoration:none}
48
- .man-navigation a:hover {color:#111;text-decoration:underline}
49
- </style>
50
- </head>
51
- <!--
52
- The following styles are deprecated and will be removed at some point:
53
- div#man, div#man ol.man, div#man ol.head, div#man ol.man.
54
-
55
- The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
56
- .man-navigation should be used instead.
57
- -->
58
- <body id='manpage'>
59
- <div class='mp' id='man'>
60
-
61
- <div class='man-navigation' style='display:none'>
62
- <a href="#NAME">NAME</a>
63
- <a href="#SYNOPSIS">SYNOPSIS</a>
64
- <a href="#DESCRIPTION">DESCRIPTION</a>
65
- <a href="#OPTIONS">OPTIONS</a>
66
- <a href="#SEE-ALSO">SEE ALSO</a>
67
- </div>
68
-
69
- <ol class='man-decor man-head man head'>
70
- <li class='tl'>vclog-changelog(1)</li>
71
- <li class='tc'>VCLog</li>
72
- <li class='tr'>vclog-changelog(1)</li>
73
- </ol>
74
-
75
- <h2 id="NAME">NAME</h2>
76
- <p class="man-name">
77
- <code>vclog-changelog</code> - <span class="man-whatis">change log</span>
78
- </p>
79
-
80
- <h2 id="SYNOPSIS">SYNOPSIS</h2>
81
-
82
- <p><code>vclog</code><br />
83
- <code>vclog log</code><br />
84
- <code>vclog changelog</code></p>
85
-
86
- <h2 id="DESCRIPTION">DESCRIPTION</h2>
87
-
88
- <p>Produce a Change Log.</p>
89
-
90
- <h2 id="OPTIONS">OPTIONS</h2>
91
-
92
- <ul>
93
- <li><p><code>--version</code>, <code>-v &lt;VERSION></code>
94
- Set current version number.</p></li>
95
- <li><p><code>-f</code>, <code>--format &lt;FORMAT></code>
96
- Output format.</p></li>
97
- <li><p><code>--style &lt;URI></code>
98
- Provide a stylesheet URI (css or xsl) for HTML or XML format.</p></li>
99
- <li><p><code>-t</code>, <code>--title TITLE</code>
100
- Document title.</p></li>
101
- <li><p><code>-s</code>, <code>--summarize</code>
102
- Produce summary output.</p></li>
103
- <li><p><code>--id</code>
104
- Include revision id in output.</p></li>
105
- <li><p><code>-l</code>, <code>--level &lt;NUMBER></code>
106
- Lowest level of commit to display [0].</p></li>
107
- </ul>
108
-
109
-
110
- <h2 id="SEE-ALSO">SEE ALSO</h2>
111
-
112
- <p><a href="vclog.1.html" class="man-ref">vclog<span class="s">(1)</span></a>, <a href="vclog-history.1.html" class="man-ref">vclog-history<span class="s">(1)</span></a></p>
113
-
114
-
115
- <ol class='man-decor man-foot man foot'>
116
- <li class='tl'>RubyWorks</li>
117
- <li class='tc'>November 2010</li>
118
- <li class='tr'>vclog-changelog(1)</li>
119
- </ol>
120
-
121
- </div>
122
- </body>
123
- </html>