From 3054dbcb9d9936600a761e7da8a25bddee6b8b8b Mon Sep 17 00:00:00 2001 From: Gabriel Andretta Date: Sun, 11 Mar 2012 15:00:33 -0300 Subject: [PATCH 1/2] alias public_folder as public_dir --- lib/sinatra/base.rb | 8 ++++++++ test/settings_test.rb | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index fce5aaa5..c3e9f693 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -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) diff --git a/test/settings_test.rb b/test/settings_test.rb index 47d82683..8e1656ad 100644 --- a/test/settings_test.rb +++ b/test/settings_test.rb @@ -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? From a8d0f9a162be4e8d8265654200c9b199cf259ac8 Mon Sep 17 00:00:00 2001 From: Gabriel Andretta Date: Sun, 11 Mar 2012 15:03:36 -0300 Subject: [PATCH 2/2] doc public_dir --- README.es.rdoc | 3 +++ README.rdoc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/README.es.rdoc b/README.es.rdoc index f6c6771d..6c1c46fc 100644 --- a/README.es.rdoc +++ b/README.es.rdoc @@ -1422,6 +1422,9 @@ O varias: sección sobre la configuración de protección de ataques más arriba. +[public_dir] alias para public_folder, 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 static). Si no diff --git a/README.rdoc b/README.rdoc index d1a37f18..a8c0886b 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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 public_folder. See below. + [public_folder] Path to the folder public files are served from. Only used if static file serving is enabled (see static setting below). Inferred from