#!/usr/bin/env ruby def arrow(args) arrow = "===> " if args.respond_to?(:each) puts args.map! { |r| arrow + r }.join("\n") else puts arrow + args end end commit_file = ARGV[0] message = `cat #{commit_file}` filter = /\A(\d[\d ,]+) - ([^\n]+)(\n{2,}(.+))?\z/m # matches either # # "123 - Some Message" # # Or # # "123 - Some Message # # Definitely something here # More optional stuff" match = filter.match message if match exit 0 else puts "" arrow "============================================== Enforcing Sentia Commit Message Policy ============================================== Fall in line soldier, correct commit format is - Summary Message o p t i o n a l where id = trello card/tracker issue id/number eg 456 - Fix user.company nilclass issue with NullCompany or 123 - Add archive post action Add POST posts#archive action Add GET posts#archived action Add 'Archive' button to /posts/:id/edit page Add hide archived posts from GET /posts Add GET /posts/archived route and << views, view styling is changed to make it obvious that the post is archived".split("\n") puts "" exit 1 end