Changes in trunk/locker [2175:2319]
- Location:
- trunk/locker
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/locker/bin/scripts-start
r2175 r2319 6 6 echo 'gallery2 Gallery2' 7 7 echo 'phpbb phpBB' 8 echo 'joomla Joomla'9 8 echo 'git Git repository' 10 9 echo 'trac Trac' -
trunk/locker/deploy/bin/django
r2175 r2319 17 17 #!/usr/bin/env python 18 18 import sys, os, time, threading, django.utils.autoreload 19 sys.path.insert(0, "/mit/$USER/Scripts/django ")19 sys.path.insert(0, "/mit/$USER/Scripts/django/$name") 20 20 os.chdir("/mit/$USER/Scripts/django/$name") 21 21 os.environ['DJANGO_SETTINGS_MODULE'] = "$name.settings" … … 51 51 chdir "/mit/$USER/Scripts/django/"; 52 52 system(qw{django-admin startproject}, $name)==0 or die "\nFailed to create app.\n\n"; 53 chdir "$name ";53 chdir "$name/$name"; 54 54 55 55 open SETTINGS, "settings.py"; … … 106 106 rename "urls.py.new", "urls.py"; 107 107 108 chdir ".."; 109 108 110 print "Initializing your project's SQL database schema...\n"; 109 111 system qw{./manage.py syncdb --noinput}; -
trunk/locker/deploy/bin/git
r2175 r2319 58 58 export GIT_PROJECT_ROOT="$gitbase" 59 59 export PATH_TRANSLATED="\$GIT_PROJECT_ROOT\$PATH_INFO" 60 export GIT_HTTP_EXPORT_ALL=1 60 61 exec git http-backend 61 62 EOF … … 67 68 system qw{git init --bare}, "$addrend.git"; 68 69 chdir "$addrend.git"; 69 70 open ENABLE, ">git-daemon-export-ok";71 print ENABLE "";72 close ENABLE;73 70 74 71 system qw{htpasswd -c}, $htpasswd, $admin_username; -
trunk/locker/deploy/bin/rails
r2175 r2319 28 28 print "If you cannot determine the cause of the problem, please\n"; 29 29 print "feel free to contact sql\@mit.edu for assistance.\n"; 30 open FAILED, ">.failed";31 close FAILED;32 30 exit 1; 33 31 } … … 43 41 my $appdir = `basename $cwd`; 44 42 chomp $appdir; 45 my $appclass = ucfirst $appdir; 43 44 open APPLICATION_RB, "config/application.rb"; 45 my $appclass; 46 while(<APPLICATION_RB>) { 47 if (/module (\w+)\n/) { 48 $appclass = $1; 49 last; 50 } 51 } 52 close APPLICATION_RB; 53 if (!$appclass) { 54 die "Couldn't find application class name - plase email scripts\@mit.edu with the names of your locker and the application you tried to create. Sorry!"; 55 } 46 56 47 57 open PUBLIC_HTACCESS, ">public/.htaccess"; … … 73 83 # RewriteBase /myrailsapp 74 84 85 RewriteCond index.html -f 75 86 RewriteRule ^\$ index.html [QSA] 76 RewriteRule ^([^.]+)\$ \$1.html [QSA]77 87 RewriteCond %{REQUEST_FILENAME} !-f 78 RewriteRule ^(.*)\$ dispatch.fcgi [QSA,L]88 RewriteRule ^(.*)\$ dispatch.fcgi/\$1 [QSA,L] 79 89 80 90 # In case Rails experiences terminal errors … … 84 94 # ErrorDocument 500 /500.html 85 95 86 RewriteBase /$addrend/public/87 96 EOF 88 97 … … 91 100 RewriteEngine On 92 101 RewriteRule ^(.*)\$ public/\$1 [QSA,L] 93 RewriteBase /$addrend/ 102 94 103 EOF 95 104 … … 98 107 unshift @railsenv, "# Uncomment below to put Rails into production mode"; 99 108 unshift @railsenv, ""; 100 unshift @railsenv, "ENV['RAILS_RELATIVE_URL_ROOT'] = \"/$addrend\"";101 109 untie @railsenv; 102 110 … … 119 127 untie @railswelcome; 120 128 129 # set config.action_controller.asset_host for all environments, 130 # so urls to static assets are generated correctly 131 # regardless of how the app is accessed 132 my $rails_assethost = " config.action_controller.asset_host = \"//$USER.scripts.mit.edu/$appdir/public\""; 133 my @environments = ('development', 'production', 'test'); 134 135 for my $environment (@environments) { 136 tie my @envfile, 'Tie::File', "config/environments/$environment.rb"; 137 my $i = 0; 138 for (@envfile) { 139 if (/^end$/) { 140 last; 141 } 142 ++$i; 143 } 144 splice @envfile, $i, 1, ($rails_assethost, 'end'); 145 untie @envfile; 146 } 147 148 121 149 tie my @railsfcgi, 'Tie::File', 'public/dispatch.fcgi'; 122 150 for (@railsfcgi) { … … 133 161 Thread.abort_on_exception = true 134 162 135 class Rack::PathInfoRewriter 163 # Strip public/dispatch.fcgi out of SCRIPT_NAME so Rails generates nicer URLs 164 class ScriptNameRewriter 165 136 166 def initialize(app) 137 167 \@app = app … … 139 169 140 170 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 171 if env['SCRIPT_NAME'] =~ /dispatch\.fcgi/ 172 env['SCRIPT_NAME'].gsub!(/public\\/dispatch\.fcgi/,'') 173 end 145 174 \@app.call(env) 146 175 end … … 152 181 153 182 begin 154 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Rack::URLMap.new("/$appdir" => ${appclass}::Application))183 Rack::Handler::FastCGI.run ScriptNameRewriter.new(Rack::URLMap.new("/" => ${appclass}::Application)) 155 184 rescue => e 156 185 dispatch_logger.error(e) … … 165 194 # List of specific files to watch for changes. 166 195 Thread.current[:watched_files] = ['public/dispatch.fcgi', 167 196 'public/.htaccess'] 168 197 # Sample filter: /(\.rb|\.erb)\$/. Default filter: watch all files 169 198 Thread.current[:watched_extensions] = // … … 194 223 else 195 224 return true if Thread.current[:watched_extensions] =~ absfile && 196 225 modified(absfile) 197 226 end 198 227 end … … 226 255 chmod 0755,'public/dispatch.fcgi'; 227 256 257 # static-cat doesn't whitelist .txt files 258 chmod 0777, 'public/robots.txt'; 259 228 260 # have to explicitly take a dependency on fcgi 261 # ruby1.9 means we need to take a dependency on minitest 262 # for rails console to work 229 263 open GEMFILE, ">>Gemfile"; 230 264 print GEMFILE "gem 'fcgi'\n"; 265 print GEMFILE "gem 'minitest'\n"; 231 266 close GEMFILE; 232 267 233 268 print "Your application is located in:\n"; 234 269 print " /mit/$USER/web_scripts/$addrend/\n"; 235 print "To run programs like rake or script/generate, run\n";270 print "To run programs like rake or rails generate, run\n"; 236 271 print " 'ssh -k $USER\@scripts' and cd to the above directory.\n\n"; 237 272 press_enter; -
trunk/locker/sbin/rpm-master.sh
r2175 r2319 1 1 #!/bin/sh 2 3 export LC_ALL=C 2 4 3 5 echo "Entering correct directory..." -
trunk/locker/sbin/rpmlist.sh
r2175 r2319 1 1 #!/bin/sh 2 3 export LC_ALL=C 2 4 3 5 copyTo='/mit/scripts/cron_scripts/rpm-sync/'
Note: See TracChangeset
for help on using the changeset viewer.