summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-04-26 00:40:07 +0300
committerSaku Ytti <saku@ytti.fi>2018-04-26 00:40:07 +0300
commitf27a0762b0effecbbc64c1e9e221aab6ebba38b2 (patch)
tree957c119ab6bf32694ba05e939858d37ae79facfe
parentce155146656ee8b5f06a175f793a9461c05134ee (diff)
praise be
-rw-r--r--.rubocop.yml3
-rw-r--r--lib/oxidized/version.rb21
2 files changed, 14 insertions, 10 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 60b4e11..20567f4 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -27,6 +27,9 @@ Style/FormatString:
Style/FormatStringToken:
EnforcedStyle: unannotated
+Style/RescueModifier:
+ Enabled: false
+
# Do not attempt to police vendored code, and exclude special cases
AllCops:
Exclude:
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