Changeset 2149 for branches/locker-dev
- Timestamp:
- Mar 24, 2012, 8:40:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/locker-dev/locker/deploy/bin/rails
r2124 r2149 5 5 use onserver; 6 6 use Tie::File; 7 use Cwd; 7 8 8 9 setup(); … … 38 39 my $prod_db = make_db("production"); 39 40 40 system qw{rails new . -D -d mysql }; 41 my $cwd = getcwd; 42 system("rails", "new", $cwd ,"-d", "mysql"); 43 my $appdir = `basename $cwd`; 44 chomp $appdir; 45 my $appclass = ucfirst $appdir; 41 46 42 47 open PUBLIC_HTACCESS, ">public/.htaccess"; … … 120 125 untie @railsfcgi; 121 126 open RAILSFCGI, ">>public/dispatch.fcgi"; 127 print RAILSFCGI "#!/usr/bin/ruby\n"; 122 128 print RAILSFCGI <<EOF; 129 require File.join(File.dirname(__FILE__), '../config/environment') 130 require 'rack' 123 131 124 132 ## Added by scripts.mit.edu autoinstaller to reload when app code changes 125 133 Thread.abort_on_exception = true 126 134 135 class Rack::PathInfoRewriter 136 def initialize(app) 137 \@app = app 138 end 139 140 def call(env) 141 env["SCRIPT_NAME"] = "" 142 parts = env['REQUEST_URI'].split('?') 143 env['PATH_INFO'] = parts[0] 144 env['QUERY_STRING'] = parts[1].to_s 145 \@app.call(env) 146 end 147 end 148 149 127 150 t1 = Thread.new do 128 RailsFCGIHandler.process! 151 dispatch_logger = Logger.new(File.join(Rails.root,'log/dispatcher.log')) 152 153 begin 154 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Rack::URLMap.new("/$appdir" => ${appclass}::Application)) 155 rescue => e 156 dispatch_logger.error(e) 157 raise e 158 end 129 159 end 130 131 160 t2 = Thread.new do 132 161 # List of directories to watch for changes before reload. … … 195 224 ## End of scripts.mit.edu autoinstaller additions 196 225 EOF 226 chmod 0755,'public/dispatch.fcgi'; 227 228 # have to explicitly take a dependency on fcgi 229 open GEMFILE, ">>Gemfile"; 230 print GEMFILE "gem 'fcgi'\n"; 231 close GEMFILE; 197 232 198 233 print "Your application is located in:\n";
Note: See TracChangeset
for help on using the changeset viewer.