vclog 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.rdoc +12 -2
- data/LICENSE +197 -17
- data/README.rdoc +11 -9
- data/bin/vclog +1 -1
- data/lib/plugins/syckle/vclog.rb +12 -12
- data/lib/vclog/adapters/abstract.rb +45 -16
- data/lib/vclog/adapters/darcs.rb +6 -1
- data/lib/vclog/adapters/git.rb +42 -2
- data/lib/vclog/adapters/hg.rb +15 -1
- data/lib/vclog/adapters/svn.rb +14 -0
- data/lib/vclog/adapters.rb +0 -17
- data/lib/vclog/change.rb +4 -0
- data/lib/vclog/cli/abstract.rb +22 -13
- data/lib/vclog/cli/autotag.rb +37 -0
- data/lib/vclog/cli/bump.rb +1 -1
- data/lib/vclog/cli/changelog.rb +2 -2
- data/lib/vclog/cli/{list.rb → formats.rb} +3 -3
- data/lib/vclog/cli/help.rb +15 -10
- data/lib/vclog/cli/history.rb +3 -4
- data/lib/vclog/cli/version.rb +1 -1
- data/lib/vclog/cli.rb +24 -188
- data/lib/vclog/facets.rb +2 -0
- data/lib/vclog/history.rb +1 -1
- data/lib/vclog/history_file.rb +64 -0
- data/lib/vclog/meta/data.rb +25 -0
- data/lib/vclog/meta/package +11 -0
- data/{PROFILE → lib/vclog/meta/profile} +6 -5
- data/lib/vclog/repo.rb +150 -0
- data/lib/vclog/tag.rb +2 -2
- data/lib/vclog/templates/changelog.html.erb +23 -18
- data/lib/vclog/templates/history.html.erb +4 -3
- data/lib/vclog.rb +3 -3
- data/man/man1/vclog-autotag.1 +23 -0
- data/man/man1/vclog-bump.1 +23 -0
- data/man/man1/vclog-changelog.1 +47 -0
- data/man/man1/vclog-history.1 +44 -0
- data/man/man1/vclog-version.1 +16 -0
- data/man/man1/vclog.1 +39 -0
- data/meta/data.rb +25 -0
- data/meta/package +11 -0
- data/meta/profile +18 -0
- data/ronn/index.txt +8 -0
- data/ronn/vclog-autotag.ronn +20 -0
- data/ronn/vclog-bump.ronn +21 -0
- data/ronn/vclog-changelog.ronn +39 -0
- data/ronn/vclog-history.ronn +38 -0
- data/ronn/vclog-version.ronn +14 -0
- data/ronn/vclog.ronn +36 -0
- metadata +39 -21
- data/REQUIRE +0 -11
- data/VERSION +0 -5
- data/lib/vclog/config.rb +0 -65
data/lib/vclog/cli/abstract.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'ostruct'
|
2
1
|
require 'optparse'
|
3
2
|
|
4
3
|
module VCLog
|
@@ -24,8 +23,8 @@ module CLI
|
|
24
23
|
|
25
24
|
# TODO: change +extra+ to +summarize+ and reverse boolean value.
|
26
25
|
def initialize
|
27
|
-
@options =
|
28
|
-
@options
|
26
|
+
@options = {}
|
27
|
+
@options[:extra] = true
|
29
28
|
end
|
30
29
|
|
31
30
|
#
|
@@ -58,23 +57,26 @@ module CLI
|
|
58
57
|
parser.separator(" ")
|
59
58
|
parser.separator("OUTPUT OPTIONS: (use varies with format)")
|
60
59
|
parser.on('--format', '-f FORMAT', "output format") do |format|
|
61
|
-
options
|
60
|
+
options[:format] = format.to_sym
|
62
61
|
end
|
63
62
|
parser.on('--style <URI>', "provide a stylesheet URI (css or xsl) for HTML or XML format") do |uri|
|
64
|
-
options
|
63
|
+
options[:stylesheet] = uri
|
65
64
|
end
|
66
65
|
parser.on('--title', '-t TITLE', "document title") do |string|
|
67
|
-
options
|
66
|
+
options[:title] = string
|
68
67
|
end
|
69
68
|
parser.on('--summarize', '-s', "produce summary output") do
|
70
|
-
options
|
69
|
+
options[:extra] = false
|
71
70
|
end
|
72
71
|
parser.on('--id', "include revision id") do
|
73
|
-
options
|
72
|
+
options[:revision] = true
|
74
73
|
end
|
75
74
|
parser.on('--level', '-l NUMBER', "lowest level of commit to display [0]") do |num|
|
76
|
-
options
|
75
|
+
options[:level] = num.to_i
|
77
76
|
end
|
77
|
+
#parser.on('--typed', "catagorize by commit type") do
|
78
|
+
# typed = true
|
79
|
+
#end
|
78
80
|
parser
|
79
81
|
end
|
80
82
|
|
@@ -84,16 +86,23 @@ module CLI
|
|
84
86
|
|
85
87
|
parser.parse!(argv)
|
86
88
|
|
87
|
-
@
|
89
|
+
@arguments = argv
|
88
90
|
|
89
|
-
|
90
|
-
@conf.level = options.level if options.level
|
91
|
+
root = Dir.pwd # TODO: find root
|
91
92
|
|
92
|
-
@
|
93
|
+
@repo = VCLog::Repo.new(root, options)
|
93
94
|
|
94
95
|
execute
|
95
96
|
end
|
96
97
|
|
98
|
+
# Repo is set in #run.
|
99
|
+
def repo
|
100
|
+
@repo
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
attr :arguments
|
105
|
+
|
97
106
|
end
|
98
107
|
|
99
108
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'vclog/cli/abstract'
|
2
|
+
|
3
|
+
module VCLog
|
4
|
+
module CLI
|
5
|
+
|
6
|
+
#
|
7
|
+
class Autotag < Abstract
|
8
|
+
|
9
|
+
#
|
10
|
+
def self.terms
|
11
|
+
['autotag']
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
def parser
|
16
|
+
super do |opt|
|
17
|
+
opt.banner = "Usage: vclog autotag"
|
18
|
+
opt.separator(" ")
|
19
|
+
opt.separator("DESCRIPTION:")
|
20
|
+
opt.separator(" Ensure each entry in History has been tagged.")
|
21
|
+
opt.separator(" ")
|
22
|
+
opt.separator("SPECIAL OPTIONS:")
|
23
|
+
opt.on('--prefix', '-p', 'tag label prefix'){ options[:prefix] = true }
|
24
|
+
opt.on('--force', '-f', 'perform tagging without confirmation'){ options[:force] = true }
|
25
|
+
opt.on('--dryrun', '-n', 'run in dryrun mode'){ $DRYRUN = true }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
def execute
|
31
|
+
repo.autotag(options[:prefix])
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/vclog/cli/bump.rb
CHANGED
data/lib/vclog/cli/changelog.rb
CHANGED
@@ -3,17 +3,17 @@ require 'vclog/cli/abstract'
|
|
3
3
|
module VCLog
|
4
4
|
module CLI
|
5
5
|
|
6
|
-
class
|
6
|
+
class Formats < Abstract
|
7
7
|
|
8
8
|
#
|
9
9
|
def self.terms
|
10
|
-
['
|
10
|
+
['formats', 'templates']
|
11
11
|
end
|
12
12
|
|
13
13
|
#
|
14
14
|
def parser
|
15
15
|
super do |opt|
|
16
|
-
opt.banner = "Usage: vclog
|
16
|
+
opt.banner = "Usage: vclog formats"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/lib/vclog/cli/help.rb
CHANGED
@@ -19,16 +19,21 @@ module CLI
|
|
19
19
|
|
20
20
|
#
|
21
21
|
def execute
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
32
37
|
end
|
33
38
|
|
34
39
|
end
|
data/lib/vclog/cli/history.rb
CHANGED
@@ -20,17 +20,16 @@ module CLI
|
|
20
20
|
opt.separator(" ")
|
21
21
|
opt.separator "SPECIAL OPTIONS:"
|
22
22
|
opt.on('--version', '-v NUM', "use as if current version number") do |num|
|
23
|
-
options
|
23
|
+
options[:version] = num
|
24
24
|
end
|
25
|
-
|
26
25
|
template_options(opt)
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
#
|
31
30
|
def execute
|
32
|
-
format = options
|
33
|
-
output =
|
31
|
+
format = options[:format] || 'ansi'
|
32
|
+
output = repo.display(:history, format, options)
|
34
33
|
puts output
|
35
34
|
end
|
36
35
|
|
data/lib/vclog/cli/version.rb
CHANGED
data/lib/vclog/cli.rb
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
module VCLog
|
2
2
|
|
3
|
-
#
|
3
|
+
#
|
4
|
+
def self.cli(*argv)
|
5
|
+
argv ||= ARGV.dup
|
6
|
+
begin
|
7
|
+
#opt = global_parser.order!(argv)
|
8
|
+
cmd = argv.shift unless argv.first =~ /^-/
|
9
|
+
cmd = cmd || 'changelog'
|
10
|
+
cli = CLI.factory(cmd)
|
11
|
+
cli.run(argv)
|
12
|
+
rescue => err
|
13
|
+
if $DEBUG
|
14
|
+
raise err
|
15
|
+
else
|
16
|
+
puts err.message
|
17
|
+
exit -1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# = Command Line Interface
|
4
23
|
#
|
5
24
|
# == SYNOPSIS
|
6
25
|
#
|
@@ -9,8 +28,7 @@ module VCLog
|
|
9
28
|
# into a common model, which then can be used to
|
10
29
|
# produce Changelogs in a variety of formats.
|
11
30
|
#
|
12
|
-
# VCLog currently support
|
13
|
-
# Mercurial/Hg are in the works.
|
31
|
+
# VCLog currently support git, hg and svn, with cvs and darcs in the works.
|
14
32
|
#
|
15
33
|
# == EXAMPLES
|
16
34
|
#
|
@@ -29,34 +47,15 @@ module VCLog
|
|
29
47
|
# To use the library programmatically, please see the API documentation.
|
30
48
|
|
31
49
|
module CLI
|
32
|
-
|
33
|
-
require 'vclog/config'
|
34
|
-
require 'vclog/adapters'
|
50
|
+
require 'vclog/repo'
|
35
51
|
|
36
52
|
require 'vclog/cli/help'
|
37
53
|
require 'vclog/cli/changelog'
|
38
54
|
require 'vclog/cli/history'
|
39
|
-
require 'vclog/cli/
|
55
|
+
require 'vclog/cli/formats'
|
40
56
|
require 'vclog/cli/bump'
|
41
57
|
require 'vclog/cli/version'
|
42
|
-
|
43
|
-
def self.main(*argv)
|
44
|
-
argv ||= ARGV.dup
|
45
|
-
begin
|
46
|
-
#opt = global_parser.order!(argv)
|
47
|
-
cmd = argv.shift unless argv.first =~ /^-/
|
48
|
-
cmd = cmd || 'changelog'
|
49
|
-
cli = CLI.factory(cmd)
|
50
|
-
cli.run(argv)
|
51
|
-
rescue => err
|
52
|
-
if $DEBUG
|
53
|
-
raise err
|
54
|
-
else
|
55
|
-
puts err.message
|
56
|
-
exit -1
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
58
|
+
require 'vclog/cli/autotag'
|
60
59
|
|
61
60
|
#
|
62
61
|
def self.factory(name)
|
@@ -71,166 +70,3 @@ module VCLog
|
|
71
70
|
|
72
71
|
end
|
73
72
|
end
|
74
|
-
|
75
|
-
# VCLog Copyright (c) 2008 Thomas Sawyer
|
76
|
-
|
77
|
-
=begin
|
78
|
-
#
|
79
|
-
def self.vclog
|
80
|
-
type = :log
|
81
|
-
format = :gnu
|
82
|
-
vers = nil
|
83
|
-
style = nil
|
84
|
-
output = nil
|
85
|
-
title = nil
|
86
|
-
version = nil
|
87
|
-
extra = false require 'vclog/cli/help'
|
88
|
-
rev = false
|
89
|
-
typed = false
|
90
|
-
|
91
|
-
optparse = OptionParser.new do |opt|
|
92
|
-
|
93
|
-
opt.banner = "Usage: vclog [--TYPE] [-f FORMAT] [OPTIONS] [DIR]"
|
94
|
-
|
95
|
-
opt.on('--current', '-c', "display current version number") do
|
96
|
-
type = :curr
|
97
|
-
end
|
98
|
-
|
99
|
-
opt.on('--bump', '-b', "display a bumped version number") do
|
100
|
-
type = :bump
|
101
|
-
end
|
102
|
-
|
103
|
-
opt.on('--formats', '-F', "list supported formats") do
|
104
|
-
puts "gnu rdoc markdown xml html atom rss json yaml"
|
105
|
-
exit
|
106
|
-
end
|
107
|
-
|
108
|
-
opt.on('--help' , '-h', 'display this help information') do
|
109
|
-
puts opt
|
110
|
-
exit
|
111
|
-
end
|
112
|
-
|
113
|
-
opt.separator(" ")
|
114
|
-
opt.separator("FORMAT OPTIONS: (use varies with format)")
|
115
|
-
|
116
|
-
opt.on('--format', '-f FORMAT', "output format") do |format|
|
117
|
-
format = format.to_sym
|
118
|
-
end
|
119
|
-
|
120
|
-
opt.on('--style <URI>', "provide a stylesheet URI (css or xsl) for HTML or XML format") do |uri|
|
121
|
-
style = uri
|
122
|
-
end
|
123
|
-
|
124
|
-
opt.on('--version', '-v NUM', "current version number") do |num|
|
125
|
-
version = num
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
#opt.on('--typed', "catagorize by commit type") do
|
130
|
-
# typed = true
|
131
|
-
#end
|
132
|
-
|
133
|
-
opt.on('--title', '-t TITLE', "document title") do |string|
|
134
|
-
title = string
|
135
|
-
end
|
136
|
-
|
137
|
-
opt.on('--detail', '-d', "provide details") do
|
138
|
-
extra = true
|
139
|
-
end
|
140
|
-
|
141
|
-
opt.on('--id', "include revision id") do
|
142
|
-
rev = true
|
143
|
-
end
|
144
|
-
|
145
|
-
opt.on('--style URI', "provide a stylesheet URI (css or xsl) for HTML or XML format") do |uri|
|
146
|
-
style = uri
|
147
|
-
end
|
148
|
-
|
149
|
-
# DEPRECATE
|
150
|
-
opt.on('--output', '-o FILE', "send output to a file instead of stdout") do |out|
|
151
|
-
output = out
|
152
|
-
end
|
153
|
-
|
154
|
-
opt.separator(" ")
|
155
|
-
opt.separator("SYSTEM OPTIONS:")
|
156
|
-
|
157
|
-
opt.on('--debug', "show debugging information") do
|
158
|
-
$DEBUG = true
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
optparse.parse!(ARGV)
|
163
|
-
|
164
|
-
root = ARGV.shift || Dir.pwd
|
165
|
-
conf = VCLog::Config.new(root)
|
166
|
-
vcs = VCLog::Adapters.factory(conf)
|
167
|
-
|
168
|
-
case type
|
169
|
-
when :bump
|
170
|
-
puts vcs.bump(version)
|
171
|
-
exit
|
172
|
-
when :curr
|
173
|
-
if vcs.tags.empty?
|
174
|
-
puts "0.0.0"
|
175
|
-
else
|
176
|
-
puts vcs.tags.last.name #TODO: ensure latest
|
177
|
-
end
|
178
|
-
exit
|
179
|
-
when :log
|
180
|
-
doctype = :changelog
|
181
|
-
#log = vcs.changelog
|
182
|
-
#log = log.typed if typed #TODO: ability to select types?
|
183
|
-
when :rel
|
184
|
-
doctype = :history
|
185
|
-
#log = vcs.history(:title=>title, :extra=>extra, :version=>version)
|
186
|
-
else
|
187
|
-
raise "huh?"
|
188
|
-
#log = vcs.changelog
|
189
|
-
#log = log.typed if typed #TODO: ability to select types?
|
190
|
-
end
|
191
|
-
|
192
|
-
options = {
|
193
|
-
:title => title,
|
194
|
-
:extra => extra,
|
195
|
-
:version => version,
|
196
|
-
:revision => rev,
|
197
|
-
:stylesheet => style
|
198
|
-
}
|
199
|
-
|
200
|
-
txt = vcs.display(doctype, format, options)
|
201
|
-
|
202
|
-
#case format
|
203
|
-
#when :xml
|
204
|
-
# txt = log.to_xml(style) # xsl stylesheet url
|
205
|
-
#when :html
|
206
|
-
# txt = log.to_html(style) # css stylesheet url
|
207
|
-
#when :yaml
|
208
|
-
# txt = log.to_yaml
|
209
|
-
#when :json
|
210
|
-
# txt = log.to_json
|
211
|
-
#when :markdown
|
212
|
-
# txt = log.to_markdown(rev)
|
213
|
-
#when :rdoc
|
214
|
-
# txt = log.to_rdoc(rev)
|
215
|
-
#else #:gnu
|
216
|
-
# txt = log.to_gnu(rev)
|
217
|
-
#end
|
218
|
-
|
219
|
-
if output
|
220
|
-
File.open(output, 'w') do |f|
|
221
|
-
f << txt
|
222
|
-
end
|
223
|
-
else
|
224
|
-
puts txt
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
#def self.changelog_file(file)
|
229
|
-
# if file && File.file?(file)
|
230
|
-
# file
|
231
|
-
# else
|
232
|
-
# Dir.glob('{history,changes,changelog}{,.*}', File::FNM_CASEFOLD).first
|
233
|
-
# end
|
234
|
-
#end
|
235
|
-
=end
|
236
|
-
|
data/lib/vclog/facets.rb
CHANGED
data/lib/vclog/history.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
module VCLog
|
2
|
+
|
3
|
+
# The HistoryFile class will parse a history into an array
|
4
|
+
# of release tags. Of course to do this, it assumes a specific
|
5
|
+
# file format.
|
6
|
+
#
|
7
|
+
class HistoryFile
|
8
|
+
|
9
|
+
FILE = '{HISTORY,HISTORY.*}'
|
10
|
+
|
11
|
+
LINE = /^[=#]/
|
12
|
+
VERS = /(\d+\.)+\d+/
|
13
|
+
DATE = /(\d+\-)+\d+/
|
14
|
+
|
15
|
+
#
|
16
|
+
CASEFOLD = File::FNM_CASEFOLD
|
17
|
+
|
18
|
+
# Release tags.
|
19
|
+
attr :tags
|
20
|
+
|
21
|
+
#
|
22
|
+
def initialize(source=nil)
|
23
|
+
if File.file?(source)
|
24
|
+
@file = source
|
25
|
+
@root = File.dirname(source)
|
26
|
+
elsif File.directory?(source)
|
27
|
+
@file = Dir.glob(File.join(source,FILE), CASEFOLD).first
|
28
|
+
@root = source
|
29
|
+
else
|
30
|
+
@file = Dir.glob(FILE).first
|
31
|
+
@root = Dir.pwd
|
32
|
+
end
|
33
|
+
raise "no history file" unless @file
|
34
|
+
|
35
|
+
@tags = extract_tags
|
36
|
+
end
|
37
|
+
|
38
|
+
# Parse history file.
|
39
|
+
def extract_tags
|
40
|
+
tags = []
|
41
|
+
desc = ''
|
42
|
+
text = File.read(@file)
|
43
|
+
text.lines.each do |line|
|
44
|
+
if LINE =~ line
|
45
|
+
vers = (VERS.match(line) || [])[0]
|
46
|
+
date = (DATE.match(line) || [])[0]
|
47
|
+
next unless vers
|
48
|
+
tags << [vers, date, desc = '']
|
49
|
+
else
|
50
|
+
desc << line
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
tags.map do |vers, date, desc|
|
55
|
+
index = desc.index(/^Changes:/) || desc.index(/^\*/) || desc.size
|
56
|
+
desc = desc[0...index].strip.fold
|
57
|
+
#[vers, date, desc]
|
58
|
+
Tag.new(vers, nil, date, nil, desc)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VCLog
|
2
|
+
|
3
|
+
def self.package
|
4
|
+
@package ||= (
|
5
|
+
require 'yaml'
|
6
|
+
YAML.load(File.new(File.dirname(__FILE__) + '/package'))
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.profile
|
11
|
+
@profile ||= (
|
12
|
+
require 'yaml'
|
13
|
+
YAML.load(File.new(File.dirname(__FILE__) + '/profile'))
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.const_missing(name)
|
18
|
+
key = name.to_s.downcase
|
19
|
+
package[key] || profile[key] || super(name)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Prime version.
|
23
|
+
VERSION = package['version']
|
24
|
+
end
|
25
|
+
|
@@ -1,9 +1,8 @@
|
|
1
1
|
---
|
2
2
|
title : VCLog
|
3
|
-
suite :
|
3
|
+
suite : rubyworks
|
4
4
|
summary : Cross-VCS/SCM ChangeLog Generator
|
5
|
-
|
6
|
-
license : MIT
|
5
|
+
license : Apache 2.0
|
7
6
|
contact : trans <transfire@gmail.com>
|
8
7
|
created : 2006-05-09
|
9
8
|
authors : Thomas Sawyer
|
@@ -12,6 +11,8 @@ description:
|
|
12
11
|
VCLog is a cross-VCS/SCM ChangeLog generator.
|
13
12
|
|
14
13
|
resources:
|
15
|
-
|
16
|
-
|
14
|
+
home: http://rubyworks.github.com/vclog
|
15
|
+
code: http://github.com/rubyworks/vclog
|
16
|
+
repo: git://github.com/proutils/vclog.git
|
17
17
|
|
18
|
+
copyright: Copyright (c) 2009 Thomas Sawyer
|