aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG1
-rw-r--r--railties/lib/commands/process/spawner.rb12
2 files changed, 12 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index eaea07a81c..f45abe977d 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -2,6 +2,7 @@
* Removed calls to fixtures in generated tests as fixtures :all is now present by default in test_helper.rb [DHH]
+* Add --prefix option to script/server when using mongrel. [dacat]
*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.1.4 - 1.2.3]
diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb
index 8fdfab945a..fd09daa55b 100644
--- a/railties/lib/commands/process/spawner.rb
+++ b/railties/lib/commands/process/spawner.rb
@@ -65,6 +65,14 @@ class MongrelSpawner < Spawner
"-c #{OPTIONS[:rails_root]} " +
"-l #{OPTIONS[:rails_root]}/log/mongrel.log"
+ # Add prefix functionality to spawner's call to mongrel_rails
+ # Digging through monrel's project subversion server, the earliest
+ # Tag that has prefix implemented in the bin/mongrel_rails file
+ # is 0.3.15 which also happens to be the earilest tag listed.
+ # References: http://mongrel.rubyforge.org/svn/tags
+ if Mongrel::Const::MONGREL_VERSION.to_f >=0.3 && !OPTIONS[:prefix].nil?
+ cmd = cmd + " --prefix #{OPTIONS[:prefix]}"
+ end
system(cmd)
end
@@ -121,7 +129,8 @@ OPTIONS = {
:port => 8000,
:address => '0.0.0.0',
:instances => 3,
- :repeat => nil
+ :repeat => nil,
+ :prefix => nil
}
ARGV.options do |opts|
@@ -182,6 +191,7 @@ ARGV.options do |opts|
opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v }
opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v }
opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |v| OPTIONS[:environment] = v }
+ opts.on("-P", "--prefix=path", String, "URL prefix for Rails app. [Used only with Mongrel > v0.3.15]: (default: #{OPTIONS[:prefix]})") { |v| OPTIONS[:prefix] = v }
opts.on("-n", "--process=name", String, "default: #{OPTIONS[:process]}") { |v| OPTIONS[:process] = v }
opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |v| OPTIONS[:spawner] = v }
opts.on("-d", "--dispatcher=path", String, "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) }