From b6e81322e19023b34588b6c76214d81adac1fd7b Mon Sep 17 00:00:00 2001 From: Pavel Skrylev Date: Fri, 8 Nov 2019 14:31:08 +0300 Subject: [PATCH] Fix write VERSION ! write VERSION file with the version from gemspec, if no .git available --- ext/extconf.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index 08e067c1..2ddb6931 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -38,11 +38,14 @@ dir_config 'libsass' libsass_version = Dir.chdir(libsass_dir) do + ver = nil if File.exist?('.git') ver = %x[git describe --abbrev=4 --dirty --always --tags].chomp - File.write('VERSION', ver) - ver + elsif + spec = ::Gem::Specification.load(File.join(gem_root, "sassc.gemspec")) + ver = spec.version end + File.write('VERSION', ver) File.read('VERSION').chomp if File.exist?('VERSION') end