repomen 0.1.2 → 0.1.3

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: d9a2002e0a9f81fb1cd5d3d0ea78fded26317280
4
- data.tar.gz: 26eb1d304aa888a7a51b5324fb641b4b61071a81
3
+ metadata.gz: 44c0c7d629d7334b190107453ad40a8807cb110b
4
+ data.tar.gz: a8326f4aaba2609d5eabc5ef2d3689cf07ff7a34
5
5
  SHA512:
6
- metadata.gz: f9d26bf5a96cee4c669721aa83eea98737cee817d63f7a7e7f3545ad5bd556f9eab9130299ae64c8cfc5e33413c6933f1e7955e82573f83ea185c4fb5cd9752d
7
- data.tar.gz: b4c1b3c8784b13fa78781d6bb60cd9ba8934004d578acc55a3a0d28576866eb4f2107e05bc7d6b99d7d27fa3c34d282e6f31f6dd55334501009b5f1c699b5bd7
6
+ metadata.gz: 05f2a6d1528a440784ab468971833e3780b6e35dd0c34037476c613373ce24a07d05f0752896f1cb7a06fc0560e6d8e785e0e85fa1deb652c170e640dcbd5473
7
+ data.tar.gz: b5553661c07d7fdfaf5e35b9f4735832eaab386174998a4cf300f9a8554b792c9dd952ae9811c4f06ceafdc6e41b0196e549f039330e8be144f9f8ffb6ee2681
@@ -48,12 +48,8 @@ module Repomen
48
48
  $?.success?
49
49
  end
50
50
 
51
- def revision
52
- rev = nil
53
- in_dir do
54
- rev = git(:'rev-parse', 'HEAD')
55
- end
56
- rev
51
+ def revision_info
52
+ @revision_info ||= parse_revision_info(git_show)
57
53
  end
58
54
 
59
55
  def tag
@@ -66,6 +62,21 @@ module Repomen
66
62
 
67
63
  private
68
64
 
65
+ def git_show
66
+ format = [
67
+ 'name: %an',
68
+ 'email: %ae',
69
+ 'date: %cd',
70
+ 'commit: %H',
71
+ 'message: %s',
72
+ ].join('%n')
73
+ output = nil
74
+ in_dir do
75
+ output = git(:show, '--format="'+format+'"')
76
+ end
77
+ output
78
+ end
79
+
69
80
  def git(*args)
70
81
  `git #{args.join(' ')}`.chomp
71
82
  end
@@ -87,6 +98,16 @@ module Repomen
87
98
  options.join(' ')
88
99
  end
89
100
 
101
+ def parse_revision_info(text)
102
+ info = {}
103
+ text.lines.each do |str|
104
+ break if str.strip.empty?
105
+ list = str.partition(':')
106
+ info[list.first] = list.last
107
+ end
108
+ info
109
+ end
110
+
90
111
  def update_repo
91
112
  pull
92
113
  end
@@ -56,7 +56,23 @@ module Repomen
56
56
 
57
57
  # Returns the revision of the repo.
58
58
  def revision
59
- @handler.revision
59
+ @handler.revision_info['commit']
60
+ end
61
+
62
+ def revision_message
63
+ @handler.revision_info['message']
64
+ end
65
+
66
+ def revision_author_name
67
+ @handler.revision_info['name']
68
+ end
69
+
70
+ def revision_author_email
71
+ @handler.revision_info['email']
72
+ end
73
+
74
+ def revision_authored_at
75
+ @handler.revision_info['date']
60
76
  end
61
77
 
62
78
  # Returns the tag of the repo.
@@ -1,3 +1,3 @@
1
1
  module Repomen
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -16,6 +16,14 @@ describe ::Repomen::Repo::Handler::Git do
16
16
  handler.retrieve
17
17
  assert File.exists?(handler.path)
18
18
  assert File.directory?(handler.path)
19
+
20
+ assert handler.revision_info
21
+ info = handler.revision_info
22
+ refute info["name"].nil?
23
+ refute info["email"].nil?
24
+ refute info["date"].nil?
25
+ refute info["commit"].nil?
26
+ refute info["message"].nil?
19
27
  end
20
28
 
21
29
  it "should recognize a Github URL via https" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repomen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Föhring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.2.2
139
+ rubygems_version: 2.2.0
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Interface wrapper for retrieving repos