ykxutils 0.1.3 → 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: d22fc7981cccfd35ad44ec562ea9ec2775c45becb73165b85163b552733e6d05
4
- data.tar.gz: 06e6f4b69633c3c02b6be1f62c7d59b353bea43a6a25524e76aea8cf9baf65f2
3
+ metadata.gz: 92fcd39e4bac75f2d24f401f1b13df235df1edc1dbfcca02fac0706880bb7979
4
+ data.tar.gz: c2cf579546cea8112a272bc8ce5204656c603ab8e61ae52a3d4d8936e606e693
5
5
  SHA512:
6
- metadata.gz: a61623d958984bc3a73a0f7295234a9ede65dbc572e39f7bc5702dfd05eac823d0b8bc6f8dd4a0bb30e39d41bdfcd6ad14c25bd71ab1a941fb8f0a0b7a22dc2f
7
- data.tar.gz: b334748905b7b82cfd78f32dcb445476710e81fbcee0577bd03c6b97a6906912f37351896190fa36b8ad4ac555c8b92ab58e800a35692d981bded1d1cfe1aa41
6
+ metadata.gz: 9d8e3978c038d6884ac2c64c1f3bbe1c4711f3e457b9201f24f036ed9fd25422f2e5e49983fc7152a6fe1980cfc98ea80b6319761b333476b6e70ee74a4f4e4c
7
+ data.tar.gz: 0d3aac6c194299ebe39eaad5a3240343a7f8d42e104791340533105c2e18ed90936439bbe9399fd593aa7e10f2d835611497e504e44ceaeb2b0844f0e5c9241e
data/.rubocop.yml CHANGED
@@ -6,6 +6,7 @@ inherit_from: .rubocop_todo.yml
6
6
 
7
7
  AllCops:
8
8
  TargetRubyVersion: 2.6
9
+ NewCops: enable
9
10
 
10
11
  Style/StringLiterals:
11
12
  Enabled: true
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-07 10:21:48 UTC using RuboCop version 1.35.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:
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ Layout/EmptyLineAfterGuardClause:
13
12
  Exclude:
14
- - 'ykxutils.gemspec'
13
+ #- 'lib/ykxutils/gitcmd.rb'
15
14
 
16
- # Offense count: 3
15
+ # Offense count: 1
17
16
  # This cop supports safe autocorrection (--autocorrect).
18
- # Configuration parameters: EnforcedStyle.
19
- # SupportedStyles: normal, indented_internal_methods
20
- Layout/IndentationConsistency:
17
+ Layout/EmptyLines:
21
18
  Exclude:
22
- - 'lib/ykxutils/yamlx.rb'
19
+ #- 'lib/ykxutils/gitcmd.rb'
23
20
 
24
- # Offense count: 2
21
+ # Offense count: 1
25
22
  # This cop supports safe autocorrection (--autocorrect).
26
- # Configuration parameters: IndentationWidth, EnforcedStyle.
27
- # SupportedStyles: spaces, tabs
28
- Layout/IndentationStyle:
23
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
24
+ Layout/LeadingCommentSpace:
29
25
  Exclude:
30
- - 'lib/ykxutils/yamlx.rb'
26
+ #- 'lib/ykxutils/gitcmd.rb'
31
27
 
32
28
  # Offense count: 1
33
29
  # This cop supports safe autocorrection (--autocorrect).
34
- # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
35
- Layout/IndentationWidth:
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/yamlx.rb'
41
+ # - 'lib/ykxutils/gitcmd.rb'
38
42
 
39
- # Offense count: 21
43
+ # Offense count: 2
40
44
  # This cop supports safe autocorrection (--autocorrect).
41
- # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
42
- Layout/LeadingCommentSpace:
45
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
46
+ # SupportedStyles: space, no_space
47
+ # SupportedStylesForEmptyBraces: space, no_space
48
+ Layout/SpaceBeforeBlockBraces:
43
49
  Exclude:
44
- - 'lib/ykxutils/yamlx.rb'
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: AllowInHeredoc.
49
- Layout/TrailingWhitespace:
62
+ # Configuration parameters: EnforcedStyle.
63
+ # SupportedStyles: final_newline, final_blank_line
64
+ Layout/TrailingEmptyLines:
50
65
  Exclude:
51
- - 'lib/ykxutils/yamlx.rb'
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: 4
74
+ # Offense count: 9
60
75
  Lint/UselessAssignment:
61
76
  Exclude:
62
- - 'lib/ykxutils/yamlx.rb'
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: 3
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: PreferredName.
72
- Naming/RescuedExceptionsVariableName:
101
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
102
+ # SupportedStyles: single_quotes, double_quotes
103
+ Style/StringLiterals:
73
104
  Exclude:
74
- - 'lib/ykxutils/yamlx.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.3)
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.0)
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.0)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ykxutils
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -4,43 +4,43 @@ module Ykxutils
4
4
  module_function
5
5
 
6
6
  def yaml_load_file_compati(yaml_file_path)
7
- setting = {}
8
- valid = false
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 => ex
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 => ex
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 => ex
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
@@ -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
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.5.8")
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.3
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
@@ -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.5.8
154
+ version: '2.6'
153
155
  required_rubygems_version: !ruby/object:Gem::Requirement
154
156
  requirements:
155
157
  - - ">="