vclog 1.9.2 → 1.10.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.
- checksums.yaml +7 -0
- data/History.md +40 -0
- data/License.txt +1 -6
- data/README.md +38 -35
- data/lib/vclog/adapters/abstract.rb +3 -8
- data/lib/vclog/adapters/git.rb +71 -133
- data/lib/vclog/adapters/svn.rb +1 -1
- data/lib/vclog/change.rb +8 -8
- data/lib/vclog/change_point.rb +0 -1
- data/lib/vclog/cli/abstract.rb +2 -2
- data/lib/vclog/config.rb +47 -49
- data/lib/vclog/core_ext.rb +14 -101
- data/lib/vclog/heuristics.rb +6 -6
- data/lib/vclog/history_file.rb +10 -3
- data/lib/vclog/metadata.rb +1 -16
- data/lib/vclog/repo.rb +7 -15
- data/lib/vclog/report.rb +10 -5
- data/lib/vclog/tag.rb +19 -6
- data/lib/vclog/version.rb +3 -0
- data/man/man1/vclog-autotag.1.ronn +1 -1
- data/man/man1/vclog-bump.1.ronn +1 -1
- data/man/man1/vclog-news.1.ronn +2 -2
- data/man/man1/vclog-version.1.ronn +1 -1
- metadata +111 -91
- data/.ruby +0 -55
- data/lib/vclog.yml +0 -55
- data/man/man1/vclog-autotag.1 +0 -29
- data/man/man1/vclog-autotag.1.html +0 -117
- data/man/man1/vclog-bump.1 +0 -23
- data/man/man1/vclog-bump.1.html +0 -111
- data/man/man1/vclog-news.1 +0 -25
- data/man/man1/vclog-news.1.html +0 -112
- data/man/man1/vclog-version.1 +0 -16
- data/man/man1/vclog-version.1.html +0 -100
- data/man/man1/vclog.1 +0 -51
- data/man/man1/vclog.1.html +0 -131
- data/spec/feature_git_changes.rb +0 -58
- data/spec/feature_git_history.rb +0 -58
- data/spec/feature_hg_changes.rb +0 -58
- data/spec/feature_hg_history.rb +0 -58
- data/spec/featurettes/repo_creation.rb +0 -64
- data/spec/featurettes/shellout.rb +0 -16
- data/test/case_metadata.rb +0 -10
data/lib/vclog/config.rb
CHANGED
|
@@ -2,32 +2,44 @@ require 'vclog/heuristics'
|
|
|
2
2
|
|
|
3
3
|
module VCLog
|
|
4
4
|
|
|
5
|
+
# Get/set master configruation(s).
|
|
6
|
+
def self.configure(&block)
|
|
7
|
+
@config ||= []
|
|
8
|
+
@config << block if block
|
|
9
|
+
@config
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
# Encapsulates configuration settings for running vclog.
|
|
6
13
|
#
|
|
14
|
+
# We recommend putting vclog configuration in a project's `etc/vclog.rb`
|
|
15
|
+
# file. For Rails projects, however, `config/vclog.rb` can be used. If
|
|
16
|
+
# usig a subdirectory is not suitable to a project then simply using
|
|
17
|
+
# the more traditional `.vclog` file works too.
|
|
18
|
+
#
|
|
7
19
|
class Config
|
|
8
20
|
|
|
21
|
+
# File glob for identifying the project's root directory.
|
|
9
22
|
#
|
|
10
|
-
#
|
|
11
|
-
|
|
23
|
+
# NOTE: SVN support is limited to repos with a trunk directory.
|
|
24
|
+
ROOT_GLOB = "{.git,.hg,_darcs,.svn/trunk}"
|
|
25
|
+
|
|
12
26
|
#
|
|
13
|
-
#
|
|
14
|
-
# ---
|
|
15
|
-
# vclog: task/vclog.rb
|
|
27
|
+
# Default vclog config file glob looks for these possible matches:
|
|
16
28
|
#
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
# * vclog.rb
|
|
30
|
+
# * etc/vclog.rb
|
|
31
|
+
# * config/vclog.rb
|
|
19
32
|
#
|
|
20
|
-
#
|
|
33
|
+
# The configuration file can also be a hidden dot file if preferred:
|
|
21
34
|
#
|
|
22
35
|
# * .vclog
|
|
23
|
-
# * .
|
|
24
|
-
# * config/vclog
|
|
25
|
-
# * .dot/vclog
|
|
26
|
-
# * dot/vclog
|
|
36
|
+
# * .etc/vclog.rb
|
|
37
|
+
# * .config/vclog.rb
|
|
27
38
|
#
|
|
28
|
-
#
|
|
39
|
+
# Root files have precedence over files in subdirectories, and the `.rb`
|
|
40
|
+
# file extension is optional in all cases.
|
|
29
41
|
#
|
|
30
|
-
|
|
42
|
+
FILE_GLOBS = [ '{,.}vclog{,.rb}', '{.,}{etc/,config/}vclog{,.rb}' ]
|
|
31
43
|
|
|
32
44
|
#
|
|
33
45
|
#
|
|
@@ -73,7 +85,11 @@ module VCLog
|
|
|
73
85
|
if file
|
|
74
86
|
Heuristics.load(file)
|
|
75
87
|
else
|
|
76
|
-
Heuristics.new
|
|
88
|
+
h = Heuristics.new
|
|
89
|
+
if config = VCLog.configure
|
|
90
|
+
config.each{ |c| c.call(h) }
|
|
91
|
+
end
|
|
92
|
+
h
|
|
77
93
|
end
|
|
78
94
|
)
|
|
79
95
|
end
|
|
@@ -95,53 +111,35 @@ module VCLog
|
|
|
95
111
|
# The vclog config file.
|
|
96
112
|
#
|
|
97
113
|
def file
|
|
98
|
-
|
|
99
|
-
Dir.glob(glob).
|
|
100
|
-
|
|
101
|
-
Dir.glob(DEFAULT_GLOB).first
|
|
114
|
+
FILE_GLOBS.each do |glob|
|
|
115
|
+
found = Dir.glob(File.join(root, glob)).find{ |f| File.file?(f) }
|
|
116
|
+
return found if found
|
|
102
117
|
end
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
#
|
|
106
|
-
# Project's map file, if present.
|
|
107
|
-
#
|
|
108
|
-
def map_file
|
|
109
|
-
file = File.join(root, MAP_FILE)
|
|
110
|
-
return file if File.exist?(file)
|
|
111
|
-
return nil
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
#
|
|
115
|
-
# Load the map file.
|
|
116
|
-
#
|
|
117
|
-
def file_map
|
|
118
|
-
@file_map ||= (
|
|
119
|
-
map_file ? YAML.load_file(map_file) : {}
|
|
120
|
-
)
|
|
118
|
+
nil
|
|
121
119
|
end
|
|
122
120
|
|
|
123
121
|
#
|
|
124
122
|
# Find project root. This searches up from the current working
|
|
125
|
-
# directory for a
|
|
126
|
-
# manager directory.
|
|
123
|
+
# directory for a source control manager directory.
|
|
127
124
|
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
#
|
|
132
|
-
# .svn/
|
|
133
|
-
# _darcs/
|
|
125
|
+
# * `.git/`
|
|
126
|
+
# * `.hg/`
|
|
127
|
+
# * `_darcs/`
|
|
128
|
+
# * `.svn/trunk`
|
|
134
129
|
#
|
|
135
130
|
# If all else fails the current directory is returned.
|
|
136
131
|
#
|
|
137
132
|
def lookup_root
|
|
138
133
|
root = nil
|
|
139
|
-
Dir.
|
|
140
|
-
|
|
141
|
-
if
|
|
142
|
-
root =
|
|
134
|
+
dir = Dir.pwd
|
|
135
|
+
loop do
|
|
136
|
+
if Dir.glob(File.join(dir, ROOT_GLOB)).first
|
|
137
|
+
root = dir
|
|
143
138
|
break
|
|
144
139
|
end
|
|
140
|
+
parent = File.dirname(dir)
|
|
141
|
+
break if parent == dir
|
|
142
|
+
dir = parent
|
|
145
143
|
end
|
|
146
144
|
root || Dir.pwd
|
|
147
145
|
end
|
data/lib/vclog/core_ext.rb
CHANGED
|
@@ -1,108 +1,21 @@
|
|
|
1
|
+
require 'ostruct'
|
|
1
2
|
require 'facets/string/fold'
|
|
2
|
-
require 'facets/string/indent'
|
|
3
|
-
require 'facets/string/tabto'
|
|
4
|
-
require 'facets/string/margin'
|
|
5
|
-
require 'facets/enumerable/group_by'
|
|
6
3
|
require 'facets/kernel/ask'
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
module VCLog
|
|
11
|
-
|
|
12
|
-
# Extensions for String class.
|
|
13
|
-
# Taken from Facets.
|
|
14
|
-
module String
|
|
15
|
-
|
|
16
|
-
# Provides a margin controlled string.
|
|
17
|
-
#
|
|
18
|
-
# x = %Q{
|
|
19
|
-
# | This
|
|
20
|
-
# | is
|
|
21
|
-
# | margin controlled!
|
|
22
|
-
# }.margin
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
# NOTE: This may still need a bit of tweaking.
|
|
26
|
-
#
|
|
27
|
-
# CREDIT: Trans
|
|
28
|
-
|
|
29
|
-
def margin(n=0)
|
|
30
|
-
#d = /\A.*\n\s*(.)/.match( self )[1]
|
|
31
|
-
#d = /\A\s*(.)/.match( self)[1] unless d
|
|
32
|
-
d = ((/\A.*\n\s*(.)/.match(self)) ||
|
|
33
|
-
(/\A\s*(.)/.match(self)))[1]
|
|
34
|
-
return '' unless d
|
|
35
|
-
if n == 0
|
|
36
|
-
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, '')
|
|
37
|
-
else
|
|
38
|
-
gsub(/\n\s*\Z/,'').gsub(/^\s*[#{d}]/, ' ' * n)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Preserves relative tabbing.
|
|
43
|
-
# The first non-empty line ends up with n spaces before nonspace.
|
|
44
|
-
#
|
|
45
|
-
# CREDIT: Gavin Sinclair
|
|
46
|
-
|
|
47
|
-
def tabto(n)
|
|
48
|
-
if self =~ /^( *)\S/
|
|
49
|
-
indent(n - $1.length)
|
|
50
|
-
else
|
|
51
|
-
self
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Indent left or right by n spaces.
|
|
56
|
-
# (This used to be called #tab and aliased as #indent.)
|
|
57
|
-
#
|
|
58
|
-
# CREDIT: Gavin Sinclair
|
|
59
|
-
# CREDIT: Trans
|
|
60
|
-
|
|
61
|
-
def indent(n)
|
|
62
|
-
if n >= 0
|
|
63
|
-
gsub(/^/, ' ' * n)
|
|
64
|
-
else
|
|
65
|
-
gsub(/^ {0,#{-n}}/, "")
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
class String #:nodoc:
|
|
74
|
-
include VCLog::String
|
|
5
|
+
class OpenStruct
|
|
6
|
+
method_undef(:type) if method_defined?(:type)
|
|
75
7
|
end
|
|
76
8
|
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
# (1..5).group_by { |n| n % 3 }
|
|
89
|
-
# #=> { 0 => [3], 1 => [1, 4], 2 => [2,5] }
|
|
90
|
-
#
|
|
91
|
-
# ["I had", 1, "dollar and", 50, "cents"].group_by { |e| e.class }
|
|
92
|
-
# #=> { String => ["I had","dollar and","cents"], Fixnum => [1,50] }
|
|
93
|
-
#
|
|
94
|
-
# CREDIT: Erik Veenstra
|
|
95
|
-
|
|
96
|
-
def group_by #:yield:
|
|
97
|
-
#h = k = e = nil
|
|
98
|
-
r = Hash.new
|
|
99
|
-
each{ |e| (r[yield(e)] ||= []) << e }
|
|
100
|
-
r
|
|
9
|
+
class String
|
|
10
|
+
# Indent the text so its first line with any content starts at column
|
|
11
|
+
# +n+, keeping the relative indentation of the lines after it. Facets
|
|
12
|
+
# had this until 4.0.
|
|
13
|
+
def tabto(n)
|
|
14
|
+
lead = self[/^([ \t]*)\S/, 1].to_s.size
|
|
15
|
+
if n >= lead
|
|
16
|
+
gsub(/^(?=.)/, ' ' * (n - lead))
|
|
17
|
+
else
|
|
18
|
+
gsub(/^[ \t]{0,#{lead - n}}/, '')
|
|
101
19
|
end
|
|
102
|
-
|
|
103
|
-
end
|
|
104
|
-
|
|
20
|
+
end unless method_defined?(:tabto)
|
|
105
21
|
end
|
|
106
|
-
|
|
107
|
-
=end
|
|
108
|
-
|
data/lib/vclog/heuristics.rb
CHANGED
|
@@ -26,7 +26,7 @@ module VCLog
|
|
|
26
26
|
# Configuration script.
|
|
27
27
|
#
|
|
28
28
|
def self.eval(script, file='(eval)', line=0)
|
|
29
|
-
new{ instance_eval(
|
|
29
|
+
new{ instance_eval(script, file, line) }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
#
|
|
@@ -113,7 +113,7 @@ module VCLog
|
|
|
113
113
|
# Set default level.
|
|
114
114
|
#
|
|
115
115
|
def level(integer=nil)
|
|
116
|
-
@level = integer.to_i
|
|
116
|
+
@level = integer.to_i if integer
|
|
117
117
|
@level
|
|
118
118
|
end
|
|
119
119
|
|
|
@@ -129,25 +129,25 @@ module VCLog
|
|
|
129
129
|
type :test, -2, "Test/Spec Adjustments"
|
|
130
130
|
type :admin, -3, "Administrative Changes"
|
|
131
131
|
|
|
132
|
-
on
|
|
132
|
+
on(/\A(\w+):/) do |commit, md|
|
|
133
133
|
type = md[1].to_sym
|
|
134
134
|
commit.type = type
|
|
135
135
|
commit.message = commit.message.sub(md[0],'').strip
|
|
136
136
|
true
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
on
|
|
139
|
+
on(/\[(\w+)\]\s*$/) do |commit, md|
|
|
140
140
|
type = md[1].to_sym
|
|
141
141
|
commit.type = type
|
|
142
142
|
commit.message = commit.message.sub(md[0],'').strip
|
|
143
143
|
true
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
on
|
|
146
|
+
on(/updated? (README|PROFILE|PACKAGE|VERSION|MANIFEST)/) do |commit|
|
|
147
147
|
commit.type = :admin
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
-
on
|
|
150
|
+
on(/(bump|bumped|prepare) version/) do |commit|
|
|
151
151
|
commit.type = :admin
|
|
152
152
|
end
|
|
153
153
|
end
|
data/lib/vclog/history_file.rb
CHANGED
|
@@ -6,7 +6,7 @@ module VCLog
|
|
|
6
6
|
#
|
|
7
7
|
class HistoryFile
|
|
8
8
|
|
|
9
|
-
FILE =
|
|
9
|
+
FILE = /\Ahistory(\.\w+)?\z/i
|
|
10
10
|
|
|
11
11
|
LINE = /^[=#]/
|
|
12
12
|
VERS = /(\d+[._])+\d+/
|
|
@@ -20,14 +20,15 @@ module VCLog
|
|
|
20
20
|
|
|
21
21
|
# Setup new HistoryFile instance.
|
|
22
22
|
def initialize(source=nil)
|
|
23
|
+
source = source.to_s
|
|
23
24
|
if File.file?(source)
|
|
24
25
|
@file = source
|
|
25
26
|
@root = File.dirname(source)
|
|
26
27
|
elsif File.directory?(source)
|
|
27
|
-
@file =
|
|
28
|
+
@file = find(source)
|
|
28
29
|
@root = source
|
|
29
30
|
else
|
|
30
|
-
@file = Dir.
|
|
31
|
+
@file = find(Dir.pwd)
|
|
31
32
|
@root = Dir.pwd
|
|
32
33
|
end
|
|
33
34
|
raise "no history file" unless @file
|
|
@@ -35,6 +36,12 @@ module VCLog
|
|
|
35
36
|
@tags = extract_tags
|
|
36
37
|
end
|
|
37
38
|
|
|
39
|
+
# Find the history file in a directory, whatever its case.
|
|
40
|
+
def find(dir)
|
|
41
|
+
name = Dir.children(dir).sort.find{ |f| FILE =~ f && File.file?(File.join(dir, f)) }
|
|
42
|
+
name && File.join(dir, name)
|
|
43
|
+
end
|
|
44
|
+
|
|
38
45
|
# Parse history file.
|
|
39
46
|
def extract_tags
|
|
40
47
|
tags = []
|
data/lib/vclog/metadata.rb
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
def self.metadata
|
|
4
|
-
@metadata ||= (
|
|
5
|
-
require 'yaml'
|
|
6
|
-
YAML.load_file(File.dirname(__FILE__) + '/../vclog.yml')
|
|
7
|
-
)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.const_missing(name)
|
|
11
|
-
key = name.to_s.downcase
|
|
12
|
-
metadata.key?(key) ? metadata[key] : super(name)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
|
|
1
|
+
require 'vclog/version'
|
data/lib/vclog/repo.rb
CHANGED
|
@@ -19,11 +19,6 @@ module VCLog
|
|
|
19
19
|
#
|
|
20
20
|
ROOT_GLOB = '{.ruby,.map/,.git/,.hg/,_darcs/,.svn/}'
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
# Project's root directory.
|
|
24
|
-
#
|
|
25
|
-
attr :root
|
|
26
|
-
|
|
27
22
|
#
|
|
28
23
|
# Options hash.
|
|
29
24
|
#
|
|
@@ -178,7 +173,7 @@ module VCLog
|
|
|
178
173
|
# gather changes for each delta
|
|
179
174
|
delta.each do |tag, (started, ended)|
|
|
180
175
|
if started
|
|
181
|
-
set = changes.select{ |c| c.date
|
|
176
|
+
set = changes.select{ |c| c.date > started && c.date <= ended }
|
|
182
177
|
#gt_vers, gt_date = gt.name, gt.date
|
|
183
178
|
#lt_vers, lt_date = lt.name, lt.date
|
|
184
179
|
#gt_date = Time.parse(gt_date) unless Time===gt_date
|
|
@@ -188,7 +183,7 @@ module VCLog
|
|
|
188
183
|
#lt_vers, lt_date = lt.name, lt.date
|
|
189
184
|
#lt_date = Time.parse(lt_date) unless Time===lt_date
|
|
190
185
|
#log = changelog.before(lt_date)
|
|
191
|
-
set = changes.select{ |c| c.date
|
|
186
|
+
set = changes.select{ |c| c.date <= ended }
|
|
192
187
|
end
|
|
193
188
|
rel << Release.new(tag, set)
|
|
194
189
|
end
|
|
@@ -213,8 +208,10 @@ module VCLog
|
|
|
213
208
|
#
|
|
214
209
|
def bump
|
|
215
210
|
last_release = releases(changes).first
|
|
216
|
-
max = last_release.changes.map{ |c| c.level }.max
|
|
217
|
-
if max
|
|
211
|
+
max = last_release.changes.map{ |c| c.level }.compact.max
|
|
212
|
+
if max.nil?
|
|
213
|
+
bump_part('patch') # nothing has changed since the last release
|
|
214
|
+
elsif max > 1
|
|
218
215
|
bump_part('major')
|
|
219
216
|
elsif max >= 0
|
|
220
217
|
bump_part('minor')
|
|
@@ -229,12 +226,7 @@ module VCLog
|
|
|
229
226
|
def bump_part(part=nil)
|
|
230
227
|
raise "bad version part - #{part}" unless ['major', 'minor', 'patch', 'build', ''].include?(part.to_s)
|
|
231
228
|
|
|
232
|
-
|
|
233
|
-
v = tags[-1].name # TODO: ensure the latest version
|
|
234
|
-
v = tags[-2].name if v == 'HEAD'
|
|
235
|
-
else
|
|
236
|
-
v = '0.0.0'
|
|
237
|
-
end
|
|
229
|
+
v = adapter.version
|
|
238
230
|
|
|
239
231
|
v = v.split(/\W/) # TODO: preserve split chars
|
|
240
232
|
|
data/lib/vclog/report.rb
CHANGED
|
@@ -31,7 +31,7 @@ module VCLog
|
|
|
31
31
|
# An instance of VCLog::Repo.
|
|
32
32
|
#
|
|
33
33
|
def initialize(repo, options)
|
|
34
|
-
@repo
|
|
34
|
+
@repo = repo
|
|
35
35
|
|
|
36
36
|
options[:type] ||= 'changelog'
|
|
37
37
|
options[:format] ||= 'ansi'
|
|
@@ -45,7 +45,7 @@ module VCLog
|
|
|
45
45
|
# Returns a Changelog object.
|
|
46
46
|
#
|
|
47
47
|
def changelog
|
|
48
|
-
changes = options.point ? repo.
|
|
48
|
+
changes = options.point ? repo.change_points : repo.changes
|
|
49
49
|
ChangeLog.new(changes).above(options.level)
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -132,7 +132,7 @@ module VCLog
|
|
|
132
132
|
tmpl_glob = File.join(DIR, 'templates', "#{type}.#{format}.{erb,rb}")
|
|
133
133
|
tmpl_file = Dir[tmpl_glob].first
|
|
134
134
|
|
|
135
|
-
raise "could not find template -- #{
|
|
135
|
+
raise "could not find template -- #{type}.#{format}" unless tmpl_file
|
|
136
136
|
|
|
137
137
|
tmpl = File.read(tmpl_file)
|
|
138
138
|
|
|
@@ -140,7 +140,7 @@ module VCLog
|
|
|
140
140
|
when '.rb'
|
|
141
141
|
eval(tmpl, binding, tmpl_file)
|
|
142
142
|
when '.erb'
|
|
143
|
-
erb = ERB.new(tmpl,
|
|
143
|
+
erb = ERB.new(tmpl, :trim_mode=>'<>')
|
|
144
144
|
erb.result(binding)
|
|
145
145
|
else
|
|
146
146
|
raise "unrecognized template type -- #{tmpl_file}"
|
|
@@ -191,7 +191,12 @@ module VCLog
|
|
|
191
191
|
@_rdoc ||= (
|
|
192
192
|
gem 'rdoc' rescue nil # to ensure latest version
|
|
193
193
|
require 'rdoc'
|
|
194
|
-
RDoc
|
|
194
|
+
# The arguments this takes have changed between RDoc versions.
|
|
195
|
+
begin
|
|
196
|
+
RDoc::Markup::ToHtml.new(RDoc::Options.new)
|
|
197
|
+
rescue ArgumentError
|
|
198
|
+
RDoc::Markup::ToHtml.new
|
|
199
|
+
end
|
|
195
200
|
)
|
|
196
201
|
end
|
|
197
202
|
|
data/lib/vclog/tag.rb
CHANGED
|
@@ -11,22 +11,22 @@ module VCLog
|
|
|
11
11
|
#
|
|
12
12
|
# Tag name, which in this case is typically a version stamp.
|
|
13
13
|
#
|
|
14
|
-
|
|
14
|
+
attr_reader :name
|
|
15
15
|
|
|
16
16
|
#
|
|
17
17
|
# Date tag was made.
|
|
18
18
|
#
|
|
19
|
-
|
|
19
|
+
attr_reader :date
|
|
20
20
|
|
|
21
21
|
#
|
|
22
22
|
# Creator to the tag.
|
|
23
23
|
#
|
|
24
|
-
|
|
24
|
+
attr_reader :author
|
|
25
25
|
|
|
26
26
|
#
|
|
27
27
|
# Tag message.
|
|
28
28
|
#
|
|
29
|
-
|
|
29
|
+
attr_reader :message
|
|
30
30
|
|
|
31
31
|
#
|
|
32
32
|
# Last commit before Tag.
|
|
@@ -94,7 +94,7 @@ module VCLog
|
|
|
94
94
|
# Set the tag message.
|
|
95
95
|
#
|
|
96
96
|
def message=(msg)
|
|
97
|
-
@message = msg.strip
|
|
97
|
+
@message = msg.to_s.strip
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
#
|
|
@@ -128,12 +128,25 @@ module VCLog
|
|
|
128
128
|
# Normal tag order is the reverse typical sorts.
|
|
129
129
|
#
|
|
130
130
|
def <=>(other)
|
|
131
|
+
return 0 if name == other.name
|
|
131
132
|
return -1 if name == 'HEAD'
|
|
132
|
-
other.name
|
|
133
|
+
return 1 if other.name == 'HEAD'
|
|
134
|
+
a, b = version_of(name), version_of(other.name)
|
|
135
|
+
(a && b) ? (b <=> a) : (other.name <=> name)
|
|
133
136
|
end
|
|
134
137
|
|
|
135
138
|
private
|
|
136
139
|
|
|
140
|
+
#
|
|
141
|
+
# The tag's name as a version number, if it can be read as one, so
|
|
142
|
+
# that 1.10 sorts after 1.9.
|
|
143
|
+
#
|
|
144
|
+
def version_of(name)
|
|
145
|
+
Gem::Version.new(name.sub(/\A[^\d]*/, ''))
|
|
146
|
+
rescue ArgumentError
|
|
147
|
+
nil
|
|
148
|
+
end
|
|
149
|
+
|
|
137
150
|
#
|
|
138
151
|
#
|
|
139
152
|
#
|
data/man/man1/vclog-bump.1.ronn
CHANGED
data/man/man1/vclog-news.1.ronn
CHANGED
|
@@ -3,7 +3,7 @@ vclog-news(1) - output latest release notice
|
|
|
3
3
|
|
|
4
4
|
## SYNOPSIS
|
|
5
5
|
|
|
6
|
-
`vclog
|
|
6
|
+
`vclog-news`
|
|
7
7
|
|
|
8
8
|
## DESCRIPTION
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ Display the most recent entry in a project's history file. This command
|
|
|
11
11
|
does NOT show the latest tag message, rather it is useful for making
|
|
12
12
|
a new tag. For instnace:
|
|
13
13
|
|
|
14
|
-
`vclog
|
|
14
|
+
`vclog-news | git tag -a -F - v1.0.0`
|
|
15
15
|
|
|
16
16
|
This command will create a new git tag using the most recent message in
|
|
17
17
|
the history file.
|