ykxutils 0.1.7 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +106 -55
  4. data/Gemfile +11 -7
  5. data/Gemfile.lock +55 -35
  6. data/Rakefile +25 -8
  7. data/SECURITY.md +21 -0
  8. data/a.northern-cross.net.conf +86 -0
  9. data/lib/ykxutils/erubyx.rb +50 -0
  10. data/lib/ykxutils/gridlist.rb +46 -0
  11. data/lib/ykxutils/nginxconfig.rb +40 -0
  12. data/lib/ykxutils/nginxconfigfiles.rb +32 -0
  13. data/lib/ykxutils/pstorex.rb +1 -1
  14. data/lib/ykxutils/version.rb +1 -1
  15. data/lib/ykxutils/yamlx.rb +31 -48
  16. data/lib/ykxutils.rb +5 -0
  17. data/test_data/4servers.erb +7 -0
  18. data/test_data/v103-3-189-127/4servers.erb +0 -0
  19. data/test_data/v103-3-189-127/a.northern-cross.net/base.yml +28 -0
  20. data/test_data/v103-3-189-127/a.northern-cross.net/value_host.yml +1 -0
  21. data/test_data/v103-3-189-127/b.northern-cross.net/base.yml +28 -0
  22. data/test_data/v103-3-189-127/b.northern-cross.net/value_host.yml +1 -0
  23. data/test_data/v103-3-189-127/c.northern-cross.net/base.yml +28 -0
  24. data/test_data/v103-3-189-127/c.northern-cross.net/value_host.yml +1 -0
  25. data/test_data/v103-3-189-127/d.northern-cross.info/base.yml +28 -0
  26. data/test_data/v103-3-189-127/d.northern-cross.info/value_host.yml +1 -0
  27. data/test_data/v103-3-189-127/d.northern-cross.net/base.yml +28 -0
  28. data/test_data/v103-3-189-127/d.northern-cross.net/value_host.yml +1 -0
  29. data/test_data/v103-3-189-127/e.northern-cross.info/base.yml +28 -0
  30. data/test_data/v103-3-189-127/e.northern-cross.info/value_host.yml +1 -0
  31. data/test_data/v103-3-189-127/e.northern-cross.net/base.yml +28 -0
  32. data/test_data/v103-3-189-127/e.northern-cross.net/value_host.yml +1 -0
  33. data/test_data/v103-3-189-127/f.northern-cross.info/base.yml +28 -0
  34. data/test_data/v103-3-189-127/f.northern-cross.info/value_host.yml +1 -0
  35. data/test_data/v103-3-189-127/f.northern-cross.net/base.yml +28 -0
  36. data/test_data/v103-3-189-127/f.northern-cross.net/value_host.yml +1 -0
  37. data/test_data/v103-3-189-127/t_server_1.erb +7 -0
  38. data/test_data/v103-3-189-127/template.erb +21 -0
  39. data/test_data/v103-3-189-127/template_ssl.erb +22 -0
  40. data/test_data/v103-3-189-127/template_ssl_www.erb +12 -0
  41. data/test_data/v103-3-189-127/template_www.erb +24 -0
  42. data/test_data/v103-3-189-127/value.yml +3 -0
  43. data/test_data/v103-3-189-127/value_ssl.yml +5 -0
  44. data/ykxutils.gemspec +25 -18
  45. metadata +88 -17
  46. data/.github/workflows/main.yml +0 -16
  47. data/.gitignore +0 -14
  48. data/bin/console +0 -15
  49. data/bin/setup +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02c51d3cabb50f00f970145af2064b5025b968a83d8445c26324937789b5da48
4
- data.tar.gz: 6ba0e9151522cbbcbb80ef4e253af57c0afe72afc14e9aab037e6cd14bb58565
3
+ metadata.gz: 40a9c8960f5a5f9fdd20a1ffa620987f76c61b90f602c9beae391290232bd224
4
+ data.tar.gz: ab77e98dc0de6d80a062e5d263d0d31b5034c1be47754612a3b32a6a86e04953
5
5
  SHA512:
6
- metadata.gz: 3e020eaa65d97e12aad7525332c62322cc294e312721446425919a42558cca7dd6b4bdfb19993d82800a3d5239b393725cb92edc9782f486fe5a0df4cc998fa7
7
- data.tar.gz: c7855e5d9a442fb151f801407f36c29dbe66904f167b5a5f87ae1737e26dd90b7d48155ebe132802b75635d221b982bc1c9be808d002189d4255ac3ced3e0605
6
+ metadata.gz: 70e64fc12c1bf0b45fc1cdbb7ae8254e962731f707351f3a47293422096ec3049c73fc09eb6ded2a7172bb3909e552712163202ae2e489d8cb5827561714e47b
7
+ data.tar.gz: fc0a7733b0c29d19a1872e877e67213d7826e7dda7e5f1c464f568bd968a1114465f073b981c0b3de8576704e7c5d7627548e8564c9187d79eb85a84af58bc19
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ require:
5
5
  inherit_from: .rubocop_todo.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.6
8
+ TargetRubyVersion: 2.7
9
9
  NewCops: enable
10
10
 
11
11
  Style/StringLiterals:
data/.rubocop_todo.yml CHANGED
@@ -1,105 +1,156 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-09-14 22:49:41 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
- Layout/EmptyLineAfterGuardClause:
10
+ # Configuration parameters: IgnoreImplicitReferences.
11
+ Lint/ShadowedArgument:
12
12
  Exclude:
13
- #- 'lib/ykxutils/gitcmd.rb'
13
+ # - 'lib/ykxutils/yamlx.rb'
14
14
 
15
15
  # Offense count: 1
16
- # This cop supports safe autocorrection (--autocorrect).
17
- Layout/EmptyLines:
18
- Exclude:
19
- #- 'lib/ykxutils/gitcmd.rb'
16
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
17
+ Metrics/AbcSize:
18
+ Max: 19
19
+
20
+ # Offense count: 3
21
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
22
+ Metrics/MethodLength:
23
+ Max: 15
20
24
 
21
25
  # Offense count: 1
22
- # This cop supports safe autocorrection (--autocorrect).
23
- # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
24
- Layout/LeadingCommentSpace:
26
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
27
+ Metrics/ParameterLists:
28
+ Max: 6
29
+
30
+ # Offense count: 1
31
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
32
+ # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
33
+ Naming/MethodParameterName:
25
34
  Exclude:
26
- #- 'lib/ykxutils/gitcmd.rb'
35
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
27
36
 
28
37
  # Offense count: 1
29
38
  # This cop supports safe autocorrection (--autocorrect).
30
- # Configuration parameters: .
31
- # SupportedStyles: space, no_space
32
- Layout/SpaceAroundEqualsInParameterDefault:
33
- EnforcedStyle: no_space
39
+ # Configuration parameters: EnforcedStyle.
40
+ # SupportedStyles: be, be_nil
41
+ RSpec/BeNil:
42
+ Exclude:
43
+ # - 'spec/ykxutils_spec.rb'
34
44
 
35
45
  # Offense count: 1
36
- # This cop supports safe autocorrection (--autocorrect).
37
- # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
38
- # SupportedStylesForExponentOperator: space, no_space
39
- Layout/SpaceAroundOperators:
46
+ RSpec/BeforeAfterAll:
40
47
  Exclude:
41
- # - 'lib/ykxutils/gitcmd.rb'
48
+ # - 'spec/spec_helper.rb'
49
+ # - 'spec/rails_helper.rb'
50
+ # - 'spec/support/**/*.rb'
51
+ # - 'spec/ykxutils_spec.rb'
42
52
 
43
53
  # Offense count: 2
44
- # This cop supports safe autocorrection (--autocorrect).
45
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
46
- # SupportedStyles: space, no_space
47
- # SupportedStylesForEmptyBraces: space, no_space
48
- Layout/SpaceBeforeBlockBraces:
54
+ # Configuration parameters: CountAsOne.
55
+ RSpec/ExampleLength:
56
+ Max: 9
57
+
58
+ # Offense count: 1
59
+ # Configuration parameters: AssignmentOnly.
60
+ RSpec/InstanceVariable:
49
61
  Exclude:
50
- # - 'lib/ykxutils/gitcmd.rb'
62
+ # - 'spec/ykxutils_spec.rb'
51
63
 
52
- # Offense count: 4
53
- # This cop supports safe autocorrection (--autocorrect).
54
- # Configuration parameters: EnforcedStyle.
55
- # SupportedStyles: space, compact, no_space
56
- Layout/SpaceInsideParens:
64
+ # Offense count: 1
65
+ RSpec/NoExpectationExample:
57
66
  Exclude:
58
- # - 'lib/ykxutils/gitcmd.rb'
67
+ # - 'spec/ykxutils_spec.rb'
59
68
 
60
69
  # Offense count: 1
61
70
  # This cop supports safe autocorrection (--autocorrect).
62
71
  # Configuration parameters: EnforcedStyle.
63
- # SupportedStyles: final_newline, final_blank_line
64
- Layout/TrailingEmptyLines:
72
+ # SupportedStyles: not_to, to_not
73
+ RSpec/NotToNot:
65
74
  Exclude:
66
- # - 'lib/ykxutils/gitcmd.rb'
75
+ # - 'spec/ykxutils_spec.rb'
67
76
 
68
- # Offense count: 1
77
+ # Offense count: 8
69
78
  # This cop supports safe autocorrection (--autocorrect).
70
- Lint/ScriptPermission:
79
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
80
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
81
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
82
+ # FunctionalMethods: let, let!, subject, watch
83
+ # AllowedMethods: lambda, proc, it
84
+ Style/BlockDelimiters:
71
85
  Exclude:
72
- - 'bin/console'
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'
73
91
 
74
- # Offense count: 9
75
- Lint/UselessAssignment:
92
+ # Offense count: 5
93
+ # This cop supports safe autocorrection (--autocorrect).
94
+ Style/ColonMethodCall:
76
95
  Exclude:
77
- #- 'lib/ykxutils/gitcmd.rb'
78
- #- 'lib/ykxutils/yamlx.rb'
96
+ # - 'lib/ykxutils/gridlist.rb'
97
+ # - 'lib/ykxutils/nginxconfig.rb'
98
+ # - 'spec/ykxutils_spec.rb'
79
99
 
80
100
  # Offense count: 1
81
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
82
- Metrics/MethodLength:
83
- Max: 17
101
+ # This cop supports safe autocorrection (--autocorrect).
102
+ Style/EachWithObject:
103
+ Exclude:
104
+ # - 'spec/ykxutils_spec.rb'
105
+
106
+ # Offense count: 3
107
+ # This cop supports safe autocorrection (--autocorrect).
108
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
109
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
110
+ # SupportedShorthandSyntax: always, never, either, consistent
111
+ Style/HashSyntax:
112
+ Exclude:
113
+ # - 'lib/ykxutils/gridlist.rb'
114
+
115
+ # Offense count: 2
116
+ # This cop supports safe autocorrection (--autocorrect).
117
+ Style/IfUnlessModifier:
118
+ Exclude:
119
+ # - 'lib/ykxutils/erubyx.rb'
120
+ # - 'lib/ykxutils/gridlist.rb'
84
121
 
85
122
  # Offense count: 1
86
123
  # This cop supports unsafe autocorrection (--autocorrect-all).
87
- # Configuration parameters: InverseMethods, InverseBlocks.
88
- Style/InverseMethods:
124
+ # Configuration parameters: EnforcedStyle.
125
+ # SupportedStyles: literals, strict
126
+ Style/MutableConstant:
89
127
  Exclude:
90
- #- 'lib/ykxutils/gitcmd.rb'
128
+ # - 'lib/ykxutils/gridlist.rb'
91
129
 
92
130
  # Offense count: 2
93
- # This cop supports unsafe autocorrection (--autocorrect-all).
94
- # Configuration parameters: Methods.
95
- Style/RedundantArgument:
131
+ # This cop supports safe autocorrection (--autocorrect).
132
+ # Configuration parameters: EnforcedStyle, MinBodyLength.
133
+ # SupportedStyles: skip_modifier_ifs, always
134
+ Style/Next:
135
+ Exclude:
136
+ # - 'lib/ykxutils/nginxconfig.rb'
137
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
138
+
139
+ # Offense count: 1
140
+ # This cop supports safe autocorrection (--autocorrect).
141
+ # Configuration parameters: PreferredDelimiters.
142
+ Style/PercentLiteralDelimiters:
96
143
  Exclude:
97
- # - 'lib/ykxutils/gitcmd.rb'
144
+ # - 'lib/ykxutils/gridlist.rb'
98
145
 
99
- # Offense count: 4
146
+ # Offense count: 45
100
147
  # This cop supports safe autocorrection (--autocorrect).
101
148
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
102
149
  # SupportedStyles: single_quotes, double_quotes
103
150
  Style/StringLiterals:
104
151
  Exclude:
105
- # - 'lib/ykxutils/gitcmd.rb'
152
+ # - 'Gemfile'
153
+ # - 'lib/ykxutils/erubyx.rb'
154
+ # - 'lib/ykxutils/gridlist.rb'
155
+ # - 'lib/ykxutils/nginxconfigfiles.rb'
156
+ # - 'ykxutils.gemspec'
data/Gemfile CHANGED
@@ -5,14 +5,18 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in ykxutils.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.7"
13
- gem "rubocop-rake", require: false
14
- gem "rubocop-rspec", require: false
8
+ gem "bundler"
9
+ gem "erubi"
10
+ gem "rake", "~> 13.1"
11
+ gem "tilt"
15
12
 
16
13
  group :development do
17
14
  gem "yard"
18
15
  end
16
+
17
+ group :test do
18
+ gem "rspec", "~> 3.12"
19
+ gem "rubocop"
20
+ gem "rubocop-rake", require: false
21
+ gem "rubocop-rspec", require: false
22
+ end
data/Gemfile.lock CHANGED
@@ -1,68 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ykxutils (0.1.7)
4
+ ykxutils (0.1.10)
5
+ bundler
6
+ erubi
7
+ rake (~> 13.0)
8
+ tilt
5
9
 
6
10
  GEM
7
11
  remote: https://rubygems.org/
8
12
  specs:
9
13
  ast (2.4.2)
10
14
  diff-lcs (1.5.0)
11
- json (2.6.2)
12
- parallel (1.22.1)
13
- 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)
14
20
  ast (~> 2.4.1)
21
+ racc
22
+ racc (1.7.3)
15
23
  rainbow (3.1.1)
16
- rake (13.0.6)
17
- regexp_parser (2.5.0)
18
- rexml (3.2.5)
19
- rspec (3.11.0)
20
- rspec-core (~> 3.11.0)
21
- rspec-expectations (~> 3.11.0)
22
- rspec-mocks (~> 3.11.0)
23
- rspec-core (3.11.0)
24
- rspec-support (~> 3.11.0)
25
- 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)
26
34
  diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.11.0)
28
- rspec-mocks (3.11.1)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-mocks (3.12.6)
29
37
  diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.11.0)
31
- rspec-support (3.11.1)
32
- rubocop (1.36.0)
38
+ rspec-support (~> 3.12.0)
39
+ rspec-support (3.12.1)
40
+ rubocop (1.59.0)
33
41
  json (~> 2.3)
42
+ language_server-protocol (>= 3.17.0)
34
43
  parallel (~> 1.10)
35
- parser (>= 3.1.2.1)
44
+ parser (>= 3.2.2.4)
36
45
  rainbow (>= 2.2.2, < 4.0)
37
46
  regexp_parser (>= 1.8, < 3.0)
38
47
  rexml (>= 3.2.5, < 4.0)
39
- rubocop-ast (>= 1.20.1, < 2.0)
48
+ rubocop-ast (>= 1.30.0, < 2.0)
40
49
  ruby-progressbar (~> 1.7)
41
- unicode-display_width (>= 1.4.0, < 3.0)
42
- rubocop-ast (1.21.0)
43
- parser (>= 3.1.1.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)
44
60
  rubocop-rake (0.6.0)
45
61
  rubocop (~> 1.0)
46
- rubocop-rspec (2.13.1)
47
- rubocop (~> 1.33)
48
- ruby-progressbar (1.11.0)
49
- unicode-display_width (2.2.0)
50
- webrick (1.7.0)
51
- yard (0.9.28)
52
- 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)
53
70
 
54
71
  PLATFORMS
55
72
  x86_64-linux
56
73
 
57
74
  DEPENDENCIES
58
75
  bundler
59
- rake (~> 13.0)
60
- rspec (~> 3.0)
61
- rubocop (~> 1.7)
76
+ erubi
77
+ rake (~> 13.1)
78
+ rspec (~> 3.12)
79
+ rubocop
80
+ rubocop-performance
62
81
  rubocop-rake
63
82
  rubocop-rspec
83
+ tilt
64
84
  yard
65
85
  ykxutils!
66
86
 
67
87
  BUNDLED WITH
68
- 2.3.17
88
+ 2.3.22
data/Rakefile CHANGED
@@ -1,12 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
4
 
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
5
+ begin
6
+ require "rspec/core/rake_task"
7
+ rescue LoadError => e
8
+ puts e.message
9
+ end
10
+ begin
11
+ RSpec::Core::RakeTask.new(:spec)
12
+ rescue NameError, LoadError => e
13
+ puts e.message
14
+ end
15
+ begin
16
+ require "rubocop/rake_task"
17
+ rescue LoadError => e
18
+ puts e.message
19
+ end
20
+ begin
21
+ RuboCop::RakeTask.new
22
+ rescue NameError, LoadError => e
23
+ puts e.message
24
+ end
25
+ begin
26
+ task default: %i[spec rubocop]
27
+ rescue LoadError => e
28
+ puts e.message
29
+ end
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
+
@@ -0,0 +1,50 @@
1
+ require "tilt"
2
+ require "yaml"
3
+
4
+ module Ykxutils
5
+ module Erubyx
6
+ module_function
7
+
8
+ def erubi_render(template_hash, scope, value_hash = {})
9
+ template_hash[:OBJ] = Tilt::ErubiTemplate.new { template_hash[:TEMPLATE] } unless template_hash[:OBJ]
10
+ template_hash[:OBJ].render(scope, value_hash)
11
+ end
12
+
13
+ ##
14
+ # `erubi_render_with_file` takes a template file path, a scope, and a value file path, reads the
15
+ # template file, loads the value file, and then calls `erubi_render` with the template hash, scope,
16
+ # and value hash
17
+ #
18
+ # Args:
19
+ # template_file_path: The path to the template file.
20
+ # scope: the scope of the template. This is the name of the directory that the template is in.
21
+ # value_file_path: The path to the YAML file that contains the values to be used in the template.
22
+ def erubi_render_with_file(template_file_path, scope, value_file_path_array)
23
+ template_text = File.read(template_file_path)
24
+ template_hash = { TEMPLATE: template_text,
25
+ OBJ: nil }
26
+ value_hash = value_file_path_array.reduce({}) do |hash, path|
27
+ # p path
28
+ hash0 = YAML.load_file(path)
29
+ # p hash0
30
+ hash = hash.merge(hash0)
31
+ # p hash
32
+ hash
33
+ end
34
+ # puts value_hash
35
+ erubi_render(template_hash, scope, value_hash)
36
+ end
37
+
38
+ def erubi_render_with_template_file(template_file_path, scope, value_hash = {})
39
+ template_text = File.read(template_file_path)
40
+ template_hash = make_template_hash(template_text)
41
+ # puts value_hash
42
+ erubi_render(template_hash, scope, value_hash)
43
+ end
44
+
45
+ def make_template_hash(text)
46
+ { TEMPLATE: text,
47
+ OBJ: nil }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,46 @@
1
+ require "ykxutils/erubyx"
2
+
3
+ module Ykxutils
4
+ module Gridlist
5
+ TAMPLETES = { GRID_DEF: { TEMPLATE: %(
6
+ .g-<%= row %>-<%= colum %> {
7
+ grid-row-start: <%= row %>;
8
+ grid-row-end: ,<%= row + 1 %>;
9
+ grid-column-start: <%= colum %>;
10
+ grid-column-end: <%= colum + 1 %>;
11
+ }
12
+ ), OBJ: nil } }.freeze
13
+
14
+ module_function
15
+
16
+ def make_one_grid(hash, row, colum)
17
+ hash[:OBJ] = Tilt::ErubiTemplate.new { hash[:TEMPLATE] } unless hash[:OBJ]
18
+ hash[:OBJ].render(Object.new, { row: row, colum: colum })
19
+ end
20
+
21
+ def make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum)
22
+ (min_row..max_row).map do |row|
23
+ (min_colum..max_colum).map do |colum|
24
+ # puts "#{row} #{colum}"
25
+ value_hash = { row: row, colum: colum }
26
+ # make_one_grid(template_hash, value_hash)
27
+ # p template_hash
28
+ # p value_hash
29
+ Ykxutils::Erubyx.erubi_render(template_hash, scope, value_hash)
30
+ end
31
+ end
32
+ end
33
+
34
+ def make_grid_list(min_row, max_row, min_colum, max_colum)
35
+ template_hash = TAMPLETES[:GRID_DEF]
36
+ scope = nil
37
+ make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum)
38
+ end
39
+
40
+ def make_grid_list_x(min_row, max_row, min_colum, max_colum)
41
+ template_hash = TAMPLETES[:GRID_DEF]
42
+ scope = nil
43
+ make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,40 @@
1
+ module Ykxutils
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
+ 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
31
+ end
32
+ hashx[k] = Ykxutils::Erubyx.erubi_render_with_file(template_pn, scope, value_file_path_array)
33
+ end
34
+ template = File.read(@root_template_pn)
35
+ template_hash = { TEMPLATE: template,
36
+ OBJ: nil }
37
+ Ykxutils::Erubyx.erubi_render(template_hash, scope, hashx)
38
+ end
39
+ end
40
+ end