Custom Heuristics - rubyworks/vclog GitHub Wiki
You can configure custom log heuristics for your project. VCLog configurations are placed in a configuration file. We recommend using etc/vclog.rb
, but config/vclog.rb
and .vclog
or just vclog.rb
also work.
Within this file rules are defined via the #on
method.
on /updated? (README|VERSION|MANIFEST)/ do |commit|
commit.label = "Adminstrative Changes"
commit.level = -3
end
Configurations can also define commit types. Types make it easier
to categorize commits, assigning them labels and levels based on a
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
end
These rules can also massage the commit message.
on /\Aadmin:/ do |commit, matchdata|
commit.type = :admin
commit.message = matchdate.post_match
end
Lastly, you can customize the colorization of the certain formats via #colors
method.
colors :blue, :cyan, :green, :yellow, :red
A larger example might look something like:
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
NOTE: This last example is a little "old-school". The latest capabilities of custom heuristics allow them to be far more flexible then the above example indicates. For example, one could use commit.files
to determine a commit type, and not use a message pattern at all.