mgit 0.4.0 → 0.4.1

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: 712d93ce29c8c64e4b37cd820a6216205edd2746
4
- data.tar.gz: da97e60a84ab1fc96fb272ad095f6b0eedaedc10
3
+ metadata.gz: 556e8ba86002bf2296aa9a64b22c832e0ffe6b7d
4
+ data.tar.gz: cfef22c03019ddab0475023c09b83380e17921fa
5
5
  SHA512:
6
- metadata.gz: d2d964c20c6b1c1daef35f4774b008c965b60ec7c610d9228ff588ee452d854ee9ea6c71101649bf417606f14417e79b6fc168eb2908e4aa951433fdd3746c4c
7
- data.tar.gz: 1f24ca99c54e9b41e0d8ce6d1231cd95c7aa3c23669f395f1ce1e98218632983ad6c07ab796ced72af18b6c80eaf61c72fecb6715b21bf503ed8ae5a27561d7b
6
+ metadata.gz: 0d4b7e77396c509b701a5338906fad08c40d97a222dcf7e1bd22131a7e8a888cc3ff197641979b12e8a9e98114d3c7fc1720b8129dd3508607a0598c46c87117
7
+ data.tar.gz: d81f3c80978f0532014dff8fb51ca1ee39acecb47c3537e264037d8e1a95f8fb5edae7d58cdabd217e29050ec8589e2d4a91c0a4cb3e48e4588d082c9ce1824b
@@ -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.chdir_each { |repo| t << [repo.name, *latest_tag] }
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
- sha = `git rev-list --tags --max-count=1 2>&1`.strip
27
- sha =~ /usage:/ ? ['none', ''] : print_tag(sha)
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 print_tag(sha)
31
- [
32
- `git describe #{sha}`.strip,
33
- Time.at(`git log -n 1 --format="%at" #{sha}`.strip.to_i).strftime('%Y-%m-%d')
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
@@ -1,3 +1,3 @@
1
1
  module MGit
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH