Skip to content

Navigation Menu

Sign up
trans edited this page Dec 12, 2011 · 4 revisions

You can configure custom log heuristics for your project. VCLog uses the confection gem to handle configuration. To define your own custom heuristics, create a .confile or Confile in your project's root directory and add a vclog section to it.

vclog do
 ...
end

Within this block we can define rules via the #on method.

 on /updated? (README|VERSION|MANIFEST)/ do |commit|
 commit.label = "Adminstrative Changes"
 commit.level = -3
 end

To 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
 end

These rules can also "massage" the commit message.

 on /\Aadmin:/ do |commit, matchdata|
 commit.type = :admin
 commit.message = matchdate.post_match
 end

Lastly, we can customize the colorization of the certain formats via #colors method.

 colors :blue, :cyan, :green, :yellow, :red

A larger example might look something like:

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
end

NOTE: 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 a pattern at all.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /