1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge branch 'public_dir_alias' of https://github.com/ohhgabriel/sinatra into ohhgabriel-public_dir_alias

This commit is contained in:
Konstantin Haase 2012-03-15 09:07:43 +01:00
commit 9cfaa260f0
4 changed files with 25 additions and 0 deletions

View file

@ -1422,6 +1422,9 @@ O varias:
sección sobre la configuración de protección de ataques
más arriba.
[public_dir] alias para <tt>public_folder</tt>, que se encuentra a
continuación.
[public_folder] path del directorio desde donde se sirven los archivos
públicos. Solo se utiliza cuando se sirven archivos
estáticos (ver la opción <tt>static</tt>). Si no

View file

@ -1367,6 +1367,8 @@ You can also hand in an array in order to disable a list of protections:
[protection] Whether or not to enable web attack protections. See
protection section above.
[public_dir] Alias for <tt>public_folder</tt>. See below.
[public_folder] Path to the folder public files are served from. Only
used if static file serving is enabled (see
<tt>static</tt> setting below). Inferred from

View file

@ -1177,6 +1177,14 @@ module Sinatra
set(:public_folder, value)
end
def public_dir=(value)
self.public_folder = value
end
def public_dir
public_folder
end
private
# Condition for matching host name. Parameter might be String or Regexp.
def host_name(pattern)

View file

@ -484,6 +484,18 @@ class SettingsTest < Test::Unit::TestCase
end
end
describe 'public_dir' do
it 'is an alias for public_folder' do
@base.public_dir = File.dirname(__FILE__)
assert_equal File.dirname(__FILE__), @base.public_dir
assert_equal @base.public_folder, @base.public_dir
@application.public_dir = File.dirname(__FILE__)
assert_equal File.dirname(__FILE__), @application.public_dir
assert_equal @application.public_folder, @application.public_dir
end
end
describe 'lock' do
it 'is disabled by default' do
assert ! @base.lock?