vclog 1.9.1 → 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.rdoc → History.md} +74 -13
- data/License.txt +23 -0
- data/{README.rdoc → README.md} +46 -45
- data/bin/vclog-news +6 -0
- 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/cli/news.rb +29 -0
- data/lib/vclog/config.rb +149 -0
- data/lib/vclog/core_ext.rb +14 -101
- data/lib/vclog/heuristics.rb +37 -5
- data/lib/vclog/history_file.rb +15 -3
- data/lib/vclog/metadata.rb +1 -16
- data/lib/vclog/repo.rb +27 -55
- data/lib/vclog/report.rb +38 -20
- data/lib/vclog/tag.rb +19 -6
- data/lib/vclog/version.rb +3 -0
- data/man/man1/index.txt +1 -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 +25 -0
- data/man/man1/vclog-version.1.ronn +1 -1
- metadata +109 -108
- data/.ruby +0 -61
- data/COPYING.rdoc +0 -32
- data/features/git.feature +0 -86
- data/features/hg.feature +0 -86
- data/features/step_definitions/history_steps.rb +0 -29
- data/features/step_definitions/repo_steps.rb +0 -72
- data/features/support/ae.rb +0 -1
- data/features/support/aruba.rb +0 -5
- data/features/support/loadpath.rb +0 -2
- data/features/support/repo.rb +0 -19
- data/features/svn.feature +0 -86
- data/lib/vclog.yml +0 -61
- 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-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/test/unit/case_metadata.rb +0 -11
- data/test/unit/helper.rb +0 -4
data/lib/vclog/repo.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
require 'confection'
|
|
2
|
-
|
|
3
1
|
require 'vclog/core_ext'
|
|
4
2
|
require 'vclog/adapters'
|
|
3
|
+
require 'vclog/config'
|
|
5
4
|
require 'vclog/heuristics'
|
|
6
5
|
require 'vclog/history_file'
|
|
7
6
|
require 'vclog/changelog'
|
|
@@ -11,18 +10,14 @@ require 'vclog/report'
|
|
|
11
10
|
|
|
12
11
|
module VCLog
|
|
13
12
|
|
|
13
|
+
# Encapsulate representaiton of the repository.
|
|
14
14
|
#
|
|
15
15
|
class Repo
|
|
16
16
|
|
|
17
17
|
#
|
|
18
18
|
# File glob used to find project root directory.
|
|
19
19
|
#
|
|
20
|
-
ROOT_GLOB = '{.git/,.hg/,_darcs/,.svn/}'
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
# Project's root directory.
|
|
24
|
-
#
|
|
25
|
-
attr :root
|
|
20
|
+
ROOT_GLOB = '{.ruby,.map/,.git/,.hg/,_darcs/,.svn/}'
|
|
26
21
|
|
|
27
22
|
#
|
|
28
23
|
# Options hash.
|
|
@@ -33,10 +28,12 @@ module VCLog
|
|
|
33
28
|
# Setup new Repo instance.
|
|
34
29
|
#
|
|
35
30
|
def initialize(root, options={})
|
|
36
|
-
|
|
31
|
+
options[:root] = root if root
|
|
32
|
+
|
|
33
|
+
@config = Config.new(options)
|
|
37
34
|
@options = options
|
|
38
35
|
|
|
39
|
-
vcs_type =
|
|
36
|
+
vcs_type = @config.vcs_type
|
|
40
37
|
|
|
41
38
|
raise ArgumentError, "Not a recognized version control system." unless vcs_type
|
|
42
39
|
|
|
@@ -51,53 +48,31 @@ module VCLog
|
|
|
51
48
|
end
|
|
52
49
|
|
|
53
50
|
#
|
|
54
|
-
#
|
|
51
|
+
# Configuration.
|
|
55
52
|
#
|
|
56
|
-
def
|
|
57
|
-
|
|
53
|
+
def config
|
|
54
|
+
@config
|
|
58
55
|
end
|
|
59
56
|
|
|
60
57
|
#
|
|
58
|
+
# Project root directory.
|
|
61
59
|
#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
dir = nil
|
|
65
|
-
Dir.chdir(root) do
|
|
66
|
-
dir = Dir.glob("{.git,.hg,.svn,_darcs}").first
|
|
67
|
-
end
|
|
68
|
-
dir[1..-1] if dir
|
|
60
|
+
def root
|
|
61
|
+
config.root
|
|
69
62
|
end
|
|
70
63
|
|
|
71
64
|
#
|
|
72
|
-
#
|
|
73
|
-
# directory for a Confection configuration file or source control
|
|
74
|
-
# manager directory.
|
|
75
|
-
#
|
|
76
|
-
# .co
|
|
77
|
-
# .git/
|
|
78
|
-
# .hg/
|
|
79
|
-
# .svn/
|
|
80
|
-
# _darcs/
|
|
81
|
-
#
|
|
82
|
-
# If all else fails the current directory is returned.
|
|
65
|
+
# Load heuristics script.
|
|
83
66
|
#
|
|
84
|
-
def
|
|
85
|
-
|
|
86
|
-
Dir.ascend(Dir.pwd) do |path|
|
|
87
|
-
check = Dir[ROOT_GLOB].first
|
|
88
|
-
if check
|
|
89
|
-
root = path
|
|
90
|
-
break
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
root || Dir.pwd
|
|
67
|
+
def heuristics
|
|
68
|
+
config.heuristics
|
|
94
69
|
end
|
|
95
70
|
|
|
96
71
|
#
|
|
97
|
-
#
|
|
72
|
+
# Check force option.
|
|
98
73
|
#
|
|
99
|
-
def
|
|
100
|
-
|
|
74
|
+
def force?
|
|
75
|
+
config.force?
|
|
101
76
|
end
|
|
102
77
|
|
|
103
78
|
#
|
|
@@ -169,7 +144,7 @@ module VCLog
|
|
|
169
144
|
|
|
170
145
|
#ver = repo.bump(version)
|
|
171
146
|
|
|
172
|
-
name =
|
|
147
|
+
name = config.version || 'HEAD'
|
|
173
148
|
user = adapter.user
|
|
174
149
|
date = ::Time.now + (3600 * 24) # one day ahead
|
|
175
150
|
|
|
@@ -198,7 +173,7 @@ module VCLog
|
|
|
198
173
|
# gather changes for each delta
|
|
199
174
|
delta.each do |tag, (started, ended)|
|
|
200
175
|
if started
|
|
201
|
-
set = changes.select{ |c| c.date
|
|
176
|
+
set = changes.select{ |c| c.date > started && c.date <= ended }
|
|
202
177
|
#gt_vers, gt_date = gt.name, gt.date
|
|
203
178
|
#lt_vers, lt_date = lt.name, lt.date
|
|
204
179
|
#gt_date = Time.parse(gt_date) unless Time===gt_date
|
|
@@ -208,7 +183,7 @@ module VCLog
|
|
|
208
183
|
#lt_vers, lt_date = lt.name, lt.date
|
|
209
184
|
#lt_date = Time.parse(lt_date) unless Time===lt_date
|
|
210
185
|
#log = changelog.before(lt_date)
|
|
211
|
-
set = changes.select{ |c| c.date
|
|
186
|
+
set = changes.select{ |c| c.date <= ended }
|
|
212
187
|
end
|
|
213
188
|
rel << Release.new(tag, set)
|
|
214
189
|
end
|
|
@@ -233,8 +208,10 @@ module VCLog
|
|
|
233
208
|
#
|
|
234
209
|
def bump
|
|
235
210
|
last_release = releases(changes).first
|
|
236
|
-
max = last_release.changes.map{ |c| c.level }.max
|
|
237
|
-
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
|
|
238
215
|
bump_part('major')
|
|
239
216
|
elsif max >= 0
|
|
240
217
|
bump_part('minor')
|
|
@@ -249,12 +226,7 @@ module VCLog
|
|
|
249
226
|
def bump_part(part=nil)
|
|
250
227
|
raise "bad version part - #{part}" unless ['major', 'minor', 'patch', 'build', ''].include?(part.to_s)
|
|
251
228
|
|
|
252
|
-
|
|
253
|
-
v = tags[-1].name # TODO: ensure the latest version
|
|
254
|
-
v = tags[-2].name if v == 'HEAD'
|
|
255
|
-
else
|
|
256
|
-
v = '0.0.0'
|
|
257
|
-
end
|
|
229
|
+
v = adapter.version
|
|
258
230
|
|
|
259
231
|
v = v.split(/\W/) # TODO: preserve split chars
|
|
260
232
|
|
data/lib/vclog/report.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'ostruct'
|
|
2
|
-
#require 'ansi'
|
|
3
2
|
require 'erb'
|
|
3
|
+
#require 'ansi'
|
|
4
4
|
|
|
5
5
|
module VCLog
|
|
6
6
|
|
|
@@ -31,13 +31,12 @@ module VCLog
|
|
|
31
31
|
# An instance of VCLog::Repo.
|
|
32
32
|
#
|
|
33
33
|
def initialize(repo, options)
|
|
34
|
-
@repo
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
34
|
+
@repo = repo
|
|
35
|
+
|
|
36
|
+
options[:type] ||= 'changelog'
|
|
37
|
+
options[:format] ||= 'ansi'
|
|
38
|
+
|
|
39
|
+
@options = OpenStruct.new(options)
|
|
41
40
|
|
|
42
41
|
@options.level ||= 0
|
|
43
42
|
end
|
|
@@ -46,7 +45,7 @@ module VCLog
|
|
|
46
45
|
# Returns a Changelog object.
|
|
47
46
|
#
|
|
48
47
|
def changelog
|
|
49
|
-
changes = options.point ? repo.
|
|
48
|
+
changes = options.point ? repo.change_points : repo.changes
|
|
50
49
|
ChangeLog.new(changes).above(options.level)
|
|
51
50
|
end
|
|
52
51
|
|
|
@@ -57,6 +56,20 @@ module VCLog
|
|
|
57
56
|
repo.releases(changelog.changes)
|
|
58
57
|
end
|
|
59
58
|
|
|
59
|
+
#
|
|
60
|
+
# Report type.
|
|
61
|
+
#
|
|
62
|
+
def type
|
|
63
|
+
options.type
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
#
|
|
67
|
+
# Report format.
|
|
68
|
+
#
|
|
69
|
+
def format
|
|
70
|
+
options.format
|
|
71
|
+
end
|
|
72
|
+
|
|
60
73
|
#
|
|
61
74
|
# User as given by the command line or from the repo.
|
|
62
75
|
#
|
|
@@ -99,7 +112,7 @@ module VCLog
|
|
|
99
112
|
#
|
|
100
113
|
def title
|
|
101
114
|
return options.title if options.title
|
|
102
|
-
case
|
|
115
|
+
case type
|
|
103
116
|
when :history
|
|
104
117
|
"RELEASE HISTORY"
|
|
105
118
|
else
|
|
@@ -114,23 +127,23 @@ module VCLog
|
|
|
114
127
|
# Print report.
|
|
115
128
|
#
|
|
116
129
|
def print
|
|
117
|
-
|
|
118
|
-
options.format ||= 'ansi'
|
|
130
|
+
require_formatter(format)
|
|
119
131
|
|
|
120
|
-
|
|
132
|
+
tmpl_glob = File.join(DIR, 'templates', "#{type}.#{format}.{erb,rb}")
|
|
133
|
+
tmpl_file = Dir[tmpl_glob].first
|
|
121
134
|
|
|
122
|
-
|
|
135
|
+
raise "could not find template -- #{type}.#{format}" unless tmpl_file
|
|
123
136
|
|
|
124
|
-
|
|
137
|
+
tmpl = File.read(tmpl_file)
|
|
125
138
|
|
|
126
|
-
case File.extname(
|
|
139
|
+
case File.extname(tmpl_file)
|
|
127
140
|
when '.rb'
|
|
128
|
-
eval(
|
|
141
|
+
eval(tmpl, binding, tmpl_file)
|
|
129
142
|
when '.erb'
|
|
130
|
-
erb = ERB.new(
|
|
143
|
+
erb = ERB.new(tmpl, :trim_mode=>'<>')
|
|
131
144
|
erb.result(binding)
|
|
132
145
|
else
|
|
133
|
-
raise "unrecognized template
|
|
146
|
+
raise "unrecognized template type -- #{tmpl_file}"
|
|
134
147
|
end
|
|
135
148
|
end
|
|
136
149
|
|
|
@@ -178,7 +191,12 @@ module VCLog
|
|
|
178
191
|
@_rdoc ||= (
|
|
179
192
|
gem 'rdoc' rescue nil # to ensure latest version
|
|
180
193
|
require 'rdoc'
|
|
181
|
-
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
|
|
182
200
|
)
|
|
183
201
|
end
|
|
184
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/index.txt
CHANGED
data/man/man1/vclog-bump.1.ronn
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
vclog-news(1) - output latest release notice
|
|
2
|
+
============================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`vclog-news`
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
Display the most recent entry in a project's history file. This command
|
|
11
|
+
does NOT show the latest tag message, rather it is useful for making
|
|
12
|
+
a new tag. For instnace:
|
|
13
|
+
|
|
14
|
+
`vclog-news | git tag -a -F - v1.0.0`
|
|
15
|
+
|
|
16
|
+
This command will create a new git tag using the most recent message in
|
|
17
|
+
the history file.
|
|
18
|
+
|
|
19
|
+
## OPTIONS
|
|
20
|
+
|
|
21
|
+
No options yet.
|
|
22
|
+
|
|
23
|
+
## SEE ALSO
|
|
24
|
+
|
|
25
|
+
vclog(1)
|