nginx_config_generator 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/config.yml.example +1 -0
- data/lib/nginx.erb +5 -5
- data/lib/nginx_config_generator.rb +3 -3
- data/nginx_config_generator.gemspec +3 -3
- metadata +1 -1
data/Rakefile
CHANGED
data/lib/config.yml.example
CHANGED
data/lib/nginx.erb
CHANGED
@@ -53,18 +53,18 @@ http {
|
|
53
53
|
# this is where you define your mongrel clusters.
|
54
54
|
# you need one of these blocks for each cluster
|
55
55
|
# and each one needs its own name to refer to it later.
|
56
|
-
<% config['sites'].each do |name, site| %>
|
57
|
-
<% next unless site['upstream'] %>
|
56
|
+
<% Array(config['sites']).each do |name, site| %>
|
57
|
+
<% next unless site['upstream'] %>
|
58
58
|
upstream <%= name %> {
|
59
|
-
<% Array(site['upstream'] || site['upstreams']).each do |server| %>
|
59
|
+
<% Array(site['upstream'] || site['upstreams']).each do |server| %>
|
60
60
|
server <%= server %>;
|
61
|
-
<% end %>
|
61
|
+
<% end %>
|
62
62
|
}
|
63
63
|
<% end %>
|
64
64
|
|
65
65
|
<% %w(sites ssl_sites).each do |site_type| %>
|
66
66
|
|
67
|
-
<% config[site_type].each do |name, site| %>
|
67
|
+
<% Array(config[site_type]).each do |name, site| %>
|
68
68
|
# the server directive is nginx's virtual host directive.
|
69
69
|
server {
|
70
70
|
|
@@ -14,14 +14,14 @@ env_out = ENV['NGINX_CONFIG_FILE']
|
|
14
14
|
|
15
15
|
error "Usage: generate_nginx_config [config file] [out file]" if ARGV.empty? && !env_in
|
16
16
|
|
17
|
-
overwrite =
|
17
|
+
overwrite = %w(-y -o -f --force --overwrite).any? { |f| ARGV.delete(f) }
|
18
18
|
|
19
|
-
config = YAML.load(ERB.new(env_in || ARGV.shift || 'config.yml').result)
|
19
|
+
config = YAML.load(ERB.new(File.read(env_in || ARGV.shift || 'config.yml')).result)
|
20
20
|
template = file:'nginx.erb'
|
21
21
|
|
22
22
|
if File.exists?(out_file = env_out || ARGV.shift || 'nginx.conf') && !overwrite
|
23
23
|
error "=> #{out_file} already exists, won't overwrite it. Quitting."
|
24
24
|
else
|
25
|
-
open(out_file, 'w+').write(ERB.new(File.read(template), nil, '>').result)
|
25
|
+
open(out_file, 'w+').write(ERB.new(File.read(template), nil, '>').result(binding))
|
26
26
|
error "=> Wrote #{out_file} successfully."
|
27
27
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Nginx_config_generator-1.
|
2
|
+
# Gem::Specification for Nginx_config_generator-1.3
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{nginx_config_generator}
|
7
|
-
s.version = "1.
|
7
|
+
s.version = "1.3"
|
8
8
|
s.date = %q{2007-08-23}
|
9
9
|
s.summary = %q{}
|
10
10
|
s.email = %q{chris@ozmm.org}
|
@@ -24,7 +24,7 @@ end
|
|
24
24
|
# require 'rubygems'
|
25
25
|
# require 'echoe'
|
26
26
|
#
|
27
|
-
# Echoe.new('nginx_config_generator', '1.
|
27
|
+
# Echoe.new('nginx_config_generator', '1.3') do |p|
|
28
28
|
# p.rubyforge_name = 'err'
|
29
29
|
# p.author = 'Chris Wanstrath'
|
30
30
|
# p.email = 'chris@ozmm.org'
|