fcom 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -6
- data/.ruby-version +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +10 -10
- data/bin/githooks/pre-push +8 -0
- data/lib/fcom/querier.rb +83 -30
- data/lib/fcom/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 119bff12adbc5cad5c6cea84a16ecb4f60c86a3c660e8d14f8702f1bfb11825b
|
4
|
+
data.tar.gz: 6388da5105a976113ce17a7b3b4c4e057e67692e73050f98c1e92f87e325ce95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8647b6f1bda783995ec33ba3783f33a749fb658070e7925811fcb0cc2220788ae2714f22a19870d64b7cbcc74ed49231d0092093572dcbe9c0fb023e1b3a6324
|
7
|
+
data.tar.gz: bad3ca0c6d631474232afa105a0e690a9e87c86c7ee1ecf865944923093568e8f9102ae84eec83ee98f2b963c8e7bf718748f58599dd966fa8d02e8e4b76ad9f
|
data/.github/dependabot.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
---
|
1
2
|
version: 2
|
2
3
|
updates:
|
3
|
-
- package-ecosystem: bundler
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
- package-ecosystem: bundler
|
5
|
+
directory: "/"
|
6
|
+
schedule:
|
7
|
+
interval: daily
|
8
|
+
time: "04:04"
|
9
|
+
timezone: America/Chicago
|
10
|
+
allow:
|
11
|
+
- dependency-type: all
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fcom (0.
|
4
|
+
fcom (0.11.0)
|
5
5
|
activesupport (>= 6, < 8)
|
6
6
|
memo_wise (>= 1.7, < 2)
|
7
7
|
rainbow (>= 3.0, < 4)
|
@@ -35,10 +35,10 @@ GEM
|
|
35
35
|
language_server-protocol (3.17.0.3)
|
36
36
|
memo_wise (1.9.0)
|
37
37
|
method_source (1.1.0)
|
38
|
-
minitest (5.24.
|
38
|
+
minitest (5.24.1)
|
39
39
|
mutex_m (0.2.0)
|
40
40
|
parallel (1.25.1)
|
41
|
-
parser (3.3.
|
41
|
+
parser (3.3.4.0)
|
42
42
|
ast (~> 2.4.1)
|
43
43
|
racc
|
44
44
|
prism (0.30.0)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rainbow (3.1.1)
|
53
53
|
rake (13.2.1)
|
54
54
|
regexp_parser (2.9.2)
|
55
|
-
rexml (3.3.
|
55
|
+
rexml (3.3.2)
|
56
56
|
strscan
|
57
57
|
rspec (3.13.0)
|
58
58
|
rspec-core (~> 3.13.0)
|
@@ -67,13 +67,13 @@ GEM
|
|
67
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
68
|
rspec-support (~> 3.13.0)
|
69
69
|
rspec-support (3.13.1)
|
70
|
-
rubocop (1.
|
70
|
+
rubocop (1.65.0)
|
71
71
|
json (~> 2.3)
|
72
72
|
language_server-protocol (>= 3.17.0)
|
73
73
|
parallel (~> 1.10)
|
74
74
|
parser (>= 3.3.0.2)
|
75
75
|
rainbow (>= 2.2.2, < 4.0)
|
76
|
-
regexp_parser (>=
|
76
|
+
regexp_parser (>= 2.4, < 3.0)
|
77
77
|
rexml (>= 3.2.5, < 4.0)
|
78
78
|
rubocop-ast (>= 1.31.1, < 2.0)
|
79
79
|
ruby-progressbar (~> 1.7)
|
@@ -85,15 +85,15 @@ GEM
|
|
85
85
|
rubocop-ast (>= 1.31.1, < 2.0)
|
86
86
|
rubocop-rake (0.6.0)
|
87
87
|
rubocop (~> 1.0)
|
88
|
-
rubocop-rspec (3.0.
|
88
|
+
rubocop-rspec (3.0.3)
|
89
89
|
rubocop (~> 1.61)
|
90
90
|
ruby-progressbar (1.13.0)
|
91
|
-
runger_release_assistant (0.
|
91
|
+
runger_release_assistant (0.10.0)
|
92
92
|
activesupport (>= 6, < 8)
|
93
93
|
memo_wise (>= 1.7, < 2)
|
94
94
|
rainbow (>= 3.0, < 4)
|
95
95
|
slop (~> 4.8)
|
96
|
-
runger_style (2.
|
96
|
+
runger_style (2.12.0)
|
97
97
|
prism (>= 0.24.0)
|
98
98
|
rubocop (>= 1.38.0, < 2)
|
99
99
|
slop (4.10.1)
|
@@ -120,7 +120,7 @@ DEPENDENCIES
|
|
120
120
|
runger_style
|
121
121
|
|
122
122
|
RUBY VERSION
|
123
|
-
ruby 3.3.
|
123
|
+
ruby 3.3.4p94
|
124
124
|
|
125
125
|
BUNDLED WITH
|
126
126
|
2.5.11
|
data/lib/fcom/querier.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative 'options_helpers.rb'
|
|
5
5
|
# This class executes a system command to retrieve the git history, which is passed through `rg`
|
6
6
|
# (ripgrep), and then ultimately is fed back to `fcom` for parsing.
|
7
7
|
class Fcom::Querier
|
8
|
+
prepend MemoWise
|
8
9
|
include ::Fcom::OptionsHelpers
|
9
10
|
|
10
11
|
def initialize(options)
|
@@ -13,6 +14,7 @@ class Fcom::Querier
|
|
13
14
|
|
14
15
|
# rubocop:disable Metrics/CyclomaticComplexity
|
15
16
|
# rubocop:disable Metrics/PerceivedComplexity
|
17
|
+
# rubocop:disable Metrics/MethodLength
|
16
18
|
def query
|
17
19
|
expression_to_match = search_string
|
18
20
|
expression_to_match = Regexp.escape(expression_to_match).gsub('\\ ', ' ') unless regex_mode?
|
@@ -24,37 +26,88 @@ class Fcom::Querier
|
|
24
26
|
|
25
27
|
quote = expression_to_match.include?('"') ? "'" : '"'
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
29
|
+
commands =
|
30
|
+
filename_by_most_recent_containing_commit.map do |commit, path_at_commit|
|
31
|
+
<<~COMMAND.squish
|
32
|
+
git log
|
33
|
+
--format="commit %s|%H|%an|%cr (%ci)"
|
34
|
+
--patch
|
35
|
+
--full-diff
|
36
|
+
--no-textconv
|
37
|
+
#{%(--author="#{author}") if author}
|
38
|
+
#{"--since=#{days}.day" unless days.nil?}
|
39
|
+
#{commit}
|
40
|
+
--
|
41
|
+
#{path_at_commit}
|
42
|
+
|
|
43
|
+
|
44
|
+
rg #{quote}(#{expression_to_match})|(^commit )|(^diff )#{quote}
|
45
|
+
--color never
|
46
|
+
#{'--ignore-case' if ignore_case?}
|
47
|
+
#{@options[:rg_options]}
|
48
|
+
|
|
49
|
+
|
50
|
+
#{'exe/' if development?}fcom #{quote}#{search_string}#{quote}
|
51
|
+
#{"--days #{days}" if days}
|
52
|
+
#{'--regex' if regex_mode?}
|
53
|
+
#{'--debug' if debug?}
|
54
|
+
#{'--ignore-case' if ignore_case?}
|
55
|
+
--path #{path_at_commit}
|
56
|
+
--parse-mode
|
57
|
+
--repo #{repo}
|
58
|
+
COMMAND
|
59
|
+
end
|
60
|
+
|
61
|
+
previous_command_generated_output = false
|
62
|
+
|
63
|
+
commands.each do |command|
|
64
|
+
Fcom.logger.debug("Executing command: #{command}")
|
65
|
+
output = `#{command}`
|
66
|
+
|
67
|
+
if output.empty?
|
68
|
+
previous_command_generated_output = false
|
69
|
+
else
|
70
|
+
if previous_command_generated_output
|
71
|
+
puts("\n\n") # print blank lines for spacing
|
72
|
+
end
|
73
|
+
|
74
|
+
previous_command_generated_output = true
|
75
|
+
|
76
|
+
puts(output)
|
77
|
+
end
|
78
|
+
end
|
57
79
|
end
|
80
|
+
# rubocop:enable Metrics/MethodLength
|
58
81
|
# rubocop:enable Metrics/PerceivedComplexity
|
59
82
|
# rubocop:enable Metrics/CyclomaticComplexity
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
memo_wise \
|
87
|
+
def filename_by_most_recent_containing_commit
|
88
|
+
{
|
89
|
+
most_recent_commit_with_file => path,
|
90
|
+
}.merge(renames.transform_keys { "#{_1}^" })
|
91
|
+
end
|
92
|
+
|
93
|
+
memo_wise \
|
94
|
+
def most_recent_commit_with_file
|
95
|
+
if system(%(test -e "#{path}"))
|
96
|
+
'HEAD'
|
97
|
+
else
|
98
|
+
`git log --all -1 --format="%H" -- "#{path}"`.rstrip
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
memo_wise \
|
103
|
+
def renames
|
104
|
+
`git log HEAD --format=%H --name-status --follow --diff-filter=R -- '#{path}'`.
|
105
|
+
split(/\n(?=[0-9a-f]{40})/).
|
106
|
+
to_h do |sha_and_name_info|
|
107
|
+
sha_and_name_info.
|
108
|
+
match(/(?<sha>[0-9a-f]{40})\n\nR\d+\s+(?<previous_name>\S+)?/).
|
109
|
+
named_captures.
|
110
|
+
values_at('sha', 'previous_name')
|
111
|
+
end
|
112
|
+
end
|
60
113
|
end
|
data/lib/fcom/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fcom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Runger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- Rakefile
|
109
109
|
- bin/_guard-core
|
110
110
|
- bin/console
|
111
|
+
- bin/githooks/pre-push
|
111
112
|
- bin/guard
|
112
113
|
- bin/release
|
113
114
|
- bin/rspec
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
- !ruby/object:Gem::Version
|
146
147
|
version: '0'
|
147
148
|
requirements: []
|
148
|
-
rubygems_version: 3.5.
|
149
|
+
rubygems_version: 3.5.15
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: CLI tool for parsing git history
|