Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use custom mime file for script/server mongrel if config/mime.yml exi…

…sts. Pass --mime=other/path for a custom mime file. [Rick Olson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5572 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 5999fdd3f30c64e340b64be1a64aa16323c6c69e 1 parent ca2d704
risk danger olson technoweenie authored
Showing with 11 additions and 1 deletion.
  1. +2 −0  railties/CHANGELOG
  2. +9 −1 railties/lib/commands/servers/mongrel.rb
2  railties/CHANGELOG
View
@@ -1,5 +1,7 @@
*SVN*
+* Use custom mime file for script/server mongrel if config/mime.yml exists. Pass --mime=other/path for a custom mime file. [Rick Olson]
+
* Add custom mime type file for mongrel. config/mime.yml is added with generated apps from the rails command. [Rick Olson]
* Update to Prototype 1.5.0_rc2 [5550] which makes it work in Opera again [Thomas Fuchs]
10 railties/lib/commands/servers/mongrel.rb
View
@@ -14,14 +14,18 @@
detach = false
ip = nil
port = nil
+mime = 'config/mime.yml'
ARGV.clone.options do |opt|
opt.on("-p", "--port=port", Integer,
"Runs Rails on the specified port.",
"Default: 3000") { |p| port = p }
- opt.on("-a", "--binding=ip", String,
+ opt.on("-a", "--address=ip", String,
"Binds Rails to the specified ip.",
"Default: 0.0.0.0") { |i| ip = i }
+ opt.on("-m", "--mime=path", String,
+ "Path to custom mime file.",
+ "Default: config/mime.yml (if it exists)") { |m| mime = m }
opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 }
opt.on('-d', '-d', 'Call with -d to detach') { detach = true }
opt.parse!
@@ -43,6 +47,10 @@
trap(:INT) { exit }
+if File.exist?(File.join(RAILS_ROOT, mime)) && !ARGV.any? { |a| a =~ /^--?m/ }
+ ARGV << "--mime=#{mime}"
+end
+
begin
ARGV.unshift("start")
load 'mongrel_rails'
Please sign in to comment.
Something went wrong with that request. Please try again.