ruby-nginx 1.0.0.pre.beta.3 → 1.0.0.pre.beta.4

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: 23ed81e982f332b222ea6f29a2e223ad1e114e5fb57953277defad3a164ca383
4
- data.tar.gz: b68c5854801f99463f05401990c434d6dbe8de74f401c03a6b2edd5a6fb13019
3
+ metadata.gz: 9a6d88117211b772d96bf97915e9ab94227c23fc3b30d01e658eca6d47c9f1fc
4
+ data.tar.gz: d64a2d5beb1392bfe892bc48f34a3cd36362a8e1022360e5081c37874bedf460
5
5
  SHA512:
6
- metadata.gz: 7446042ae6a1a49eb49f034a455497d3a7eb4032800e124520db8ba74ef0a937a394de8b24cd58bb7cc12340b1d569574e5ef4e9fae0d25eeb3131d499979833
7
- data.tar.gz: d3b9bc26b024f25b1925f7f18a51bd0a13f0753434458b6fc6ce4d9c59cfed661b534522b84851220bc16327f5654ad7dd00d85878b5dd3c3088ed2c21a452a1
6
+ metadata.gz: 3eb09a3ffffa06c21b7e0432c63fd1d1a40ae4d5234003357087ca016091801bdb33e0cfbf22f16e461bde45ec38aa38465590224e8acb2cbfca13f632fc6dc3
7
+ data.tar.gz: ec68fde1a5e5ebe27383bc6e596533b2ed968d37fab890fbfa3033684a875105ff762441c69ad68c2b1cd9d94ca0833825888c55065bb7014875c9641eaa61d2
data/README.md CHANGED
@@ -156,6 +156,7 @@ Options:
156
156
  -r, [--root-path=ROOT_PATH] # default: $PWD
157
157
  -s, [--ssl], [--no-ssl], [--skip-ssl] # default: false
158
158
  -l, [--log], [--no-log], [--skip-log] # default: false
159
+ -t, [--template-path=TEMPLATE_PATH] # default: [GEM_PATH]/nginx/templates/nginx.conf
159
160
  -cert-file, [--ssl-certificate-path=SSL_CERTIFICATE_PATH] # default: ~/.ruby-nginx/certs/_[DOMAIN].pem
160
161
  -key-file, [--ssl-certificate-key-path=SSL_CERTIFICATE_KEY_PATH] # default: ~/.ruby-nginx/certs/_[DOMAIN]-key.pem
161
162
  -access-log, [--access-log-path=ACCESS_LOG_PATH] # default: ~/.ruby-nginx/logs/[DOMAIN].access.log
@@ -25,6 +25,7 @@ module Ruby
25
25
  method_option :root_path, aliases: "-r", type: :string, desc: "default: $PWD"
26
26
  method_option :ssl, aliases: "-s", type: :boolean, desc: defaults(:ssl)
27
27
  method_option :log, aliases: "-l", type: :boolean, desc: defaults(:log)
28
+ method_option :template_path, aliases: "-t", type: :string, desc: "default: [GEM_PATH]/nginx/templates/nginx.conf"
28
29
  method_option :ssl_certificate_path, aliases: "-cert-file", type: :string, desc: default_paths(:ssl_certificate_path)
29
30
  method_option :ssl_certificate_key_path, aliases: "-key-file", type: :string, desc: default_paths(:ssl_certificate_key_path)
30
31
  method_option :access_log_path, aliases: "-access-log", type: :string, desc: default_paths(:access_log_path)
@@ -35,6 +36,7 @@ module Ruby
35
36
  port: options.port,
36
37
  host: options.host,
37
38
  root_path: options.root_path,
39
+ template_path: options.template_path,
38
40
  ssl: options.ssl,
39
41
  log: options.log,
40
42
  ssl_certificate_path: options.ssl_certificate_path,
@@ -36,7 +36,7 @@ module Ruby
36
36
  create_ssl_certs! if options[:ssl]
37
37
  create_log_files! if options[:log]
38
38
 
39
- ERB.new(File.read(options[:template_path])).result(binding)
39
+ ERB.new(load_template).result(binding)
40
40
  end
41
41
 
42
42
  def defaults
@@ -82,6 +82,16 @@ module Ruby
82
82
  self.options = default_paths.merge(options)
83
83
  end
84
84
 
85
+ def load_template
86
+ File.read(options[:template_path])
87
+ rescue Errno::EISDIR
88
+ raise Ruby::Nginx::AbortError, "Template is a directory: #{options[:template_path]}"
89
+ rescue Errno::ENOENT
90
+ raise Ruby::Nginx::AbortError, "Template does not exist at: #{options[:template_path]}"
91
+ rescue => e
92
+ raise Ruby::Nginx::AbortError, "Failed to read template.", cause: e
93
+ end
94
+
85
95
  def create_ssl_certs!
86
96
  System::Mkcert.create!(
87
97
  options[:domain],
@@ -58,7 +58,8 @@ server {
58
58
  location @<%= name %> {
59
59
  proxy_pass http://<%= name %>;
60
60
  proxy_http_version 1.1;
61
- proxy_cache_bypass $http_upgrade;
61
+ proxy_no_cache 1;
62
+ proxy_cache_bypass 1;
62
63
 
63
64
  <% if options[:ssl] %>
64
65
  # proxy SSL
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ruby
4
4
  module Nginx
5
- VERSION = "1.0.0-beta.3"
5
+ VERSION = "1.0.0-beta.4"
6
6
 
7
7
  Version = Gem::Version
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nginx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.3
4
+ version: 1.0.0.pre.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bert McCutchen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-11 00:00:00.000000000 Z
11
+ date: 2025-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb