From 6707d7e9240b12b967b4631c89c57d6ab529d200 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 12 Jun 2019 14:13:34 +0100 Subject: [PATCH] extconf.rb: Always write VERSION if we have .git This ensures VERSION is updated when the repo is updated --- ext/extconf.rb | 5 ++--- sassc.gemspec | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index d85e4dd1..08e067c1 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -38,13 +38,12 @@ dir_config 'libsass' libsass_version = Dir.chdir(libsass_dir) do - if File.exist?('VERSION') - File.read('VERSION').chomp - elsif File.exist?('.git') + if File.exist?('.git') ver = %x[git describe --abbrev=4 --dirty --always --tags].chomp File.write('VERSION', ver) ver end + File.read('VERSION').chomp if File.exist?('VERSION') end if libsass_version diff --git a/sassc.gemspec b/sassc.gemspec index becd5e40..912df0df 100644 --- a/sassc.gemspec +++ b/sassc.gemspec @@ -48,7 +48,7 @@ Gem::Specification.new do |spec| end # Write a VERSION file for non-binary gems (for `SassC::Native.version`). - if !File.exist?(File.join(libsass_dir, 'VERSION')) + if File.exist?(File.join(libsass_dir, '.git')) libsass_version = Dir.chdir(libsass_dir) do %x[git describe --abbrev=4 --dirty --always --tags].chomp end