gitversion 1.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/GitVersion.exe +0 -0
- data/bin/GitVersion.pdb +0 -0
- data/bin/gitversion +3 -1
- data/gitversion.gemspec +20 -0
- data/lib/git_version.rb +12 -0
- data/lib/git_version/parser.rb +76 -0
- metadata +17 -10
- checksums.yaml +0 -7
data/bin/GitVersion.exe
CHANGED
Binary file
|
data/bin/GitVersion.pdb
CHANGED
Binary file
|
data/bin/gitversion
CHANGED
data/gitversion.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.platform = Gem::Platform::RUBY
|
3
|
+
spec.name = 'gitversion'
|
4
|
+
spec.licenses = ['MIT']
|
5
|
+
spec.version = '3.0.0'
|
6
|
+
spec.summary = 'Derives SemVer information from a repository following GitFlow or GitHubFlow.'
|
7
|
+
spec.description = <<-EOF
|
8
|
+
Derives SemVer information from a repository following GitFlow or GitHubFlow.
|
9
|
+
EOF
|
10
|
+
|
11
|
+
spec.authors = ['NServiceBus','Simon Cropp']
|
12
|
+
spec.email = 'info@nservicebus.com'
|
13
|
+
spec.homepage = 'http://github.com/Particular/GitVersion'
|
14
|
+
spec.rubyforge_project = 'GitVersion'
|
15
|
+
|
16
|
+
spec.files = Dir['bin/**/*', 'lib/**/*', '*.gemspec']
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/.+(?<!\.exe|\.pdb)$}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
end
|
data/lib/git_version.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
module GitVersion
|
5
|
+
class Parser
|
6
|
+
attr_reader :args
|
7
|
+
attr_accessor :gitversion_exe
|
8
|
+
|
9
|
+
def initialize(args = [])
|
10
|
+
@args = args
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_missing(symbol, *args)
|
14
|
+
keys = [symbol.to_s, pascal_case(symbol.to_s)]
|
15
|
+
|
16
|
+
found_key = keys.find { |key| json.has_key?(key) }
|
17
|
+
return json[found_key] if found_key
|
18
|
+
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def json
|
23
|
+
@json ||= run_gitversion
|
24
|
+
end
|
25
|
+
|
26
|
+
def gitversion_exe
|
27
|
+
@gitversion_exe ||= File.expand_path(File.join(File.dirname(__FILE__), '../../bin/GitVersion.exe'))
|
28
|
+
end
|
29
|
+
|
30
|
+
def inspect
|
31
|
+
unless @json
|
32
|
+
|
33
|
+
return <<EOF
|
34
|
+
#{to_s}
|
35
|
+
Will invoke #{cmd_string} when first used.
|
36
|
+
EOF
|
37
|
+
|
38
|
+
else
|
39
|
+
|
40
|
+
return <<EOF
|
41
|
+
#{to_s}
|
42
|
+
Invoked #{cmd_string} and parsed its output:
|
43
|
+
#{json.inspect}
|
44
|
+
EOF
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def run_gitversion
|
51
|
+
stdout_and_stderr, status = Open3.capture2e(*cmd)
|
52
|
+
|
53
|
+
raise StandardError.new("Failed running #{cmd_string}, #{status}. We received the following output:\n#{stdout_and_stderr}") unless status.success?
|
54
|
+
|
55
|
+
JSON.parse(stdout_and_stderr)
|
56
|
+
end
|
57
|
+
|
58
|
+
def cmd
|
59
|
+
cmd = [gitversion_exe]
|
60
|
+
cmd << args
|
61
|
+
cmd.flatten.reject(&:nil?)
|
62
|
+
end
|
63
|
+
|
64
|
+
def cmd_string
|
65
|
+
cmd.join(' ')
|
66
|
+
end
|
67
|
+
|
68
|
+
def pascal_case(str)
|
69
|
+
str
|
70
|
+
.to_s
|
71
|
+
.split('_')
|
72
|
+
.inject([]) { |buffer, e| buffer.push(e.capitalize) }
|
73
|
+
.join
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- NServiceBus
|
@@ -9,41 +10,47 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
13
14
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
15
|
+
description: ! 'Derives SemVer information from a repository following GitFlow or
|
16
|
+
GitHubFlow.
|
17
|
+
|
18
|
+
'
|
16
19
|
email: info@nservicebus.com
|
17
20
|
executables:
|
18
21
|
- gitversion
|
19
22
|
extensions: []
|
20
23
|
extra_rdoc_files: []
|
21
24
|
files:
|
25
|
+
- bin/gitversion
|
22
26
|
- bin/GitVersion.exe
|
23
27
|
- bin/GitVersion.pdb
|
24
|
-
-
|
28
|
+
- lib/git_version/parser.rb
|
29
|
+
- lib/git_version.rb
|
30
|
+
- gitversion.gemspec
|
25
31
|
homepage: http://github.com/Particular/GitVersion
|
26
32
|
licenses:
|
27
33
|
- MIT
|
28
|
-
metadata: {}
|
29
34
|
post_install_message:
|
30
35
|
rdoc_options: []
|
31
36
|
require_paths:
|
32
37
|
- lib
|
33
38
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
34
40
|
requirements:
|
35
|
-
- - '>='
|
41
|
+
- - ! '>='
|
36
42
|
- !ruby/object:Gem::Version
|
37
43
|
version: '0'
|
38
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
39
46
|
requirements:
|
40
|
-
- - '>='
|
47
|
+
- - ! '>='
|
41
48
|
- !ruby/object:Gem::Version
|
42
49
|
version: '0'
|
43
50
|
requirements: []
|
44
51
|
rubyforge_project: GitVersion
|
45
|
-
rubygems_version:
|
52
|
+
rubygems_version: 1.8.30
|
46
53
|
signing_key:
|
47
|
-
specification_version:
|
54
|
+
specification_version: 3
|
48
55
|
summary: Derives SemVer information from a repository following GitFlow or GitHubFlow.
|
49
56
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: c33ca59c7e3bc1bbe0d81e5dfa3d22f115d77e09
|
4
|
-
data.tar.gz: d1d7a8044c46627e4aad53b0e09ae6ac80afc339
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: db1648e117e5ff573886b7858670e16332977dc1428c4e666900dcbbe093d6f3d812a43c47489995ca5757cde4e2fb6d31185830804aef00c69e6ff1edb2ff16
|
7
|
-
data.tar.gz: 5e00c3067df2b38890a1743a96aba8feb4f31c1dc49e6f5e256f20e4f913a5ecf069ddb88da6d92caa3d709f17b30ddc42aecb1b13bfc3c596494939d3df07ff
|