Sha256: 5416b7517b74561ea8888916815235177d3f3a85c9a57ee46530843cab6c34d6

Contents?: true

Size: 483 Bytes

Versions: 9

Compression:

Stored size: 483 Bytes

Contents

#!/usr/bin/ruby
require 'colorize'

@msg = IO.read(ARGV[0]).force_encoding('UTF-8')

def commit_check
  standards = %w(fix: fix: feat: feat: style: style: doc: doc: docs: docs: ref: ref: refactor: refactor: chore: chore: test: test: Merge merge Revert revert)
  standards.each do |standard|
    check(standard)
  end
  puts '==> commit message不符合规范!'.red
  exit 1
end

def check(keyword)
  if @msg.start_with? keyword
    exit 0
  end
end

commit_check

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ggsm-1.7.5 lib/ggsm/hook/commit-msg
ggsm-1.7.4 lib/ggsm/hook/commit-msg
ggsm-1.7.3 lib/ggsm/hook/commit-msg
ggsm-1.7.2 lib/ggsm/hook/commit-msg
ggsm-1.7.1 lib/ggsm/hook/commit-msg
ggsm-1.7.0 lib/ggsm/hook/commit-msg
ggsm-1.6.2 lib/ggsm/hook/commit-msg
ggsm-1.6.1 lib/ggsm/hook/commit-msg
ggsm-1.6.0 lib/ggsm/hook/commit-msg