summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-04-25 19:09:40 +0300
committerSaku Ytti <saku@ytti.fi>2018-04-25 19:09:40 +0300
commit60c3408bfc0f6aa5a89013f99e0763719440f29b (patch)
treede67bc3157822ceeb8e4280addcf2379d5d54d29
parentcc22060553df70db059bd6f4273f2ec391060f52 (diff)
set version from git
you still need to bump version.rb, as 'rake tag' will use that to create git tag, which we need :>
-rw-r--r--lib/oxidized/cli.rb2
-rw-r--r--lib/oxidized/version.rb11
-rw-r--r--oxidized.gemspec1
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/oxidized/cli.rb b/lib/oxidized/cli.rb
index c29e269..23cc28c 100644
--- a/lib/oxidized/cli.rb
+++ b/lib/oxidized/cli.rb
@@ -44,7 +44,7 @@ module Oxidized
on 'd', 'debug', 'turn on debugging'
on 'daemonize', 'Daemonize/fork the process'
on 'v', 'version', 'show version' do
- puts Oxidized::VERSION
+ puts Oxidized::VERSION_FULL
Kernel.exit
end
end
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
diff --git a/oxidized.gemspec b/oxidized.gemspec
index 6fcd5c5..06e1af9 100644
--- a/oxidized.gemspec
+++ b/oxidized.gemspec
@@ -1,6 +1,7 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'oxidized/version'
+Oxidized.version_set
Gem::Specification.new do |s|
s.name = 'oxidized'