Skip to content

Commit

Permalink
Merge pull request #345 from rhysd/check-changelog
Browse files Browse the repository at this point in the history
Check changelog
  • Loading branch information
thinca committed Nov 29, 2015
2 parents 3b2de16 + a84032d commit 813db6b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -16,7 +16,7 @@ addons:
- lua5.1

install:
- bash install-vim.sh
- bash scripts/install-vim.sh
- if [ x"$HEAD" = "xyes" ]; then export PATH=$HOME/vim/bin:$PATH; fi

before_script:
Expand All @@ -33,6 +33,7 @@ script:
- sh /tmp/vim-vimlint/bin/vimlint.sh -l /tmp/vim-vimlint -p /tmp/vim-vimlparser -e EVL103=1 -e EVL102.l:_=1 -c func_abort=1 autoload
# - /tmp/vim-themis/bin/themis --runtimepath /tmp/vimproc --reporter dot
- /tmp/vim-themis/bin/themis --runtimepath /tmp/vimproc --exclude ConcurrentProcess --reporter dot
- ruby scripts/check-changelog.rb
notifications:
webhooks:
urls:
Expand Down
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -83,7 +83,7 @@ f82a6fc3f8b17f9492980b26d49dadf93bf3a915
Previous stop() is same to kill().
7998c7cb1ab3a263a47dd6de0fe51fb91dae06ab
Modules: Prelude
path2project_directory recognize git submodule.
path2project_directory recognize git submodule.
114b44e70a14d267b8b66bfc0ade2988144c3a42
Modules: *
If file 'Prelude' exists in current directory,
Expand Down
42 changes: 42 additions & 0 deletions scripts/check-changelog.rb
@@ -0,0 +1,42 @@
ChangesPath = ARGV[0] || 'Changes'
raise "#{ChangesPath} does not exist" unless File.exists? ChangesPath

def git_hash?(hash)
system "git rev-parse --quiet --verify #{hash} > /dev/null"
end

def check(change)
success = true
git_hash, *description = change

unless git_hash?(git_hash)
STDERR.puts "Commit '#{git_hash}' does not exist in this repository."
success = false
end

case
when description.empty?
STDERR.puts "No description for commit '#{git_hash}'"
success = false
when description.first !~ /^\tModules:\s+/
STDERR.puts "Description must start with 'Modules:': #{description.first}"
success = false
end

description.each do |line|
unless line =~ /^\t/
STDERR.puts "All lines of description must start with \\t: #{line}"
success = false
end
end

success
end

success = File.foreach(ChangesPath)
.slice_before{|l| l =~ /^\h+$/ }
.map{|b| b.map(&:chop!)}
.map{|c| check c}
.all?

exit(success ? 0 : 1)
File renamed without changes.

0 comments on commit 813db6b

Please sign in to comment.