We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Finish the Apache 2 module installer script. Rename mod_rails to 
mod_passenger.
Hongli Lai (Phusion) (author)
Thu Feb 21 10:01:22 -0800 2008
commit  c7cb43807fd37a61417783f1f8e56ecdaf7f84f3
tree    69397e544e949c525c63737ee2b341b84ddf9a05
parent  0812844eded2a566a737d5487633ff501f294492
...
95
96
97
98
 
99
100
 
101
102
103
...
109
110
111
112
113
 
 
114
115
116
117
118
 
119
120
 
121
122
123
...
132
133
134
135
136
 
 
137
138
139
...
146
147
148
149
 
150
151
152
...
226
227
228
229
 
230
231
232
233
 
234
235
236
...
250
251
252
253
 
254
 
255
256
257
...
272
273
274
 
275
276
277
...
95
96
97
 
98
99
 
100
101
102
103
...
109
110
111
 
 
112
113
114
115
116
117
 
118
119
 
120
121
122
123
...
132
133
134
 
 
135
136
137
138
139
...
146
147
148
 
149
150
151
152
...
226
227
228
 
229
230
231
232
233
234
235
236
237
...
251
252
253
 
254
255
256
257
258
259
...
274
275
276
277
278
279
280
0
@@ -95,9 +95,9 @@ subdir 'ext/apache2' do
0
   apxs_objects = APACHE2::OBJECTS.keys.join(',')
0
 
0
   desc "Build mod_passenger Apache 2 module"
0
- task :apache2 => 'mod_rails.so'
0
+ task :apache2 => 'mod_passenger.so'
0
   
0
- file 'mod_rails.so' => ['../boost/src/libboost_thread.a', 'mod_rails.o'] + APACHE2::OBJECTS.keys do
0
+ file 'mod_passenger.so' => ['../boost/src/libboost_thread.a', 'mod_passenger.o'] + APACHE2::OBJECTS.keys do
0
     # apxs totally sucks. We couldn't get it working correctly
0
     # on MacOS X (it had various problems with building universal
0
     # binaries), so we decided to ditch it and build/install the
0
@@ -109,15 +109,15 @@ subdir 'ext/apache2' do
0
       linkflags << " " << OSX_ARCHS
0
     end
0
     linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR_LIBS}"
0
- create_shared_library 'mod_rails.so',
0
- APACHE2::OBJECTS.keys.join(' ') << ' mod_rails.o',
0
+ create_shared_library 'mod_passenger.so',
0
+ APACHE2::OBJECTS.keys.join(' ') << ' mod_passenger.o',
0
       linkflags
0
   end
0
   
0
   desc "Install mod_passenger Apache 2 module"
0
- task 'apache2:install' => 'mod_rails.o' do
0
+ task 'apache2:install' => 'mod_passenger.so' do
0
     install_dir = `#{APACHE2::XS} -q LIBEXECDIR`.strip
0
- sh "cp", "mod_rails.so", install_dir
0
+ sh "cp", "mod_passenger.so", install_dir
0
   end
0
   
0
   desc "Install mod_passenger Apache 2 module and restart Apache"
0
@@ -132,8 +132,8 @@ subdir 'ext/apache2' do
0
     sh "#{APACHE2::CTL} start"
0
   end
0
   
0
- file 'mod_rails.o' => ['mod_rails.c'] do
0
- compile_c 'mod_rails.c', APACHE2::CXXFLAGS
0
+ file 'mod_passenger.o' => ['mod_passenger.c'] do
0
+ compile_c 'mod_passenger.c', APACHE2::CXXFLAGS
0
   end
0
   
0
   APACHE2::OBJECTS.each_pair do |target, sources|
0
@@ -146,7 +146,7 @@ subdir 'ext/apache2' do
0
   
0
   desc "Remove generated files for mod_passenger Apache 2 module"
0
   task 'apache2:clean' do
0
- files = [APACHE2::OBJECTS.keys, %w(mod_rails.lo mod_rails.slo mod_rails.la .libs)]
0
+ files = [APACHE2::OBJECTS.keys, %w(mod_passenger.o mod_passenger.so)]
0
     sh("rm", "-rf", *files.flatten)
0
   end
0
 end
0
@@ -226,11 +226,12 @@ spec = Gem::Specification.new do |s|
0
   s.homepage = "http://passenger.phusion.nl/"
0
   s.summary = "Apache module for Ruby on Rails support."
0
   s.name = "passenger"
0
- s.version = "1.0.0"
0
+ s.version = "0.9.0"
0
   s.requirements << "fastthread" << "Apache 2 with development headers"
0
   s.require_path = "lib"
0
   s.add_dependency 'rake', '>= 0.8.1'
0
   s.add_dependency 'fastthread', '>= 1.0.1'
0
+ s.add_dependency 'rspec', '>= 1.1.2'
0
   s.extensions << 'ext/mod_rails/extconf.rb'
0
   s.files = FileList[
0
     'Rakefile',
0
@@ -250,8 +251,9 @@ spec = Gem::Specification.new do |s|
0
     'test/stub/*/*/*/*/*'
0
   ] - Dir['test/stub/*/log/*'] \
0
    - Dir['test/stub/*/tmp/*/*']
0
- s.executables = 'passenger-spawn-server'
0
+ s.executables = ['passenger-spawn-server', 'passenger-install-apache2-module']
0
   s.has_rdoc = true
0
+ s.test_file = 'test/support/run_rspec_tests.rb'
0
   s.description = "Passenger is an Apache module for Ruby on Rails support."
0
 end
0
 
0
@@ -272,6 +274,7 @@ task :sloccount do
0
     "ext/apache2",
0
     "ext/mod_rails/*.c",
0
     "test/*.{cpp,rb}",
0
+ "test/support/*.rb",
0
     "test/stub/*.rb",
0
     "benchmark/*.{cpp,rb}"
0
   ]
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
0
@@ -1,3 +1,113 @@
0
 #!/usr/bin/env ruby
0
-Dir.chdir("#{File.dirname(__FILE__)}/..")
0
-exec "rake", "apache2:install"
0
+PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
0
+PASSENGER_WEBSITE = "http://passenger.phusion.nl/"
0
+PHUSION_WEBSITE = "www.phusion.nl"
0
+Dir.chdir(PASSENGER_ROOT)
0
+
0
+def banner(text)
0
+ return "\e[33m\e[44m\e[1m#{text}\e[0m"
0
+end
0
+
0
+def bold(text)
0
+ return "\e[1m#{text}\e[0m"
0
+end
0
+
0
+def red(text)
0
+ return "\e[1m\e[31m#{text}\e[0m"
0
+end
0
+
0
+def wait
0
+ begin
0
+ STDIN.readline
0
+ rescue Interrupt
0
+ exit 2
0
+ end
0
+end
0
+
0
+puts <<EOF
0
+#{banner("Welcome to the Passenger Apache 2 module installer.")}
0
+
0
+This installer will guide you through the entire installation process. It
0
+shouldn't take more than 3 minutes in total.
0
+
0
+Here's what you can expect from the installation process:
0
+
0
+ #{bold('1.')} The Apache 2 module will be automatically installed for you.
0
+ #{bold('2.')} This installer will teach you how to configure Apache.
0
+ #{bold('3.')} This installer will teach you how to deploy a Ruby on Rails application.
0
+ #{bold('4.')} There is no step 4.
0
+
0
+Don't worry if anything goes wrong. This installer will advise you on how to
0
+solve the problem.
0
+
0
+#{bold('Press Enter to continue, or Ctrl-C to abort.')}
0
+EOF
0
+wait
0
+puts "--------------------------------------------------------------------"
0
+
0
+puts banner('Compiling and installing Apache 2 module...')
0
+puts "cd #{PASSENGER_ROOT}"
0
+puts "rake apache2:install"
0
+
0
+if system "rake", "apache2:install"
0
+ module_location = `apxs2 -q LIBEXECDIR`.strip << "/mod_passenger.so"
0
+ spawn_server_location = "#{PASSENGER_ROOT}/bin/passenger-spawn-server"
0
+
0
+ puts "--------------------------------------------------------------------"
0
+ puts banner('The Apache 2 module was successfully installed.')
0
+ message = <<EOF
0
+ Please edit your Apache configuration file, and add these lines:
0
+
0
+ #{bold('LoadModule passenger_module ' << module_location)}
0
+ #{bold('RailsSpawnServer ' << spawn_server_location)}
0
+
0
+ After you restart Apache, you are ready to deploy any number of Ruby on Rails
0
+ applications on Apache, without any further Ruby on Rails-specific
0
+ configuration!
0
+
0
+ #{bold('Press ENTER to continue.')}
0
+EOF
0
+ puts message.gsub(/^\t/, '')
0
+ wait
0
+
0
+ puts "--------------------------------------------------------------------"
0
+ message = <<EOF
0
+ #{banner('Deploying a Ruby on Rails application: an example')}
0
+ Suppose you have a Ruby on Rails application in #{bold('/somewhere')}.
0
+
0
+ #{bold('1.')} Add a virtual host to your Apache configuration file.
0
+ #{bold('2.')} Set the virtual host's DocumentRoot to #{bold('/somewhere/public')}.
0
+
0
+ And that's it! You may also want to check the documentation on our website,
0
+ #{bold(PASSENGER_WEBSITE)}, for security and optimization tips and other
0
+ useful information.
0
+
0
+ Enjoy Passenger, a product of Phusion (#{bold(PHUSION_WEBSITE)}) :-)
0
+
0
+EOF
0
+ puts message.gsub(/^\t/, '')
0
+else
0
+ message = <<EOF
0
+ --------------------------------------------------------------------
0
+ #{red('It looks like something went wrong.')}
0
+
0
+ #{bold('*')} Do you see any #{bold('permission errors?')} If so, then please rerun this installer
0
+ as root.
0
+ #{bold('*')} Do you see any errors about #{bold(".h files that can't be found")}? If so, then you
0
+ probably don't have the Apache/APR development headers installed. Please
0
+ install the Apache/APR development headers and try again.
0
+
0
+ It is also possible that the headers are installed, but your compiler can't
0
+ find them. Please set the environment variables #{bold('C_INCLUDE_PATH')} and
0
+ #{bold('CPLUS_INCLUDE_PATH')} to the directory where your Apache/APR headers are
0
+ located.
0
+
0
+ If the above checklist didn't help, please use our support facilities at
0
+
0
+ #{bold(PASSENGER_WEBSITE)}
0
+
0
+EOF
0
+ puts message.gsub(/^\t/, '')
0
+ exit 1
0
+end
0
+
...
5
6
7
8
 
9
10
11
...
80
81
82
83
 
84
85
86
87
88
89
 
90
91
92
...
108
109
110
111
 
112
113
114
...
116
117
118
119
 
120
121
122
...
124
125
126
127
 
128
129
130
...
5
6
7
 
8
9
10
11
...
80
81
82
 
83
84
85
86
87
88
 
89
90
91
92
...
108
109
110
 
111
112
113
114
...
116
117
118
 
119
120
121
122
...
124
125
126
 
127
128
129
130
0
@@ -5,7 +5,7 @@
0
 
0
 using namespace Passenger;
0
 
0
-extern "C" module AP_MODULE_DECLARE_DATA rails_module;
0
+extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
0
 
0
 
0
 template<typename T> static apr_status_t
0
@@ -80,13 +80,13 @@ passenger_config_merge_all_servers(apr_pool_t *pool, server_rec *main_server) {
0
   server_rec *s;
0
   
0
   for (s = main_server; s != NULL; s = s->next) {
0
- ServerConfig *config = (ServerConfig *) ap_get_module_config(s->module_config, &rails_module);
0
+ ServerConfig *config = (ServerConfig *) ap_get_module_config(s->module_config, &passenger_module);
0
     final->ruby = (final->ruby != NULL) ? final->ruby : config->ruby;
0
     final->env = (final->env != NULL) ? final->env : config->env;
0
     final->spawnServer = (final->spawnServer != NULL) ? final->spawnServer : config->spawnServer;
0
   }
0
   for (s = main_server; s != NULL; s = s->next) {
0
- ServerConfig *config = (ServerConfig *) ap_get_module_config(s->module_config, &rails_module);
0
+ ServerConfig *config = (ServerConfig *) ap_get_module_config(s->module_config, &passenger_module);
0
     *config = *final;
0
   }
0
 }
0
@@ -108,7 +108,7 @@ cmd_rails_auto_detect(cmd_parms *cmd, void *pcfg, int arg) {
0
 static const char *
0
 cmd_rails_ruby(cmd_parms *cmd, void *pcfg, const char *arg) {
0
   ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
- cmd->server->module_config, &rails_module);
0
+ cmd->server->module_config, &passenger_module);
0
   config->ruby = arg;
0
   return NULL;
0
 }
0
@@ -116,7 +116,7 @@ cmd_rails_ruby(cmd_parms *cmd, void *pcfg, const char *arg) {
0
 static const char *
0
 cmd_rails_env(cmd_parms *cmd, void *pcfg, const char *arg) {
0
   ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
- cmd->server->module_config, &rails_module);
0
+ cmd->server->module_config, &passenger_module);
0
   config->env = arg;
0
   return NULL;
0
 }
0
@@ -124,7 +124,7 @@ cmd_rails_env(cmd_parms *cmd, void *pcfg, const char *arg) {
0
 static const char *
0
 cmd_rails_spawn_server(cmd_parms *cmd, void *pcfg, const char *arg) {
0
   ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
- cmd->server->module_config, &rails_module);
0
+ cmd->server->module_config, &passenger_module);
0
   config->spawnServer = arg;
0
   return NULL;
0
 }
...
27
28
29
30
 
31
32
33
...
48
49
50
51
 
52
53
54
55
 
56
57
58
...
27
28
29
 
30
31
32
33
...
48
49
50
 
51
52
53
54
 
55
56
57
58
0
@@ -27,7 +27,7 @@
0
 using namespace std;
0
 using namespace Passenger;
0
 
0
-extern "C" module AP_MODULE_DECLARE_DATA rails_module;
0
+extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
0
 
0
 #define DEFAULT_RUBY_COMMAND "ruby"
0
 #define DEFAULT_RAILS_ENV "production"
0
@@ -48,11 +48,11 @@ private:
0
   ApplicationPoolPtr applicationPool;
0
   
0
   DirConfig *getDirConfig(request_rec *r) {
0
- return (DirConfig *) ap_get_module_config(r->per_dir_config, &rails_module);
0
+ return (DirConfig *) ap_get_module_config(r->per_dir_config, &passenger_module);
0
   }
0
   
0
   ServerConfig *getServerConfig(server_rec *s) {
0
- return (ServerConfig *) ap_get_module_config(s->module_config, &rails_module);
0
+ return (ServerConfig *) ap_get_module_config(s->module_config, &passenger_module);
0
   }
0
   
0
   /**

Comments

    No one has commented yet.