From 1f9f0552cb80c8a7e247d2a2061d253a94860309 Mon Sep 17 00:00:00 2001 From: Richard Hoyle <638442+rahrah@users.noreply.github.com> Date: Mon, 4 Jun 2018 16:35:36 +0100 Subject: [PATCH 1/2] Get Version from git describe not travis envvar Users should get version number from git rather than a possibly non-existent environment variable. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 5f58cb6d9..28941d1ca 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ namespace :book do `cp progit.asc progit.asc.bak` begin - version_string = ENV['TRAVIS_TAG'] || '0' + version_string = `git describe --tags`.chomp text = File.read('progit.asc') new_contents = text.gsub("$$VERSION$$", version_string).gsub("$$DATE$$", Time.now.strftime("%Y-%m-%d")) File.open("progit.asc", "w") {|file| file.puts new_contents } From 98c116c41a652b68beecc29f9e83c9a286874dc0 Mon Sep 17 00:00:00 2001 From: Richard Hoyle <638442+rahrah@users.noreply.github.com> Date: Thu, 7 Jun 2018 17:43:12 +0100 Subject: [PATCH 2/2] Get Version from git if travis envvar not set Get version number from git if travis envvar not set. Default to 0 if all fails. --- Rakefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 28941d1ca..98733dec8 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,10 @@ namespace :book do `cp progit.asc progit.asc.bak` begin - version_string = `git describe --tags`.chomp + version_string = ENV['TRAVIS_TAG'] || `git describe --tags`.chomp + if version_string.empty? + version_string = '0' + end text = File.read('progit.asc') new_contents = text.gsub("$$VERSION$$", version_string).gsub("$$DATE$$", Time.now.strftime("%Y-%m-%d")) File.open("progit.asc", "w") {|file| file.puts new_contents }