ykxutils 0.1.13 → 0.1.14

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: 167c4be663f6870f3b32073e6cf4d31d697d112054653915c5a29f2ce202fd1f
4
- data.tar.gz: 12214c5815e3bc0c6fdf4c89f4b211097e4bd270fb6dd9fabca1ed65ed1d7fde
3
+ metadata.gz: dbe824d0e20b9b05858f8bf9b50d350c5d3bf1752a0788645930356c0bf0c5f3
4
+ data.tar.gz: 54ca216a25e25cfbce58d83952a96a02f9a9b0166146ec369f36c0d9d5ab98d1
5
5
  SHA512:
6
- metadata.gz: 6e6b44e3fce399d7901b1ab2383449a58126a63bc5b1b3c6fea0c166cb4ad4eb41398ba40ae442ee05677b3525df579b44e3fb765e0d671eb9eb8de9233338d1
7
- data.tar.gz: d98737567d4c85da02084275c5db7a0570792f968b6ab27ffa5e4cb9e0de8a60bdd68cd26f7a06a29d2d44458dbd98cb94cb2fcd3f98ef31a8346e40922a92f4
6
+ metadata.gz: e99bec2aa2b9297da61f2e4f379e154c1ce989a83620ca099d0dadc6cc64e7ce6fbf5977e05ed8d855fe143b5209e54d6437e6f5c0842f65f809aaaf0f7e2df0
7
+ data.tar.gz: 86f46a1786acbe463eb023af68f2ffdf49db7a799cc159486fc2fb0d087b924fafa2c1a7d958de7df6b697d46027d7e5313533013ee2e9b53245d2e474a98233
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-02-06 17:44:56 UTC using RuboCop version 1.59.0.
3
+ # on 2024-07-03 23:05:09 UTC using RuboCop version 1.59.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
@@ -8,19 +8,10 @@
8
8
 
9
9
  # Offense count: 1
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
- Bundler/OrderedGems:
11
+ # Configuration parameters: Width, AllowedPatterns.
12
+ Layout/IndentationWidth:
14
13
  Exclude:
15
- # - 'Gemfile'
16
-
17
- # Offense count: 1
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: EnforcedStyle.
20
- # SupportedStyles: final_newline, final_blank_line
21
- Layout/TrailingEmptyLines:
22
- Exclude:
23
- # - 'Gemfile'
14
+ - 'spec/ykxutils_spec.rb'
24
15
 
25
16
  # Offense count: 1
26
17
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
@@ -43,7 +34,6 @@ RSpec/ExampleLength:
43
34
  Max: 8
44
35
 
45
36
  # Offense count: 1
46
- # Configuration parameters: AssignmentOnly.
47
- RSpec/InstanceVariable:
48
- Exclude:
49
- # - 'spec/ykxutils_spec.rb'
37
+ # Configuration parameters: AllowSubject.
38
+ RSpec/MultipleMemoizedHelpers:
39
+ Max: 6
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  gem "bundler"
9
9
  gem "erubi"
10
- gem "rake", "~> 13.1"
10
+ gem "rake", "~> 13.2"
11
11
  gem "tilt"
12
12
 
13
13
  group :development do
@@ -16,7 +16,7 @@ group :development do
16
16
  end
17
17
 
18
18
  group :test do
19
- gem "rspec", "~> 3.12"
19
+ gem "rspec", "~> 3.13"
20
20
  gem "rubocop"
21
21
  gem "rubocop-performance"
22
22
  gem "rubocop-rake", require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ykxutils (0.1.13)
4
+ ykxutils (0.1.14)
5
5
  erubi
6
6
  tilt
7
7
 
@@ -9,76 +9,72 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.2)
12
- debug (1.9.1)
12
+ debug (1.9.2)
13
13
  irb (~> 1.10)
14
14
  reline (>= 0.3.8)
15
- diff-lcs (1.5.0)
16
- erubi (1.12.0)
15
+ diff-lcs (1.5.1)
16
+ erubi (1.13.0)
17
17
  io-console (0.7.2)
18
- irb (1.11.1)
18
+ irb (1.12.0)
19
19
  rdoc
20
20
  reline (>= 0.4.2)
21
- json (2.7.1)
21
+ json (2.7.2)
22
22
  language_server-protocol (3.17.0.3)
23
- parallel (1.24.0)
24
- parser (3.2.2.4)
23
+ parallel (1.25.1)
24
+ parser (3.3.3.0)
25
25
  ast (~> 2.4.1)
26
26
  racc
27
27
  psych (5.1.2)
28
28
  stringio
29
- racc (1.7.3)
29
+ racc (1.8.0)
30
30
  rainbow (3.1.1)
31
- rake (13.1.0)
32
- rdoc (6.6.2)
31
+ rake (13.2.1)
32
+ rdoc (6.7.0)
33
33
  psych (>= 4.0.0)
34
- regexp_parser (2.8.3)
35
- reline (0.4.2)
34
+ regexp_parser (2.9.2)
35
+ reline (0.5.0)
36
36
  io-console (~> 0.5)
37
- rexml (3.2.6)
38
- rspec (3.12.0)
39
- rspec-core (~> 3.12.0)
40
- rspec-expectations (~> 3.12.0)
41
- rspec-mocks (~> 3.12.0)
42
- rspec-core (3.12.2)
43
- rspec-support (~> 3.12.0)
44
- rspec-expectations (3.12.3)
37
+ rexml (3.3.1)
38
+ strscan
39
+ rspec (3.13.0)
40
+ rspec-core (~> 3.13.0)
41
+ rspec-expectations (~> 3.13.0)
42
+ rspec-mocks (~> 3.13.0)
43
+ rspec-core (3.13.0)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-expectations (3.13.0)
45
46
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.12.0)
47
- rspec-mocks (3.12.6)
47
+ rspec-support (~> 3.13.0)
48
+ rspec-mocks (3.13.0)
48
49
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.12.0)
50
- rspec-support (3.12.1)
51
- rubocop (1.59.0)
50
+ rspec-support (~> 3.13.0)
51
+ rspec-support (3.13.0)
52
+ rubocop (1.64.1)
52
53
  json (~> 2.3)
53
54
  language_server-protocol (>= 3.17.0)
54
55
  parallel (~> 1.10)
55
- parser (>= 3.2.2.4)
56
+ parser (>= 3.3.0.2)
56
57
  rainbow (>= 2.2.2, < 4.0)
57
58
  regexp_parser (>= 1.8, < 3.0)
58
59
  rexml (>= 3.2.5, < 4.0)
59
- rubocop-ast (>= 1.30.0, < 2.0)
60
+ rubocop-ast (>= 1.31.1, < 2.0)
60
61
  ruby-progressbar (~> 1.7)
61
62
  unicode-display_width (>= 2.4.0, < 3.0)
62
- rubocop-ast (1.30.0)
63
- parser (>= 3.2.1.0)
64
- rubocop-capybara (2.20.0)
65
- rubocop (~> 1.41)
66
- rubocop-factory_bot (2.25.1)
67
- rubocop (~> 1.41)
68
- rubocop-performance (1.20.1)
63
+ rubocop-ast (1.31.3)
64
+ parser (>= 3.3.1.0)
65
+ rubocop-performance (1.21.1)
69
66
  rubocop (>= 1.48.1, < 2.0)
70
- rubocop-ast (>= 1.30.0, < 2.0)
67
+ rubocop-ast (>= 1.31.1, < 2.0)
71
68
  rubocop-rake (0.6.0)
72
69
  rubocop (~> 1.0)
73
- rubocop-rspec (2.25.0)
74
- rubocop (~> 1.40)
75
- rubocop-capybara (~> 2.17)
76
- rubocop-factory_bot (~> 2.22)
70
+ rubocop-rspec (3.0.2)
71
+ rubocop (~> 1.61)
77
72
  ruby-progressbar (1.13.0)
78
73
  stringio (3.1.0)
79
- tilt (2.3.0)
74
+ strscan (3.1.0)
75
+ tilt (2.4.0)
80
76
  unicode-display_width (2.5.0)
81
- yard (0.9.34)
77
+ yard (0.9.36)
82
78
 
83
79
  PLATFORMS
84
80
  x86_64-linux
@@ -87,8 +83,8 @@ DEPENDENCIES
87
83
  bundler
88
84
  debug
89
85
  erubi
90
- rake (~> 13.1)
91
- rspec (~> 3.12)
86
+ rake (~> 13.2)
87
+ rspec (~> 3.13)
92
88
  rubocop
93
89
  rubocop-performance
94
90
  rubocop-rake
@@ -0,0 +1,51 @@
1
+ require "yaml"
2
+ require "pathname"
3
+
4
+ module Ykxutils
5
+ module_function
6
+
7
+ def make_output_filename(prefix, basename, postfix, extname, extname_pn)
8
+ if extname == nil
9
+ if extname_pn.size <= 1
10
+ extname = ""
11
+ else
12
+ extname = extname_pn.to_s
13
+ end
14
+ end
15
+ "#{prefix}#{basename}#{postfix}#{extname}"
16
+ end
17
+
18
+ def make_output_file_pn(out_dir, ofname, input_pn)
19
+ case out_dir
20
+ when nil
21
+ Pathname.new(ofname)
22
+ when :SAME
23
+ parent = input_pn.parent
24
+ parent + ofname
25
+ else
26
+ out_dir_pn = Pathname.new(out_dir)
27
+ out_dir_pn + ofname
28
+ end
29
+ end
30
+
31
+ def make_output_path( input_path:, out_dir: nil, prefix: "", postfix: "", extname: nil)
32
+ input_pn = Pathname.new(input_path)
33
+ basename = input_pn.basename(".*")
34
+ extname_pn = input_pn.extname
35
+ ofname = make_output_filename(prefix, basename, postfix, extname, extname_pn)
36
+ output_pn = make_output_file_pn(out_dir, ofname, input_pn)
37
+ if input_pn.expand_path('/') === output_pn.expand_path('/')
38
+ nil
39
+ else
40
+ output_pn.to_s
41
+ end
42
+ end
43
+
44
+ def file_convert(infile, outfile, &block)
45
+ if block
46
+ block.call(infile, outfile)
47
+ else
48
+ false
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,30 @@
1
+ require "yaml"
2
+
3
+ module Ykxutils
4
+ module_function
5
+
6
+ def complemente_dt_tag(line)
7
+ if line =~ /<DT>/
8
+ # p "complemente_dt_tag T"
9
+ line + "</DT>"
10
+ elsif line =~ /<dt>/
11
+ line + "</dt>"
12
+ else
13
+ # p "complemente_dt_tag F"
14
+ line
15
+ end
16
+ end
17
+
18
+ def reform_dt_tag(infilename, outfilename)
19
+ infile = File.open(infilename)
20
+ outfile = File.open(outfilename, 'w')
21
+
22
+ Ykxutils::file_convert(infile, outfile){ |infile, outfile|
23
+ while line = infile.gets
24
+ line.chomp!
25
+ oline = Ykxutils.complemente_dt_tag(line)
26
+ outfile.write( oline + "\n" )
27
+ end
28
+ }
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ykxutils
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
data/lib/ykxutils.rb CHANGED
@@ -8,6 +8,8 @@ require_relative "ykxutils/gitcmd"
8
8
  require_relative "ykxutils/nginxconfig"
9
9
  require_relative "ykxutils/nginxconfigfiles"
10
10
  require_relative "ykxutils/gridlist"
11
+ require_relative "ykxutils/fileop"
12
+ require_relative "ykxutils/htmlparsex"
11
13
 
12
14
  module Ykxutils
13
15
  class Error < StandardError; end
data/test_data/a.txt ADDED
File without changes
@@ -0,0 +1 @@
1
+ <dt>abc
@@ -0,0 +1 @@
1
+ <dt>abc</dt>
@@ -0,0 +1 @@
1
+ <dt>abc</dt>
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.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - ykominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-05 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi
@@ -59,14 +59,20 @@ files:
59
59
  - a.northern-cross.net.conf
60
60
  - lib/ykxutils.rb
61
61
  - lib/ykxutils/erubyx.rb
62
+ - lib/ykxutils/fileop.rb
62
63
  - lib/ykxutils/gitcmd.rb
63
64
  - lib/ykxutils/gridlist.rb
65
+ - lib/ykxutils/htmlparsex.rb
64
66
  - lib/ykxutils/nginxconfig.rb
65
67
  - lib/ykxutils/nginxconfigfiles.rb
66
68
  - lib/ykxutils/pstorex.rb
67
69
  - lib/ykxutils/version.rb
68
70
  - lib/ykxutils/yamlx.rb
69
71
  - test_data/4servers.erb
72
+ - test_data/a.txt
73
+ - test_data/fileop/in.html
74
+ - test_data/fileop/out.html
75
+ - test_data/fileop/out_0.html
70
76
  - test_data/test.yaml
71
77
  - test_data/v103-3-189-127/4servers.erb
72
78
  - test_data/v103-3-189-127/a.northern-cross.net/base.yml
@@ -117,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
123
  - !ruby/object:Gem::Version
118
124
  version: '0'
119
125
  requirements: []
120
- rubygems_version: 3.5.11
126
+ rubygems_version: 3.5.14
121
127
  signing_key:
122
128
  specification_version: 4
123
129
  summary: New version of utilty function created by yk.