public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
Fixing pidfiles glob on cluster and pidfile argument
gabriel (author)
Fri May 02 15:03:20 -0700 2008
commit  f08bd8868ba3dac4b402006211e9f784fd4de830
tree    f15442c26cb5bfd9279849c8aceebe9faaf4d522
parent  2c098c5cc536d847d2374c182015a71cde279ea7
...
189
190
191
192
 
 
 
 
193
194
195
...
189
190
191
 
192
193
194
195
196
197
198
0
@@ -189,7 +189,10 @@
0
       def pid_files
0
         if Merb::Config[:pid_file]
0
           if Merb::Config[:cluster]
0
- Dir[Merb::Config[:pid_file] + ".*.pid"]
0
+ ext = File.extname(Merb::Config[:pid_file])
0
+ base = File.basename(Merb::Config[:pid_file], ext)
0
+ dir = File.dirname(Merb::Config[:pid_file])
0
+ Dir[dir / "#{base}.*#{ext}"]
0
           else
0
             [ Merb::Config[:pid_file] ]
0
           end
...
71
72
73
74
 
 
75
76
77
78
79
80
 
 
 
81
82
83
84
85
 
 
 
86
87
88
...
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
0
@@ -71,18 +71,25 @@
0
   
0
   it "should have server return PIDfile setting as is with no cluster nodes" do
0
     Merb::Config.parse_args(["-P", "pidfile", "-p", "6000"])
0
- Merb::Server.pid_file(6000).should == "pidfile"
0
+ Merb::Server.pid_file(6000).should == "pidfile"
0
+ Merb::Server.pid_files.should == ["pidfile"]
0
   end
0
   
0
   it "should support setting of PIDfile with cluster nodes" do
0
     Merb::Config.parse_args(["-P", "/tmp/merb.pidfile", "-c", "2", "-p", "6000"])
0
     Merb::Server.pid_file(6000).should == "/tmp/merb.6000.pidfile"
0
     Merb::Server.pid_file(6001).should == "/tmp/merb.6001.pidfile"
0
+
0
+ Dir.should_receive(:[]).with("/tmp/merb.*.pidfile")
0
+ Merb::Server.pid_files
0
   end
0
   
0
   it "should support default PIDfile setting" do
0
     Merb::Config.parse_args(["-p", "6000"])
0
     Merb::Server.pid_file(6000).should == Merb.log_path / "merb.6000.pid"
0
+
0
+ Dir.should_receive(:[]).with(Merb.log_path / "merb.*.pid")
0
+ Merb::Server.pid_files
0
   end
0
 
0
   it "should support -h to set the hostname" do

Comments

    No one has commented yet.