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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e5c9c3bed78aa884b754dead58bf57ff0673100380b8d24881c6fca2c765fd6
4
- data.tar.gz: ab9fc2befae4c7e53df63ae7d5d9dc6f2cb2b9964d5721f87e512392bcfe3573
3
+ metadata.gz: 92fcd39e4bac75f2d24f401f1b13df235df1edc1dbfcca02fac0706880bb7979
4
+ data.tar.gz: c2cf579546cea8112a272bc8ce5204656c603ab8e61ae52a3d4d8936e606e693
5
5
  SHA512:
6
- metadata.gz: d5dc8f18b24e6cc75ebc0f42ed72d6af2df91a936c162234f6900665af86c8134661f59e8838d2f1c47bc4b8eb87965a9ce2aa7d6e924586663091fe31e82377
7
- data.tar.gz: 75183d0298ca403931c633f0d1eff51c8269c374d290532a5534cb8e626b3a0b660aad2c46e5fe6d6855c6758c0dedfd62be9642674925f7cb771e1f7feba017
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-13 03:51:05 UTC using RuboCop version 1.36.0.
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
- # Configuration parameters: IndentationWidth, EnforcedStyle.
34
- # SupportedStyles: spaces, tabs
35
- Layout/IndentationStyle:
11
+ Layout/EmptyLineAfterGuardClause:
36
12
  Exclude:
37
- #- 'lib/ykxutils/yamlx.rb'
13
+ #- 'lib/ykxutils/gitcmd.rb'
38
14
 
39
15
  # Offense count: 1
40
16
  # This cop supports safe autocorrection (--autocorrect).
41
- # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
42
- Layout/IndentationWidth:
17
+ Layout/EmptyLines:
43
18
  Exclude:
44
- #- 'lib/ykxutils/yamlx.rb'
19
+ #- 'lib/ykxutils/gitcmd.rb'
45
20
 
46
- # Offense count: 21
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/yamlx.rb'
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: 2
35
+ # Offense count: 1
67
36
  # This cop supports safe autocorrection (--autocorrect).
68
- Layout/SpaceBeforeComma:
37
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
38
+ # SupportedStylesForExponentOperator: space, no_space
39
+ Layout/SpaceAroundOperators:
69
40
  Exclude:
70
- #- 'spec/ykxutils_spec.rb'
41
+ # - 'lib/ykxutils/gitcmd.rb'
71
42
 
72
- # Offense count: 4
43
+ # Offense count: 2
73
44
  # This cop supports safe autocorrection (--autocorrect).
74
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
45
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
75
46
  # SupportedStyles: space, no_space
76
47
  # SupportedStylesForEmptyBraces: space, no_space
77
- Layout/SpaceInsideBlockBraces:
48
+ Layout/SpaceBeforeBlockBraces:
78
49
  Exclude:
79
- #- 'spec/ykxutils_spec.rb'
50
+ # - 'lib/ykxutils/gitcmd.rb'
80
51
 
81
- # Offense count: 3
52
+ # Offense count: 4
82
53
  # This cop supports safe autocorrection (--autocorrect).
83
- # Configuration parameters: AllowInHeredoc.
84
- Layout/TrailingWhitespace:
54
+ # Configuration parameters: EnforcedStyle.
55
+ # SupportedStyles: space, compact, no_space
56
+ Layout/SpaceInsideParens:
85
57
  Exclude:
86
- #- 'lib/ykxutils/yamlx.rb'
87
- #- 'spec/ykxutils_spec.rb'
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: 4
74
+ # Offense count: 9
96
75
  Lint/UselessAssignment:
97
76
  Exclude:
98
- - 'lib/ykxutils/yamlx.rb'
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: 3
106
- # This cop supports safe autocorrection (--autocorrect).
107
- # Configuration parameters: PreferredName.
108
- Naming/RescuedExceptionsVariableName:
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/yamlx.rb'
90
+ #- 'lib/ykxutils/gitcmd.rb'
111
91
 
112
92
  # Offense count: 2
113
- # This cop supports safe autocorrection (--autocorrect).
114
- RSpec/EmptyLineAfterFinalLet:
93
+ # This cop supports unsafe autocorrection (--autocorrect-all).
94
+ # Configuration parameters: Methods.
95
+ Style/RedundantArgument:
115
96
  Exclude:
116
- #- 'spec/ykxutils_spec.rb'
97
+ # - 'lib/ykxutils/gitcmd.rb'
117
98
 
118
- # Offense count: 1
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
- #- 'spec/ykxutils_spec.rb'
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)
4
+ ykxutils (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ykxutils
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -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 => e
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 => e
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 => e
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
@@ -3,6 +3,7 @@
3
3
  require_relative "ykxutils/version"
4
4
  require_relative "ykxutils/yamlx"
5
5
  require_relative "ykxutils/pstorex"
6
+ require_relative "ykxutils/gitcmd"
6
7
 
7
8
  module Ykxutils
8
9
  class Error < StandardError; 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
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-13 00:00:00.000000000 Z
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