From 920f36ec7bd0fff3565bf425b58b67f5873538b3 Mon Sep 17 00:00:00 2001 From: Ryan Boland Date: Jun 18 2019 13:09:13 +0000 Subject: Merge pull request #131 from glebm/ver extconf.rb: Always write VERSION if we have .git --- diff --git a/ext/extconf.rb b/ext/extconf.rb index d85e4dd..08e067c 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -38,13 +38,12 @@ $CFLAGS.gsub!(/[\s+](-ansi|-std=[^\s]+)/, '') 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 becd5e4..912df0d 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