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 CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'echoe'
3
3
 
4
- Echoe.new('nginx_config_generator', '1.2') do |p|
4
+ Echoe.new('nginx_config_generator', '1.3') do |p|
5
5
  p.rubyforge_name = 'err'
6
6
  p.author = 'Chris Wanstrath'
7
7
  p.email = 'chris@ozmm.org'
@@ -60,6 +60,7 @@ ssl_sites:
60
60
  - 127.0.0.1:8000
61
61
  - 127.0.0.1:8001
62
62
  no_www: true
63
+ server_name: errtheblog.com
63
64
  # Just strings that get spit out as rewrites
64
65
  rewrites:
65
66
  - ^/feed/feedburner http://feeds.feedburner.com/errtheblog
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 = !(%w(-y -o -f --force --overwrite) & ARGV).empty?
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
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.2"
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.2') do |p|
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'
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: nginx_config_generator
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.2"
6
+ version: "1.3"
7
7
  date: 2007-08-23 00:00:00 -07:00
8
8
  summary: ""
9
9
  require_paths: