ykxutils 0.1.8 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb57978cd24ccbb824287f130d77a3c38a6703e0341914b32221adf60786bb73
4
- data.tar.gz: 92fd92f8550542480f7f44e11870d0a18edc3c7412311d0511bd0c9e554eacbd
3
+ metadata.gz: c0659659032f5707b2cdeade5612ba9450d0b031766aa3ae592c0ac33e598543
4
+ data.tar.gz: a101d3eb24966539154012d769913cb0be13fac416eb1de173a77034bf6576e5
5
5
  SHA512:
6
- metadata.gz: 594acd0dd1516dfad347315770af817a49df02e09bbee5b3b78f6dae768a6272f450a160318a708e5e3d39b6070be5128bf2d327045da9c516bbe3e891b45e94
7
- data.tar.gz: 1909511a5120c6a9564f74db65f45d602277df8ee594010f3ea6f7d2da2f7c3dab22bf2aec8739c29369fe75bbee547e6f10ee0171d0ee4b31af76a0940d9e99
6
+ metadata.gz: 623fb0b29f44a21eaaf84ead317c17b104d701cd81f28345f9788d513a3690f79c644e5e12f8450b90c27d0f6dc9dbabff19db4124abbde81a61eabeb5536281
7
+ data.tar.gz: b4a226775f324625a513cc9c802ee2779ef9593b66da85abc798e998c56bc91cc9a4ee3b25f5e64030733da1da6de53ffe74858239d86f2b23ab9822addc6b07
data/.rubocop.yml CHANGED
@@ -27,3 +27,12 @@ Layout/LineLength:
27
27
 
28
28
  Style/Documentation:
29
29
  Enabled: false
30
+
31
+ #追加
32
+ #
33
+ Style/StringConcatenation:
34
+ Enabled: false
35
+ #
36
+ Naming/AccessorMethodName:
37
+ Enabled: false
38
+
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-10-11 11:06:24 UTC using RuboCop version 1.36.0.
3
+ # on 2024-02-06 17:44:56 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
@@ -12,168 +12,38 @@
12
12
  # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
13
  Bundler/OrderedGems:
14
14
  Exclude:
15
- # - 'Gemfile'
16
-
17
- # Offense count: 1
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
20
- # Include: **/*.gemspec
21
- Gemspec/OrderedDependencies:
22
- Exclude:
23
- # - 'ykxutils.gemspec'
15
+ # - 'Gemfile'
24
16
 
25
17
  # Offense count: 1
26
18
  # This cop supports safe autocorrection (--autocorrect).
27
19
  # Configuration parameters: EnforcedStyle.
28
- # SupportedStyles: space, no_space
29
- Layout/SpaceAroundEqualsInParameterDefault:
30
- Exclude:
31
- # - 'lib/ykxutils/pstorex.rb'
32
-
33
- # Offense count: 10
34
- Lint/UselessAssignment:
20
+ # SupportedStyles: final_newline, final_blank_line
21
+ Layout/TrailingEmptyLines:
35
22
  Exclude:
36
- # - 'lib/ykxutils/yamlx.rb'
23
+ # - 'Gemfile'
37
24
 
38
25
  # Offense count: 1
39
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
26
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
40
27
  Metrics/AbcSize:
41
28
  Max: 19
42
29
 
43
30
  # Offense count: 3
44
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
31
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
45
32
  Metrics/MethodLength:
46
- Max: 15
33
+ Max: 14
47
34
 
48
35
  # Offense count: 1
49
36
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
50
37
  Metrics/ParameterLists:
51
38
  Max: 6
52
39
 
53
- # Offense count: 1
54
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
55
- # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
56
- Naming/MethodParameterName:
57
- Exclude:
58
- - 'lib/ykxutils/nginxconfigfiles.rb'
59
-
60
- # Offense count: 1
61
- # This cop supports safe autocorrection (--autocorrect).
62
- # Configuration parameters: EnforcedStyle.
63
- # SupportedStyles: be, be_nil
64
- RSpec/BeNil:
65
- Exclude:
66
- - 'spec/ykxutils_spec.rb'
67
-
68
- # Offense count: 1
69
- RSpec/BeforeAfterAll:
70
- Exclude:
71
- - 'spec/spec_helper.rb'
72
- - 'spec/rails_helper.rb'
73
- - 'spec/support/**/*.rb'
74
- - 'spec/ykxutils_spec.rb'
75
-
76
40
  # Offense count: 2
77
41
  # Configuration parameters: CountAsOne.
78
42
  RSpec/ExampleLength:
79
- Max: 9
43
+ Max: 8
80
44
 
81
45
  # Offense count: 1
82
46
  # Configuration parameters: AssignmentOnly.
83
47
  RSpec/InstanceVariable:
84
48
  Exclude:
85
- - 'spec/ykxutils_spec.rb'
86
-
87
- # Offense count: 1
88
- RSpec/NoExpectationExample:
89
- Exclude:
90
- - 'spec/ykxutils_spec.rb'
91
-
92
- # Offense count: 1
93
- # This cop supports safe autocorrection (--autocorrect).
94
- # Configuration parameters: EnforcedStyle.
95
- # SupportedStyles: not_to, to_not
96
- RSpec/NotToNot:
97
- Exclude:
98
- - 'spec/ykxutils_spec.rb'
99
-
100
- # Offense count: 8
101
- # This cop supports safe autocorrection (--autocorrect).
102
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
103
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
104
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
105
- # FunctionalMethods: let, let!, subject, watch
106
- # AllowedMethods: lambda, proc, it
107
- Style/BlockDelimiters:
108
- Exclude:
109
- - 'lib/ykxutils/erubyx.rb'
110
- - 'lib/ykxutils/gridlist.rb'
111
- - 'lib/ykxutils/nginxconfig.rb'
112
- - 'lib/ykxutils/nginxconfigfiles.rb'
113
- - 'spec/ykxutils_spec.rb'
114
-
115
- # Offense count: 5
116
- # This cop supports safe autocorrection (--autocorrect).
117
- Style/ColonMethodCall:
118
- Exclude:
119
- - 'lib/ykxutils/gridlist.rb'
120
- - 'lib/ykxutils/nginxconfig.rb'
121
- - 'spec/ykxutils_spec.rb'
122
-
123
- # Offense count: 1
124
- # This cop supports safe autocorrection (--autocorrect).
125
- Style/EachWithObject:
126
- Exclude:
127
- - 'spec/ykxutils_spec.rb'
128
-
129
- # Offense count: 3
130
- # This cop supports safe autocorrection (--autocorrect).
131
- # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
132
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
133
- # SupportedShorthandSyntax: always, never, either, consistent
134
- Style/HashSyntax:
135
- Exclude:
136
- - 'lib/ykxutils/gridlist.rb'
137
-
138
- # Offense count: 2
139
- # This cop supports safe autocorrection (--autocorrect).
140
- Style/IfUnlessModifier:
141
- Exclude:
142
- - 'lib/ykxutils/erubyx.rb'
143
- - 'lib/ykxutils/gridlist.rb'
144
-
145
- # Offense count: 1
146
- # This cop supports unsafe autocorrection (--autocorrect-all).
147
- # Configuration parameters: EnforcedStyle.
148
- # SupportedStyles: literals, strict
149
- Style/MutableConstant:
150
- Exclude:
151
- - 'lib/ykxutils/gridlist.rb'
152
-
153
- # Offense count: 2
154
- # This cop supports safe autocorrection (--autocorrect).
155
- # Configuration parameters: EnforcedStyle, MinBodyLength.
156
- # SupportedStyles: skip_modifier_ifs, always
157
- Style/Next:
158
- Exclude:
159
- - 'lib/ykxutils/nginxconfig.rb'
160
- - 'lib/ykxutils/nginxconfigfiles.rb'
161
-
162
- # Offense count: 1
163
- # This cop supports safe autocorrection (--autocorrect).
164
- # Configuration parameters: PreferredDelimiters.
165
- Style/PercentLiteralDelimiters:
166
- Exclude:
167
- - 'lib/ykxutils/gridlist.rb'
168
-
169
- # Offense count: 45
170
- # This cop supports safe autocorrection (--autocorrect).
171
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
172
- # SupportedStyles: single_quotes, double_quotes
173
- Style/StringLiterals:
174
- Exclude:
175
- - 'Gemfile'
176
- - 'lib/ykxutils/erubyx.rb'
177
- - 'lib/ykxutils/gridlist.rb'
178
- - 'lib/ykxutils/nginxconfigfiles.rb'
179
- - 'ykxutils.gemspec'
49
+ # - 'spec/ykxutils_spec.rb'
data/Gemfile CHANGED
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in ykxutils.gemspec
6
6
  gemspec
7
7
 
8
- gem 'bundler'
9
- gem 'erubi'
10
- gem 'rake', '~> 13.0'
11
- gem 'tilt'
8
+ gem "bundler"
9
+ gem "erubi"
10
+ gem "rake", "~> 13.1"
11
+ gem "tilt"
12
12
 
13
13
  group :development do
14
- gem 'yard'
14
+ gem "debug"
15
+ gem "yard"
15
16
  end
16
17
 
17
18
  group :test do
18
- gem 'rspec', '~> 3.0'
19
- gem 'rubocop'
20
- gem 'rubocop-rake', require: false
21
- gem 'rubocop-rspec', require: false
19
+ gem "rspec", "~> 3.12"
20
+ gem "rubocop"
21
+ gem "rubocop-performance"
22
+ gem "rubocop-rake", require: false
23
+ gem "rubocop-rspec", require: false
22
24
  end
data/Gemfile.lock CHANGED
@@ -1,73 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ykxutils (0.1.8)
5
- bundler
6
- erubi
7
- rake (~> 13.0)
8
- tilt
4
+ ykxutils (0.1.12)
9
5
 
10
6
  GEM
11
7
  remote: https://rubygems.org/
12
8
  specs:
13
9
  ast (2.4.2)
10
+ debug (1.9.1)
11
+ irb (~> 1.10)
12
+ reline (>= 0.3.8)
14
13
  diff-lcs (1.5.0)
15
- erubi (1.11.0)
16
- json (2.6.2)
17
- parallel (1.22.1)
18
- parser (3.1.2.1)
14
+ erubi (1.12.0)
15
+ io-console (0.7.2)
16
+ irb (1.11.1)
17
+ rdoc
18
+ reline (>= 0.4.2)
19
+ json (2.7.1)
20
+ language_server-protocol (3.17.0.3)
21
+ parallel (1.24.0)
22
+ parser (3.2.2.4)
19
23
  ast (~> 2.4.1)
24
+ racc
25
+ psych (5.1.2)
26
+ stringio
27
+ racc (1.7.3)
20
28
  rainbow (3.1.1)
21
- rake (13.0.6)
22
- regexp_parser (2.6.0)
23
- rexml (3.2.5)
24
- rspec (3.11.0)
25
- rspec-core (~> 3.11.0)
26
- rspec-expectations (~> 3.11.0)
27
- rspec-mocks (~> 3.11.0)
28
- rspec-core (3.11.0)
29
- rspec-support (~> 3.11.0)
30
- rspec-expectations (3.11.1)
29
+ rake (13.1.0)
30
+ rdoc (6.6.2)
31
+ psych (>= 4.0.0)
32
+ regexp_parser (2.8.3)
33
+ reline (0.4.2)
34
+ io-console (~> 0.5)
35
+ rexml (3.2.6)
36
+ rspec (3.12.0)
37
+ rspec-core (~> 3.12.0)
38
+ rspec-expectations (~> 3.12.0)
39
+ rspec-mocks (~> 3.12.0)
40
+ rspec-core (3.12.2)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-expectations (3.12.3)
31
43
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.11.0)
33
- rspec-mocks (3.11.1)
44
+ rspec-support (~> 3.12.0)
45
+ rspec-mocks (3.12.6)
34
46
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.11.0)
36
- rspec-support (3.11.1)
37
- rubocop (1.36.0)
47
+ rspec-support (~> 3.12.0)
48
+ rspec-support (3.12.1)
49
+ rubocop (1.59.0)
38
50
  json (~> 2.3)
51
+ language_server-protocol (>= 3.17.0)
39
52
  parallel (~> 1.10)
40
- parser (>= 3.1.2.1)
53
+ parser (>= 3.2.2.4)
41
54
  rainbow (>= 2.2.2, < 4.0)
42
55
  regexp_parser (>= 1.8, < 3.0)
43
56
  rexml (>= 3.2.5, < 4.0)
44
- rubocop-ast (>= 1.20.1, < 2.0)
57
+ rubocop-ast (>= 1.30.0, < 2.0)
45
58
  ruby-progressbar (~> 1.7)
46
- unicode-display_width (>= 1.4.0, < 3.0)
47
- rubocop-ast (1.21.0)
48
- parser (>= 3.1.1.0)
49
- rubocop-performance (1.15.0)
50
- rubocop (>= 1.7.0, < 2.0)
51
- rubocop-ast (>= 0.4.0)
59
+ unicode-display_width (>= 2.4.0, < 3.0)
60
+ rubocop-ast (1.30.0)
61
+ parser (>= 3.2.1.0)
62
+ rubocop-capybara (2.20.0)
63
+ rubocop (~> 1.41)
64
+ rubocop-factory_bot (2.25.1)
65
+ rubocop (~> 1.41)
66
+ rubocop-performance (1.20.1)
67
+ rubocop (>= 1.48.1, < 2.0)
68
+ rubocop-ast (>= 1.30.0, < 2.0)
52
69
  rubocop-rake (0.6.0)
53
70
  rubocop (~> 1.0)
54
- rubocop-rspec (2.13.2)
55
- rubocop (~> 1.33)
56
- ruby-progressbar (1.11.0)
57
- tilt (2.0.11)
58
- unicode-display_width (2.3.0)
59
- webrick (1.7.0)
60
- yard (0.9.28)
61
- webrick (~> 1.7.0)
71
+ rubocop-rspec (2.25.0)
72
+ rubocop (~> 1.40)
73
+ rubocop-capybara (~> 2.17)
74
+ rubocop-factory_bot (~> 2.22)
75
+ ruby-progressbar (1.13.0)
76
+ stringio (3.1.0)
77
+ tilt (2.3.0)
78
+ unicode-display_width (2.5.0)
79
+ yard (0.9.34)
62
80
 
63
81
  PLATFORMS
64
82
  x86_64-linux
65
83
 
66
84
  DEPENDENCIES
67
85
  bundler
86
+ debug
68
87
  erubi
69
- rake (~> 13.0)
70
- rspec (~> 3.0)
88
+ rake (~> 13.1)
89
+ rspec (~> 3.12)
71
90
  rubocop
72
91
  rubocop-performance
73
92
  rubocop-rake
data/SECURITY.md ADDED
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Use this section to tell people about which versions of your project are
6
+ currently being supported with security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 5.1.x | :white_check_mark: |
11
+ | 5.0.x | :x: |
12
+ | 4.0.x | :white_check_mark: |
13
+ | < 4.0 | :x: |
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use this section to tell people how to report a vulnerability.
18
+
19
+ Tell them where to go, how often they can expect to get an update on a
20
+ reported vulnerability, what to expect if the vulnerability is accepted or
21
+ declined, etc.
@@ -0,0 +1,86 @@
1
+ server {
2
+ listen 443 ssl;
3
+ ssl_certificate /etc/letsencrypt/live/v103-3-189-127.myvps.jp/fullchain.pem;
4
+ ssl_certificate_key /etc/letsencrypt/live/v103-3-189-127.myvps.jp/privkey.pem;
5
+ server_name a.northern-cross.net;
6
+
7
+ error_log /var/www/vhosts/a.northern-cross.net/statistics/logs/ssl_error_log;
8
+ access_log /var/www/vhosts/a.northern-cross.net/statistics/logs/ssl_access_log;
9
+
10
+ # rewrite_log on;
11
+
12
+ root /var/www/vhosts/a.northern-cross.net/httpdocs;
13
+ location / {
14
+ index index.html;
15
+ }
16
+ error_page 500 502 503 504 /50x.html;
17
+ #error_page 500 /50x.html;
18
+ location = /50x.html {
19
+ root /usr/share/nginx/html/;
20
+ index 50x.html;
21
+ }
22
+ }
23
+
24
+
25
+ server {
26
+ listen 443 ssl;
27
+ server_name www.a.northern-cross.net;
28
+ #
29
+ return 301 https://a.northern-cross.net;
30
+
31
+ ssl_certificate /etc/letsencrypt/live/v103-3-189-127.myvps.jp/fullchain.pem;
32
+ ssl_certificate_key /etc/letsencrypt/live/v103-3-189-127.myvps.jp/privkey.pem;
33
+ include /etc/letsencrypt/options-ssl-nginx.conf;
34
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
35
+
36
+ }
37
+
38
+
39
+ server {
40
+ if ($host = a.northern-cross.net) {
41
+ return 301 https://$host$request_uri;
42
+ }
43
+
44
+ listen 80;
45
+ server_name a.northern-cross.net;
46
+
47
+ error_log /var/www/vhosts/a.northern-cross.net/statistics/logs/error_log;
48
+ access_log /var/www/vhosts/a.northern-cross.net/statistics/logs/access_log;
49
+
50
+ root /var/www/vhosts/a.northern-cross.net/httpdocs;
51
+ location / {
52
+ index index.html;
53
+ }
54
+ error_page 500 502 503 504 /50x.html;
55
+ location = /50x.html {
56
+ root /usr/share/nginx/html/;
57
+ index 50x.html;
58
+ }
59
+ }
60
+
61
+
62
+ server {
63
+ if ($host = northern-cross.net) {
64
+ return 301 https://$host$request_uri;
65
+ }
66
+
67
+
68
+ listen 80;
69
+ server_name a.northern-cross.net;
70
+
71
+ error_log /var/www/vhosts/a.northern-cross.net/statistics/logs/error_log;
72
+ access_log /var/www/vhosts/a.northern-cross.net/statistics/logs/access_log;
73
+
74
+ rewrite_log on;
75
+
76
+ root /var/www/vhosts/a.northern-cross.net/httpdocs;
77
+ location / {
78
+ index index.html;
79
+ }
80
+ error_page 500 502 503 504 /50x.html;
81
+ location = /50x.html {
82
+ root /usr/share/nginx/html/;
83
+ index 50x.html;
84
+ }
85
+ }
86
+
@@ -1,14 +1,12 @@
1
- require 'tilt'
2
- require 'yaml'
1
+ require "tilt"
2
+ require "yaml"
3
3
 
4
4
  module Ykxutils
5
5
  module Erubyx
6
6
  module_function
7
7
 
8
8
  def erubi_render(template_hash, scope, value_hash = {})
9
- unless template_hash[:OBJ]
10
- template_hash[:OBJ] = Tilt::ErubiTemplate.new { template_hash[:TEMPLATE] }
11
- end
9
+ template_hash[:OBJ] = Tilt::ErubiTemplate.new { template_hash[:TEMPLATE] } unless template_hash[:OBJ]
12
10
  template_hash[:OBJ].render(scope, value_hash)
13
11
  end
14
12
 
@@ -25,14 +23,14 @@ module Ykxutils
25
23
  template_text = File.read(template_file_path)
26
24
  template_hash = { TEMPLATE: template_text,
27
25
  OBJ: nil }
28
- value_hash = value_file_path_array.reduce({}) { |hash, path|
26
+ value_hash = value_file_path_array.reduce({}) do |hash, path|
29
27
  # p path
30
28
  hash0 = YAML.load_file(path)
31
29
  # p hash0
32
30
  hash = hash.merge(hash0)
33
31
  # p hash
34
32
  hash
35
- }
33
+ end
36
34
  # puts value_hash
37
35
  erubi_render(template_hash, scope, value_hash)
38
36
  end
@@ -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
@@ -1,37 +1,34 @@
1
- require 'ykxutils/erubyx'
1
+ require "ykxutils/erubyx"
2
2
 
3
3
  module Ykxutils
4
4
  module Gridlist
5
- TAMPLETES = { :GRID_DEF =>
6
- { :TEMPLATE => %!
5
+ TAMPLETES = { GRID_DEF: { TEMPLATE: %(
7
6
  .g-<%= row %>-<%= colum %> {
8
7
  grid-row-start: <%= row %>;
9
8
  grid-row-end: ,<%= row + 1 %>;
10
9
  grid-column-start: <%= colum %>;
11
10
  grid-column-end: <%= colum + 1 %>;
12
11
  }
13
- !, :OBJ => nil } }
12
+ ), OBJ: nil } }.freeze
14
13
 
15
14
  module_function
16
15
 
17
16
  def make_one_grid(hash, row, colum)
18
- unless hash[:OBJ]
19
- hash[:OBJ] = Tilt::ErubiTemplate.new { hash[:TEMPLATE] }
20
- end
17
+ hash[:OBJ] = Tilt::ErubiTemplate.new { hash[:TEMPLATE] } unless hash[:OBJ]
21
18
  hash[:OBJ].render(Object.new, { row: row, colum: colum })
22
19
  end
23
20
 
24
21
  def make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum)
25
- (min_row..max_row).map { |row|
26
- (min_colum..max_colum).map { |colum|
22
+ (min_row..max_row).map do |row|
23
+ (min_colum..max_colum).map do |colum|
27
24
  # puts "#{row} #{colum}"
28
25
  value_hash = { row: row, colum: colum }
29
26
  # make_one_grid(template_hash, value_hash)
30
27
  # p template_hash
31
28
  # p value_hash
32
- Ykxutils::Erubyx::erubi_render(template_hash, scope, value_hash)
33
- }
34
- }
29
+ Ykxutils::Erubyx.erubi_render(template_hash, scope, value_hash)
30
+ end
31
+ end
35
32
  end
36
33
 
37
34
  def make_grid_list(min_row, max_row, min_colum, max_colum)
@@ -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
@@ -18,23 +18,23 @@ module Ykxutils
18
18
  def extract(scope)
19
19
  hashx = {}
20
20
  @hash.each do |k, v|
21
- if k !~ /^_/
22
- # puts k
23
- # puts v
24
- pn = Pathname.new(v["template"]).cleanpath
25
- # Pathname.new(v).cleanpath
26
- template_pn = @server_dir_pn + pn
27
- # puts(template_pn)
28
- value_file_path_array = v["value"].map { |x|
29
- @virtual_domain_dir_pn + Pathname.new(x).cleanpath
30
- }
31
- hashx[k] = Ykxutils::Erubyx::erubi_render_with_file(template_pn, scope, value_file_path_array)
21
+ next unless k !~ /^_/
22
+
23
+ # puts k
24
+ # puts v
25
+ pn = Pathname.new(v["template"]).cleanpath
26
+ # Pathname.new(v).cleanpath
27
+ template_pn = @server_dir_pn + pn
28
+ # puts(template_pn)
29
+ value_file_path_array = v["value"].map do |x|
30
+ @virtual_domain_dir_pn + Pathname.new(x).cleanpath
32
31
  end
32
+ hashx[k] = Ykxutils::Erubyx.erubi_render_with_file(template_pn, scope, value_file_path_array)
33
33
  end
34
34
  template = File.read(@root_template_pn)
35
35
  template_hash = { TEMPLATE: template,
36
36
  OBJ: nil }
37
- Ykxutils::Erubyx::erubi_render(template_hash, scope, hashx)
37
+ Ykxutils::Erubyx.erubi_render(template_hash, scope, hashx)
38
38
  end
39
39
  end
40
40
  end
@@ -1,33 +1,32 @@
1
- require 'find'
2
- require_relative 'nginxconfig'
1
+ require "find"
2
+ require_relative "nginxconfig"
3
3
 
4
4
  module Ykxutils
5
5
  class Nginxconfigfiles
6
- def get_file_list(start_dir, re)
6
+ def get_file_list(start_dir, rex)
7
7
  @file_list = []
8
8
 
9
- Find.find(start_dir) { |x|
10
- if x =~ re
11
- # puts x
9
+ Find.find(start_dir) do |x|
10
+ if x =~ rex
12
11
  @file_list << x
13
12
  Find.prune
14
13
  end
15
- }
14
+ end
16
15
  @file_list
17
16
  end
18
17
 
19
18
  def output(file_list)
20
- file_list.map { |fname|
19
+ file_list.map do |fname|
21
20
  parent_dir_pn = Pathname.new(fname).cleanpath.parent
22
21
  vdomain = parent_dir_pn.basename
23
22
  output_fname = "#{vdomain}.conf"
24
23
  cli = ::Ykxutils::Nginxconfig.new(fname)
25
24
  scope = nil
26
- File.open(output_fname, "w") { |f|
25
+ File.open(output_fname, "w") do |f|
27
26
  x = cli.extract(scope)
28
27
  f.write(x)
29
- }
30
- }
28
+ end
29
+ end
31
30
  end
32
31
  end
33
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ykxutils
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.12"
5
5
  end
@@ -1,20 +1,25 @@
1
1
  require "yaml"
2
2
 
3
3
  module Ykxutils
4
+ SUCCESS = 0
5
+ ARGUMENT_ERROR = 1
6
+ STANDARD_ERROR = 2
7
+
4
8
  module_function
5
9
 
6
10
  def yaml_load_file_aliases(yaml_file_path, use_aliases: true)
11
+ converted = nil
7
12
  begin
8
- use_aliases ? YAML.load_file(yaml_file_path, aliases: true) : YAML.load_file(yaml_file_path)
9
- value = 0
13
+ converted = use_aliases ? YAML.load_file(yaml_file_path, aliases: true) : YAML.load_file(yaml_file_path)
14
+ value = SUCCESS
10
15
  rescue ArgumentError
11
16
  # puts e.message
12
- value = 1
17
+ value = ARGUMENT_ERROR
13
18
  rescue StandardError
14
- # puts e.message
15
- value = 2
19
+ # puts e.message8
20
+ value = STANDARD_ERROR
16
21
  end
17
- value
22
+ [converted, value]
18
23
  end
19
24
 
20
25
  def yaml_load_file_compati(yaml_file_path)
@@ -24,22 +29,23 @@ module Ykxutils
24
29
  end
25
30
 
26
31
  def yaml_load_aliases(content, use_aliases: true)
32
+ converted = nil
27
33
  begin
28
- use_aliases ? YAML.safe_load(content, aliases: true) : YAML.safe_load(content)
29
- value = 0
34
+ converted = use_aliases ? YAML.safe_load(content, use_aliases) : YAML.safe_load(content)
35
+ result = SUCCESS
30
36
  rescue ArgumentError
31
37
  # puts e.message
32
- value = 1
38
+ result = ARGUMENT_ERROR
33
39
  rescue StandardError
34
40
  # puts e.message
35
- value = 2
41
+ result = STANDARD_ERROR
36
42
  end
37
- value
43
+ [converted, result]
38
44
  end
39
45
 
40
46
  def yaml_load_compati(content)
41
- setting = yaml_load_aliases(content, use_aliases: true)
42
- setting = yaml_load_aliases(content, use_aliases: false) if setting.nil?
43
- setting
47
+ ret_array = yaml_load_aliases(content, use_aliases: true)
48
+ ret_array = yaml_load_aliases(content, use_aliases: false) if ret_array[1] != 0
49
+ ret_array[0]
44
50
  end
45
51
  end
data/lib/ykxutils.rb CHANGED
@@ -8,8 +8,11 @@ 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
16
+
14
17
  # Your code goes here...
15
18
  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>
data/ykxutils.gemspec CHANGED
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'lib/ykxutils/version'
3
+ require_relative "lib/ykxutils/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'ykxutils'
6
+ spec.name = "ykxutils"
7
7
  spec.version = Ykxutils::VERSION
8
- spec.authors = ['ykominami']
9
- spec.email = ['ykominami@gmail.com']
8
+ spec.authors = ["ykominami"]
9
+ spec.email = ["ykominami@gmail.com"]
10
10
 
11
- spec.summary = 'New version of utilty function created by yk.'
12
- spec.description = 'New version of utilty function created by yk.'
13
- spec.homepage = 'https://ykominami.github.io/ykxutils'
14
- spec.license = 'MIT'
15
- spec.required_ruby_version = '>= 2.7'
11
+ spec.summary = "New version of utilty function created by yk."
12
+ spec.description = "New version of utilty function created by yk."
13
+ spec.homepage = "https://ykominami.github.io/ykxutils"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.7"
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
18
 
19
- spec.metadata['homepage_uri'] = spec.homepage
20
- spec.metadata['source_code_uri'] = 'https://github.com/ykominami/ykxutils'
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/ykominami/ykxutils"
21
21
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
@@ -27,28 +27,28 @@ Gem::Specification.new do |spec|
27
27
  (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
28
  end
29
29
  end
30
- spec.bindir = 'exe'
30
+ spec.bindir = "exe"
31
31
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ['lib']
32
+ spec.require_paths = ["lib"]
33
33
 
34
- spec.add_runtime_dependency 'bundler'
34
+ # spec.add_runtime_dependency "bundler"
35
35
  # spec.add_runtime_dependency 'debug'
36
- spec.add_runtime_dependency 'erubi'
37
- spec.add_runtime_dependency 'rake', '~> 13.0'
38
- spec.add_runtime_dependency 'tilt'
36
+ # spec.add_runtime_dependency "erubi"
37
+ # spec.add_runtime_dependency "rake", "~> 13.0"
38
+ # spec.add_runtime_dependency "tilt"
39
39
 
40
- spec.add_development_dependency 'rspec', '~> 3.0'
41
- spec.add_development_dependency 'rubocop'
42
- spec.add_development_dependency 'rubocop-performance'
43
- spec.add_development_dependency 'rubocop-rake'
44
- spec.add_development_dependency 'rubocop-rspec'
40
+ # spec.add_development_dependency "rspec", "~> 3.0"
41
+ # spec.add_development_dependency "rubocop"
42
+ # spec.add_development_dependency "rubocop-performance"
43
+ # spec.add_development_dependency "rubocop-rake"
44
+ # spec.add_development_dependency "rubocop-rspec"
45
45
 
46
- spec.add_development_dependency 'yard'
46
+ # spec.add_development_dependency "yard"
47
47
 
48
48
  # Uncomment to register a new dependency of your gem
49
49
  # spec.add_dependency "example-gem", "~> 1.0"
50
50
 
51
51
  # For more information and examples about making a new gem, check out our
52
52
  # guide at: https://bundler.io/guides/creating_gem.html
53
- spec.metadata['rubygems_mfa_required'] = 'true'
53
+ spec.metadata["rubygems_mfa_required"] = "true"
54
54
  end
metadata CHANGED
@@ -1,155 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ykxutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - ykominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: erubi
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '13.0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '13.0'
55
- - !ruby/object:Gem::Dependency
56
- name: tilt
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-performance
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: yard
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
11
+ date: 2024-03-09 00:00:00.000000000 Z
12
+ dependencies: []
153
13
  description: New version of utilty function created by yk.
154
14
  email:
155
15
  - ykominami@gmail.com
@@ -167,16 +27,24 @@ files:
167
27
  - LICENSE.txt
168
28
  - README.md
169
29
  - Rakefile
30
+ - SECURITY.md
31
+ - a.northern-cross.net.conf
170
32
  - lib/ykxutils.rb
171
33
  - lib/ykxutils/erubyx.rb
34
+ - lib/ykxutils/fileop.rb
172
35
  - lib/ykxutils/gitcmd.rb
173
36
  - lib/ykxutils/gridlist.rb
37
+ - lib/ykxutils/htmlparsex.rb
174
38
  - lib/ykxutils/nginxconfig.rb
175
39
  - lib/ykxutils/nginxconfigfiles.rb
176
40
  - lib/ykxutils/pstorex.rb
177
41
  - lib/ykxutils/version.rb
178
42
  - lib/ykxutils/yamlx.rb
179
43
  - test_data/4servers.erb
44
+ - test_data/a.txt
45
+ - test_data/fileop/in.html
46
+ - test_data/fileop/out.html
47
+ - test_data/fileop/out_0.html
180
48
  - test_data/test.yaml
181
49
  - test_data/v103-3-189-127/4servers.erb
182
50
  - test_data/v103-3-189-127/a.northern-cross.net/base.yml
@@ -227,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
95
  - !ruby/object:Gem::Version
228
96
  version: '0'
229
97
  requirements: []
230
- rubygems_version: 3.1.6
98
+ rubygems_version: 3.3.26
231
99
  signing_key:
232
100
  specification_version: 4
233
101
  summary: New version of utilty function created by yk.