Changeset 1426 for trunk/locker
- Timestamp:
- Jan 18, 2010, 2:24:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/locker/deploy/bin/rails
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/locker-dev/locker/deploy/bin/rails merged eligible /branches/fc11-dev/locker/deploy/bin/rails 1121-1258
r1298 r1426 90 90 91 91 tie my @railsenv, 'Tie::File', 'config/environment.rb'; 92 unshift @railsenv, "# ENV['RAILS_ENV'] ||= 'production'"; 93 unshift @railsenv, "# Uncomment below to put Rails into production mode"; 94 unshift @railsenv, ""; 92 95 unshift @railsenv, "ENV['RAILS_RELATIVE_URL_ROOT'] = \"/$addrend\""; 93 96 untie @railsenv; … … 111 114 untie @railswelcome; 112 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 # Iterations since last reload 137 Thread.current[:iterations] = 0 138 139 def modified(file) 140 begin 141 mtime = File.stat(file).mtime 142 rescue 143 false 144 else 145 if Thread.current[:iterations] == 0 146 Thread.current[:modifications][file] = mtime 147 end 148 Thread.current[:modifications][file] != mtime 149 end 150 end 151 152 # Don't symlink yourself into a loop. Please. Things will still work 153 # (Linux limits your symlink depth) but you will be sad 154 def modified_dir(dir) 155 Dir.new(dir).each do |file| 156 absfile = File.join(dir, file) 157 if FileTest.directory? absfile 158 next if file == '.' or file == '..' 159 return true if modified_dir(absfile) 160 else 161 return true if Thread.current[:watched_extensions] =~ absfile && 162 modified(absfile) 163 end 164 end 165 false 166 end 167 168 def reload 169 Thread.current[:modifications] = {} 170 Thread.current[:iterations] = 0 171 RailsFCGIHandler.reload! 172 end 173 174 Thread.current[:modifications] = {} 175 # Wait until the modify time changes, then reload. 176 while true 177 reload if Thread.current[:watched_dirs].inject(false) {|z, dir| z || modified_dir(File.join(File.dirname(__FILE__), '..', dir))} 178 Thread.current[:iterations] += 1 179 sleep 1 180 end 181 end 182 183 t1.join 184 t2.join 185 ## End of scripts.mit.edu autoinstaller additions 186 EOF 187 113 188 print "Your application is located in:\n"; 114 189 print " /mit/$USER/web_scripts/$addrend/\n"; -
Property
svn:mergeinfo
set to
(toggle deleted branches)
Note: See TracChangeset
for help on using the changeset viewer.