gitvers 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44bf054e60011e1929bff58edad3db900e2ad026
4
- data.tar.gz: f37543a43344a6ca41c39baeb9d8f54f9f73eea9
3
+ metadata.gz: 9a6996c712660658e00e1cc09202fe5c7745d3af
4
+ data.tar.gz: 6917942a4b5783dc0f21cd900ba6cb4516d555a4
5
5
  SHA512:
6
- metadata.gz: 3edee606480d87c07372b1fd944891c74fca921c660bc1c91a6de9a9ee7ddd2e05b53dff737975e5736fb94774a339d85825737ad41660d9ad82f305c48cb8cc
7
- data.tar.gz: 0c775b080e44dda95bbaadcf7784c8ecde2adf1bd8be6ab16a64caf658bed10575c93fd4e439280f86568b8b0551036fe53f5402f053fa471873d84f6ca09638
6
+ metadata.gz: 5738d15873fb6ef033caa73c778ec4a197b6043158d107aa5140f4177c2118af226c77eb05dc67d921fccbd71368b06676385464a0d04eda868881139e00328e
7
+ data.tar.gz: 5f2f77a4663c0d06908e1230ee47a61df9c0060d4257071fd5f06afecd20952a4a6a6b9ef601058157a30497a6f23824c5f89293d04ad55c4e7e1b698f53e819
data/lib/gitvers/cli.rb CHANGED
@@ -28,9 +28,18 @@ module Gitvers
28
28
  when 'revision'
29
29
  puts rep.revision_number
30
30
  when 'shell'
31
- puts "GITVERS_REVISION=#{rep.revision_number}"
32
- puts "GITVERS_FULL=#{rep.full_version}"
33
- puts "GITVERS_SHORT=#{rep.short_version}"
31
+ opts = ARGV.shift(2)
32
+ export = opts.include?('export')
33
+ noprefix = opts.include?('noprefix')
34
+
35
+ v = [rep.revision_number, rep.full_version, rep.short_version]
36
+ k = %w(GITVERS_REVISION GITVERS_FULL GITVERS_SHORT)
37
+ k = %w(REVISION_NUMBER FULL_VERSION SHORT_VERSION) if noprefix
38
+
39
+ v.each_with_index do |val, i|
40
+ print 'export ' if export
41
+ puts "#{k[i]}=#{val}"
42
+ end
34
43
  when 'lines'
35
44
  puts rep.revision_number
36
45
  puts rep.full_version
@@ -63,6 +72,9 @@ Commands:
63
72
  - short # x.y.z
64
73
  - revision # revision
65
74
  - shell # output GITVERS_<name> variables
75
+ # supports two options
76
+ - export # prefix lines with export
77
+ - noprefix # do not prefix lines with GITVERS_
66
78
  - lines # output 3 lines with revision, full, short respectively
67
79
 
68
80
 
@@ -1,3 +1,3 @@
1
1
  module Gitvers
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitvers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Goy