Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Removed the "Allow mod rewrite rules" from the UI because it's not an…
Browse files Browse the repository at this point in the history
… as highly used option as the others, we find. So let the user edit it in themselves.
  • Loading branch information
alloy committed Dec 3, 2008
1 parent 8f81b78 commit 0aaf713
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 152 deletions.
4 changes: 0 additions & 4 deletions English.lproj/PassengerPaneHelp/PassengerPaneHelp.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ <h1><img src="../../PassengerPref.tiff" alt="Passenger preferences icon" height=
<td>Run in…</td>
<td>The environment you want to run the Rails application in.</td>
</tr>
<tr>
<td>Allow custom rewrite rules</td>
<td>By default, Passenger uses its own rewrite rules to run Rails applications. Please note that you will have to remove or change the default <tt>.htaccess</tt> file if you turn this on.</td>
</tr>
</table>

<p>You can drag an item from the source list onto a text editor or into the terminal to further customize the Apache configuration.</p>
Expand Down
130 changes: 6 additions & 124 deletions English.lproj/PassengerPref.xib
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9E17</string>
<string key="IBDocument.SystemVersion">9F33</string>
<string key="IBDocument.InterfaceBuilderVersion">670</string>
<string key="IBDocument.AppKitVersion">949.33</string>
<string key="IBDocument.AppKitVersion">949.34</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -484,33 +484,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="NSCellBackgroundColor" ref="131886356"/>
<reference key="NSFont" ref="829849519"/>
</object>
<object class="NSButton" id="73888779">
<reference key="NSNextResponder" ref="452669158"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{91, 35}, {190, 18}}</string>
<reference key="NSSuperview" ref="452669158"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="866162661">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Allow custom rewrite rules</string>
<reference key="NSSupport" ref="829849519"/>
<reference key="NSControlView" ref="73888779"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">130</int>
<object class="NSCustomResource" key="NSNormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
<object class="NSButtonImageSource" key="NSAlternateImage">
<string key="NSImageName">NSSwitch</string>
</object>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSTextField" id="425273535">
<reference key="NSNextResponder" ref="452669158"/>
<int key="NSvFlags">268</int>
Expand Down Expand Up @@ -1091,22 +1064,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
</object>
<int key="connectionID">336</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: authorized</string>
<reference key="source" ref="73888779"/>
<reference key="destination" ref="565115411"/>
<object class="NSNibBindingConnector" key="connector" id="261940900">
<reference key="NSSource" ref="73888779"/>
<reference key="NSDestination" ref="565115411"/>
<string key="NSLabel">enabled: authorized</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">authorized</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">339</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: authorized</string>
Expand Down Expand Up @@ -1221,26 +1178,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
</object>
<int key="connectionID">358</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: selection.allow_mod_rewrite</string>
<reference key="source" ref="73888779"/>
<reference key="destination" ref="467003467"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="73888779"/>
<reference key="NSDestination" ref="467003467"/>
<string key="NSLabel">value: selection.allow_mod_rewrite</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">selection.allow_mod_rewrite</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSAllowsEditingMultipleValuesSelection</string>
<reference key="NS.object.0" ref="8"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">359</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: canRemove</string>
Expand Down Expand Up @@ -1409,42 +1346,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
</object>
<int key="connectionID">393</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled2: selection.host</string>
<reference key="source" ref="73888779"/>
<reference key="destination" ref="467003467"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="73888779"/>
<reference key="NSDestination" ref="467003467"/>
<string key="NSLabel">enabled2: selection.host</string>
<string key="NSBinding">enabled2</string>
<string key="NSKeyPath">selection.host</string>
<object class="NSDictionary" key="NSOptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMultipleValuesPlaceholder</string>
<string>NSNoSelectionPlaceholder</string>
<string>NSNotApplicablePlaceholder</string>
<string>NSNullPlaceholder</string>
<string>NSValueTransformerName</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="8"/>
<reference ref="8"/>
<reference ref="7"/>
<reference ref="7"/>
<string>NSIsNotNil</string>
</object>
</object>
<reference key="NSPreviousConnector" ref="261940900"/>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">400</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled3: selection.host</string>
Expand Down Expand Up @@ -1600,8 +1501,8 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="0"/>
<real value="-1.000000e+00"/>
<reference ref="8"/>
<reference ref="7"/>
</object>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
Expand Down Expand Up @@ -1880,7 +1781,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
<reference ref="228518755"/>
<reference ref="631300605"/>
<reference ref="1057804348"/>
<reference ref="73888779"/>
<reference ref="425273535"/>
</object>
<reference key="parent" ref="453226259"/>
Expand Down Expand Up @@ -1913,20 +1813,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
<reference key="object" ref="986642367"/>
<reference key="parent" ref="425273535"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">253</int>
<reference key="object" ref="73888779"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="866162661"/>
</object>
<reference key="parent" ref="298054908"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">254</int>
<reference key="object" ref="866162661"/>
<reference key="parent" ref="73888779"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">247</int>
<reference key="object" ref="1057804348"/>
Expand Down Expand Up @@ -2133,8 +2019,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
<string>250.IBPluginDependency</string>
<string>251.IBPluginDependency</string>
<string>252.IBPluginDependency</string>
<string>253.IBPluginDependency</string>
<string>254.IBPluginDependency</string>
<string>257.IBPluginDependency</string>
<string>258.IBPluginDependency</string>
<string>274.IBPluginDependency</string>
Expand Down Expand Up @@ -2188,9 +2072,9 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{71, 266}, {668, 438}}</string>
<string>{{325, 473}, {668, 438}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{71, 266}, {668, 438}}</string>
<string>{{325, 473}, {668, 438}}</string>
<reference ref="9"/>
<string>{{-5, 388}, {668, 438}}</string>
<reference ref="9"/>
Expand Down Expand Up @@ -2237,8 +2121,6 @@ dHRwOi8vd3d3Lm1vZHJhaWxzLmNvbSBmb3IgaW5zdGFsbGF0aW9uIGluc3RydWN0aW9ucy4</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
Expand Down
8 changes: 1 addition & 7 deletions PassengerApplication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ def serializedApplicationsData(apps)
end
end

kvc_accessor :host, :path, :aliases, :dirty, :valid, :revertable, :environment, :allow_mod_rewrite
kvc_accessor :host, :path, :aliases, :dirty, :valid, :revertable, :environment
attr_accessor :user_defined_data, :vhostname

def init
if super_init
@environment = DEVELOPMENT
@allow_mod_rewrite = false

@new_app = true
@dirty = @valid = @revertable = false
Expand Down Expand Up @@ -174,7 +173,6 @@ def to_hash
'aliases' => @aliases.to_s,
'path' => @path.to_s,
'environment' => (@environment.nil? ? @custom_environment : (@environment == DEVELOPMENT ? 'development' : 'production')),
'allow_mod_rewrite' => (@allow_mod_rewrite == true || @allow_mod_rewrite == 1),
'vhostname' => @vhostname,
'user_defined_data' => @user_defined_data
}
Expand Down Expand Up @@ -207,9 +205,6 @@ def load_data_from_vhost_file(file = config_path)
@custom_environment = $2
end

data.gsub!(/\n\s*RailsAllowModRewrite\s+(off|on)/, '')
self.allow_mod_rewrite = ($1 == 'on')

data.gsub!(/<VirtualHost\s(.+?)>/, '')
self.vhostname = $1

Expand All @@ -234,7 +229,6 @@ def set_original_values!
'aliases' => @aliases,
'path' => @path,
'environment' => @custom_environment || @environment,
'allow_mod_rewrite' => @allow_mod_rewrite,
'user_defined_data' => @user_defined_data
}
end
Expand Down
1 change: 0 additions & 1 deletion config_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def create_vhost_conf(index)
(" ServerAlias #{app['aliases']}" unless app['aliases'].empty?),
" DocumentRoot \"#{public_dir}\"",
" #{app['app_type'].capitalize}Env #{app['environment']}",
(" RailsAllowModRewrite " << (app['allow_mod_rewrite'] ? 'on' : 'off') if app['app_type'] == 'rails'),
(app['user_defined_data'] unless app['user_defined_data'].empty?),
"</VirtualHost>"
].compact.join("\n")
Expand Down
4 changes: 0 additions & 4 deletions test/config_installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@app.aliases = 'manfred-s-blog.local my-blog.local'
@app.path = '/User/het-manfred/rails code/blog'
@app.environment = PassengerApplication::PRODUCTION
@app.allow_mod_rewrite = true
@app.vhostname = 'het-manfreds-wiki.local:443'

@installer = ConfigInstaller.new([@app.to_hash].to_yaml)
Expand All @@ -34,7 +33,6 @@
'aliases' => 'manfred-s-blog.local my-blog.local',
'path' => '/User/het-manfred/rails code/blog',
'environment' => 'production',
'allow_mod_rewrite' => true,
'vhostname' => 'het-manfreds-wiki.local:443',
'user_defined_data' => " <directory \"/User/het-manfred/rails code/blog/public\">\n Order allow,deny\n Allow from all\n </directory>"
}]
Expand All @@ -61,7 +59,6 @@
ServerAlias manfred-s-blog.local my-blog.local
DocumentRoot "/User/het-manfred/rails code/blog/public"
RailsEnv production
RailsAllowModRewrite on
<directory \"/User/het-manfred/rails code/blog/public\">
Order allow,deny
Allow from all
Expand Down Expand Up @@ -95,7 +92,6 @@
ServerName het-manfreds-blog.local
DocumentRoot "/User/het-manfred/rails code/blog/public"
RailsEnv production
RailsAllowModRewrite on
<directory \"/User/het-manfred/rails code/blog/public\">
Order allow,deny
Allow from all
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/blog.vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
Order allow,deny
Allow from all
</directory>
RailsAllowModRewrite off
</VirtualHost>
1 change: 0 additions & 1 deletion test/fixtures/staging.vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
Order allow,deny
Allow from all
</directory>
RailsAllowModRewrite off
</VirtualHost>
1 change: 0 additions & 1 deletion test/fixtures/wiki.vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
BindAddress 192.168.0.123
DocumentRoot "/Users/het-manfred/rails code/wiki/public"
RailsEnv production
RailsAllowModRewrite on
<Location "/">
AuthType Basic
AuthName "Development Preview"
Expand Down
11 changes: 2 additions & 9 deletions test/passenger_application_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,13 @@ def after_setup
passenger_app.aliases.should == "manfred-s-blog.local my-blog.local"
passenger_app.path.should == "/Users/het-manfred/rails code/blog"
passenger_app.environment.should == PassengerApplication::DEVELOPMENT
passenger_app.allow_mod_rewrite.should.be false
passenger_app.vhostname.should == '*:80'

passenger_app = PassengerApplication.alloc.initWithFile(File.expand_path('../fixtures/wiki.vhost.conf', __FILE__))
passenger_app.host.should == "het-manfreds-wiki.local"
passenger_app.aliases.should == ""
passenger_app.path.should == "/Users/het-manfred/rails code/wiki"
passenger_app.environment.should == PassengerApplication::PRODUCTION
passenger_app.allow_mod_rewrite.should.be true
passenger_app.vhostname.should == 'het-manfreds-wiki.local:443'
passenger_app.user_defined_data.should == %{
BindAddress 192.168.0.123
Expand Down Expand Up @@ -268,7 +266,6 @@ def after_setup
assigns(:host, 'app.local'.to_ns)
assigns(:aliases, 'alias1.local alias2.local'.to_ns)
assigns(:user_defined_data, "<directory \"/some/path\">\n foo bar\n</directory>")
assigns(:allow_mod_rewrite, false.to_ns)
assigns(:vhostname, 'het-manfreds-wiki.local:443')

passenger_app.to_hash.should == {
Expand All @@ -278,7 +275,6 @@ def after_setup
'aliases' => 'alias1.local alias2.local',
'path' => passenger_app.path,
'environment' => 'development',
'allow_mod_rewrite' => false,
'vhostname' => 'het-manfreds-wiki.local:443',
'user_defined_data' => "<directory \"/some/path\">\n foo bar\n</directory>"
}
Expand Down Expand Up @@ -323,16 +319,14 @@ def after_setup
passenger_app.setValue_forKey('', 'aliases')
passenger_app.setValue_forKey('/some/path', 'path')
passenger_app.setValue_forKey('production', 'environment')
passenger_app.setValue_forKey(true, 'allow_mod_rewrite')

passenger_app.should.be.dirty
passenger_app.should.be.valid
passenger_app.to_hash.except('app_type', 'config_path', 'user_defined_data', 'new_app', 'vhostname').should == {
'host' => 'foo.local',
'path' => '/some/path',
'aliases' => '',
'environment' => 'production',
'allow_mod_rewrite' => true,
'environment' => 'production'
}

passenger_app.should.be.revertable
Expand All @@ -343,8 +337,7 @@ def after_setup
'host' => 'het-manfreds-blog.local',
'aliases' => 'manfred-s-blog.local my-blog.local',
'path' => '/Users/het-manfred/rails code/blog',
'environment' => 'development',
'allow_mod_rewrite' => false
'environment' => 'development'
}
end

Expand Down

0 comments on commit 0aaf713

Please sign in to comment.