From 60c3408bfc0f6aa5a89013f99e0763719440f29b Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Wed, 25 Apr 2018 19:09:40 +0300 Subject: set version from git you still need to bump version.rb, as 'rake tag' will use that to create git tag, which we need :> --- lib/oxidized/version.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/oxidized/version.rb') diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index 9a92133..0d90e34 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -1,3 +1,14 @@ module Oxidized VERSION = '0.21.0' + VERSION_FULL = '0.21.0-175-gcc22060' + def self.version_set + Oxidized.send(:remove_const, :VERSION_FULL) + const_set(:VERSION_FULL, %x(git describe --tags).chop) + Oxidized.send(:remove_const, :VERSION) + const_set(:VERSION, %x(git describe --tags --abbrev=0).chop) + file = File.readlines(__FILE__) + file[1] = " VERSION = '%s'\n" % VERSION + file[2] = " VERSION_FULL = '%s'\n" % VERSION_FULL + File.write(__FILE__, file.join) + end end -- cgit v1.2.1 From 9b22dfeebd5d5f30a8e15be28a00ff84534e9998 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Wed, 25 Apr 2018 21:14:40 +0300 Subject: only set version when building packege --- lib/oxidized/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/version.rb') diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index 0d90e34..de99d5f 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -1,6 +1,6 @@ module Oxidized VERSION = '0.21.0' - VERSION_FULL = '0.21.0-175-gcc22060' + VERSION_FULL = '0.21.0-180-g9691008' def self.version_set Oxidized.send(:remove_const, :VERSION_FULL) const_set(:VERSION_FULL, %x(git describe --tags).chop) -- cgit v1.2.1 From 377faa395d79c485ce9dfea6a0483067684d8ada Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Thu, 26 Apr 2018 00:26:27 +0300 Subject: safe guard version for environment without git --- lib/oxidized/version.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'lib/oxidized/version.rb') diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index de99d5f..a5422fd 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -2,13 +2,17 @@ module Oxidized VERSION = '0.21.0' VERSION_FULL = '0.21.0-180-g9691008' def self.version_set - Oxidized.send(:remove_const, :VERSION_FULL) - const_set(:VERSION_FULL, %x(git describe --tags).chop) - Oxidized.send(:remove_const, :VERSION) - const_set(:VERSION, %x(git describe --tags --abbrev=0).chop) - file = File.readlines(__FILE__) - file[1] = " VERSION = '%s'\n" % VERSION - file[2] = " VERSION_FULL = '%s'\n" % VERSION_FULL - File.write(__FILE__, file.join) + version_full = %x(git describe --tags).chop rescue "" + version = %x(git describe --tags --abbrev=0).chop rescue "" + if [version, version_full].none? &:empty? + Oxidized.send(:remove_const, :VERSION) + Oxidized.send(:remove_const, :VERSION_FULL) + const_set(:VERSION, version) + const_set(:VERSION_FULL, version_full) + file = File.readlines(__FILE__) + file[1] = " VERSION = '%s'\n" % VERSION + file[2] = " VERSION_FULL = '%s'\n" % VERSION_FULL + File.write(__FILE__, file.join) + end end end -- cgit v1.2.1 From ce155146656ee8b5f06a175f793a9461c05134ee Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Thu, 26 Apr 2018 00:31:21 +0300 Subject: fix rubocop being anal --- lib/oxidized/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/version.rb') diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index a5422fd..1ca2f55 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -4,7 +4,7 @@ module Oxidized def self.version_set version_full = %x(git describe --tags).chop rescue "" version = %x(git describe --tags --abbrev=0).chop rescue "" - if [version, version_full].none? &:empty? + if [version, version_full].none?(&:empty?) Oxidized.send(:remove_const, :VERSION) Oxidized.send(:remove_const, :VERSION_FULL) const_set(:VERSION, version) -- cgit v1.2.1 From f27a0762b0effecbbc64c1e9e221aab6ebba38b2 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Thu, 26 Apr 2018 00:40:07 +0300 Subject: praise be --- lib/oxidized/version.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/oxidized/version.rb') diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index 1ca2f55..b607e12 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -4,15 +4,16 @@ module Oxidized def self.version_set version_full = %x(git describe --tags).chop rescue "" version = %x(git describe --tags --abbrev=0).chop rescue "" - if [version, version_full].none?(&:empty?) - Oxidized.send(:remove_const, :VERSION) - Oxidized.send(:remove_const, :VERSION_FULL) - const_set(:VERSION, version) - const_set(:VERSION_FULL, version_full) - file = File.readlines(__FILE__) - file[1] = " VERSION = '%s'\n" % VERSION - file[2] = " VERSION_FULL = '%s'\n" % VERSION_FULL - File.write(__FILE__, file.join) - end + + return false unless [version, version_full].none?(&:empty?) + + Oxidized.send(:remove_const, :VERSION) + Oxidized.send(:remove_const, :VERSION_FULL) + const_set(:VERSION, version) + const_set(:VERSION_FULL, version_full) + file = File.readlines(__FILE__) + file[1] = " VERSION = '%s'\n" % VERSION + file[2] = " VERSION_FULL = '%s'\n" % VERSION_FULL + File.write(__FILE__, file.join) end end -- cgit v1.2.1