From e77b40154e5dfa99987dc37235a13f974feaa9c5 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 29 Nov 2015 01:31:50 +0900 Subject: [PATCH 1/3] Move isntall-vim.sh to scripts directory --- .travis.yml | 2 +- install-vim.sh => scripts/install-vim.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename install-vim.sh => scripts/install-vim.sh (100%) diff --git a/.travis.yml b/.travis.yml index d2efc2bab..3ce409cb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/install-vim.sh b/scripts/install-vim.sh similarity index 100% rename from install-vim.sh rename to scripts/install-vim.sh From 3dfb08e4ad8a3a10105ccf28cfe2162dcb61bfcd Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 29 Nov 2015 02:08:19 +0900 Subject: [PATCH 2/3] Fix changelog --- Changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changes b/Changes index 59c1ac358..d312e2c4a 100644 --- a/Changes +++ b/Changes @@ -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, From a84032d93eeb953f74e361be5fbdd9691c5647f4 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 29 Nov 2015 02:09:28 +0900 Subject: [PATCH 3/3] Add script to check changelog and run it on Travis Enumerable#lazy is not available because Ruby is 1.9.3 on Travis --- .travis.yml | 1 + scripts/check-changelog.rb | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 scripts/check-changelog.rb diff --git a/.travis.yml b/.travis.yml index 3ce409cb3..3b8b002d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/scripts/check-changelog.rb b/scripts/check-changelog.rb new file mode 100644 index 000000000..4f548ab75 --- /dev/null +++ b/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)