obst 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/obst/git_log.rb +14 -9
- data/lib/obst/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa5dec61f4c26ed664472ec781fc2cd49cd9e394045bd5300a0cce2553df855
|
4
|
+
data.tar.gz: 2ae5084507590446957c8082d5764fb81fd6c53f7fec007c0b066f266be8be8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24d2cabc29a3b9366bf5f556adf56b70144edef016dd2b68097efcc4766ddb006aca9218a3686bab089b089fdb473b7f4914357af4280c151f35935ba0e4d5c
|
7
|
+
data.tar.gz: 6a0336b13a65f370496b004fa315928951a2e4f69b8ee097e1d944b7933c23de85204258378031922943b417bd351f8e0d33f887f34286c1a3b08532c4910b66
|
data/.gitignore
CHANGED
data/lib/obst/git_log.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
1
3
|
module Obst
|
2
4
|
class GitLog
|
3
5
|
def initialize(**opts)
|
4
|
-
|
5
|
-
@
|
6
|
-
@
|
6
|
+
path = opts[:C] || '.'
|
7
|
+
@cmd = ['git', '-C', path, 'log', '--name-status', '--pretty=format:%ad', "--date=format:'%Y-%m-%d %H:%M:%S'"]
|
8
|
+
@cmd << '--after' << opts[:after] if opts[:after]
|
9
|
+
@cmd << '--before' << opts[:before] if opts[:before]
|
7
10
|
end
|
8
11
|
|
9
12
|
def to_s
|
10
|
-
|
13
|
+
`#{@cmd.join(' ')}`
|
11
14
|
end
|
12
15
|
|
13
16
|
class Commit
|
@@ -26,7 +29,6 @@ module Obst
|
|
26
29
|
AMD = /^[AMD]/
|
27
30
|
RENAME = /^R/
|
28
31
|
|
29
|
-
|
30
32
|
attr_reader :status, :name, :old_name
|
31
33
|
|
32
34
|
def initialize(line)
|
@@ -47,10 +49,13 @@ module Obst
|
|
47
49
|
def commits
|
48
50
|
Enumerator.new do |y|
|
49
51
|
batch = []
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
Open3.popen2(*@cmd) do |stdin, stdout, status_thread|
|
53
|
+
stdout.each_line do |line|
|
54
|
+
next batch << line unless line == EMPTY_LINE
|
55
|
+
y << Commit.new(batch)
|
56
|
+
batch.clear
|
57
|
+
end
|
58
|
+
raise 'fail to loop git log' unless status_thread.value.success?
|
54
59
|
end
|
55
60
|
y << Commit.new(batch)
|
56
61
|
end
|
data/lib/obst/version.rb
CHANGED