vclog 1.2 → 1.4.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 +87 -0
- data/PROFILE +17 -0
- data/{README → README.rdoc} +0 -0
- data/REQUIRE +9 -0
- data/{TODO → ROADMAP.rdoc} +0 -17
- data/VERSION +5 -0
- data/bin/vclog +1 -1
- data/features/history.feature +16 -0
- data/features/step_definitions/history_steps.rb +29 -0
- data/features/support/ae.rb +1 -0
- data/features/support/loadpath.rb +2 -0
- data/lib/plugins/syckle/vclog.rb +194 -0
- data/lib/vclog/changelog.rb +86 -131
- data/lib/vclog/cli.rb +12 -8
- data/lib/vclog/heuristics.rb +15 -0
- data/lib/vclog/history.rb +76 -109
- data/lib/vclog/release.rb +4 -0
- data/lib/vclog/tag.rb +5 -0
- data/lib/vclog/templates/changelog.gnu +6 -0
- data/lib/vclog/templates/changelog.html +34 -0
- data/lib/vclog/templates/changelog.markdown +6 -0
- data/lib/vclog/templates/changelog.rdoc +6 -0
- data/lib/vclog/templates/changelog.xml +16 -0
- data/lib/vclog/templates/changelog.xsl +34 -0
- data/lib/vclog/templates/history.html +47 -0
- data/lib/vclog/templates/history.markdown +12 -0
- data/lib/vclog/templates/history.rdoc +12 -0
- data/lib/vclog/templates/history.xml +30 -0
- data/lib/vclog/vcs/git.rb +16 -18
- data/lib/vclog/vcs/svn.rb +30 -20
- data/lib/vclog/vcs.rb +12 -3
- data/lib/vclog.rb +1 -0
- data/meta/{project → name} +0 -0
- data/meta/{parent → suite} +0 -0
- data/meta/version +1 -1
- metadata +50 -27
- data/HISTORY.md +0 -55
- data/MANIFEST +0 -36
- data/meta/loadpath +0 -2
data/lib/vclog/cli.rb
CHANGED
@@ -59,7 +59,7 @@ module VCLog
|
|
59
59
|
|
60
60
|
optparse = OptionParser.new do |opt|
|
61
61
|
|
62
|
-
opt.banner = "Usage: vclog [TYPE] [FORMAT] [OPTIONS] [DIR]"
|
62
|
+
opt.banner = "Usage: vclog [--TYPE] [--FORMAT] [OPTIONS] [DIR]"
|
63
63
|
|
64
64
|
opt.separator(" ")
|
65
65
|
opt.separator("OUTPUT TYPE (choose one):")
|
@@ -73,11 +73,11 @@ module VCLog
|
|
73
73
|
end
|
74
74
|
|
75
75
|
opt.on('--bump', '-b', "display a bumped version number") do
|
76
|
-
|
76
|
+
type = :bump
|
77
77
|
end
|
78
78
|
|
79
79
|
opt.on('--current', '-c', "display current version number") do
|
80
|
-
|
80
|
+
type = :curr
|
81
81
|
end
|
82
82
|
|
83
83
|
opt.separator(" ")
|
@@ -122,7 +122,7 @@ module VCLog
|
|
122
122
|
title = string
|
123
123
|
end
|
124
124
|
|
125
|
-
opt.on('--extra', '-e', "provide extra output
|
125
|
+
opt.on('--extra', '-e', "provide extra output (used by some formats)") do
|
126
126
|
extra = true
|
127
127
|
end
|
128
128
|
|
@@ -130,8 +130,8 @@ module VCLog
|
|
130
130
|
version = num
|
131
131
|
end
|
132
132
|
|
133
|
-
opt.on('--style
|
134
|
-
style =
|
133
|
+
opt.on('--style <URI>', "provide a stylesheet URI (css or xsl) for HTML or XML format") do |uri|
|
134
|
+
style = uri
|
135
135
|
end
|
136
136
|
|
137
137
|
opt.on('--id', "include revision ids (in formats that normally do not)") do
|
@@ -139,7 +139,7 @@ module VCLog
|
|
139
139
|
end
|
140
140
|
|
141
141
|
# DEPRECATE
|
142
|
-
opt.on('--output', '-o
|
142
|
+
opt.on('--output', '-o <FILE>', "send output to a file instead of stdout") do |out|
|
143
143
|
output = out
|
144
144
|
end
|
145
145
|
|
@@ -167,7 +167,11 @@ module VCLog
|
|
167
167
|
puts vcs.bump(version)
|
168
168
|
exit
|
169
169
|
when :curr
|
170
|
-
|
170
|
+
if vcs.tags.empty?
|
171
|
+
puts "0.0.0"
|
172
|
+
else
|
173
|
+
puts vcs.tags.last.name #TODO: ensure latest
|
174
|
+
end
|
171
175
|
exit
|
172
176
|
when :log
|
173
177
|
log = vcs.changelog
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VCLog
|
2
|
+
|
3
|
+
# TODO: Develop heuristics for determining the nature
|
4
|
+
# of changes from the commit messages. Ultimately allow
|
5
|
+
# user to customize heuristics per project.
|
6
|
+
module Heuristics
|
7
|
+
|
8
|
+
def explicit_tag(message)
|
9
|
+
md = /^(\w+)\:/.match(message)
|
10
|
+
md ? {:tag => md[1]} : {}
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/lib/vclog/history.rb
CHANGED
@@ -4,6 +4,7 @@ module VCLog
|
|
4
4
|
require 'vclog/changelog'
|
5
5
|
require 'vclog/tag'
|
6
6
|
require 'vclog/release'
|
7
|
+
require 'erb'
|
7
8
|
|
8
9
|
# = Release History Class
|
9
10
|
#
|
@@ -24,24 +25,26 @@ module VCLog
|
|
24
25
|
#
|
25
26
|
class History
|
26
27
|
|
27
|
-
|
28
|
+
# Location of this file in the file system.
|
29
|
+
DIR = File.dirname(__FILE__)
|
28
30
|
|
29
|
-
|
31
|
+
attr :vcs
|
30
32
|
|
33
|
+
# Alternate title.
|
31
34
|
attr_accessor :title
|
32
35
|
|
33
36
|
# Current working version.
|
34
37
|
attr_accessor :version
|
35
38
|
|
39
|
+
# Provide extra information.
|
36
40
|
attr_accessor :extra
|
37
41
|
|
38
42
|
#
|
39
43
|
def initialize(vcs, opts={})
|
40
|
-
@vcs
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@version = opts[:version]
|
44
|
+
@vcs = vcs
|
45
|
+
@title = opts[:title] || "RELEASE HISTORY"
|
46
|
+
@extra = opts[:extra]
|
47
|
+
@version = opts[:version]
|
45
48
|
end
|
46
49
|
|
47
50
|
# Tag list from version control system.
|
@@ -50,27 +53,30 @@ module VCLog
|
|
50
53
|
end
|
51
54
|
|
52
55
|
# Change list from version control system.
|
56
|
+
|
53
57
|
def changes
|
54
58
|
@changes ||= vcs.changes
|
55
59
|
end
|
56
60
|
|
57
61
|
# Changelog object
|
62
|
+
|
58
63
|
def changelog
|
59
64
|
@changlog ||= vcs.changelog #ChangeLog.new(changes)
|
60
65
|
end
|
61
66
|
|
62
67
|
#
|
68
|
+
|
63
69
|
def releases
|
64
70
|
@releases ||= (
|
65
71
|
rel = []
|
66
72
|
|
67
|
-
tags = tags
|
73
|
+
tags = self.tags
|
68
74
|
|
69
75
|
ver = vcs.bump(version)
|
70
76
|
time = ::Time.now
|
71
77
|
user = ENV['USER'] # TODO: get user name from vcs
|
72
78
|
|
73
|
-
tags << Tag.new(ver, time, user, "
|
79
|
+
tags << Tag.new(ver, time, user, "Current Development")
|
74
80
|
|
75
81
|
# TODO: Do we need to add a Time.now tag?
|
76
82
|
# add current verion to release list (if given)
|
@@ -82,7 +88,8 @@ module VCLog
|
|
82
88
|
#rels = rels.uniq # only uniq releases
|
83
89
|
|
84
90
|
# sort by release date
|
85
|
-
tags = tags.sort{ |a,b|
|
91
|
+
#tags = tags.sort{ |a,b| b.name <=> a.name }
|
92
|
+
tags = tags.sort{ |a,b| b.date <=> a.date }
|
86
93
|
|
87
94
|
# organize into deltas
|
88
95
|
deltas, last = [], nil
|
@@ -111,129 +118,71 @@ module VCLog
|
|
111
118
|
)
|
112
119
|
end
|
113
120
|
|
114
|
-
#
|
121
|
+
# Group +changes+ by tag type.
|
122
|
+
|
123
|
+
def groups(changes)
|
124
|
+
@groups ||= changes.group_by{ |e| e.type_number }
|
125
|
+
end
|
126
|
+
|
127
|
+
# Same as to_gnu.
|
128
|
+
|
115
129
|
def to_s(rev=false)
|
116
130
|
to_gnu(rev)
|
117
131
|
end
|
118
132
|
|
119
|
-
# TODO: What would GNU history
|
133
|
+
# TODO: What would GNU history look like?
|
134
|
+
|
120
135
|
def to_gnu(rev=false)
|
121
136
|
to_markdown(rev)
|
122
137
|
end
|
123
138
|
|
124
|
-
# Translate history into an XML document.
|
125
|
-
def to_xml(xsl=nil)
|
126
|
-
require 'rexml/document'
|
127
|
-
xml = REXML::Document.new('<history></history>')
|
128
|
-
#xml << REXML::XMLDecl.default
|
129
|
-
root = xml.root
|
130
|
-
releases.each do |release|
|
131
|
-
rel = root.add_element('release')
|
132
|
-
tel = rel.add_element('tag')
|
133
|
-
tel.add_element('name').add_text(release.tag.name)
|
134
|
-
tel.add_element('date').add_text(release.tag.date.to_s)
|
135
|
-
tel.add_element('author').add_text(release.tag.author)
|
136
|
-
tel.add_element('message').add_text(release.tag.message)
|
137
|
-
cel = rel.add_element('changes')
|
138
|
-
release.changes.sort{|a,b| b.date <=> a.date}.each do |entry|
|
139
|
-
el = cel.add_element('entry')
|
140
|
-
el.add_element('date').add_text(entry.date.to_s)
|
141
|
-
el.add_element('author').add_text(entry.author)
|
142
|
-
el.add_element('type').add_text(entry.type)
|
143
|
-
el.add_element('revision').add_text(entry.revision)
|
144
|
-
el.add_element('message').add_text(entry.message)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
out = String.new
|
148
|
-
fmt = REXML::Formatters::Pretty.new
|
149
|
-
fmt.compact = true
|
150
|
-
fmt.write(xml, out)
|
151
|
-
#
|
152
|
-
txt = %[<?xml version="1.0"?>\n]
|
153
|
-
txt += %[<?xml-stylesheet href="#{xsl}" type="text/xsl" ?>\n] if xsl
|
154
|
-
txt += out
|
155
|
-
txt
|
156
|
-
end
|
157
|
-
|
158
|
-
# Translate history into a HTML document.
|
159
|
-
#
|
160
|
-
# TODO: Need to add some headers.
|
161
|
-
#
|
162
|
-
def to_html(css=nil)
|
163
|
-
require 'rexml/document'
|
164
|
-
xml = REXML::Document.new('<div class="history"></div>')
|
165
|
-
#xml << REXML::XMLDecl.default
|
166
|
-
root = xml.root
|
167
|
-
releases.each do |release|
|
168
|
-
rel = root.add_element('div')
|
169
|
-
rel.add_attribute('class', 'release')
|
170
|
-
tel = rel.add_element('div')
|
171
|
-
tel.add_attribute('class', 'tag')
|
172
|
-
tel.add_element('div').add_text(release.tag.name).add_attribute('class', 'name')
|
173
|
-
tel.add_element('div').add_text(release.tag.date.to_s).add_attribute('class', 'date')
|
174
|
-
tel.add_element('div').add_text(release.tag.author).add_attribute('class', 'author')
|
175
|
-
tel.add_element('div').add_text(release.tag.message).add_attribute('class', 'message')
|
176
|
-
cel = rel.add_element('ul')
|
177
|
-
cel.add_attribute('class', 'changes')
|
178
|
-
release.changes.sort{|a,b| b.date <=> a.date}.each do |entry|
|
179
|
-
el = cel.add_element('li')
|
180
|
-
el.add_attribute('class', 'entry')
|
181
|
-
el.add_element('div').add_text(entry.date.to_s).add_attribute('class', 'date')
|
182
|
-
el.add_element('div').add_text(entry.author).add_attribute('class', 'author')
|
183
|
-
el.add_element('div').add_text(entry.type).add_attribute('class', 'type')
|
184
|
-
el.add_element('div').add_text(entry.revision).add_attribute('class', 'revision')
|
185
|
-
el.add_element('div').add_text(entry.message).add_attribute('class', 'message')
|
186
|
-
end
|
187
|
-
end
|
188
|
-
out = String.new
|
189
|
-
fmt = REXML::Formatters::Pretty.new
|
190
|
-
fmt.compact = true
|
191
|
-
fmt.write(xml, out)
|
192
|
-
#
|
193
|
-
x = []
|
194
|
-
x << %[<html>]
|
195
|
-
x << %[<head>]
|
196
|
-
x << %[ <title>ChangeLog</title>]
|
197
|
-
x << %[ <style>]
|
198
|
-
x << %[ body{font-family: sans-serif;}]
|
199
|
-
x << %[ #changelog{width:800px;margin:0 auto;}]
|
200
|
-
x << %[ li{padding: 10px;}]
|
201
|
-
x << %[ .date{font-weight: bold; color: gray; float: left; padding: 0 5px;}]
|
202
|
-
x << %[ .author{color: red;}]
|
203
|
-
x << %[ .message{padding: 5 0; font-weight: bold;}]
|
204
|
-
x << %[ .revision{font-size: 0.8em;}]
|
205
|
-
x << %[ </style>]
|
206
|
-
x << %[ <link rel="stylesheet" href="#{css}" type="text/css">] if css
|
207
|
-
x << %[</head>]
|
208
|
-
x << %[<body>]
|
209
|
-
x << out
|
210
|
-
x << %[</body>]
|
211
|
-
x << %[</html>]
|
212
|
-
x.join("\n")
|
213
|
-
end
|
214
|
-
|
215
139
|
# Translate history into a YAML document.
|
140
|
+
|
216
141
|
def to_yaml(*args)
|
217
142
|
require 'yaml'
|
218
143
|
releases.to_yaml(*args)
|
219
144
|
end
|
220
145
|
|
221
146
|
# Translate history into a JSON document.
|
147
|
+
|
222
148
|
def to_json
|
223
149
|
require 'json'
|
224
150
|
releases.to_json
|
225
151
|
end
|
226
152
|
|
227
|
-
# Translate history into a
|
228
|
-
|
229
|
-
|
153
|
+
# Translate history into a XML document.
|
154
|
+
|
155
|
+
def to_xml(xsl=nil)
|
156
|
+
tmp = File.read(File.join(DIR, 'templates', 'history.xml'))
|
157
|
+
erb = ERB.new(tmp)
|
158
|
+
erb.result(binding)
|
230
159
|
end
|
231
160
|
|
232
|
-
# Translate history into a
|
161
|
+
# Translate history into a HTML document.
|
162
|
+
|
163
|
+
def to_html(css=nil)
|
164
|
+
tmp = File.read(File.join(DIR, 'templates', 'history.html'))
|
165
|
+
erb = ERB.new(tmp)
|
166
|
+
erb.result(binding)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Translate history into a RDoc document.
|
170
|
+
|
233
171
|
def to_rdoc(rev=false)
|
234
|
-
|
172
|
+
tmp = File.read(File.join(DIR, 'templates', 'history.rdoc'))
|
173
|
+
erb = ERB.new(tmp)
|
174
|
+
erb.result(binding)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Translate history into a Markdown formatted document.
|
178
|
+
|
179
|
+
def to_markdown(rev=false)
|
180
|
+
tmp = File.read(File.join(DIR, 'templates', 'history.markdown'))
|
181
|
+
erb = ERB.new(tmp)
|
182
|
+
erb.result(binding)
|
235
183
|
end
|
236
184
|
|
185
|
+
=begin
|
237
186
|
#
|
238
187
|
def to_markup(marker, rev=false)
|
239
188
|
entries = []
|
@@ -252,14 +201,16 @@ module VCLog
|
|
252
201
|
# reverse entries order and make into document
|
253
202
|
marker + " #{title}\n\n" + entries.reverse.join("\n")
|
254
203
|
end
|
204
|
+
=end
|
255
205
|
|
256
206
|
private
|
257
207
|
|
208
|
+
=begin
|
258
209
|
#
|
259
210
|
def to_markup_changes(changes, rev=false)
|
260
211
|
groups = changes.group_by{ |e| e.type_number }
|
261
212
|
string = ""
|
262
|
-
|
213
|
+
groups.keys.sort.each do |n|
|
263
214
|
entries = groups[n]
|
264
215
|
next if !entries
|
265
216
|
next if entries.empty?
|
@@ -283,6 +234,8 @@ module VCLog
|
|
283
234
|
end
|
284
235
|
string
|
285
236
|
end
|
237
|
+
=end
|
238
|
+
|
286
239
|
|
287
240
|
=begin
|
288
241
|
# Extract release tags from a release file.
|
@@ -308,6 +261,20 @@ module VCLog
|
|
308
261
|
end
|
309
262
|
=end
|
310
263
|
|
264
|
+
private
|
265
|
+
|
266
|
+
#
|
267
|
+
def h(input)
|
268
|
+
result = input.to_s.dup
|
269
|
+
result.gsub!("&", "&")
|
270
|
+
result.gsub!("<", "<")
|
271
|
+
result.gsub!(">", ">")
|
272
|
+
result.gsub!("'", "'")
|
273
|
+
#result.gsub!("@", "&at;")
|
274
|
+
result.gsub!("\"", """)
|
275
|
+
return result
|
276
|
+
end
|
277
|
+
|
311
278
|
end
|
312
279
|
|
313
280
|
end
|
data/lib/vclog/release.rb
CHANGED
data/lib/vclog/tag.rb
CHANGED
@@ -0,0 +1,6 @@
|
|
1
|
+
<% by_date.each do |date, date_changes| %><% date_changes.by_author.each do |author, author_changes| %>
|
2
|
+
<%= date %> <%= author %>
|
3
|
+
<% author_changes.each do |entry| %>
|
4
|
+
* <%= entry.message %> <% if entry.type %><<%= entry.type %>><% end %><% if rev %>(#<%= entry.revision %>)<% end %><% end %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title><%= title %></title>
|
4
|
+
<style>
|
5
|
+
body{font-family: sans-serif;}
|
6
|
+
h1{ }
|
7
|
+
h2{ color: #555; }
|
8
|
+
li{padding: 10px;}
|
9
|
+
.changelog{width:800px; margin:0 auto;}
|
10
|
+
.title{font-size: 64px;}
|
11
|
+
.date{font-weight: bold; color: green; float: left; padding-right: 15px;}
|
12
|
+
.author{font-weight: bold; color: blue;}
|
13
|
+
.message{padding: 5 0; font-weight: bold;}
|
14
|
+
.revision{font-size: 0.8em;}
|
15
|
+
</style>
|
16
|
+
<% if css %>
|
17
|
+
<link rel="stylesheet" href="#{css}" type="text/css">
|
18
|
+
<% end %>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<div class="changelog">
|
22
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
23
|
+
<div class="commit">
|
24
|
+
<div class="revision">#<%= h entry.revision %></div>
|
25
|
+
<div class="date"><%= entry.date %></div>
|
26
|
+
<div class="author"><%= h entry.author %></div>
|
27
|
+
<div class="type"><%= h entry.type %></div>
|
28
|
+
<div class="message"><%= h entry.message %></div>
|
29
|
+
</commit>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</body>
|
33
|
+
</html>
|
34
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# <%= title %>
|
2
|
+
<% by_date.each do |date, date_changes| %><% date_changes.by_author.each do |author, author_changes| %>
|
3
|
+
## <%= date %> <%= author %>
|
4
|
+
<% author_changes.each do |entry| %>
|
5
|
+
* <%= entry.message %> <% if entry.type %><<%= entry.type %>><% end %><% if rev %>(#<%= entry.revision %>)<% end %><% end %>
|
6
|
+
<% end %><% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
= <%= title %>
|
2
|
+
<% by_date.each do |date, date_changes| %><% date_changes.by_author.each do |author, author_changes| %>
|
3
|
+
== <%= date %> <%= author %>
|
4
|
+
<% author_changes.each do |entry| %>
|
5
|
+
* <%= entry.message %> <% if entry.type %><<%= entry.type %>><% end %><% if rev %>(#<%= entry.revision %>)<% end %><% end %>
|
6
|
+
<% end %><% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<% if xsl %>
|
3
|
+
<?xml-stylesheet href="#{xsl}" type="text/xsl" ?>
|
4
|
+
<% end %>
|
5
|
+
<changelog title="<%= title %>">
|
6
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
7
|
+
<commit>
|
8
|
+
<revision>#<%= h entry.revision %></revision>
|
9
|
+
<date><%= entry.date %></date>
|
10
|
+
<author><%= h entry.author %></author>
|
11
|
+
<type><%= h entry.type %></type>
|
12
|
+
<message><%= h entry.message %></message>
|
13
|
+
</commit>
|
14
|
+
<% end %>
|
15
|
+
</changelog>
|
16
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
2
|
+
|
3
|
+
<xsl:output cdata-section-elements="script"/>
|
4
|
+
|
5
|
+
<xsl:template match="/">
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>Changelog</title>
|
9
|
+
<link REL='SHORTCUT ICON' HREF="../img/ruby-sm.png" />
|
10
|
+
<style>
|
11
|
+
td { font-family: sans-serif; padding: 0px 10px; }
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div class="container">
|
16
|
+
<h1>Changelog</h1>
|
17
|
+
<table style="width: 100%;">
|
18
|
+
<xsl:apply-templates />
|
19
|
+
</table>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
23
|
+
</xsl:template>
|
24
|
+
|
25
|
+
<xsl:template match="entry">
|
26
|
+
<tr>
|
27
|
+
<td><b><pre><xsl:value-of select="message"/></pre></b></td>
|
28
|
+
<td><xsl:value-of select="author"/></td>
|
29
|
+
<td><xsl:value-of select="date"/></td>
|
30
|
+
</tr>
|
31
|
+
</xsl:template>
|
32
|
+
|
33
|
+
</xsl:stylesheet>
|
34
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title><%= title %> History</title>
|
4
|
+
<style>
|
5
|
+
body{font-family: sans-serif;}
|
6
|
+
h1{ }
|
7
|
+
h2{ color: #555; }
|
8
|
+
li{padding: 10px;}
|
9
|
+
.changelog{width:800px; margin:0 auto;}
|
10
|
+
.title{font-size: 64px;}
|
11
|
+
.date{font-weight: bold; color: green; float: left; padding-right: 15px;}
|
12
|
+
.author{font-weight: bold; color: blue;}
|
13
|
+
.message{padding: 5 0; font-weight: bold;}
|
14
|
+
.revision{font-size: 0.8em;}
|
15
|
+
</style>
|
16
|
+
<% if css %>
|
17
|
+
<link rel="stylesheet" href="#{css}" type="text/css">
|
18
|
+
<% end %>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<div class="history">
|
22
|
+
<div class="title"><%= title %></div>
|
23
|
+
<% releases.each do |release| %>
|
24
|
+
<% tag = release.tag %>
|
25
|
+
<h1><%= tag.name %> / <%= tag.date.strftime('%Y-%m-%d') %></h1>
|
26
|
+
<p><%= tag.message %></p>
|
27
|
+
<% if extra %>
|
28
|
+
<% groups(release.changes).each do |number, changes| %>
|
29
|
+
<h2><%= changes.size %> <%= changes[0].type_phrase %></h2>
|
30
|
+
<ul class="log">
|
31
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
32
|
+
<li class="entry">
|
33
|
+
<div class="message"><%= h entry.message %></div>
|
34
|
+
<!-- <div class="type"><%= h entry.type %></div> -->
|
35
|
+
<div class="revision">#<%= h entry.revision %></div>
|
36
|
+
<div class="date"><%= entry.date %></div>
|
37
|
+
<div class="author"><%= h entry.author %></div>
|
38
|
+
</li>
|
39
|
+
<% end %>
|
40
|
+
</ul>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
</body>
|
46
|
+
</html>
|
47
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# <%= title %>
|
2
|
+
<% releases.each do |release| %><% tag = release.tag %>
|
3
|
+
## <%= tag.name %> / <%= tag.date.strftime('%Y-%m-%d') %>
|
4
|
+
|
5
|
+
<%= h tag.message.strip %> (<%= tag.author %>)
|
6
|
+
|
7
|
+
<% if extra %>Changes:
|
8
|
+
<% groups(release.changes).each do |number, changes| %>
|
9
|
+
* <%= changes.size %> <%= changes[0].type_phrase %>
|
10
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
11
|
+
* <%= entry.message %> <% if rev %>(#<%= entry.revision %>)<% end %><% end %>
|
12
|
+
<% end %><% end %><% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= <%= title %>
|
2
|
+
<% releases.each do |release| %><% tag = release.tag %>
|
3
|
+
== <%= tag.name %> / <%= tag.date.strftime('%Y-%m-%d') %>
|
4
|
+
|
5
|
+
<%= h tag.message.strip %> (<%= tag.author %>)
|
6
|
+
|
7
|
+
<% if extra %>Changes:
|
8
|
+
<% groups(release.changes).each do |number, changes| %>
|
9
|
+
* <%= changes.size %> <%= changes[0].type_phrase %>
|
10
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
11
|
+
* <%= entry.message %> <% if rev %>(#<%= entry.revision %>)<% end %><% end %>
|
12
|
+
<% end %><% end %><% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<% if xsl %>
|
3
|
+
<?xml-stylesheet href="#{xsl}" type="text/xsl" ?>
|
4
|
+
<% end %>
|
5
|
+
<history>
|
6
|
+
<title><%= title %></title>
|
7
|
+
<% releases.each do |release| %>
|
8
|
+
<tag>
|
9
|
+
<% tag = release.tag %>
|
10
|
+
<name><%= h tag.name %></name>
|
11
|
+
<date><%= tag.date.strftime('%Y-%m-%d') %></date>
|
12
|
+
<author><%= h tag.author %></author>
|
13
|
+
<message><%= h tag.message %></message>
|
14
|
+
<% groups(release.changes).each do |number, changes| %>
|
15
|
+
<commit-group type="<%= changes[0].type %>" label="<%= changes[0].type_phrase %>">
|
16
|
+
<% changes.sort{|a,b| b.date <=> a.date}.each do |entry| %>
|
17
|
+
<commit>
|
18
|
+
<revision>#<%= h entry.revision %></revision>
|
19
|
+
<date><%= entry.date %></date>
|
20
|
+
<author><%= h entry.author %></author>
|
21
|
+
<type><%= h entry.type %></type>
|
22
|
+
<message><%= h entry.message %></message>
|
23
|
+
</commit>
|
24
|
+
<% end %>
|
25
|
+
</commit-group>
|
26
|
+
<% end %>
|
27
|
+
</tag>
|
28
|
+
<% end %>
|
29
|
+
</history>
|
30
|
+
|
data/lib/vclog/vcs/git.rb
CHANGED
@@ -25,25 +25,13 @@ module VCLog
|
|
25
25
|
#
|
26
26
|
def extract_changes
|
27
27
|
list = []
|
28
|
-
changelog = `git
|
29
|
-
changes = changelog.split(
|
28
|
+
changelog = `git log --pretty=format:"---%ci|~|%aN|~|%H|~|%s"`.strip
|
29
|
+
changes = changelog.split("---")
|
30
|
+
#changes = changelog.split(/^commit/m)
|
30
31
|
changes.shift # throw the first (empty) entry away
|
31
|
-
changes.each do |
|
32
|
-
date, who, rev, msg =
|
33
|
-
|
34
|
-
unless rev
|
35
|
-
rev = line.strip
|
36
|
-
next
|
37
|
-
end
|
38
|
-
if md = /^Author:(.*?)$/.match(line)
|
39
|
-
who = md[1]
|
40
|
-
elsif md = /^Date:(.*?)$/m.match(line)
|
41
|
-
date = Time.parse(md[1])
|
42
|
-
else
|
43
|
-
msg << line.strip
|
44
|
-
end
|
45
|
-
end
|
46
|
-
msg = msg.join("\n")
|
32
|
+
changes.each do |entry|
|
33
|
+
date, who, rev, msg = entry.split('|~|')
|
34
|
+
date = Time.parse(date)
|
47
35
|
msg, type = *split_type(msg)
|
48
36
|
list << [rev, date, who, msg, type]
|
49
37
|
end
|
@@ -72,6 +60,16 @@ module VCLog
|
|
72
60
|
who = who.split(':')[1].strip
|
73
61
|
date = date[date.index(':')+1..-1].strip
|
74
62
|
msg = msg.join("\n")
|
63
|
+
|
64
|
+
info = `git show #{tag}^ --pretty=format:"%ci|-|"`
|
65
|
+
date, *_ = *info.split('|-|')
|
66
|
+
|
67
|
+
#md = /\Atag(.*?)\n(.*?)^commit/m.match(info)
|
68
|
+
#_who, _date, *_msg = *md[2].split(/\n/)
|
69
|
+
#_who = _who.split(':')[1].strip
|
70
|
+
#_date = _date[_date.index(':')+1..-1].strip
|
71
|
+
#_msg = _msg.join("\n")
|
72
|
+
|
75
73
|
list << [tag, date, who, msg]
|
76
74
|
end
|
77
75
|
list
|