ykxutils 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +43 -62
- data/Gemfile.lock +1 -1
- data/lib/ykxutils/gitcmd.rb +58 -0
- data/lib/ykxutils/version.rb +1 -1
- data/lib/ykxutils/yamlx.rb +4 -4
- data/lib/ykxutils.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92fcd39e4bac75f2d24f401f1b13df235df1edc1dbfcca02fac0706880bb7979
|
4
|
+
data.tar.gz: c2cf579546cea8112a272bc8ce5204656c603ab8e61ae52a3d4d8936e606e693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d8e3978c038d6884ac2c64c1f3bbe1c4711f3e457b9201f24f036ed9fd25422f2e5e49983fc7152a6fe1980cfc98ea80b6319761b333476b6e70ee74a4f4e4c
|
7
|
+
data.tar.gz: 0d3aac6c194299ebe39eaad5a3240343a7f8d42e104791340533105c2e18ed90936439bbe9399fd593aa7e10f2d835611497e504e44ceaeb2b0844f0e5c9241e
|
data/.rubocop_todo.yml
CHANGED
@@ -1,60 +1,29 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-09-
|
3
|
+
# on 2022-09-14 22:49:41 UTC using RuboCop version 1.36.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
|
-
# Configuration parameters: Include.
|
11
|
-
# Include: **/*.gemspec
|
12
|
-
Gemspec/RequiredRubyVersion:
|
13
|
-
Exclude:
|
14
|
-
#- 'ykxutils.gemspec'
|
15
|
-
|
16
|
-
# Offense count: 1
|
17
|
-
# This cop supports safe autocorrection (--autocorrect).
|
18
|
-
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
19
|
-
Layout/ExtraSpacing:
|
20
|
-
Exclude:
|
21
|
-
#- 'spec/ykxutils_spec.rb'
|
22
|
-
|
23
|
-
# Offense count: 3
|
24
|
-
# This cop supports safe autocorrection (--autocorrect).
|
25
|
-
# Configuration parameters: EnforcedStyle.
|
26
|
-
# SupportedStyles: normal, indented_internal_methods
|
27
|
-
Layout/IndentationConsistency:
|
28
|
-
Exclude:
|
29
|
-
#- 'lib/ykxutils/yamlx.rb'
|
30
|
-
|
31
|
-
# Offense count: 2
|
32
10
|
# This cop supports safe autocorrection (--autocorrect).
|
33
|
-
|
34
|
-
# SupportedStyles: spaces, tabs
|
35
|
-
Layout/IndentationStyle:
|
11
|
+
Layout/EmptyLineAfterGuardClause:
|
36
12
|
Exclude:
|
37
|
-
#- 'lib/ykxutils/
|
13
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
38
14
|
|
39
15
|
# Offense count: 1
|
40
16
|
# This cop supports safe autocorrection (--autocorrect).
|
41
|
-
|
42
|
-
Layout/IndentationWidth:
|
17
|
+
Layout/EmptyLines:
|
43
18
|
Exclude:
|
44
|
-
#- 'lib/ykxutils/
|
19
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
45
20
|
|
46
|
-
# Offense count:
|
21
|
+
# Offense count: 1
|
47
22
|
# This cop supports safe autocorrection (--autocorrect).
|
48
23
|
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
49
24
|
Layout/LeadingCommentSpace:
|
50
25
|
Exclude:
|
51
|
-
#- 'lib/ykxutils/
|
52
|
-
|
53
|
-
# Offense count: 2
|
54
|
-
# This cop supports safe autocorrection (--autocorrect).
|
55
|
-
Layout/SpaceAfterComma:
|
56
|
-
Exclude:
|
57
|
-
#- 'spec/ykxutils_spec.rb'
|
26
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
58
27
|
|
59
28
|
# Offense count: 1
|
60
29
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -63,28 +32,38 @@ Layout/SpaceAfterComma:
|
|
63
32
|
Layout/SpaceAroundEqualsInParameterDefault:
|
64
33
|
EnforcedStyle: no_space
|
65
34
|
|
66
|
-
# Offense count:
|
35
|
+
# Offense count: 1
|
67
36
|
# This cop supports safe autocorrection (--autocorrect).
|
68
|
-
|
37
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
38
|
+
# SupportedStylesForExponentOperator: space, no_space
|
39
|
+
Layout/SpaceAroundOperators:
|
69
40
|
Exclude:
|
70
|
-
|
41
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
71
42
|
|
72
|
-
# Offense count:
|
43
|
+
# Offense count: 2
|
73
44
|
# This cop supports safe autocorrection (--autocorrect).
|
74
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces
|
45
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
75
46
|
# SupportedStyles: space, no_space
|
76
47
|
# SupportedStylesForEmptyBraces: space, no_space
|
77
|
-
Layout/
|
48
|
+
Layout/SpaceBeforeBlockBraces:
|
78
49
|
Exclude:
|
79
|
-
|
50
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
80
51
|
|
81
|
-
# Offense count:
|
52
|
+
# Offense count: 4
|
82
53
|
# This cop supports safe autocorrection (--autocorrect).
|
83
|
-
# Configuration parameters:
|
84
|
-
|
54
|
+
# Configuration parameters: EnforcedStyle.
|
55
|
+
# SupportedStyles: space, compact, no_space
|
56
|
+
Layout/SpaceInsideParens:
|
85
57
|
Exclude:
|
86
|
-
|
87
|
-
|
58
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
59
|
+
|
60
|
+
# Offense count: 1
|
61
|
+
# This cop supports safe autocorrection (--autocorrect).
|
62
|
+
# Configuration parameters: EnforcedStyle.
|
63
|
+
# SupportedStyles: final_newline, final_blank_line
|
64
|
+
Layout/TrailingEmptyLines:
|
65
|
+
Exclude:
|
66
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
88
67
|
|
89
68
|
# Offense count: 1
|
90
69
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -92,33 +71,35 @@ Lint/ScriptPermission:
|
|
92
71
|
Exclude:
|
93
72
|
- 'bin/console'
|
94
73
|
|
95
|
-
# Offense count:
|
74
|
+
# Offense count: 9
|
96
75
|
Lint/UselessAssignment:
|
97
76
|
Exclude:
|
98
|
-
|
77
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
78
|
+
#- 'lib/ykxutils/yamlx.rb'
|
99
79
|
|
100
80
|
# Offense count: 1
|
101
81
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
102
82
|
Metrics/MethodLength:
|
103
83
|
Max: 17
|
104
84
|
|
105
|
-
# Offense count:
|
106
|
-
# This cop supports
|
107
|
-
# Configuration parameters:
|
108
|
-
|
85
|
+
# Offense count: 1
|
86
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
87
|
+
# Configuration parameters: InverseMethods, InverseBlocks.
|
88
|
+
Style/InverseMethods:
|
109
89
|
Exclude:
|
110
|
-
#- 'lib/ykxutils/
|
90
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
111
91
|
|
112
92
|
# Offense count: 2
|
113
|
-
# This cop supports
|
114
|
-
|
93
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
94
|
+
# Configuration parameters: Methods.
|
95
|
+
Style/RedundantArgument:
|
115
96
|
Exclude:
|
116
|
-
|
97
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
117
98
|
|
118
|
-
# Offense count:
|
99
|
+
# Offense count: 4
|
119
100
|
# This cop supports safe autocorrection (--autocorrect).
|
120
101
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
121
102
|
# SupportedStyles: single_quotes, double_quotes
|
122
103
|
Style/StringLiterals:
|
123
104
|
Exclude:
|
124
|
-
|
105
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
3
|
+
module Ykxutils
|
4
|
+
module_function
|
5
|
+
|
6
|
+
def func_git_log(target_line)
|
7
|
+
line_no = 1
|
8
|
+
buf = []
|
9
|
+
buf_error = []
|
10
|
+
prog = "git log --oneline"
|
11
|
+
_stdin, stdout, stderr = Open3.popen3(prog)
|
12
|
+
stdout.each do |line|
|
13
|
+
buf << line
|
14
|
+
break if line_no == target_line
|
15
|
+
|
16
|
+
line_no += 1
|
17
|
+
end
|
18
|
+
stderr.each do |line_e|
|
19
|
+
buf_error << line_e
|
20
|
+
end
|
21
|
+
|
22
|
+
[buf, buf_error]
|
23
|
+
end
|
24
|
+
|
25
|
+
def func_get_commit_id(target)
|
26
|
+
commit_id = ""
|
27
|
+
buf, buf_error = func_git_log(target)
|
28
|
+
puts buf_error
|
29
|
+
index = target - 1
|
30
|
+
str = buf[index]
|
31
|
+
commit_id = str.split.first if str
|
32
|
+
|
33
|
+
commit_id
|
34
|
+
end
|
35
|
+
|
36
|
+
def func_git_diff_tree(commit_id)
|
37
|
+
buf = []
|
38
|
+
return buf if commit_id == ""
|
39
|
+
|
40
|
+
prog = "git diff-tree --name-status -r #{commit_id}"
|
41
|
+
_stdin, stdout, _stderr = Open3.popen3(prog)
|
42
|
+
stdout.each do |line|
|
43
|
+
buf << line
|
44
|
+
end
|
45
|
+
|
46
|
+
buf
|
47
|
+
end
|
48
|
+
|
49
|
+
def func_get_files_from_commit(target)
|
50
|
+
commit_id = func_get_commit_id(target)
|
51
|
+
# puts commit_id
|
52
|
+
buf = func_git_diff_tree(commit_id)
|
53
|
+
|
54
|
+
lines = buf.grep_v(/^D/)
|
55
|
+
lines.map { |x| x.split[1] }
|
56
|
+
# files.map{|x| puts x}
|
57
|
+
end
|
58
|
+
end
|
data/lib/ykxutils/version.rb
CHANGED
data/lib/ykxutils/yamlx.rb
CHANGED
@@ -9,14 +9,14 @@ module Ykxutils
|
|
9
9
|
begin
|
10
10
|
setting = YAML.load_file(yaml_file_path, aliases: true)
|
11
11
|
valid = true
|
12
|
-
rescue ArgumentError
|
12
|
+
rescue ArgumentError
|
13
13
|
# p "yaml_load_file_compat 1"
|
14
14
|
# p ex.class
|
15
15
|
# p ex.inspect
|
16
16
|
# p ex.message
|
17
17
|
# p ex.backtrace
|
18
18
|
# exit#
|
19
|
-
rescue StandardError
|
19
|
+
rescue StandardError
|
20
20
|
# p "yaml_load_file_compat 1-2"
|
21
21
|
# p ex.class
|
22
22
|
# p ex.inspect
|
@@ -27,7 +27,7 @@ module Ykxutils
|
|
27
27
|
if valid != true
|
28
28
|
begin
|
29
29
|
setting = YAML.load_file(yaml_file_path)
|
30
|
-
valid = true
|
30
|
+
# valid = true
|
31
31
|
rescue ArgumentError
|
32
32
|
# p "yaml_load_file_compat 2"
|
33
33
|
# p ex.class
|
@@ -35,7 +35,7 @@ module Ykxutils
|
|
35
35
|
# p ex.message
|
36
36
|
# p ex.backtrace
|
37
37
|
#
|
38
|
-
rescue StandardError
|
38
|
+
rescue StandardError
|
39
39
|
# p "yaml_load_file_compat 2-2"
|
40
40
|
# p ex.class
|
41
41
|
# p ex.inspect
|
data/lib/ykxutils.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ykxutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ykominami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- bin/console
|
131
131
|
- bin/setup
|
132
132
|
- lib/ykxutils.rb
|
133
|
+
- lib/ykxutils/gitcmd.rb
|
133
134
|
- lib/ykxutils/pstorex.rb
|
134
135
|
- lib/ykxutils/version.rb
|
135
136
|
- lib/ykxutils/yamlx.rb
|