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 +4 -4
- data/lib/gitvers/cli.rb +15 -3
- data/lib/gitvers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6996c712660658e00e1cc09202fe5c7745d3af
|
4
|
+
data.tar.gz: 6917942a4b5783dc0f21cd900ba6cb4516d555a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
32
|
-
|
33
|
-
|
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
|
|
data/lib/gitvers/version.rb
CHANGED