Repository navigation
Custom Heuristics
You can configure custom log heuristics for your project. VCLog uses the RC gem to handle configuration. To define your own custom heuristics, create a Config.rb in your project's root directory and add a vclog config section to it.
config :vclog do
...
endWithin this block we can define rules via the #on method.
on /updated? (README|VERSION|MANIFEST)/ do |commit|
commit.label = "Adminstrative Changes"
commit.level = -3
endTo make things easier we can setup commit types. Types make it easier to categorize commits, assigning them labels and levels base on the type name. Use #type in the rules to specify the level and label of a commit type.
type :admin, -2, "Administrave Changes"
on /updated? (README|VERSION|MANIFEST)/ do |commit|
commit.type = :admin
endThese rules can also "massage" the commit message.
on /\Aadmin:/ do |commit, matchdata|
commit.type = :admin
commit.message = matchdate.post_match
endLastly, we can customize the colorization of the certain formats via #colors method.
colors :blue, :cyan, :green, :yellow, :redA larger example might look something like:
config :vclog do
type :major, 1, "Major Enhancements"
type :bug, 0, "Bug Fixes"
type :minor, -1, "Minor Enhancements"
type :admin, -2, "Administrative Changes"
on /^generate:/ do |commit|
commit.type = :minor
end
on /^admin:/ do |commit|
commit.type = :admin
end
on /^minor:/ do |commit|
commit.type = :minor
end
on /^major:/ do |commit|
commit.type = :major
end
on /updated? (README|PROFILE|PACKAGE|VERSION|MANIFEST)/ do
commit.type = :admin
end
on /bump(ed)? version/ do
commit.type = :admin
end
on /^(\w+):/ do |word|
commit.type = word.to_sym
commit.label = "#{word.capitalize} Changes"
end
on /\[(\w+)\]\s*$/ do |word|
commit.type = word.to_sym
commit.label = "#{word.capitalize} Changes"
end
endNOTE: This last example is a little "old-school". The latest capabilities of custom heuristics allow them to be far more flexible then than above example indicate. For example, one could use commit.files to determine a commit type, and not use a message pattern at all.