ykutils 0.1.1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.rubocop.yml +2 -1
  4. data/.rubocop_todo.yml +181 -85
  5. data/Gemfile +12 -4
  6. data/Gemfile.lock +23 -13
  7. data/bin/erubix +17 -0
  8. data/bin/erubix2 +13 -0
  9. data/bin/makegrid +4 -4
  10. data/lib/ykutils/erubyx.rb +41 -3
  11. data/lib/ykutils/fileoputils.rb +2 -2
  12. data/lib/ykutils/gridlist.rb +49 -67
  13. data/lib/ykutils/lines.rb +143 -143
  14. data/lib/ykutils/lsutils.rb +71 -71
  15. data/lib/ykutils/nginxconfig.rb +40 -0
  16. data/lib/ykutils/nginxconfigfiles.rb +31 -0
  17. data/lib/ykutils/nkfutil.rb +148 -147
  18. data/lib/ykutils/nkfutil19.rb +9 -11
  19. data/lib/ykutils/osutil.rb +16 -16
  20. data/lib/ykutils/retcodex.rb +1 -3
  21. data/lib/ykutils/stext.rb +427 -425
  22. data/lib/ykutils/stextx.rb +32 -32
  23. data/lib/ykutils/stringutils.rb +111 -111
  24. data/lib/ykutils/treemanager.rb +33 -33
  25. data/lib/ykutils/treemanagera.rb +21 -21
  26. data/lib/ykutils/version.rb +1 -1
  27. data/lib/ykutils/xlines.rb +8 -8
  28. data/lib/ykutils/yamlop.rb +227 -227
  29. data/lib/ykutils/yamlxop.rb +35 -35
  30. data/lib/ykutils.rb +4 -0
  31. data/test_data/4servers.erb +7 -0
  32. data/test_data/a.bat +5 -0
  33. data/test_data/a_ncn.bat +12 -0
  34. data/test_data/top.yml +0 -0
  35. data/test_data/v103-3-189-127/4servers.erb +0 -0
  36. data/test_data/v103-3-189-127/a.northern-cross.net/base.yml +28 -0
  37. data/test_data/v103-3-189-127/a.northern-cross.net/value_host.yml +1 -0
  38. data/test_data/v103-3-189-127/b.northern-cross.net/base.yml +28 -0
  39. data/test_data/v103-3-189-127/b.northern-cross.net/value_host.yml +1 -0
  40. data/test_data/v103-3-189-127/c.northern-cross.net/base.yml +28 -0
  41. data/test_data/v103-3-189-127/c.northern-cross.net/value_host.yml +1 -0
  42. data/test_data/v103-3-189-127/d.northern-cross.info/base.yml +28 -0
  43. data/test_data/v103-3-189-127/d.northern-cross.info/value_host.yml +1 -0
  44. data/test_data/v103-3-189-127/d.northern-cross.net/base.yml +28 -0
  45. data/test_data/v103-3-189-127/d.northern-cross.net/value_host.yml +1 -0
  46. data/test_data/v103-3-189-127/e.northern-cross.info/base.yml +28 -0
  47. data/test_data/v103-3-189-127/e.northern-cross.info/value_host.yml +1 -0
  48. data/test_data/v103-3-189-127/e.northern-cross.net/base.yml +28 -0
  49. data/test_data/v103-3-189-127/e.northern-cross.net/value_host.yml +1 -0
  50. data/test_data/v103-3-189-127/f.northern-cross.info/base.yml +28 -0
  51. data/test_data/v103-3-189-127/f.northern-cross.info/value_host.yml +1 -0
  52. data/test_data/v103-3-189-127/f.northern-cross.net/base.yml +28 -0
  53. data/test_data/v103-3-189-127/f.northern-cross.net/value_host.yml +1 -0
  54. data/test_data/v103-3-189-127/t_server_1.erb +7 -0
  55. data/test_data/v103-3-189-127/template.erb +21 -0
  56. data/test_data/v103-3-189-127/template_ssl.erb +22 -0
  57. data/test_data/v103-3-189-127/template_ssl_www.erb +12 -0
  58. data/test_data/v103-3-189-127/template_www.erb +24 -0
  59. data/test_data/v103-3-189-127/value.yml +3 -0
  60. data/test_data/v103-3-189-127/value_ssl.yml +5 -0
  61. data/ykutils.gemspec +45 -43
  62. metadata +44 -8
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: d.northern-cross.info
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: d.northern-cross.net
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: e.northern-cross.info
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: e.northern-cross.net
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: f.northern-cross.info
@@ -0,0 +1,28 @@
1
+ _root:
2
+ template: 4servers.erb
3
+ server1:
4
+ protocol: ssl
5
+ template: template_ssl.erb
6
+ value:
7
+ - value_host.yml
8
+ - ../value_ssl.yml
9
+ server2:
10
+ protocol: ssl
11
+ domain: www
12
+ template: template_ssl_www.erb
13
+ value:
14
+ - value_host.yml
15
+ - ../value_ssl.yml
16
+ server3:
17
+ protocol:
18
+ template: template.erb
19
+ value:
20
+ - value_host.yml
21
+ - ../value.yml
22
+ server4:
23
+ protocol:
24
+ domain: www
25
+ template: template_www.erb
26
+ value:
27
+ - value_host.yml
28
+ - ../value.yml
@@ -0,0 +1 @@
1
+ host: f.northern-cross.net
@@ -0,0 +1,7 @@
1
+ <%= server_ssl %>
2
+
3
+ <%= server_ssl_www %>
4
+
5
+ <%= server %>
6
+
7
+ <%= server_www %>
@@ -0,0 +1,21 @@
1
+ server {
2
+ if ($host = <%= host %>) {
3
+ return 301 https://$host$request_uri;
4
+ }
5
+
6
+ listen 80;
7
+ server_name <%= host %>;
8
+
9
+ error_log /var/www/vhosts/<%= host %>/statistics/logs/<%= error_log %>;
10
+ access_log /var/www/vhosts/<%= host %>/statistics/logs/<%= access_log %>;
11
+
12
+ root /var/www/vhosts/<%= host %>/httpdocs;
13
+ location / {
14
+ index index.html;
15
+ }
16
+ error_page 500 502 503 504 /50x.html;
17
+ location = /50x.html {
18
+ root /usr/share/nginx/html/;
19
+ index 50x.html;
20
+ }
21
+ }
@@ -0,0 +1,22 @@
1
+ server {
2
+ listen <%= ssl_port %>;
3
+ ssl_certificate <%= ssl_certificate %>;
4
+ ssl_certificate_key <%= ssl_certificate_key %>;
5
+ server_name <%= host %>;
6
+
7
+ error_log /var/www/vhosts/<%= host %>/statistics/logs/<%= error_log %>;
8
+ access_log /var/www/vhosts/<%= host %>/statistics/logs/<%= access_log %>;
9
+
10
+ # rewrite_log on;
11
+
12
+ root /var/www/vhosts/<%= host %>/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
+ }
@@ -0,0 +1,12 @@
1
+ server {
2
+ listen <%= ssl_port %>;
3
+ server_name www.<%= host %>;
4
+ #
5
+ return 301 https://<%= host %>;
6
+
7
+ ssl_certificate <%= ssl_certificate %>;
8
+ ssl_certificate_key <%= ssl_certificate_key %>;
9
+ include /etc/letsencrypt/options-ssl-nginx.conf;
10
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
11
+
12
+ }
@@ -0,0 +1,24 @@
1
+ server {
2
+ if ($host = northern-cross.net) {
3
+ return 301 https://$host$request_uri;
4
+ }
5
+
6
+
7
+ listen <%= port %>;
8
+ server_name <%= host %>;
9
+
10
+ error_log /var/www/vhosts/<%= host %>/statistics/logs/<%= error_log %>;
11
+ access_log /var/www/vhosts/<%= host %>/statistics/logs/<%= access_log %>;
12
+
13
+ rewrite_log on;
14
+
15
+ root /var/www/vhosts/<%= host %>/httpdocs;
16
+ location / {
17
+ index index.html;
18
+ }
19
+ error_page 500 502 503 504 /50x.html;
20
+ location = /50x.html {
21
+ root /usr/share/nginx/html/;
22
+ index 50x.html;
23
+ }
24
+ }
@@ -0,0 +1,3 @@
1
+ error_log: error_log
2
+ access_log: access_log
3
+ port: 80
@@ -0,0 +1,5 @@
1
+ error_log: ssl_error_log
2
+ access_log: ssl_access_log
3
+ ssl_port: 443 ssl
4
+ ssl_certificate: /etc/letsencrypt/live/v103-3-189-127.myvps.jp/fullchain.pem
5
+ ssl_certificate_key: /etc/letsencrypt/live/v103-3-189-127.myvps.jp/privkey.pem
data/ykutils.gemspec CHANGED
@@ -1,43 +1,45 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("lib", __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
-
6
- require_relative "lib/ykutils/version"
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = "ykutils"
10
- spec.version = Ykutils::VERSION
11
- spec.authors = ["yasuo kominami"]
12
- spec.email = ["ykominami@gmail.com"]
13
-
14
- spec.summary = "utilty function created by yk."
15
- spec.description = "utilty function created by yk."
16
- spec.homepage = ""
17
- spec.license = "MIT"
18
- spec.required_ruby_version = ">= 2.6.0"
19
-
20
- #spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
21
-
22
- # spec.metadata["homepage_uri"] = spec.homepage
23
- # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
24
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
25
-
26
- # Specify which files should be added to the gem when it is released.
27
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
-
29
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- # Uncomment to register a new dependency of your gem
35
- # spec.add_dependency "example-gem", "~> 1.0"
36
- spec.add_dependency "filex"
37
- spec.add_development_dependency "rubocop-rake"
38
- spec.add_development_dependency "rubocop-rspec"
39
-
40
- # For more information and examples about making a new gem, check out our
41
- # guide at: https://bundler.io/guides/creating_gem.html
42
- spec.metadata["rubygems_mfa_required"] = "true"
43
- end
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require_relative "lib/ykutils/version"
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "ykutils"
10
+ spec.version = Ykutils::VERSION
11
+ spec.authors = ["yasuo kominami"]
12
+ spec.email = ["ykominami@gmail.com"]
13
+
14
+ spec.summary = "utilty function created by yk."
15
+ spec.description = "utilty function created by yk."
16
+ spec.homepage = "https://ykominami.github.io/ykutils/"
17
+ spec.license = "MIT"
18
+ spec.required_ruby_version = ">= 2.6.0"
19
+
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/ykominami/ykutils"
24
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+
29
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+ spec.add_dependency "erubi"
37
+ spec.add_dependency "filex"
38
+ spec.add_dependency "tilt"
39
+ # spec.add_development_dependency "rubocop-rake"
40
+ # spec.add_development_dependency "rubocop-rspec"
41
+
42
+ # For more information and examples about making a new gem, check out our
43
+ # guide at: https://bundler.io/guides/creating_gem.html
44
+ spec.metadata["rubygems_mfa_required"] = "true"
45
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ykutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: filex
14
+ name: erubi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,13 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rubocop-rake
28
+ name: filex
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -39,13 +39,13 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rubocop-rspec
42
+ name: tilt
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -72,6 +72,8 @@ files:
72
72
  - README.md
73
73
  - Rakefile
74
74
  - bin/console
75
+ - bin/erubix
76
+ - bin/erubix2
75
77
  - bin/makegrid
76
78
  - bin/setup
77
79
  - lib/ykutils.rb
@@ -84,6 +86,8 @@ files:
84
86
  - lib/ykutils/hasharray.rb
85
87
  - lib/ykutils/lines.rb
86
88
  - lib/ykutils/lsutils.rb
89
+ - lib/ykutils/nginxconfig.rb
90
+ - lib/ykutils/nginxconfigfiles.rb
87
91
  - lib/ykutils/nkfutil.rb
88
92
  - lib/ykutils/nkfutil19.rb
89
93
  - lib/ykutils/osutil.rb
@@ -100,11 +104,43 @@ files:
100
104
  - lib/ykutils/yamlop.rb
101
105
  - lib/ykutils/yamlxop.rb
102
106
  - sig/ykutils.rbs
107
+ - test_data/4servers.erb
108
+ - test_data/a.bat
109
+ - test_data/a_ncn.bat
110
+ - test_data/top.yml
111
+ - test_data/v103-3-189-127/4servers.erb
112
+ - test_data/v103-3-189-127/a.northern-cross.net/base.yml
113
+ - test_data/v103-3-189-127/a.northern-cross.net/value_host.yml
114
+ - test_data/v103-3-189-127/b.northern-cross.net/base.yml
115
+ - test_data/v103-3-189-127/b.northern-cross.net/value_host.yml
116
+ - test_data/v103-3-189-127/c.northern-cross.net/base.yml
117
+ - test_data/v103-3-189-127/c.northern-cross.net/value_host.yml
118
+ - test_data/v103-3-189-127/d.northern-cross.info/base.yml
119
+ - test_data/v103-3-189-127/d.northern-cross.info/value_host.yml
120
+ - test_data/v103-3-189-127/d.northern-cross.net/base.yml
121
+ - test_data/v103-3-189-127/d.northern-cross.net/value_host.yml
122
+ - test_data/v103-3-189-127/e.northern-cross.info/base.yml
123
+ - test_data/v103-3-189-127/e.northern-cross.info/value_host.yml
124
+ - test_data/v103-3-189-127/e.northern-cross.net/base.yml
125
+ - test_data/v103-3-189-127/e.northern-cross.net/value_host.yml
126
+ - test_data/v103-3-189-127/f.northern-cross.info/base.yml
127
+ - test_data/v103-3-189-127/f.northern-cross.info/value_host.yml
128
+ - test_data/v103-3-189-127/f.northern-cross.net/base.yml
129
+ - test_data/v103-3-189-127/f.northern-cross.net/value_host.yml
130
+ - test_data/v103-3-189-127/t_server_1.erb
131
+ - test_data/v103-3-189-127/template.erb
132
+ - test_data/v103-3-189-127/template_ssl.erb
133
+ - test_data/v103-3-189-127/template_ssl_www.erb
134
+ - test_data/v103-3-189-127/template_www.erb
135
+ - test_data/v103-3-189-127/value.yml
136
+ - test_data/v103-3-189-127/value_ssl.yml
103
137
  - ykutils.gemspec
104
- homepage: ''
138
+ homepage: https://ykominami.github.io/ykutils/
105
139
  licenses:
106
140
  - MIT
107
141
  metadata:
142
+ homepage_uri: https://ykominami.github.io/ykutils/
143
+ source_code_uri: https://github.com/ykominami/ykutils
108
144
  rubygems_mfa_required: 'true'
109
145
  post_install_message:
110
146
  rdoc_options: []