ykxutils 0.1.8 → 0.1.11

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: fb57978cd24ccbb824287f130d77a3c38a6703e0341914b32221adf60786bb73
4
- data.tar.gz: 92fd92f8550542480f7f44e11870d0a18edc3c7412311d0511bd0c9e554eacbd
3
+ metadata.gz: 40a9c8960f5a5f9fdd20a1ffa620987f76c61b90f602c9beae391290232bd224
4
+ data.tar.gz: ab77e98dc0de6d80a062e5d263d0d31b5034c1be47754612a3b32a6a86e04953
5
5
  SHA512:
6
- metadata.gz: 594acd0dd1516dfad347315770af817a49df02e09bbee5b3b78f6dae768a6272f450a160318a708e5e3d39b6070be5128bf2d327045da9c516bbe3e891b45e94
7
- data.tar.gz: 1909511a5120c6a9564f74db65f45d602277df8ee594010f3ea6f7d2da2f7c3dab22bf2aec8739c29369fe75bbee547e6f10ee0171d0ee4b31af76a0940d9e99
6
+ metadata.gz: 70e64fc12c1bf0b45fc1cdbb7ae8254e962731f707351f3a47293422096ec3049c73fc09eb6ded2a7172bb3909e552712163202ae2e489d8cb5827561714e47b
7
+ data.tar.gz: fc0a7733b0c29d19a1872e877e67213d7826e7dda7e5f1c464f568bd968a1114465f073b981c0b3de8576704e7c5d7627548e8564c9187d79eb85a84af58bc19
data/.rubocop_todo.yml CHANGED
@@ -1,39 +1,16 @@
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 2023-12-12 09:49:25 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
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
- Bundler/OrderedGems:
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'
24
-
25
- # Offense count: 1
26
- # This cop supports safe autocorrection (--autocorrect).
27
- # 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:
10
+ # Configuration parameters: IgnoreImplicitReferences.
11
+ Lint/ShadowedArgument:
35
12
  Exclude:
36
- # - 'lib/ykxutils/yamlx.rb'
13
+ # - 'lib/ykxutils/yamlx.rb'
37
14
 
38
15
  # Offense count: 1
39
16
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
@@ -55,7 +32,7 @@ Metrics/ParameterLists:
55
32
  # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
56
33
  Naming/MethodParameterName:
57
34
  Exclude:
58
- - 'lib/ykxutils/nginxconfigfiles.rb'
35
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
59
36
 
60
37
  # Offense count: 1
61
38
  # This cop supports safe autocorrection (--autocorrect).
@@ -63,15 +40,15 @@ Naming/MethodParameterName:
63
40
  # SupportedStyles: be, be_nil
64
41
  RSpec/BeNil:
65
42
  Exclude:
66
- - 'spec/ykxutils_spec.rb'
43
+ # - 'spec/ykxutils_spec.rb'
67
44
 
68
45
  # Offense count: 1
69
46
  RSpec/BeforeAfterAll:
70
47
  Exclude:
71
- - 'spec/spec_helper.rb'
72
- - 'spec/rails_helper.rb'
73
- - 'spec/support/**/*.rb'
74
- - 'spec/ykxutils_spec.rb'
48
+ # - 'spec/spec_helper.rb'
49
+ # - 'spec/rails_helper.rb'
50
+ # - 'spec/support/**/*.rb'
51
+ # - 'spec/ykxutils_spec.rb'
75
52
 
76
53
  # Offense count: 2
77
54
  # Configuration parameters: CountAsOne.
@@ -82,12 +59,12 @@ RSpec/ExampleLength:
82
59
  # Configuration parameters: AssignmentOnly.
83
60
  RSpec/InstanceVariable:
84
61
  Exclude:
85
- - 'spec/ykxutils_spec.rb'
62
+ # - 'spec/ykxutils_spec.rb'
86
63
 
87
64
  # Offense count: 1
88
65
  RSpec/NoExpectationExample:
89
66
  Exclude:
90
- - 'spec/ykxutils_spec.rb'
67
+ # - 'spec/ykxutils_spec.rb'
91
68
 
92
69
  # Offense count: 1
93
70
  # This cop supports safe autocorrection (--autocorrect).
@@ -95,7 +72,7 @@ RSpec/NoExpectationExample:
95
72
  # SupportedStyles: not_to, to_not
96
73
  RSpec/NotToNot:
97
74
  Exclude:
98
- - 'spec/ykxutils_spec.rb'
75
+ # - 'spec/ykxutils_spec.rb'
99
76
 
100
77
  # Offense count: 8
101
78
  # This cop supports safe autocorrection (--autocorrect).
@@ -106,25 +83,25 @@ RSpec/NotToNot:
106
83
  # AllowedMethods: lambda, proc, it
107
84
  Style/BlockDelimiters:
108
85
  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'
86
+ # - 'lib/ykxutils/erubyx.rb'
87
+ # - 'lib/ykxutils/gridlist.rb'
88
+ # - 'lib/ykxutils/nginxconfig.rb'
89
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
90
+ # - 'spec/ykxutils_spec.rb'
114
91
 
115
92
  # Offense count: 5
116
93
  # This cop supports safe autocorrection (--autocorrect).
117
94
  Style/ColonMethodCall:
118
95
  Exclude:
119
- - 'lib/ykxutils/gridlist.rb'
120
- - 'lib/ykxutils/nginxconfig.rb'
121
- - 'spec/ykxutils_spec.rb'
96
+ # - 'lib/ykxutils/gridlist.rb'
97
+ # - 'lib/ykxutils/nginxconfig.rb'
98
+ # - 'spec/ykxutils_spec.rb'
122
99
 
123
100
  # Offense count: 1
124
101
  # This cop supports safe autocorrection (--autocorrect).
125
102
  Style/EachWithObject:
126
103
  Exclude:
127
- - 'spec/ykxutils_spec.rb'
104
+ # - 'spec/ykxutils_spec.rb'
128
105
 
129
106
  # Offense count: 3
130
107
  # This cop supports safe autocorrection (--autocorrect).
@@ -133,14 +110,14 @@ Style/EachWithObject:
133
110
  # SupportedShorthandSyntax: always, never, either, consistent
134
111
  Style/HashSyntax:
135
112
  Exclude:
136
- - 'lib/ykxutils/gridlist.rb'
113
+ # - 'lib/ykxutils/gridlist.rb'
137
114
 
138
115
  # Offense count: 2
139
116
  # This cop supports safe autocorrection (--autocorrect).
140
117
  Style/IfUnlessModifier:
141
118
  Exclude:
142
- - 'lib/ykxutils/erubyx.rb'
143
- - 'lib/ykxutils/gridlist.rb'
119
+ # - 'lib/ykxutils/erubyx.rb'
120
+ # - 'lib/ykxutils/gridlist.rb'
144
121
 
145
122
  # Offense count: 1
146
123
  # This cop supports unsafe autocorrection (--autocorrect-all).
@@ -148,7 +125,7 @@ Style/IfUnlessModifier:
148
125
  # SupportedStyles: literals, strict
149
126
  Style/MutableConstant:
150
127
  Exclude:
151
- - 'lib/ykxutils/gridlist.rb'
128
+ # - 'lib/ykxutils/gridlist.rb'
152
129
 
153
130
  # Offense count: 2
154
131
  # This cop supports safe autocorrection (--autocorrect).
@@ -156,15 +133,15 @@ Style/MutableConstant:
156
133
  # SupportedStyles: skip_modifier_ifs, always
157
134
  Style/Next:
158
135
  Exclude:
159
- - 'lib/ykxutils/nginxconfig.rb'
160
- - 'lib/ykxutils/nginxconfigfiles.rb'
136
+ # - 'lib/ykxutils/nginxconfig.rb'
137
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
161
138
 
162
139
  # Offense count: 1
163
140
  # This cop supports safe autocorrection (--autocorrect).
164
141
  # Configuration parameters: PreferredDelimiters.
165
142
  Style/PercentLiteralDelimiters:
166
143
  Exclude:
167
- - 'lib/ykxutils/gridlist.rb'
144
+ # - 'lib/ykxutils/gridlist.rb'
168
145
 
169
146
  # Offense count: 45
170
147
  # This cop supports safe autocorrection (--autocorrect).
@@ -172,8 +149,8 @@ Style/PercentLiteralDelimiters:
172
149
  # SupportedStyles: single_quotes, double_quotes
173
150
  Style/StringLiterals:
174
151
  Exclude:
175
- - 'Gemfile'
176
- - 'lib/ykxutils/erubyx.rb'
177
- - 'lib/ykxutils/gridlist.rb'
178
- - 'lib/ykxutils/nginxconfigfiles.rb'
179
- - 'ykxutils.gemspec'
152
+ # - 'Gemfile'
153
+ # - 'lib/ykxutils/erubyx.rb'
154
+ # - 'lib/ykxutils/gridlist.rb'
155
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
156
+ # - 'ykxutils.gemspec'
data/Gemfile CHANGED
@@ -1,22 +1,22 @@
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 "yard"
15
15
  end
16
16
 
17
17
  group :test do
18
- gem 'rspec', '~> 3.0'
19
- gem 'rubocop'
20
- gem 'rubocop-rake', require: false
21
- gem 'rubocop-rspec', require: false
18
+ gem "rspec", "~> 3.12"
19
+ gem "rubocop"
20
+ gem "rubocop-rake", require: false
21
+ gem "rubocop-rspec", require: false
22
22
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ykxutils (0.1.8)
4
+ ykxutils (0.1.10)
5
5
  bundler
6
6
  erubi
7
7
  rake (~> 13.0)
@@ -12,53 +12,61 @@ GEM
12
12
  specs:
13
13
  ast (2.4.2)
14
14
  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)
15
+ erubi (1.12.0)
16
+ json (2.7.1)
17
+ language_server-protocol (3.17.0.3)
18
+ parallel (1.24.0)
19
+ parser (3.2.2.4)
19
20
  ast (~> 2.4.1)
21
+ racc
22
+ racc (1.7.3)
20
23
  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)
24
+ rake (13.1.0)
25
+ regexp_parser (2.8.3)
26
+ rexml (3.2.6)
27
+ rspec (3.12.0)
28
+ rspec-core (~> 3.12.0)
29
+ rspec-expectations (~> 3.12.0)
30
+ rspec-mocks (~> 3.12.0)
31
+ rspec-core (3.12.2)
32
+ rspec-support (~> 3.12.0)
33
+ rspec-expectations (3.12.3)
31
34
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.11.0)
33
- rspec-mocks (3.11.1)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-mocks (3.12.6)
34
37
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.11.0)
36
- rspec-support (3.11.1)
37
- rubocop (1.36.0)
38
+ rspec-support (~> 3.12.0)
39
+ rspec-support (3.12.1)
40
+ rubocop (1.59.0)
38
41
  json (~> 2.3)
42
+ language_server-protocol (>= 3.17.0)
39
43
  parallel (~> 1.10)
40
- parser (>= 3.1.2.1)
44
+ parser (>= 3.2.2.4)
41
45
  rainbow (>= 2.2.2, < 4.0)
42
46
  regexp_parser (>= 1.8, < 3.0)
43
47
  rexml (>= 3.2.5, < 4.0)
44
- rubocop-ast (>= 1.20.1, < 2.0)
48
+ rubocop-ast (>= 1.30.0, < 2.0)
45
49
  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)
50
+ unicode-display_width (>= 2.4.0, < 3.0)
51
+ rubocop-ast (1.30.0)
52
+ parser (>= 3.2.1.0)
53
+ rubocop-capybara (2.20.0)
54
+ rubocop (~> 1.41)
55
+ rubocop-factory_bot (2.25.1)
56
+ rubocop (~> 1.41)
57
+ rubocop-performance (1.20.1)
58
+ rubocop (>= 1.48.1, < 2.0)
59
+ rubocop-ast (>= 1.30.0, < 2.0)
52
60
  rubocop-rake (0.6.0)
53
61
  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)
62
+ rubocop-rspec (2.25.0)
63
+ rubocop (~> 1.40)
64
+ rubocop-capybara (~> 2.17)
65
+ rubocop-factory_bot (~> 2.22)
66
+ ruby-progressbar (1.13.0)
67
+ tilt (2.3.0)
68
+ unicode-display_width (2.5.0)
69
+ yard (0.9.34)
62
70
 
63
71
  PLATFORMS
64
72
  x86_64-linux
@@ -66,8 +74,8 @@ PLATFORMS
66
74
  DEPENDENCIES
67
75
  bundler
68
76
  erubi
69
- rake (~> 13.0)
70
- rspec (~> 3.0)
77
+ rake (~> 13.1)
78
+ rspec (~> 3.12)
71
79
  rubocop
72
80
  rubocop-performance
73
81
  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
@@ -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)
@@ -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.11"
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
@@ -11,5 +11,6 @@ require_relative "ykxutils/gridlist"
11
11
 
12
12
  module Ykxutils
13
13
  class Error < StandardError; end
14
+
14
15
  # Your code goes here...
15
16
  end
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,14 +1,14 @@
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.11
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
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -167,6 +167,8 @@ files:
167
167
  - LICENSE.txt
168
168
  - README.md
169
169
  - Rakefile
170
+ - SECURITY.md
171
+ - a.northern-cross.net.conf
170
172
  - lib/ykxutils.rb
171
173
  - lib/ykxutils/erubyx.rb
172
174
  - lib/ykxutils/gitcmd.rb
@@ -227,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
229
  - !ruby/object:Gem::Version
228
230
  version: '0'
229
231
  requirements: []
230
- rubygems_version: 3.1.6
232
+ rubygems_version: 3.3.26
231
233
  signing_key:
232
234
  specification_version: 4
233
235
  summary: New version of utilty function created by yk.