Changeset 1408 for branches/locker-dev/locker/deploy/bin
- Timestamp:
- Jan 7, 2010, 12:32:45 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/locker-dev/locker/deploy/bin/rails
r1407 r1408 114 114 untie @railswelcome; 115 115 116 tie my @railsfcgi, 'Tie::File', 'public/dispatch.fcgi'; 117 for (@railsfcgi) { 118 s/^[^#]*RailsFCGIHandler/## Commented out by scripts.mit.edu autoinstaller\n## RailsFCGIHandler/; 119 } 120 untie @railsfcgi; 121 open RAILSFCGI, ">>public/dispatch.fcgi"; 122 print RAILSFCGI <<EOF; 123 124 ## Added by scripts.mit.edu autoinstaller to reload when app code changes 125 Thread.abort_on_exception = true 126 127 t1 = Thread.new do 128 RailsFCGIHandler.process! 129 end 130 131 t2 = Thread.new do 132 # List of directories to watch for changes before reload 133 Thread.current[:watched_dirs] = ['app', 'config', 'db', 'lib', 'public'] 134 # Sample filter: /(\.rb|\.erb)\$/. Default filter: watch all files 135 Thread.current[:watched_extensions] = // 136 137 def modified(file) 138 mtime = File.stat(file).mtime 139 Thread.current[:modifications][file] ||= mtime 140 Thread.current[:modifications][file] != mtime 141 end 142 143 # Don't symlink yourself into a loop. Please. 144 def modified_dir(dir) 145 Dir.new(dir).each do |file| 146 absfile = File.join(dir, file) 147 if FileTest.directory? absfile 148 next if file == '.' or file == '..' 149 return true if modified_dir(absfile) 150 else 151 return true if Thread.current[:watched_extensions] =~ absfile && 152 modified(absfile) 153 end 154 end 155 false 156 end 157 158 def reload 159 Thread.current[:modifications] = {} 160 RailsFCGIHandler.reload! 161 end 162 163 Thread.current[:modifications] = {} 164 # Wait until the modify time changes, then reload. 165 while true 166 reload if Thread.current[:watched_dirs].inject(false) {|z, dir| z || 167 modified_dir(File.join(File.dirname(__FILE__), '..', dir))} 168 sleep 1 169 end 170 end 171 172 t1.join 173 t2.join 174 ## End of scripts.mit.edu autoinstaller additions 175 EOF 176 116 177 print "Your application is located in:\n"; 117 178 print " /mit/$USER/web_scripts/$addrend/\n";
Note: See TracChangeset
for help on using the changeset viewer.