ykxutils 0.1.3 → 0.1.5
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/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +62 -31
- data/Gemfile.lock +3 -3
- data/lib/ykxutils/gitcmd.rb +58 -0
- data/lib/ykxutils/version.rb +1 -1
- data/lib/ykxutils/yamlx.rb +28 -28
- data/lib/ykxutils.rb +1 -0
- data/ykxutils.gemspec +2 -1
- metadata +5 -3
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.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,54 +1,69 @@
|
|
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
|
-
#
|
11
|
-
|
12
|
-
Gemspec/RequiredRubyVersion:
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
Layout/EmptyLineAfterGuardClause:
|
13
12
|
Exclude:
|
14
|
-
|
13
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
15
14
|
|
16
|
-
# Offense count:
|
15
|
+
# Offense count: 1
|
17
16
|
# This cop supports safe autocorrection (--autocorrect).
|
18
|
-
|
19
|
-
# SupportedStyles: normal, indented_internal_methods
|
20
|
-
Layout/IndentationConsistency:
|
17
|
+
Layout/EmptyLines:
|
21
18
|
Exclude:
|
22
|
-
|
19
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
23
20
|
|
24
|
-
# Offense count:
|
21
|
+
# Offense count: 1
|
25
22
|
# This cop supports safe autocorrection (--autocorrect).
|
26
|
-
# Configuration parameters:
|
27
|
-
|
28
|
-
Layout/IndentationStyle:
|
23
|
+
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
24
|
+
Layout/LeadingCommentSpace:
|
29
25
|
Exclude:
|
30
|
-
|
26
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
31
27
|
|
32
28
|
# Offense count: 1
|
33
29
|
# This cop supports safe autocorrection (--autocorrect).
|
34
|
-
# Configuration parameters:
|
35
|
-
|
30
|
+
# Configuration parameters: .
|
31
|
+
# SupportedStyles: space, no_space
|
32
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
33
|
+
EnforcedStyle: no_space
|
34
|
+
|
35
|
+
# Offense count: 1
|
36
|
+
# This cop supports safe autocorrection (--autocorrect).
|
37
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
38
|
+
# SupportedStylesForExponentOperator: space, no_space
|
39
|
+
Layout/SpaceAroundOperators:
|
36
40
|
Exclude:
|
37
|
-
- 'lib/ykxutils/
|
41
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
38
42
|
|
39
|
-
# Offense count:
|
43
|
+
# Offense count: 2
|
40
44
|
# This cop supports safe autocorrection (--autocorrect).
|
41
|
-
# Configuration parameters:
|
42
|
-
|
45
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
46
|
+
# SupportedStyles: space, no_space
|
47
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
48
|
+
Layout/SpaceBeforeBlockBraces:
|
43
49
|
Exclude:
|
44
|
-
- 'lib/ykxutils/
|
50
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
51
|
+
|
52
|
+
# Offense count: 4
|
53
|
+
# This cop supports safe autocorrection (--autocorrect).
|
54
|
+
# Configuration parameters: EnforcedStyle.
|
55
|
+
# SupportedStyles: space, compact, no_space
|
56
|
+
Layout/SpaceInsideParens:
|
57
|
+
Exclude:
|
58
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
45
59
|
|
46
60
|
# Offense count: 1
|
47
61
|
# This cop supports safe autocorrection (--autocorrect).
|
48
|
-
# Configuration parameters:
|
49
|
-
|
62
|
+
# Configuration parameters: EnforcedStyle.
|
63
|
+
# SupportedStyles: final_newline, final_blank_line
|
64
|
+
Layout/TrailingEmptyLines:
|
50
65
|
Exclude:
|
51
|
-
- 'lib/ykxutils/
|
66
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
52
67
|
|
53
68
|
# Offense count: 1
|
54
69
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -56,19 +71,35 @@ Lint/ScriptPermission:
|
|
56
71
|
Exclude:
|
57
72
|
- 'bin/console'
|
58
73
|
|
59
|
-
# Offense count:
|
74
|
+
# Offense count: 9
|
60
75
|
Lint/UselessAssignment:
|
61
76
|
Exclude:
|
62
|
-
|
77
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
78
|
+
#- 'lib/ykxutils/yamlx.rb'
|
63
79
|
|
64
80
|
# Offense count: 1
|
65
81
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
66
82
|
Metrics/MethodLength:
|
67
83
|
Max: 17
|
68
84
|
|
69
|
-
# Offense count:
|
85
|
+
# Offense count: 1
|
86
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
87
|
+
# Configuration parameters: InverseMethods, InverseBlocks.
|
88
|
+
Style/InverseMethods:
|
89
|
+
Exclude:
|
90
|
+
#- 'lib/ykxutils/gitcmd.rb'
|
91
|
+
|
92
|
+
# Offense count: 2
|
93
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
94
|
+
# Configuration parameters: Methods.
|
95
|
+
Style/RedundantArgument:
|
96
|
+
Exclude:
|
97
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
98
|
+
|
99
|
+
# Offense count: 4
|
70
100
|
# This cop supports safe autocorrection (--autocorrect).
|
71
|
-
# Configuration parameters:
|
72
|
-
|
101
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
102
|
+
# SupportedStyles: single_quotes, double_quotes
|
103
|
+
Style/StringLiterals:
|
73
104
|
Exclude:
|
74
|
-
- 'lib/ykxutils/
|
105
|
+
# - 'lib/ykxutils/gitcmd.rb'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ykxutils (0.1.
|
4
|
+
ykxutils (0.1.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
rspec-mocks (3.11.1)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
30
|
rspec-support (~> 3.11.0)
|
31
|
-
rspec-support (3.11.
|
31
|
+
rspec-support (3.11.1)
|
32
32
|
rubocop (1.36.0)
|
33
33
|
json (~> 2.3)
|
34
34
|
parallel (~> 1.10)
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
parser (>= 3.1.1.0)
|
44
44
|
rubocop-rake (0.6.0)
|
45
45
|
rubocop (~> 1.0)
|
46
|
-
rubocop-rspec (2.13.
|
46
|
+
rubocop-rspec (2.13.1)
|
47
47
|
rubocop (~> 1.33)
|
48
48
|
ruby-progressbar (1.11.0)
|
49
49
|
unicode-display_width (2.2.0)
|
@@ -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
@@ -4,43 +4,43 @@ module Ykxutils
|
|
4
4
|
module_function
|
5
5
|
|
6
6
|
def yaml_load_file_compati(yaml_file_path)
|
7
|
-
|
8
|
-
|
7
|
+
setting = {}
|
8
|
+
valid = false
|
9
9
|
begin
|
10
10
|
setting = YAML.load_file(yaml_file_path, aliases: true)
|
11
11
|
valid = true
|
12
|
-
rescue ArgumentError
|
13
|
-
#p "yaml_load_file_compat 1"
|
14
|
-
#p ex.class
|
15
|
-
#p ex.inspect
|
16
|
-
#p ex.message
|
17
|
-
#p ex.backtrace
|
18
|
-
#exit#
|
19
|
-
rescue StandardError
|
20
|
-
#p "yaml_load_file_compat 1-2"
|
21
|
-
#p ex.class
|
22
|
-
#p ex.inspect
|
23
|
-
#p ex.message
|
24
|
-
#p ex.backtrace
|
12
|
+
rescue ArgumentError
|
13
|
+
# p "yaml_load_file_compat 1"
|
14
|
+
# p ex.class
|
15
|
+
# p ex.inspect
|
16
|
+
# p ex.message
|
17
|
+
# p ex.backtrace
|
18
|
+
# exit#
|
19
|
+
rescue StandardError
|
20
|
+
# p "yaml_load_file_compat 1-2"
|
21
|
+
# p ex.class
|
22
|
+
# p ex.inspect
|
23
|
+
# p ex.message
|
24
|
+
# p ex.backtrace
|
25
25
|
end
|
26
|
-
|
26
|
+
|
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
|
-
#p "yaml_load_file_compat 2"
|
33
|
-
#p ex.class
|
34
|
-
#p ex.inspect
|
35
|
-
#p ex.message
|
36
|
-
#p ex.backtrace
|
32
|
+
# p "yaml_load_file_compat 2"
|
33
|
+
# p ex.class
|
34
|
+
# p ex.inspect
|
35
|
+
# p ex.message
|
36
|
+
# p ex.backtrace
|
37
37
|
#
|
38
|
-
rescue StandardError
|
39
|
-
#p "yaml_load_file_compat 2-2"
|
40
|
-
#p ex.class
|
41
|
-
#p ex.inspect
|
42
|
-
#p ex.message
|
43
|
-
#p ex.backtrace
|
38
|
+
rescue StandardError
|
39
|
+
# p "yaml_load_file_compat 2-2"
|
40
|
+
# p ex.class
|
41
|
+
# p ex.inspect
|
42
|
+
# p ex.message
|
43
|
+
# p ex.backtrace
|
44
44
|
end
|
45
45
|
end
|
46
46
|
setting
|
data/lib/ykxutils.rb
CHANGED
data/ykxutils.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "New version of utilty function created by yk."
|
13
13
|
spec.homepage = "https://ykominami.github.io/ykxutils"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6")
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
18
18
|
|
@@ -43,4 +43,5 @@ Gem::Specification.new do |spec|
|
|
43
43
|
|
44
44
|
# For more information and examples about making a new gem, checkout our
|
45
45
|
# guide at: https://bundler.io/guides/creating_gem.html
|
46
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
46
47
|
end
|
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
|
@@ -141,6 +142,7 @@ licenses:
|
|
141
142
|
metadata:
|
142
143
|
homepage_uri: https://ykominami.github.io/ykxutils
|
143
144
|
source_code_uri: https://github.com/ykominami/ykxutils
|
145
|
+
rubygems_mfa_required: 'true'
|
144
146
|
post_install_message:
|
145
147
|
rdoc_options: []
|
146
148
|
require_paths:
|
@@ -149,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
151
|
requirements:
|
150
152
|
- - ">="
|
151
153
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
154
|
+
version: '2.6'
|
153
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
156
|
requirements:
|
155
157
|
- - ">="
|