vclog 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +57 -0
- data/COPYING.rdoc +32 -0
- data/README.rdoc +18 -19
- data/features/git.feature +16 -16
- data/features/hg.feature +16 -16
- data/features/step_definitions/repo_steps.rb +2 -1
- data/features/support/aruba.rb +5 -1
- data/features/support/repo.rb +7 -3
- data/features/svn.feature +16 -16
- data/lib/vclog.rb +1 -1
- data/lib/vclog/adapters/abstract.rb +0 -19
- data/lib/vclog/adapters/git.rb +34 -6
- data/lib/vclog/adapters/svn.rb +1 -1
- data/lib/vclog/change.rb +43 -23
- data/lib/vclog/heuristics.rb +32 -49
- data/lib/vclog/heuristics/label.rb +29 -0
- data/lib/vclog/heuristics/rule.rb +33 -0
- data/lib/vclog/metadata.rb +2 -12
- data/lib/vclog/repo.rb +23 -19
- data/{ronn → man/man1}/index.txt +0 -0
- data/man/man1/vclog-autotag.1.html +117 -0
- data/{ronn/vclog-autotag.ronn → man/man1/vclog-autotag.1.ronn} +0 -0
- data/man/man1/vclog-bump.1.html +111 -0
- data/{ronn/vclog-bump.ronn → man/man1/vclog-bump.1.ronn} +0 -0
- data/man/man1/vclog-changelog.1.html +123 -0
- data/{ronn/vclog-changelog.ronn → man/man1/vclog-changelog.1.ronn} +0 -0
- data/man/man1/vclog-history.1.html +122 -0
- data/{ronn/vclog-history.ronn → man/man1/vclog-history.1.ronn} +0 -0
- data/man/man1/vclog-version.1.html +100 -0
- data/{ronn/vclog-version.ronn → man/man1/vclog-version.1.ronn} +0 -0
- data/man/man1/vclog.1.html +122 -0
- data/{ronn/vclog.ronn → man/man1/vclog.1.ronn} +0 -0
- data/test/unit/case_metadata.rb +11 -0
- data/test/unit/helper.rb +4 -0
- metadata +132 -122
- data/HISTORY.rdoc +0 -158
- data/LICENSE +0 -203
- data/lib/plugins/syckle/vclog.rb +0 -221
- data/lib/vclog/heuristics/default.rb +0 -24
- data/lib/vclog/meta/data.rb +0 -25
- data/lib/vclog/meta/package +0 -11
- data/lib/vclog/meta/profile +0 -18
- data/meta/data.rb +0 -25
- data/meta/package +0 -11
- data/meta/profile +0 -18
data/lib/vclog.rb
CHANGED
@@ -247,25 +247,6 @@ module Adapters
|
|
247
247
|
end
|
248
248
|
=end
|
249
249
|
|
250
|
-
# Find vclog config directory. This searches up from the current
|
251
|
-
# working directory for the following paths (in order):
|
252
|
-
#
|
253
|
-
# .vclog/
|
254
|
-
# .config/vclog/
|
255
|
-
# config/vclog/
|
256
|
-
#
|
257
|
-
def lookup_config
|
258
|
-
conf = nil
|
259
|
-
Dir.ascend(Dir.pwd) do |path|
|
260
|
-
check = Dir['{.vclog/,.config/vclog/,config/vclog/}/'].first
|
261
|
-
if check
|
262
|
-
conf = path
|
263
|
-
break
|
264
|
-
end
|
265
|
-
end
|
266
|
-
conf
|
267
|
-
end
|
268
|
-
|
269
250
|
public
|
270
251
|
|
271
252
|
#
|
data/lib/vclog/adapters/git.rb
CHANGED
@@ -7,6 +7,12 @@ module Adapters
|
|
7
7
|
#
|
8
8
|
class Git < Abstract
|
9
9
|
|
10
|
+
GIT_COMMIT_MARKER = '=====%n'
|
11
|
+
GIT_FIELD_MARKER = '-----%n'
|
12
|
+
|
13
|
+
RUBY_COMMIT_MARKER = "=====\n"
|
14
|
+
RUBY_FIELD_MARKER = "-----\n"
|
15
|
+
|
10
16
|
# TODO: in the future we might use grit, if it improves enough.
|
11
17
|
def initialize_framework
|
12
18
|
#require 'grit'
|
@@ -22,16 +28,38 @@ module Adapters
|
|
22
28
|
def extract_changes
|
23
29
|
list = []
|
24
30
|
changelog = `git log --pretty=format:"\036|||%ci|~|%aN|~|%H|~|%s"`.strip
|
25
|
-
|
26
|
-
|
31
|
+
|
32
|
+
command = 'git log --name-only --pretty=format:"' +
|
33
|
+
GIT_COMMIT_MARKER +
|
34
|
+
'%ci' +
|
35
|
+
GIT_FIELD_MARKER +
|
36
|
+
'%aN' +
|
37
|
+
GIT_FIELD_MARKER +
|
38
|
+
'%H' +
|
39
|
+
GIT_FIELD_MARKER +
|
40
|
+
'%s' +
|
41
|
+
GIT_FIELD_MARKER +
|
42
|
+
'"'
|
43
|
+
|
44
|
+
changes = `#{command}`.split(RUBY_COMMIT_MARKER)
|
27
45
|
changes.shift # throw the first (empty) entry away
|
28
46
|
changes.each do |entry|
|
29
|
-
date, who, id, msg = entry.split(
|
30
|
-
date
|
31
|
-
|
47
|
+
date, who, id, msg, files = entry.split(RUBY_FIELD_MARKER)
|
48
|
+
date = Time.parse(date)
|
49
|
+
files = files.split("\n")
|
50
|
+
list << Change.new(:id=>id, :date=>date, :who=>who, :msg=>msg, :files=>files)
|
32
51
|
end
|
33
52
|
list
|
34
|
-
end
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
#def extract_files(change_list)
|
57
|
+
# change_list.each do |change|
|
58
|
+
# files = `git show --pretty="format:" --name-only #{c.id}`
|
59
|
+
# files = files.split("\n")
|
60
|
+
# change.files = files
|
61
|
+
# end
|
62
|
+
#end
|
35
63
|
|
36
64
|
# TODO
|
37
65
|
#def extract_changes
|
data/lib/vclog/adapters/svn.rb
CHANGED
data/lib/vclog/change.rb
CHANGED
@@ -2,23 +2,33 @@ require 'vclog/kernel'
|
|
2
2
|
|
3
3
|
module VCLog
|
4
4
|
|
5
|
-
# The Change class models an
|
5
|
+
# The Change class models an entry in a change log.
|
6
6
|
#
|
7
7
|
class Change
|
8
8
|
|
9
9
|
include Comparable
|
10
10
|
|
11
|
+
# Commit reference id.
|
11
12
|
attr_accessor :id
|
13
|
+
|
14
|
+
# Date/time of commit.
|
12
15
|
attr_accessor :date
|
16
|
+
|
17
|
+
# Committer.
|
13
18
|
attr_accessor :author
|
19
|
+
|
20
|
+
# Commit message.
|
14
21
|
attr_accessor :message
|
15
22
|
|
23
|
+
# List of files changed in the commit.
|
24
|
+
attr_accessor :files
|
25
|
+
|
16
26
|
attr_accessor :type
|
17
27
|
attr_accessor :level
|
18
28
|
attr_accessor :label
|
19
29
|
|
20
30
|
#
|
21
|
-
def initialize(data={})
|
31
|
+
def initialize(data={})
|
22
32
|
data.each do |k,v|
|
23
33
|
__send__("#{k}=", v)
|
24
34
|
end
|
@@ -35,10 +45,20 @@ module VCLog
|
|
35
45
|
end
|
36
46
|
|
37
47
|
# Alternate name for id.
|
48
|
+
alias_method :ref, :id
|
49
|
+
alias_method :ref=, :id=
|
50
|
+
alias_method :reference, :id
|
51
|
+
alias_method :reference=, :id=
|
52
|
+
|
53
|
+
# Alternate name for id.
|
54
|
+
#
|
55
|
+
# @deprecated
|
38
56
|
alias_method :rev, :id
|
39
57
|
alias_method :rev=, :id=
|
40
58
|
|
41
59
|
# Alternate name for id.
|
60
|
+
#
|
61
|
+
# @deprecated
|
42
62
|
alias_method :revision, :id
|
43
63
|
alias_method :revision=, :id=
|
44
64
|
|
@@ -46,7 +66,6 @@ module VCLog
|
|
46
66
|
alias_method :msg, :message
|
47
67
|
alias_method :msg=, :message=
|
48
68
|
|
49
|
-
|
50
69
|
# Alias for author.
|
51
70
|
alias_method :who, :author
|
52
71
|
alias_method :who=, :author=
|
@@ -63,26 +82,6 @@ module VCLog
|
|
63
82
|
# end
|
64
83
|
#end
|
65
84
|
|
66
|
-
=begin
|
67
|
-
#
|
68
|
-
def type_phrase
|
69
|
-
case type.to_s
|
70
|
-
when 'maj', 'major'
|
71
|
-
'Major Enhancements'
|
72
|
-
when 'min', 'minor'
|
73
|
-
'Minor Enhancements'
|
74
|
-
when 'bug'
|
75
|
-
'Bug Fixes'
|
76
|
-
when ''
|
77
|
-
'General Enhancements'
|
78
|
-
when '-'
|
79
|
-
'Administrative Changes'
|
80
|
-
else
|
81
|
-
"#{type.to_s.capitalize} Enhancements"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
=end
|
85
|
-
|
86
85
|
#
|
87
86
|
def <=>(other)
|
88
87
|
other.date <=> date
|
@@ -92,6 +91,9 @@ module VCLog
|
|
92
91
|
"#<Change:#{object_id} #{date}>"
|
93
92
|
end
|
94
93
|
|
94
|
+
# TODO: Rename revision to `referece` or `ref`.
|
95
|
+
|
96
|
+
#
|
95
97
|
def to_h
|
96
98
|
{ 'author' => @author,
|
97
99
|
'date' => @date,
|
@@ -119,6 +121,24 @@ module VCLog
|
|
119
121
|
end
|
120
122
|
|
121
123
|
=begin
|
124
|
+
#
|
125
|
+
def type_phrase
|
126
|
+
case type.to_s
|
127
|
+
when 'maj', 'major'
|
128
|
+
'Major Enhancements'
|
129
|
+
when 'min', 'minor'
|
130
|
+
'Minor Enhancements'
|
131
|
+
when 'bug'
|
132
|
+
'Bug Fixes'
|
133
|
+
when ''
|
134
|
+
'General Enhancements'
|
135
|
+
when '-'
|
136
|
+
'Administrative Changes'
|
137
|
+
else
|
138
|
+
"#{type.to_s.capitalize} Enhancements"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
122
142
|
# Looks for a "[type]" indicator at the end of the commit message.
|
123
143
|
# If that is not found, it looks at front of message for
|
124
144
|
# "[type]" or "[type]:". Failing that it tries just "type:".
|
data/lib/vclog/heuristics.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
|
+
require 'vclog/heuristics/label'
|
2
|
+
require 'vclog/heuristics/rule'
|
3
|
+
|
1
4
|
module VCLog
|
2
5
|
|
3
6
|
#
|
4
7
|
class Heuristics
|
5
8
|
|
6
|
-
# Load heuristics from a
|
9
|
+
# Load heuristics from a designated file.
|
7
10
|
#
|
8
|
-
#
|
11
|
+
# @param file [String] configuration file
|
9
12
|
#
|
10
13
|
def self.load(file)
|
11
|
-
|
12
|
-
|
13
|
-
else
|
14
|
-
file = File.dirname(__FILE__) + '/heuristics/default.rb'
|
15
|
-
end
|
16
|
-
|
17
|
-
h = new
|
18
|
-
h.instance_eval(File.read(file), file)
|
19
|
-
h
|
14
|
+
raise LoadError unless File.exist?(file)
|
15
|
+
new{ instance_eval(File.read(file), file) }
|
20
16
|
end
|
21
17
|
|
22
18
|
#
|
23
|
-
def initialize
|
19
|
+
def initialize(&block)
|
24
20
|
@rules = []
|
25
21
|
@labels = {}
|
22
|
+
|
23
|
+
if block
|
24
|
+
instance_eval(&block)
|
25
|
+
else
|
26
|
+
default
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
#
|
@@ -52,49 +54,30 @@ module VCLog
|
|
52
54
|
@labels[type.to_sym] = Label.new(type, level, label)
|
53
55
|
end
|
54
56
|
|
55
|
-
#
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
# Default settings.
|
58
|
+
def default
|
59
|
+
set :major, 1, "Major Enhancements"
|
60
|
+
set :bug, 0, "Bug Fixes"
|
61
|
+
set :minor, -1, "Minor Enhancements"
|
62
|
+
set :doc, -1, "Documentation Changes"
|
63
|
+
set :admin, -2, "Administrative Changes"
|
64
|
+
|
65
|
+
on /^(\w+):/ do |msg, md|
|
66
|
+
word = md[1]
|
67
|
+
[word.to_sym, md.post_match]
|
62
68
|
end
|
63
69
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
attr :label
|
69
|
-
|
70
|
-
#
|
71
|
-
def to_a
|
72
|
-
[type, level, label]
|
70
|
+
on /\[(\w+)\]\s*$/ do |msg, md|
|
71
|
+
word = md[1]
|
72
|
+
[word.to_sym, md.pre_match]
|
73
73
|
end
|
74
|
-
end
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
def initialize(pattern, &block)
|
80
|
-
@pattern = pattern
|
81
|
-
@block = block
|
75
|
+
on /updated? (README|PROFILE|PACKAGE|VERSION|MANIFEST)/ do
|
76
|
+
:admin
|
82
77
|
end
|
83
78
|
|
84
|
-
|
85
|
-
|
86
|
-
if matchdata = @pattern.match(message)
|
87
|
-
case @block.arity
|
88
|
-
when 0
|
89
|
-
@block.call
|
90
|
-
when 1
|
91
|
-
@block.call(matchdata)
|
92
|
-
else
|
93
|
-
@block.call(message, matchdata)
|
94
|
-
end
|
95
|
-
else
|
96
|
-
nil
|
97
|
-
end
|
79
|
+
on /(bump|bumped|prepare) version/ do
|
80
|
+
:admin
|
98
81
|
end
|
99
82
|
end
|
100
83
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module VCLog
|
2
|
+
|
3
|
+
class Heuristics
|
4
|
+
|
5
|
+
#
|
6
|
+
#
|
7
|
+
class Label
|
8
|
+
#
|
9
|
+
def initialize(type, level, label)
|
10
|
+
@type = type
|
11
|
+
@level = level.to_i
|
12
|
+
@label = label.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
attr :type
|
16
|
+
|
17
|
+
attr :level
|
18
|
+
|
19
|
+
attr :label
|
20
|
+
|
21
|
+
#
|
22
|
+
def to_a
|
23
|
+
[type, level, label]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module VCLog
|
2
|
+
|
3
|
+
class Heuristics
|
4
|
+
|
5
|
+
#
|
6
|
+
class Rule
|
7
|
+
#
|
8
|
+
def initialize(pattern, &block)
|
9
|
+
@pattern = pattern
|
10
|
+
@block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
# Process the rule.
|
14
|
+
def call(message)
|
15
|
+
if matchdata = @pattern.match(message)
|
16
|
+
case @block.arity
|
17
|
+
when 0
|
18
|
+
@block.call
|
19
|
+
when 1
|
20
|
+
@block.call(matchdata)
|
21
|
+
else
|
22
|
+
@block.call(message, matchdata)
|
23
|
+
end
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
data/lib/vclog/metadata.rb
CHANGED
data/lib/vclog/repo.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'confection'
|
2
|
+
|
1
3
|
require 'vclog/adapters'
|
2
4
|
require 'vclog/heuristics'
|
3
5
|
require 'vclog/history_file'
|
@@ -10,10 +12,10 @@ module VCLog
|
|
10
12
|
%w{display}.each{ |name| undef_method(name) }
|
11
13
|
|
12
14
|
# File glob used to find project root directory.
|
13
|
-
ROOT_GLOB = '{.
|
15
|
+
ROOT_GLOB = '{.git/,.hg/,_darcs/,.svn/}'
|
14
16
|
|
15
17
|
# File glob used to find the vclog configuration directory.
|
16
|
-
CONFIG_GLOB = '{
|
18
|
+
#CONFIG_GLOB = '{.,.config/,config/,task/,tasks/}vclog{,.rb}'
|
17
19
|
|
18
20
|
# Project's root directory.
|
19
21
|
attr :root
|
@@ -30,7 +32,7 @@ module VCLog
|
|
30
32
|
@root = root || lookup_root
|
31
33
|
@options = options
|
32
34
|
|
33
|
-
|
35
|
+
#@config_directory = Dir[File.join(@root, CONFIG_GLOB)]
|
34
36
|
|
35
37
|
@level = (options[:level] || 0).to_i
|
36
38
|
|
@@ -46,9 +48,9 @@ module VCLog
|
|
46
48
|
end
|
47
49
|
|
48
50
|
#
|
49
|
-
def config_directory
|
50
|
-
|
51
|
-
end
|
51
|
+
#def config_directory
|
52
|
+
# @config_directory
|
53
|
+
#end
|
52
54
|
|
53
55
|
#
|
54
56
|
def force?
|
@@ -59,23 +61,25 @@ module VCLog
|
|
59
61
|
def read_type
|
60
62
|
dir = nil
|
61
63
|
Dir.chdir(root) do
|
62
|
-
dir = Dir.glob("{.
|
64
|
+
dir = Dir.glob("{.git,.hg,.svn,_darcs}").first
|
63
65
|
end
|
64
66
|
dir[1..-1] if dir
|
65
67
|
end
|
66
68
|
|
67
69
|
# Find project root. This searches up from the current working
|
68
|
-
# directory for
|
70
|
+
# directory for a Confection configuration file or source control
|
71
|
+
# manager directory.
|
69
72
|
#
|
70
|
-
# .
|
71
|
-
# .
|
72
|
-
#
|
73
|
-
# .
|
74
|
-
#
|
73
|
+
# .co
|
74
|
+
# .git/
|
75
|
+
# .hg/
|
76
|
+
# .svn/
|
77
|
+
# _darcs/
|
75
78
|
#
|
76
|
-
|
79
|
+
# If all else fails the current directory is returned.
|
80
|
+
def lookup_root
|
77
81
|
root = nil
|
78
|
-
Dir.ascend(
|
82
|
+
Dir.ascend(Dir.pwd) do |path|
|
79
83
|
check = Dir[ROOT_GLOB].first
|
80
84
|
if check
|
81
85
|
root = path
|
@@ -87,13 +91,13 @@ module VCLog
|
|
87
91
|
|
88
92
|
# Load heuristics script.
|
89
93
|
def heuristics
|
90
|
-
@heuristics ||= Heuristics.
|
94
|
+
@heuristics ||= Heuristics.new(&Confection[:vclog])
|
91
95
|
end
|
92
96
|
|
93
97
|
# Heurtistics script.
|
94
|
-
def heuristics_file
|
95
|
-
|
96
|
-
end
|
98
|
+
#def heuristics_file
|
99
|
+
# @heuristics_file ||= Dir[File.join(root, CONFIG_GLOB)].first
|
100
|
+
#end
|
97
101
|
|
98
102
|
# Access to Repo's HISTORY file.
|
99
103
|
def history_file
|