public
Description: Magic configuration for your nginx, mongrels and god!
Homepage: http://archangel.rubyforge.org/
Clone URL: git://github.com/halorgium/archangel.git
Added a default vhost for nginx and made `default' a reserved site name
halorgium (author)
Wed Feb 13 13:45:46 -0800 2008
commit  39e1760966f0bf9c9b81caff2d028e6c22152fbc
tree    c52be327bd60fe50faa61db9a5d53194f4afa7f0
parent  d9fc4fe0d81ef6c5ab170564f37f7a9fc7378334
...
8
9
10
 
11
12
13
...
8
9
10
11
12
13
14
0
@@ -8,6 +8,7 @@ config/hoe.rb
0
 config/requirements.rb
0
 fixtures/config_with_2_profiles.archangel
0
 fixtures/single_site.archangel
0
+fixtures/site_called_default.archangel
0
 fixtures/site_with_mongrels.archangel
0
 lib/archangel.rb
0
 lib/archangel/configuration.rb
...
5
6
7
8
 
9
10
11
12
 
 
13
14
15
...
5
6
7
 
8
9
10
11
12
13
14
15
16
17
0
@@ -5,11 +5,13 @@ module Archangel
0
     def initialize(configuration)
0
       @configuration = configuration
0
     end
0
- attr_writer :base_path, :mime_types, :pid_file, :error_log, :access_log
0
+ attr_writer :base_path, :default_root, :mime_types, :pid_file, :error_log, :access_log
0
     attr_accessor :uid, :gid
0
     
0
     def file(key)
0
       case key
0
+ when :default_root
0
+ @default_root || "#{base_path}/default/public"
0
       when :mime_types
0
         @mime_types || "#{base_path}/conf/mime.types"
0
       when :pid_file
...
16
17
18
 
 
 
 
19
20
21
...
16
17
18
19
20
21
22
23
24
25
0
@@ -16,6 +16,10 @@ module Archangel
0
       @nginx.base_path = base_path
0
     end
0
     
0
+ def default_root(default_root)
0
+ @nginx.default_root = default_root
0
+ end
0
+
0
     def mime_types(mime_types)
0
       @nginx.mime_types = mime_types
0
     end
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 module Archangel
0
   class Site
0
     def initialize(name, options, configuration)
0
+ raise ArgumentError, "`default' is a reserved site name" if name.to_s == "default"
0
       @name, @options, @configuration, @hostnames, @fair = name, options, configuration, [], true
0
     end
0
     attr_reader :name, :options, :configuration
...
127
128
129
 
 
 
 
 
 
 
 
 
 
 
130
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
0
@@ -127,4 +127,15 @@ module Archangel
0
       @config.sites.first.upstreams.size.should == 4
0
     end
0
   end
0
+
0
+ describe Configuration, "for site_called_default" do
0
+ include ConfigurationHelpers
0
+
0
+ it "should raise an exception" do
0
+ File.should_receive(:read).and_return(fixture_data(:site_called_default))
0
+ lambda {
0
+ Configuration.evaluate("site_called_default")
0
+ }.should raise_error(ArgumentError)
0
+ end
0
+ end
0
 end
...
31
32
33
 
 
 
 
 
 
 
 
 
 
 
34
35
36
...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
0
@@ -31,6 +31,17 @@ http {
0
   gzip_types text/plain text/html text/css application/x-javascript text/xml
0
                       application/xml application/xml+rss text/javascript;
0
 
0
+ server {
0
+ listen 80;
0
+
0
+ client_max_body_size 50M;
0
+
0
+ root <%= nginx.file(:default_root) %>;
0
+
0
+ access_log <%= nginx.file(:access_log) % "default" %> main;
0
+ }
0
+
0
+
0
   include <%= nginx.base_path %>/upstreams/*.conf;
0
   include <%= nginx.base_path %>/servers/*.conf;
0
 }

Comments

    No one has commented yet.