public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Add enterprisey aspects.
Hongli Lai (Phusion (author)
Mon Apr 28 09:56:25 -0700 2008
commit  bb20616dc45356ab8bcec522d99c53195da3df7f
tree    2218de7d6d1eeae291f6e034e432be156ca693a3
parent  3ca31b3e37c891d3f543944fb108b52e152b99d4
...
383
384
385
386
 
 
387
388
389
...
383
384
385
 
386
387
388
389
390
0
@@ -383,7 +383,8 @@
0
     'passenger-spawn-server',
0
     'passenger-install-apache2-module',
0
     'passenger-config',
0
- 'passenger-memory-stats'
0
+ 'passenger-memory-stats',
0
+ 'passenger-make-enterprisey'
0
   ]
0
   s.has_rdoc = true
0
   s.extra_rdoc_files = ['README']
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
0
@@ -1 +1,63 @@
0
+#!/usr/bin/env ruby
0
+# Phusion Passenger - http://www.modrails.com/
0
+# Copyright (C) 2008 Phusion
0
+#
0
+# This program is free software; you can redistribute it and/or modify
0
+# it under the terms of the GNU General Public License as published by
0
+# the Free Software Foundation; version 2 of the License.
0
+#
0
+# This program is distributed in the hope that it will be useful,
0
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
0
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0
+# GNU General Public License for more details.
0
+#
0
+# You should have received a copy of the GNU General Public License along
0
+# with this program; if not, write to the Free Software Foundation, Inc.,
0
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
+
0
+PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
0
+require 'digest/md5'
0
+
0
+##############################################################################
0
+#
0
+# Hidden license
0
+#
0
+# By reading the source code of this file, you're automatically agreeing
0
+# with the following conditions:
0
+#
0
+# 1. You will sell your soul to us for $0.
0
+# 2. You will watch the movie "Hot Fuzz".
0
+#
0
+# [ Allow ] or [ Deny ]
0
+#
0
+##############################################################################
0
+
0
+
0
+
0
+
0
+trap("INT") { exit 1 }
0
+if File.exist?("#{PASSENGER_ROOT}/enterprisey.txt")
0
+ puts "Congratulations, your Passenger Enterprise License has already been activated!"
0
+else
0
+ puts %{
0
+ Phusion Genuine Advantage
0
+ -------------------------
0
+ Welcome to the Phusion Genuine Advantage (PGA) program. This program will help
0
+ you with activating your Passenger Enterprise License.
0
+
0
+ Please enter your Enterprise License Key:
0
+ }.gsub(/^\t\t/, '').strip
0
+ done = false
0
+ while !done
0
+ key = STDIN.readline.strip
0
+ if key == Digest::MD5.hexdigest(%{Saying "Rails doesn't scale" is like saying "my car doesn’t go infinitely fast".})
0
+ done = true
0
+ else
0
+ STDERR.puts "Invalid key given. Please try again:"
0
+ end
0
+ end
0
+ system("touch", "#{PASSENGER_ROOT}/enterprisey.txt")
0
+ puts "Congratulations! Your Passenger Enterprise License has been activated!"
0
+ puts "Please restart Apache to take full advantage of your Enterprise License."
0
+end
...
97
98
99
 
100
101
102
103
104
105
 
 
 
 
106
107
108
...
136
137
138
139
 
140
141
142
...
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
141
142
143
 
144
145
146
147
0
@@ -97,12 +97,17 @@
0
   DEFAULT = 'DEFAULT' # :nodoc:
0
   CONTENT_LENGTH = 'CONTENT_LENGTH' # :nodoc:
0
   HTTP_CONTENT_LENGTH = 'HTTP_CONTENT_LENGTH' # :nodoc:
0
+ X_POWERED_BY = 'X-Powered-By'
0
   
0
   NINJA_PATCHING_LOCK = Mutex.new
0
   @@ninja_patched_action_controller = false
0
   
0
   File.read("#{File.dirname(__FILE__)}/../../Rakefile") =~ /^PACKAGE_VERSION = "(.*)"$/
0
   PASSENGER_VERSION = $1
0
+ PASSENGER_HEADER = "Phusion Passenger (mod_rails) #{PASSENGER_VERSION}"
0
+ if File.exist?("#{File.dirname(__FILE__)}/../../enterprisey.txt")
0
+ PASSENGER_HEADER << ", Enterprise Edition"
0
+ end
0
   
0
   # The name of the socket on which the request handler accepts
0
   # new connections. This is either a Unix socket filename, or
0
@@ -136,7 +141,7 @@
0
           alias passenger_orig_perform_action perform_action
0
           
0
           def perform_action(*whatever)
0
- headers["X-Powered-By"] = "Phusion Passenger (mod_rails) #{PASSENGER_VERSION}"
0
+ headers[X_POWERED_BY] = PASSENGER_HEADER
0
             passenger_orig_perform_action(*whatever)
0
           end
0
         end
...
247
248
249
 
250
251
252
...
247
248
249
250
251
252
253
0
@@ -247,6 +247,7 @@
0
   end
0
   
0
   def send_error_page(channel, template_name, options = {})
0
+ options["enterprisey"] = File.exist?("#{File.dirname(__FILE__)}/../../enterprisey.txt")
0
     data = HTMLTemplate.new(template_name, options).result
0
     channel.write('error_page')
0
     channel.write_scalar(data)
...
14
15
16
17
 
18
19
20
...
28
29
30
31
 
32
33
34
...
14
15
16
 
17
18
19
20
...
28
29
30
 
31
32
33
34
0
@@ -14,7 +14,7 @@
0
 
0
   <div id="site_container">
0
     <div id="site_header">
0
- <ul class="corporate_identity">
0
+ <ul class="corporate_identity <% if @enterprisey %>enterprise_edition<% end %>">
0
         <li class="logo"><a href="http://www.modrails.com"><span>Phusion Passenger</span></a></li>
0
       </ul>
0
     </div>
0
@@ -28,7 +28,7 @@
0
        text. Thank you.
0
       -->
0
       <div class="container">
0
- Powered by <a href="http://www.modrails.com/">Phusion Passenger</a>>,
0
+ Powered by <a href="http://www.modrails.com/">Phusion Passenger</a><% if @enterprisey %> (Enterprise Edition)<% end %>,
0
         <tt>mod_rails</tt> for Apache.
0
       </div>
0
     </div>

Comments

  • myabc Mon Apr 28 10:34:08 -0700 2008

    April 1 was 27 days ago!