From b14d61ccf029615b4e381e5db0139d4cbe0ae3b8 Mon Sep 17 00:00:00 2001 From: Karl Southern Date: Tue, 17 May 2016 17:24:25 +0100 Subject: [PATCH] Pre-release checks test. --- Rakefile | 20 ++++++++++++++++++++ Vagrantfile | 1 + 2 files changed, 21 insertions(+) diff --git a/Rakefile b/Rakefile index dff9e9f..01b3779 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require 'logstash/devutils/rake' require 'jars/installer' +require 'rubygems' desc 'Fetch any jars required for this plugin' task :install_jars do @@ -7,3 +8,22 @@ task :install_jars do ENV['JARS_VENDOR'] = 'false' Jars::Installer.new.vendor_jars!(false) end + +desc 'Pre-release checks' +task :pre_release_checks do + + if `git status --porcelain`.chomp.length > 0 + raise "You have unstaged or uncommitted changes! Please only deploy from a clean working directory!" + end + + spec = Gem::Specification::load("logstash-output-jdbc.gemspec") + expected_tag_name = "v#{spec.version}" + + current_tag_name = `git describe --exact-match --tags HEAD`.chomp + if $? == 0 + raise "Expected git tag to be '#{expected_tag_name}', but got '#{current_tag_name}'." if current_tag_name != expected_tag_name + else + raise "Expected git tag to be '#{expected_tag_name}, but got nothing." + end + +end diff --git a/Vagrantfile b/Vagrantfile index 0796074..1cde748 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,6 +6,7 @@ Vagrant.configure(2) do |config| config.vm.synced_folder '.', '/vagrant', type: :virtualbox config.vm.provision 'shell', inline: <<-EOP + apt-get install git -y -q gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby-1.7 usermod -a -G rvm vagrant