public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Runner now remembers -r, -D and -V parameters
so that clustered servers inherit those and
`restart` keep your parameters.
macournoyer (author)
Fri Jul 18 08:39:43 -0700 2008
commit  a8ed858fcd39ac6b6cab0fa03853b3ed479a30a3
tree    a0ba067fd9fb525f4462cd41fe6f6b34ae062ee6
parent  f67fb1820ad5d790655c85bbc410a99fe1bea28d
...
1
 
 
2
3
4
...
1
2
3
4
5
6
0
@@ -1,4 +1,6 @@
0
 == 1.0.0 The Big release
0
+ * Runner now remembers -r, -D and -V parameters so that clustered servers inherit those and
0
+ `restart` keep your parameters.
0
  * Make Set-Cookie header, in Rails adapter, compatible with current Rack spec [Pedro Belo]
0
    [#73, state:resolved]
0
  * Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
0
...
57
58
59
60
 
61
62
63
...
57
58
59
 
60
61
62
63
0
@@ -57,7 +57,7 @@ You need to setup a config.ru file and pass it to the thin script:
0
  
0
  run app
0
 
0
- thin start -r config.ru
0
+ thin start -R config.ru
0
  
0
 See example directory for more samples and run 'thin -h' for usage.
0
 
...
40
41
42
43
 
 
44
45
46
...
116
117
118
119
120
121
 
 
 
122
123
124
...
157
158
159
 
 
 
 
160
161
162
...
40
41
42
 
43
44
45
46
47
...
117
118
119
 
 
 
120
121
122
123
124
125
...
158
159
160
161
162
163
164
165
166
167
0
@@ -40,7 +40,8 @@ module Thin
0
         :log => 'log/thin.log',
0
         :pid => 'tmp/pids/thin.pid',
0
         :max_conns => Server::DEFAULT_MAXIMUM_CONNECTIONS,
0
- :max_persistent_conns => Server::DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS
0
+ :max_persistent_conns => Server::DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS,
0
+ :requires => []
0
       }
0
       
0
       parse!
0
@@ -116,9 +117,9 @@ module Thin
0
         opts.separator ""
0
         opts.separator "Common options:"
0
 
0
- opts.on_tail("-r", "--require FILE", "require the library") { |file| ruby_require file }
0
- opts.on_tail("-D", "--debug", "Set debbuging on") { Logging.debug = true }
0
- opts.on_tail("-V", "--trace", "Set tracing on (log raw request/response)") { Logging.trace = true }
0
+ opts.on_tail("-r", "--require FILE", "require the library") { |file| @options[:requires] << file }
0
+ opts.on_tail("-D", "--debug", "Set debbuging on") { @options[:debug] = true }
0
+ opts.on_tail("-V", "--trace", "Set tracing on (log raw request/response)") { @options[:trace] = true }
0
         opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
0
         opts.on_tail('-v', '--version', "Show version") { puts Thin::SERVER; exit }
0
       end
0
@@ -157,6 +158,10 @@ module Thin
0
       # relative to this one.
0
       Dir.chdir(@options[:chdir]) unless CONFIGLESS_COMMANDS.include?(@command)
0
       
0
+ @options[:requires].each { |r| ruby_require r }
0
+ Logging.debug = @options[:debug]
0
+ Logging.trace = @options[:trace]
0
+
0
       controller = case
0
       when cluster? then Controllers::Cluster.new(@options)
0
       when service? then Controllers::Service.new(@options)
...
217
218
219
 
 
 
220
221
222
...
217
218
219
220
221
222
223
224
225
0
@@ -217,6 +217,9 @@ ENDIF:title
0
       <li><a href="/thin/download/">download</a></li>
0
       <li><a href="/thin/usage/">usage</a></li>
0
       <li><a href="/thin/doc/">doc</a></li>
0
+ <li><a href="http://github.com/macournoyer/thin/">code</a></li>
0
+ <li><a href="http://thin.lighthouseapp.com/projects/7212-thin/">bugs</a></li>
0
+ <li><a href="/thin/users/">users</a></li>
0
       <li><a href="http://groups.google.com/group/thin-ruby/">community</a></li>
0
     </ul>
0
     <div id="sidebar">
...
13
14
15
16
 
17
18
19
...
66
67
68
69
 
70
 
71
72
73
74
75
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
78
79
...
13
14
15
 
16
17
18
19
...
66
67
68
 
69
70
71
72
73
74
75
76
 
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
0
@@ -13,7 +13,7 @@ describe Runner do
0
     Runner.new(%w(stop)).command.should == 'stop'
0
     Runner.new(%w(restart)).command.should == 'restart'
0
   end
0
-
0
+
0
   it "should abort on unknow command" do
0
     runner = Runner.new(%w(poop))
0
     
0
@@ -66,14 +66,33 @@ describe Runner do
0
   it "should warn when require a rack config file" do
0
     STDERR.stub!(:write)
0
     STDERR.should_receive(:write).with(/WARNING:/)
0
-
0
+
0
     runner = Runner.new(%w(start -r config.ru))
0
+ runner.run! rescue nil
0
     
0
     runner.options[:rackup].should == 'config.ru'
0
   end
0
   
0
   it "should require file" do
0
- proc { Runner.new(%w(start -r unexisting)) }.should raise_error(LoadError)
0
+ runner = Runner.new(%w(start -r unexisting))
0
+ proc { runner.run! }.should raise_error(LoadError)
0
+ end
0
+
0
+ it "should remember requires" do
0
+ runner = Runner.new(%w(start -r rubygems -r thin))
0
+ runner.options[:requires].should == %w(rubygems thin)
0
+ end
0
+
0
+ it "should remember debug options" do
0
+ runner = Runner.new(%w(start -D -V))
0
+ runner.options[:debug].should be_true
0
+ runner.options[:trace].should be_true
0
+ end
0
+
0
+ it "should default debug and trace to false" do
0
+ runner = Runner.new(%w(start))
0
+ runner.options[:debug].should_not be_true
0
+ runner.options[:trace].should_not be_true
0
   end
0
 end
0
 

Comments

    No one has commented yet.