git.rb 0.10.0 → 0.12.0
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/Git.rb +2 -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/{AllButFirst → Array/AllButFirst}/all_but_first.rb +0 -0
- data/lib/Thoran/{AllButLast → Array/AllButLast}/all_but_last.rb +0 -0
- data/lib/Thoran/{FirstX → Array/FirstX}/firstX.rb +0 -0
- data/lib/Thoran/{LastX → Array/LastX}/lastX.rb +0 -0
- data/lib/Thoran/String/Capture/capture.rb +7 -0
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 459398f5d902325a3770ac8c518c9a8013fcc1628cdd9b378928c511bc4ef60d
|
4
|
+
data.tar.gz: 8ca58382ad1011dad9a66e78cf4afefbc6ccc9ce4c7bf5b257d019a5a60a6f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c34905fa20b9f3c0ae51d5525afab7cc2714c7c4f68e89c3be1a8cd114b662b7564a31d1dbb511aa8f1c06b01a64602612c51a5d418764bb245a6830365b8db
|
7
|
+
data.tar.gz: 6022dd1235db64aef9b2a9d64775a3603c97fb7d73632b10836438c1f8bbc5064663bff882df1c6686d6ea0a335370a78ccc6e6377ed668213bb65ec85b75f0d
|
data/lib/Git.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)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.12.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: 2020-
|
11
|
+
date: 2020-10-22 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/
|
30
|
-
- lib/Thoran/
|
31
|
-
- lib/Thoran/
|
32
|
-
- lib/Thoran/
|
29
|
+
- lib/String/capture.rb
|
30
|
+
- lib/Thoran/Array/AllButFirst/all_but_first.rb
|
31
|
+
- lib/Thoran/Array/AllButLast/all_but_last.rb
|
32
|
+
- lib/Thoran/Array/FirstX/firstX.rb
|
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.1
|
53
|
-
signing_key:
|
54
|
+
rubygems_version: 3.2.0.rc.1
|
55
|
+
signing_key:
|
54
56
|
specification_version: 4
|
55
57
|
summary: Do git stuff from Ruby.
|
56
58
|
test_files: []
|