mgit 0.4.0 → 0.4.1
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/lib/mgit/commands/tags.rb +16 -10
- data/lib/mgit/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: 556e8ba86002bf2296aa9a64b22c832e0ffe6b7d
|
4
|
+
data.tar.gz: cfef22c03019ddab0475023c09b83380e17921fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4b7e77396c509b701a5338906fad08c40d97a222dcf7e1bd22131a7e8a888cc3ff197641979b12e8a9e98114d3c7fc1720b8129dd3508607a0598c46c87117
|
7
|
+
data.tar.gz: d81f3c80978f0532014dff8fb51ca1ee39acecb47c3537e264037d8e1a95f8fb5edae7d58cdabd217e29050ec8589e2d4a91c0a4cb3e48e4588d082c9ce1824b
|
data/lib/mgit/commands/tags.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
1
3
|
module MGit
|
2
4
|
class TagsCommand < Command
|
3
5
|
def execute(args)
|
4
6
|
t = []
|
5
|
-
Registry.
|
7
|
+
Registry.each { |repo| t << print_latest_tag(repo) }
|
6
8
|
ptable t, :columns => [24, nil, nil]
|
7
9
|
end
|
8
10
|
|
@@ -15,23 +17,27 @@ module MGit
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def description
|
18
|
-
'display the latest tag in repository'
|
20
|
+
'display the latest tag in repository (master branch)'
|
19
21
|
end
|
20
22
|
|
21
23
|
register_command :tags
|
22
24
|
|
23
25
|
private
|
24
26
|
|
25
|
-
def latest_tag
|
26
|
-
|
27
|
-
|
27
|
+
def latest_tag(path)
|
28
|
+
sout, serr, st = Open3.capture3('git describe --tags --abbrev=0 master', :chdir => path)
|
29
|
+
(/fatal:/ =~ serr) ? 'none' : sout.strip
|
30
|
+
end
|
31
|
+
|
32
|
+
def latest_tag_time(path, tag)
|
33
|
+
sout, st = Open3.capture3("git log -n 1 --format='%at' #{tag}", :chdir => path)
|
34
|
+
Time.at(sout.strip.to_i).strftime('%Y-%m-%d')
|
28
35
|
end
|
29
36
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
]
|
37
|
+
def print_latest_tag(repo)
|
38
|
+
tag = latest_tag(repo.path)
|
39
|
+
commit = (tag == 'none') ? 'n/a' : latest_tag_time(repo.path, tag)
|
40
|
+
[repo.name, tag, commit]
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
data/lib/mgit/version.rb
CHANGED