git-revision 0.0.3 → 1.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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +8 -2
- data/git-revision.gemspec +3 -3
- data/lib/git-revision.rb +12 -2
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bfa27f5493c24e5c7f3cf14d5837d0b19a045570f5b20d57f71a4d0b4ae3404
|
4
|
+
data.tar.gz: 8e28bdc6f0461ba403a8c01ffe6056f85beb77214626e07c62dbea2831d8fa13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479e32d0b458bb45def22cc189981e2dfc6f64a5c4bf7c3126edd9352dfcc28c02990fd32f73a6799c6a43420ba25916bb8c5cebfc1939ae105d98b78a6e2960
|
7
|
+
data.tar.gz: 604dd83e5e679b53ef6341613a29d90b07aaaee904fa7d631daf5a150db82e5e8f077086e7253dd2962cea3e49e0a1a4967b2f5bfdcbc158102c9e9a998ce1a0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Git Revision
|
2
2
|
|
3
3
|
Git Revision is a simple (45 SLoC) Ruby gem that provides basic information about git source code.
|
4
|
-
You can use it in your apps, [for example](
|
4
|
+
You can use it in your apps, [for example](https://stackoverflow.com/a/8501359), to show deployed version.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -23,19 +23,24 @@ bundle install
|
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
{
|
26
|
+
:author => "John Smith",
|
27
|
+
:branch => "master",
|
26
28
|
:commit_hash => "60619c10baca6f9b4d03253697d43b7cf5d08edf",
|
27
29
|
:commit_hash_short => "60619c1",
|
28
30
|
:commit_subject => "release beta version",
|
29
31
|
:authored_date => "Fri Jun 8 17:55:01 2012 +0500",
|
30
32
|
:authored_timestamp => "1339160101",
|
31
33
|
:commit_tag => "4.2.0.beta",
|
32
|
-
:repo_last_tag => "4.2.0.beta"
|
34
|
+
:repo_last_tag => "4.2.0.beta",
|
35
|
+
:long_tag => "v4.2.0.beta-7-60619c1"
|
33
36
|
}
|
34
37
|
```
|
35
38
|
|
36
39
|
Additionally you can access these methods directly:
|
37
40
|
|
38
41
|
```ruby
|
42
|
+
Git::Revision.author # returns last commit author
|
43
|
+
Git::Revision.branch # returns current branch
|
39
44
|
Git::Revision.commit # returns last commit hash
|
40
45
|
Git::Revision.commit_short # returns abbreviated last commit hash (7 characters)
|
41
46
|
Git::Revision.message # returns last commit message subject
|
@@ -43,6 +48,7 @@ Git::Revision.date # returns authored date of last commit
|
|
43
48
|
Git::Revision.timestamp # returns authored date of last commit in Unix time
|
44
49
|
Git::Revision.tag # returns last commit tag if exists
|
45
50
|
Git::Revision.last_tag # returns last tag in repository if exists
|
51
|
+
Git::Revision.long_tag # returns last tag, number of commits since, and short commit hash
|
46
52
|
```
|
47
53
|
|
48
54
|
## License
|
data/git-revision.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'git-revision'
|
3
|
-
gem.version = '0.0
|
3
|
+
gem.version = '1.0.0'
|
4
4
|
gem.files = `git ls-files`.split($\)
|
5
5
|
gem.require_path = 'lib'
|
6
|
-
gem.license = 'BSD'
|
6
|
+
gem.license = 'BSD-2-Clause'
|
7
7
|
|
8
8
|
gem.author = 'Nihad Abbasov'
|
9
9
|
gem.email = 'nihad@42na.in'
|
10
10
|
gem.summary = 'Git Revision provides information about git source code.'
|
11
|
-
gem.homepage = '
|
11
|
+
gem.homepage = 'https://github.com/NARKOZ/git-revision'
|
12
12
|
end
|
data/lib/git-revision.rb
CHANGED
@@ -22,19 +22,28 @@ module Git
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def tag
|
25
|
-
`git
|
25
|
+
`git tag --points-at #{commit} | sort | head -n 1`.strip
|
26
26
|
end
|
27
27
|
|
28
28
|
def last_tag
|
29
29
|
`git describe --tags --abbrev=0`.strip
|
30
30
|
end
|
31
31
|
|
32
|
+
def long_tag
|
33
|
+
`git describe --long`.strip
|
34
|
+
end
|
35
|
+
|
32
36
|
def branch
|
33
37
|
`git rev-parse --abbrev-ref HEAD`.strip
|
34
38
|
end
|
35
39
|
|
40
|
+
def author
|
41
|
+
`git log -1 --pretty=format:"%an"`
|
42
|
+
end
|
43
|
+
|
36
44
|
def info
|
37
45
|
@info ||= {
|
46
|
+
:author => author,
|
38
47
|
:branch => branch,
|
39
48
|
:commit_hash => commit,
|
40
49
|
:commit_hash_short => commit_short,
|
@@ -42,7 +51,8 @@ module Git
|
|
42
51
|
:authored_date => date,
|
43
52
|
:authored_timestamp => timestamp,
|
44
53
|
:commit_tag => tag,
|
45
|
-
:repo_last_tag => last_tag
|
54
|
+
:repo_last_tag => last_tag,
|
55
|
+
:long_tag => long_tag
|
46
56
|
}
|
47
57
|
end
|
48
58
|
end
|
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-revision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nihad Abbasov
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
|
-
description:
|
14
12
|
email: nihad@42na.in
|
15
13
|
executables: []
|
16
14
|
extensions: []
|
@@ -20,11 +18,10 @@ files:
|
|
20
18
|
- README.md
|
21
19
|
- git-revision.gemspec
|
22
20
|
- lib/git-revision.rb
|
23
|
-
homepage:
|
21
|
+
homepage: https://github.com/NARKOZ/git-revision
|
24
22
|
licenses:
|
25
|
-
- BSD
|
23
|
+
- BSD-2-Clause
|
26
24
|
metadata: {}
|
27
|
-
post_install_message:
|
28
25
|
rdoc_options: []
|
29
26
|
require_paths:
|
30
27
|
- lib
|
@@ -39,8 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
36
|
- !ruby/object:Gem::Version
|
40
37
|
version: '0'
|
41
38
|
requirements: []
|
42
|
-
rubygems_version: 3.
|
43
|
-
signing_key:
|
39
|
+
rubygems_version: 3.6.9
|
44
40
|
specification_version: 4
|
45
41
|
summary: Git Revision provides information about git source code.
|
46
42
|
test_files: []
|