git.rb 0.10.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Git/Blame.rb +1 -2
- data/lib/Git/Branch.rb +4 -0
- data/lib/Git/Log.rb +30 -8
- data/lib/Git/VERSION.rb +3 -1
- data/lib/String/capture.rb +28 -0
- data/lib/Thoran/String/Capture/capture.rb +7 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73aee3654b476be49b07919f42351e4a215eed644ca265e430fa9ae5bb342602
|
4
|
+
data.tar.gz: 5a1d9932d003433378f7e2ca9c3110e1417b0e4758aea2756117e8ad76d8f3d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c767573d7f5d0912231e6f8cbd7ac74d725fd4982494d1d2871eaba18b76bea7b4179684601550603f39b93817462184c32e4f22cba1f44b4494f7c1d20a9ea1
|
7
|
+
data.tar.gz: 84aa02f3100e0cf04e2321f323d5fb35f3cb848791e261382572ed56de93f0750bbfdfd980a9a4408395474e4699356ab24e79f657fcacb856b6a1d1dd136a97
|
data/lib/Git/Blame.rb
CHANGED
data/lib/Git/Branch.rb
CHANGED
data/lib/Git/Log.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
# => "thoran"
|
19
19
|
|
20
20
|
require 'Ordinal/Array'
|
21
|
+
require 'String/capture'
|
21
22
|
|
22
23
|
module Git
|
23
24
|
class Log
|
@@ -26,23 +27,45 @@ module Git
|
|
26
27
|
|
27
28
|
class << self
|
28
29
|
def parse(commit_string)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
hash = merge = author = date = message = ''
|
31
|
+
commit_string.split("\n").each do |line|
|
32
|
+
case line.strip
|
33
|
+
when /^commit (\w+)/
|
34
|
+
hash = line.strip.capture(/^commit (\w+)/)
|
35
|
+
when /^Merge: /
|
36
|
+
merge = line.strip.gsub(/^Merge: /, '')
|
37
|
+
when /^Author: /
|
38
|
+
author = line.strip.gsub(/^Author: /, '')
|
39
|
+
when /^Date: /
|
40
|
+
date = line.strip.gsub(/^Date: /, '')
|
41
|
+
else
|
42
|
+
if line.strip.empty?
|
43
|
+
(message ||= '') << "\n\n"
|
44
|
+
else
|
45
|
+
(message ||= '') << line.lstrip
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
commit_args = {
|
50
|
+
hash: hash,
|
51
|
+
author: author,
|
52
|
+
date: date,
|
53
|
+
message: message.lstrip
|
54
|
+
}
|
55
|
+
commit_args.merge!(merge: merge)
|
56
|
+
Commit.new(commit_args)
|
36
57
|
end
|
37
58
|
end # class << self
|
38
59
|
|
39
60
|
attr_reader :hash
|
61
|
+
attr_reader :merge
|
40
62
|
attr_reader :author
|
41
63
|
attr_reader :date
|
42
64
|
attr_reader :message
|
43
65
|
|
44
66
|
def initialize(values = {})
|
45
67
|
@hash = values[:hash]
|
68
|
+
@merge = values[:merge]
|
46
69
|
@author = values[:author]
|
47
70
|
@date = values[:date]
|
48
71
|
@message = values[:message]
|
@@ -60,7 +83,6 @@ module Git
|
|
60
83
|
commit_log = Log.new
|
61
84
|
commit_string = ''
|
62
85
|
log_stream.each_line do |line|
|
63
|
-
line.lstrip!
|
64
86
|
if line =~ /^commit/ && !commit_string.empty?
|
65
87
|
commit_log.prepend(Commit.parse(commit_string))
|
66
88
|
commit_string = line
|
data/lib/Git/VERSION.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Thoran/String/Capture/capture.rb
|
2
|
+
# Thoran::String::Capture#capture
|
3
|
+
|
4
|
+
# 20161109
|
5
|
+
# 0.3.1
|
6
|
+
|
7
|
+
# Changes since 0.2:
|
8
|
+
# 1. + Thoran namespace.
|
9
|
+
# 0/1
|
10
|
+
# 2. Updated the MiniTest superclass only---no implementation changes.
|
11
|
+
|
12
|
+
module Thoran
|
13
|
+
module String
|
14
|
+
module Capture
|
15
|
+
|
16
|
+
def capture(regex)
|
17
|
+
if md = self.match(regex)
|
18
|
+
md[1]
|
19
|
+
else
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
String.send(:include, Thoran::String::Capture)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoran
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Do stuff with git-blame, git-branch, git-log, and git-remote from Ruby.
|
14
14
|
email: code@thoran.com
|
@@ -26,15 +26,17 @@ files:
|
|
26
26
|
- lib/Git/VERSION.rb
|
27
27
|
- lib/Ordinal.rb
|
28
28
|
- lib/Ordinal/Array.rb
|
29
|
+
- lib/String/capture.rb
|
29
30
|
- lib/Thoran/Array/AllButFirst/all_but_first.rb
|
30
31
|
- lib/Thoran/Array/AllButLast/all_but_last.rb
|
31
32
|
- lib/Thoran/Array/FirstX/firstX.rb
|
32
33
|
- lib/Thoran/Array/LastX/lastX.rb
|
34
|
+
- lib/Thoran/String/Capture/capture.rb
|
33
35
|
homepage: http://github.com/thoran/git.rb
|
34
36
|
licenses:
|
35
37
|
- MIT
|
36
38
|
metadata: {}
|
37
|
-
post_install_message:
|
39
|
+
post_install_message:
|
38
40
|
rdoc_options: []
|
39
41
|
require_paths:
|
40
42
|
- lib
|
@@ -49,8 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
51
|
- !ruby/object:Gem::Version
|
50
52
|
version: '0'
|
51
53
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
53
|
-
signing_key:
|
54
|
+
rubygems_version: 3.2.3
|
55
|
+
signing_key:
|
54
56
|
specification_version: 4
|
55
57
|
summary: Do git stuff from Ruby.
|
56
58
|
test_files: []
|