ykutils 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile +13 -5
  4. data/Gemfile.lock +8 -3
  5. data/bin/erubix +17 -0
  6. data/bin/erubix2 +13 -0
  7. data/lib/ykutils/erubyx.rb +27 -0
  8. data/lib/ykutils/gridlist.rb +3 -3
  9. data/lib/ykutils/nginxconfig.rb +41 -0
  10. data/lib/ykutils/nginxconfigfiles.rb +31 -0
  11. data/lib/ykutils/version.rb +1 -1
  12. data/lib/ykutils.rb +4 -0
  13. data/test_data/4servers.erb +7 -0
  14. data/test_data/a.bat +5 -0
  15. data/test_data/a_ncn.bat +12 -0
  16. data/test_data/top.yml +0 -0
  17. data/test_data/v103-3-189-127/4servers.erb +0 -0
  18. data/test_data/v103-3-189-127/a.northern-cross.net/base.yml +28 -0
  19. data/test_data/v103-3-189-127/a.northern-cross.net/value_host.yml +1 -0
  20. data/test_data/v103-3-189-127/b.northern-cross.net/base.yml +28 -0
  21. data/test_data/v103-3-189-127/b.northern-cross.net/value_host.yml +1 -0
  22. data/test_data/v103-3-189-127/c.northern-cross.net/base.yml +28 -0
  23. data/test_data/v103-3-189-127/c.northern-cross.net/value_host.yml +1 -0
  24. data/test_data/v103-3-189-127/d.northern-cross.info/base.yml +28 -0
  25. data/test_data/v103-3-189-127/d.northern-cross.info/value_host.yml +1 -0
  26. data/test_data/v103-3-189-127/d.northern-cross.net/base.yml +28 -0
  27. data/test_data/v103-3-189-127/d.northern-cross.net/value_host.yml +1 -0
  28. data/test_data/v103-3-189-127/e.northern-cross.info/base.yml +28 -0
  29. data/test_data/v103-3-189-127/e.northern-cross.info/value_host.yml +1 -0
  30. data/test_data/v103-3-189-127/e.northern-cross.net/base.yml +28 -0
  31. data/test_data/v103-3-189-127/e.northern-cross.net/value_host.yml +1 -0
  32. data/test_data/v103-3-189-127/f.northern-cross.info/base.yml +28 -0
  33. data/test_data/v103-3-189-127/f.northern-cross.info/value_host.yml +1 -0
  34. data/test_data/v103-3-189-127/f.northern-cross.net/base.yml +28 -0
  35. data/test_data/v103-3-189-127/f.northern-cross.net/value_host.yml +1 -0
  36. data/test_data/v103-3-189-127/t_server_1.erb +7 -0
  37. data/test_data/v103-3-189-127/template.erb +21 -0
  38. data/test_data/v103-3-189-127/template_ssl.erb +22 -0
  39. data/test_data/v103-3-189-127/template_ssl_www.erb +12 -0
  40. data/test_data/v103-3-189-127/template_www.erb +24 -0
  41. data/test_data/v103-3-189-127/value.yml +3 -0
  42. data/test_data/v103-3-189-127/value_ssl.yml +5 -0
  43. metadata +37 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64a9a78e4cbc27c71e753038eb3c7c79ea06bbba9d54670302705964b000581c
4
- data.tar.gz: a73847929de26acddce29a240848fa527580879d430d2f2062964cc1882cdef7
3
+ metadata.gz: fecfcb7c978ed74dee5ad1d8ac76c4c503c32bba715085c1d7d775ac0fab9d6e
4
+ data.tar.gz: 21d7e56aa28377d83b977d52e9e62e5408fb1d04488baf869bc1ce874a2f75a0
5
5
  SHA512:
6
- metadata.gz: ebbe17d7b690bbbf2a98ed5e6c69f7fb36c32e7ee3b6c37166abf8cd99b0ae44a7d2db13822d74320de6b8a4b4c7a2612b729c293734321261cfedf13c3ccd53
7
- data.tar.gz: 2475c18db65ce6bcc6cb8f3bcab363fc22ae80a5a3f788be3d6e3fa33ffd9f95d5f44f6d144416cd98db3dac985d2eda70884332c83c093a71f83c70ec751b8f
6
+ metadata.gz: ee112d8a0bbace3bcbd63034e48baebbfef182df826a16766e87a8f0f5427ae400b0de3cae53038ccd9ca599567db7bc6c798f932858d66fc97b36ff02ce2d61
7
+ data.tar.gz: a804459567c83b26d6b7e9b5e334abb210ebb7d6b972d91e55d30b6f54d153f60dafd1b49fe1b4222d36a75c23fc2ddbb70bfc8bd02dcc8b6a993e9d5358986f
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.conf
13
+ checksum/
data/Gemfile CHANGED
@@ -5,11 +5,19 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in ykutils.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem "tilt"
9
+ gem "erubi"
9
10
 
10
- gem "rspec", "~> 3.0"
11
+ group :development, optional: true do
12
+ gem "rake", "~> 13.0"
11
13
 
12
- gem "rubocop", "~> 1.21"
14
+ gem "yard"
15
+ end
13
16
 
14
- gem "tilt"
15
- gem "erubi"
17
+ group :test, optional: true do
18
+ gem "rspec", "~> 3.0"
19
+
20
+ gem "rubocop", "~> 1.21"
21
+ gem "rubocop-rake"
22
+ gem "rubocop-rspec"
23
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ykutils (0.1.3)
4
+ ykutils (0.1.4)
5
5
  filex
6
6
 
7
7
  GEM
@@ -53,9 +53,13 @@ GEM
53
53
  ruby-progressbar (1.11.0)
54
54
  tilt (2.0.10)
55
55
  unicode-display_width (2.1.0)
56
+ webrick (1.7.0)
57
+ yard (0.9.28)
58
+ webrick (~> 1.7.0)
56
59
 
57
60
  PLATFORMS
58
- x64-mingw-ucrt
61
+ x64-mingw32
62
+ x64-unknown
59
63
 
60
64
  DEPENDENCIES
61
65
  erubi
@@ -65,7 +69,8 @@ DEPENDENCIES
65
69
  rubocop-rake
66
70
  rubocop-rspec
67
71
  tilt
72
+ yard
68
73
  ykutils!
69
74
 
70
75
  BUNDLED WITH
71
- 2.3.7
76
+ 2.3.9
data/bin/erubix ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ykutils"
6
+
7
+ template_file_path = ARGV[0]
8
+ value_file_path_array = [ARGV[1]]
9
+ ind = 2
10
+ while ARGV.size > ind
11
+ value_file_path_array << ARGV[ind]
12
+ ind += 1
13
+ end
14
+
15
+ scope = nil
16
+ content = Ykutils::Erubyx::erubi_render_with_file(template_file_path, scope, value_file_path_array)
17
+ puts content
data/bin/erubix2 ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ykutils"
6
+ require 'yaml'
7
+ require 'find'
8
+
9
+ ncf = Ykutils::Nginxconfigfiles.new
10
+ re = /base.yml$/
11
+ start_dir = ARGV[0]
12
+ file_list = ncf.get_file_list(start_dir, re)
13
+ ncf.output(file_list)
@@ -1,4 +1,5 @@
1
1
  require 'tilt'
2
+ require 'yaml'
2
3
 
3
4
  module Ykutils
4
5
  module Erubyx
@@ -10,5 +11,31 @@ module Ykutils
10
11
  end
11
12
  template_hash[:OBJ].render( scope, value_hash )
12
13
  end
14
+
15
+ ##
16
+ # `erubi_render_with_file` takes a template file path, a scope, and a value file path, reads the
17
+ # template file, loads the value file, and then calls `erubi_render` with the template hash, scope,
18
+ # and value hash
19
+ #
20
+ # Args:
21
+ # template_file_path: The path to the template file.
22
+ # scope: the scope of the template. This is the name of the directory that the template is in.
23
+ # value_file_path: The path to the YAML file that contains the values to be used in the template.
24
+ def erubi_render_with_file(template_file_path, scope, value_file_path_array)
25
+ template_text = File.read(template_file_path)
26
+ template_hash = { TEMPLATE: template_text,
27
+ OBJ: nil
28
+ }
29
+ value_hash = value_file_path_array.reduce({}){ |hash, path|
30
+ #p path
31
+ hash0 = YAML.load_file(path)
32
+ #p hash0
33
+ hash = hash.merge(hash0)
34
+ #p hash
35
+ hash
36
+ }
37
+ #puts value_hash
38
+ erubi_render(template_hash, scope, value_hash)
39
+ end
13
40
  end
14
41
  end
@@ -27,14 +27,14 @@ module Ykutils
27
27
  #puts "#{row} #{colum}"
28
28
  value_hash = { row: row, colum: colum }
29
29
  #make_one_grid(template_hash, value_hash)
30
- p template_hash
31
- p value_hash
30
+ #p template_hash
31
+ #p value_hash
32
32
  Ykutils::Erubyx::erubi_render(template_hash, scope, value_hash)
33
33
  }
34
34
  }
35
35
  end
36
36
 
37
- def make_grid_list()
37
+ def make_grid_list(min_row, max_row, min_colum, max_colum)
38
38
  template_hash = TAMPLETES[:GRID_DEF]
39
39
  scope = nil
40
40
  make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum)
@@ -0,0 +1,41 @@
1
+ module Ykutils
2
+ class Nginxconfig
3
+ def initialize(yaml_path)
4
+ #p "yaml_path=#{yaml_path}"
5
+ yaml_pn = Pathname.new(yaml_path).cleanpath
6
+ @virtual_domain_dir_pn = yaml_pn.parent
7
+ @server_dir_pn = @virtual_domain_dir_pn.parent
8
+ @common_dir_pn = @server_dir_pn.parent
9
+ @hash = YAML.load_file(yaml_pn)
10
+ #p @hash
11
+ @root = @hash["_root"]
12
+ #p @root
13
+ root_template_0_pn = Pathname.new(@root["template"]).cleanpath
14
+ @root_template_pn = @common_dir_pn + root_template_0_pn
15
+ # puts "@root_template_pn=#{@root_template_pn}"
16
+ end
17
+
18
+ def extract(scope)
19
+ hashx = {}
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] = Ykutils::Erubyx::erubi_render_with_file(template_pn, scope, value_file_path_array)
32
+ end
33
+ end
34
+ template = File.read(@root_template_pn)
35
+ template_hash = { TEMPLATE: template,
36
+ OBJ: nil
37
+ }
38
+ Ykutils::Erubyx::erubi_render(template_hash, scope, hashx)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,31 @@
1
+ module Ykutils
2
+ require 'find'
3
+ class Nginxconfigfiles
4
+ def get_file_list(start_dir, re)
5
+ @file_list = []
6
+
7
+ Find.find(start_dir){|x|
8
+ if x =~ re
9
+ #puts x
10
+ @file_list << x
11
+ Find.prune
12
+ end
13
+ }
14
+ @file_list
15
+ end
16
+
17
+ def output(file_list)
18
+ file_list.map{ |fname|
19
+ parent_dir_pn = Pathname.new(fname).cleanpath.parent
20
+ vdomain = parent_dir_pn.basename
21
+ output_fname = "#{vdomain}.conf"
22
+ cli = Nginxconfig.new(fname)
23
+ scope = nil
24
+ File.open( output_fname, "w"){|f|
25
+ x = cli.extract(scope)
26
+ f.write(x)
27
+ }
28
+ }
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ykutils
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/ykutils.rb CHANGED
@@ -9,6 +9,8 @@ require "ykutils/filepermision"
9
9
  require "ykutils/hasharray"
10
10
  require "ykutils/lines"
11
11
  require "ykutils/lsutils"
12
+ require "ykutils/nginxconfig"
13
+ require "ykutils/nginxconfigfiles"
12
14
  require "ykutils/nkfutil"
13
15
  require "ykutils/nkfutil19"
14
16
  require "ykutils/osutil"
@@ -24,6 +26,8 @@ require "ykutils/xlines"
24
26
  require "ykutils/yamlop"
25
27
  require "ykutils/yamlxop"
26
28
 
29
+ require 'pathname'
27
30
  module Ykutils
31
+ TEST_DATA_DIR = Pathname.new(__dir__).parent + "test_data"
28
32
  # Your code goes here...
29
33
  end
@@ -0,0 +1,7 @@
1
+ <%= server1 %>
2
+
3
+ <%= server2 %>
4
+
5
+ <%= server3 %>
6
+
7
+ <%= server4 %>
data/test_data/a.bat ADDED
@@ -0,0 +1,5 @@
1
+ set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
2
+ set TD_DIR=%TOP_DIR%\test_data
3
+ set V103_DIR=%TD_DIR%\v103-3-189-127
4
+ set A_DIR=%V103_dir%\a.northern-cross.net
5
+ bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
@@ -0,0 +1,12 @@
1
+ @echo off
2
+ set TOP_DIR=C:\Users\ykomi\cur\ruby\ykutils
3
+ set TD_DIR=%TOP_DIR%\test_data
4
+ set V103_DIR=%TD_DIR%\v103-3-189-127
5
+ set A_DIR=%V103_dir%\a.northern-cross.net
6
+ REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
7
+
8
+ REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_ssl_www.erb %A_DIR%\value_host.yml %V103_DIR%\value_ssl.yml
9
+ REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
10
+ REM bundle exec ruby %TOP_DIR%\bin\erubix %V103_DIR%\template_www.erb %A_DIR%\value_host.yml %V103_DIR%\value.yml
11
+ REM bundle exec ruby %TOP_DIR%\bin\erubix2 %A_DIR%\base.yml
12
+ bundle exec ruby %TOP_DIR%\bin\erubix2 %1
data/test_data/top.yml ADDED
File without changes
File without changes
@@ -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: a.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: b.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: c.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: 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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ykutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filex
@@ -73,6 +73,8 @@ files:
73
73
  - Rakefile
74
74
  - _config.yml
75
75
  - bin/console
76
+ - bin/erubix
77
+ - bin/erubix2
76
78
  - bin/makegrid
77
79
  - bin/setup
78
80
  - lib/ykutils.rb
@@ -85,6 +87,8 @@ files:
85
87
  - lib/ykutils/hasharray.rb
86
88
  - lib/ykutils/lines.rb
87
89
  - lib/ykutils/lsutils.rb
90
+ - lib/ykutils/nginxconfig.rb
91
+ - lib/ykutils/nginxconfigfiles.rb
88
92
  - lib/ykutils/nkfutil.rb
89
93
  - lib/ykutils/nkfutil19.rb
90
94
  - lib/ykutils/osutil.rb
@@ -101,6 +105,36 @@ files:
101
105
  - lib/ykutils/yamlop.rb
102
106
  - lib/ykutils/yamlxop.rb
103
107
  - sig/ykutils.rbs
108
+ - test_data/4servers.erb
109
+ - test_data/a.bat
110
+ - test_data/a_ncn.bat
111
+ - test_data/top.yml
112
+ - test_data/v103-3-189-127/4servers.erb
113
+ - test_data/v103-3-189-127/a.northern-cross.net/base.yml
114
+ - test_data/v103-3-189-127/a.northern-cross.net/value_host.yml
115
+ - test_data/v103-3-189-127/b.northern-cross.net/base.yml
116
+ - test_data/v103-3-189-127/b.northern-cross.net/value_host.yml
117
+ - test_data/v103-3-189-127/c.northern-cross.net/base.yml
118
+ - test_data/v103-3-189-127/c.northern-cross.net/value_host.yml
119
+ - test_data/v103-3-189-127/d.northern-cross.info/base.yml
120
+ - test_data/v103-3-189-127/d.northern-cross.info/value_host.yml
121
+ - test_data/v103-3-189-127/d.northern-cross.net/base.yml
122
+ - test_data/v103-3-189-127/d.northern-cross.net/value_host.yml
123
+ - test_data/v103-3-189-127/e.northern-cross.info/base.yml
124
+ - test_data/v103-3-189-127/e.northern-cross.info/value_host.yml
125
+ - test_data/v103-3-189-127/e.northern-cross.net/base.yml
126
+ - test_data/v103-3-189-127/e.northern-cross.net/value_host.yml
127
+ - test_data/v103-3-189-127/f.northern-cross.info/base.yml
128
+ - test_data/v103-3-189-127/f.northern-cross.info/value_host.yml
129
+ - test_data/v103-3-189-127/f.northern-cross.net/base.yml
130
+ - test_data/v103-3-189-127/f.northern-cross.net/value_host.yml
131
+ - test_data/v103-3-189-127/t_server_1.erb
132
+ - test_data/v103-3-189-127/template.erb
133
+ - test_data/v103-3-189-127/template_ssl.erb
134
+ - test_data/v103-3-189-127/template_ssl_www.erb
135
+ - test_data/v103-3-189-127/template_www.erb
136
+ - test_data/v103-3-189-127/value.yml
137
+ - test_data/v103-3-189-127/value_ssl.yml
104
138
  - ykutils.gemspec
105
139
  homepage: https://ykominami.github.io/ykutils/
106
140
  licenses:
@@ -124,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
158
  - !ruby/object:Gem::Version
125
159
  version: '0'
126
160
  requirements: []
127
- rubygems_version: 3.3.7
161
+ rubygems_version: 3.0.3.1
128
162
  signing_key:
129
163
  specification_version: 4
130
164
  summary: utilty function created by yk.