Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
michelc committed Oct 28, 2011
2 parents 393640e + a27a95d commit cf27ad4
Show file tree
Hide file tree
Showing 22 changed files with 876 additions and 123 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -7,9 +7,9 @@ rvm:
- jruby
- ruby-head
env:
- "rack=1.3.0"
- "rack=1.3.4"
- "rack=master"
- "tilt=1.3.2"
- "tilt=1.3.3"
- "tilt=master"
notifications:
recipients:
Expand Down
37 changes: 34 additions & 3 deletions CHANGES
@@ -1,4 +1,23 @@
= 1.3.0 / Not Yet Released
= 1.3.2 / Not Yet Released

* Don't automatically add `Rack::CommonLogger` if `Rack::Server` is adding it,
too. (Konstantin Haase)

* Setting `logging` to `nil` will avoid setting up `Rack::NullLogger`.
(Konstantin Haase)

* Fix bug where rendering a second template in the same request after the
first one raised an exception skipped the default layout (Nathan Baum)

= 1.3.1 / 2011-10-05

* Support adding more than one callback to the stream object. (Konstantin
Haase)

* Fix for infinite loop when streaming on 1.9.2 with Thin from a modular
application (Konstantin Haase)

= 1.3.0 / 2011-09-30

* Added `stream` helper method for easily creating streaming APIs, Server
Sent Events or even WebSockets. See README for more on that topic.
Expand All @@ -12,7 +31,7 @@
* Added support for HTTP PATCH requests. (Konstantin Haase)

* Use rack-protection to defend against common opportunistic attacks.
(Konstantin Haase)
(Josh Lane, Jacob Burkhart, Konstantin Haase)

* Support for Creole templates, Creole is a standardized wiki markup,
supported by many wiki implementations. (Konstanin Haase)
Expand Down Expand Up @@ -82,6 +101,11 @@
* Conditional requests on `etag` helper now work properly for unsafe HTTP
methods. (Matthew Schinckel, Konstantin Haase)

* The `last_modified` helper does not stop execution and change the status code
if the status code is something different than 200. (Konstantin Haase)

* Added support for If-Unmodified-Since header. (Konstantin Haase)

* `Sinatra::Base.run!` now prints to stderr rather than stdout. (Andrew
Armenia)

Expand Down Expand Up @@ -120,7 +144,14 @@
* Fix handling of broken query params when displaying exceptions. (Luke
Jahnke)

= 1.2.7 (backports release) / Not Yet Released
= 1.2.8 / Not Yet Released

Backported from 1.3.2:

* Fix bug where rendering a second template in the same request after the
first one raised an exception skipped the default layout (Nathan Baum)

= 1.2.7 (backports release) / 2011-09-30

Custom changes:

Expand Down
40 changes: 19 additions & 21 deletions Gemfile
Expand Up @@ -19,27 +19,25 @@ gem 'ci_reporter', :group => :ci
github = "git://github.com/%s.git"
repos = { 'tilt' => github % "rtomayko/tilt", 'rack' => github % "rack/rack" }
%w[tilt rack].each do |lib|
dep = (ENV[lib] || 'stable').sub "#{lib}-", ''
dep = nil if dep == 'stable'
dep = {:git => repos[lib], :branch => dep} if dep and dep !~ /(\d+\.)+\d+/
dep = case ENV[lib] || 'stable'
when 'stable'
nil
when /(\d+\.)+\d+/
"~> " + ENV[lib].sub("#{lib}-", '')
else
{:git => repos[lib], :branch => dep}
end
gem lib, dep
end

gem 'haml', '>= 3.0'
gem 'sass'
gem 'builder'
gem 'erubis'
gem 'less', '~> 1.0'

if RUBY_ENGINE == "maglev"
gem 'liquid', :git => "https://github.com/Shopify/liquid.git"
else
gem 'liquid'
end

gem 'liquid'
gem 'slim', '~> 1.0'
gem 'temple', '!= 0.3.3'
gem 'RedCloth' if RUBY_VERSION < "1.9.3" and not RUBY_ENGINE.start_with? 'ma'
gem 'RedCloth' if RUBY_VERSION < "1.9.3" and not RUBY_ENGINE == "macruby"
gem 'coffee-script', '>= 2.0'
gem 'rdoc'
gem 'kramdown'
Expand All @@ -49,10 +47,16 @@ gem 'creole'
if RUBY_ENGINE == 'jruby'
gem 'nokogiri', '!= 1.5.0'
gem 'jruby-openssl'
elsif RUBY_ENGINE != 'maglev'
else
gem 'nokogiri'
end

if RUBY_ENGINE == "ruby"
gem 'less', '~> 2.0'
else
gem 'less', '~> 1.0'
end

unless RUBY_ENGINE == 'jruby' && JRUBY_VERSION < "1.6.1" && !ENV['TRAVIS']
# C extensions
gem 'rdiscount'
Expand All @@ -62,16 +66,10 @@ unless RUBY_ENGINE == 'jruby' && JRUBY_VERSION < "1.6.1" && !ENV['TRAVIS']
#gem 'bluecloth'
end

if RUBY_ENGINE == 'maglev'
gem 'json', :git => "https://github.com/MagLev/json.git"
platforms :ruby_18, :jruby do
gem 'json'
gem 'markaby'
gem 'radius'
else
platforms :ruby_18, :jruby do
gem 'json'
gem 'markaby'
gem 'radius'
end
end

platforms :mri_18 do
Expand Down
4 changes: 2 additions & 2 deletions README.de.rdoc
Expand Up @@ -1953,9 +1953,9 @@ SemVer und SemVerTag.
* {Mailing-Liste}[http://groups.google.com/group/sinatrarb]
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] auf http://freenode.net
* {Sinatra Book}[http://sinatra-book.gittr.com] Kochbuch Tutorial
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Sinatra-Rezepte aus
* {Sinatra Recipes}[http://recipes.sinatrarb.com/] Sinatra-Rezepte aus
der Community
* API Dokumentation für die {aktuelle Version}[http://rubydoc.info/gems/sinatra]
oder für {HEAD}[http://rubydoc.info/github/sinatra/sinatra] auf
http://rubydoc.info
* {CI Server}[http://ci.rkh.im/view/Sinatra/]
* {CI Server}[http://ci.rkh.im/view/Sinatra/]
28 changes: 25 additions & 3 deletions README.es.rdoc
Expand Up @@ -916,11 +916,16 @@ para <tt>Sinatra::Application</tt>. Si heredaste de
<tt>Sinatra::Base</tt>, probablemente quieras habilitarlo manualmente:

class MiApp < Sinatra::Base
configure(:production, :development) do
configure :production, :development do
enable :logging
end
end

Para evitar que se inicialice cualquier middleware de logging, configurá
+logging+ a +nil+. Tené en cuenta que, cuando hagas esto, +logger+ va a
devolver +nil+. Un caso común es cuando querés usar tu propio logger. Sinatra
va a usar lo que encuentre en <tt>env['rack.logger']</tt>.

=== Tipos Mime

Cuando usás <tt>send_file</tt> o archivos estáticos tal vez tengas tipos mime
Expand Down Expand Up @@ -1055,6 +1060,23 @@ Usá la configuración <tt>:static_cache_control</tt> para agregar el encabezado
<tt>Cache-Control</tt> a archivos estáticos (ver la sección de configuración
para más detalles).

De acuerdo con la RFC 2616 tu aplicación debería comportarse diferente si a las
cabeceras If-Match o If-None-Match se le asigna el valor <tt>*</tt> cuando el
recurso solicitado ya existe. Sinatra asume para peticiones seguras (como get)
e idempotentes (como put) que el recurso existe, mientras que para el resto
(como post), que no. Podes cambiar este comportamiento con la opción
<tt>:new_resource</tt>:

get '/crear' do
etag '', :new_resource => true
Articulo.create
erb :nuevo_articulo
end

Si querés seguir usando una weak ETag, indicalo con la opción <tt>:kind</tt>:

etag '', :new_resource => true, :kind => :weak

=== Enviando Archivos

Para enviar archivos, podés usar el método <tt>send_file</tt>:
Expand Down Expand Up @@ -1283,7 +1305,7 @@ Podés acceder a estas opciones utilizando el método <tt>settings</tt>:
...
end

==== Configurando la Protección de Ataques
=== Configurando la Protección de Ataques

Sinatra usa {Rack::Protection}[https://github.com/rkh/rack-protection#readme]
para defender a tu aplicación de los ataques más comunes. Tenés que tener en
Expand Down Expand Up @@ -1987,7 +2009,7 @@ siguiendo las especificaciones SemVer y SemVerTag.
* {Lista de Correo}[http://groups.google.com/group/sinatrarb/topics]
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] en http://freenode.net
* {Sinatra Book}[http://sinatra-book.gittr.com] Tutorial (en inglés).
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Recetas contribuidas
* {Sinatra Recipes}[http://recipes.sinatrarb.com/] Recetas contribuidas
por la comunidad (en inglés).
* Documentación de la API para la
{última versión liberada}[http://rubydoc.info/gems/sinatra] o para la
Expand Down
4 changes: 2 additions & 2 deletions README.fr.rdoc
Expand Up @@ -1988,9 +1988,9 @@ SemVer que SemVerTag.
* {IRC : #sinatra}[irc://chat.freenode.net/#sinatra] sur http://freenode.net
* {IRC : #sinatra}[irc://chat.freenode.net/#sinatra] on http://freenode.net
* {Sinatra Book}[http://sinatra-book.gittr.com] Tutoriels et recettes
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Recettes contribuées
* {Sinatra Recipes}[http://recipes.sinatrarb.com/] Recettes contribuées
par la communauté
* Documentation API de la {dernière version}[http://rubydoc.info/gems/sinatra]
ou du {HEAD courant}[http://rubydoc.info/github/sinatra/sinatra] sur
http://rubydoc.info
* {CI server}[http://ci.rkh.im/view/Sinatra/]
* {CI server}[http://ci.rkh.im/view/Sinatra/]
1 change: 1 addition & 0 deletions README.jp.rdoc
Expand Up @@ -376,6 +376,7 @@ textileからメソッドを呼び出すことも、localsに変数を渡すこ
RDocテンプレートを使うにはRDocライブラリが必要です:

# rdoc/markup/to_htmlを読み込みます
require "rdoc"
require "rdoc/markup/to_html"

get '/' do
Expand Down
26 changes: 24 additions & 2 deletions README.rdoc
Expand Up @@ -885,11 +885,16 @@ default, so if you inherit from <tt>Sinatra::Base</tt>, you probably want to
enable it yourself:

class MyApp < Sinatra::Base
configure(:production, :development) do
configure :production, :development do
enable :logging
end
end

To avoid any logging middleware to be set up, set the +logging+ setting to
+nil+. However, keep in mind that +logger+ will in that case return +nil+. A
common use case is when you want to set your own logger. Sinatra will use
whatever it will find in <tt>env['rack.logger']</tt>.

=== Mime Types

When using <tt>send_file</tt> or static files you may have mime types Sinatra
Expand Down Expand Up @@ -1018,6 +1023,23 @@ try {rack-cache}[http://rtomayko.github.com/rack-cache/]:
Use the <tt>:static_cache_control</tt> setting (see below) to add
<tt>Cache-Control</tt> header info to static files.

According to RFC 2616 your application should behave differently if the If-Match
or If-None-Match header is set to <tt>*</tt> depending on whether the resource
requested is already in existence. Sinatra assumes resources for safe (like get)
and idempotent (like put) requests are already in existence, whereas other
resources (for instance for post requests), are treated as new resources. You
can change this behavior by passing in a <tt>:new_resource</tt> option:

get '/create' do
etag '', :new_resource => true
Article.create
erb :new_article
end

If you still want to use a weak ETag, pass in a <tt>:kind</tt> option:

etag '', :new_resource => true, :kind => :weak

=== Sending Files

For sending files, you can use the <tt>send_file</tt> helper method:
Expand Down Expand Up @@ -1925,7 +1947,7 @@ SemVerTag.
* {Mailing List}[http://groups.google.com/group/sinatrarb/topics]
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] on http://freenode.net
* {Sinatra Book}[http://sinatra-book.gittr.com] Cookbook Tutorial
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Community
* {Sinatra Recipes}[http://recipes.sinatrarb.com/] Community
contributed recipes
* API documentation for the {latest release}[http://rubydoc.info/gems/sinatra]
or the {current HEAD}[http://rubydoc.info/github/sinatra/sinatra] on
Expand Down
2 changes: 1 addition & 1 deletion README.ru.rdoc
Expand Up @@ -1779,7 +1779,7 @@ SemVerTag.
* {Группы рассылки}[http://groups.google.com/group/sinatrarb/topics]
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] на http://freenode.net
* {Sinatra Book}[http://sinatra-book.gittr.com] учебник и сборник рецептов
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] сборник рецептов
* {Sinatra Recipes}[http://recipes.sinatrarb.com/] сборник рецептов
* API документация к {последнему релизу}[http://rubydoc.info/gems/sinatra]
или {текущему HEAD}[http://rubydoc.info/github/sinatra/sinatra] на
http://rubydoc.info
1 change: 1 addition & 0 deletions README.zh.rdoc
Expand Up @@ -492,6 +492,7 @@ Rack body对象或者HTTP状态码:
需要引入 <tt>RDoc</tt> gem/library 以渲染RDoc模板:

# 需要在你的应用中引入rdoc/markup/to_html
require "rdoc"
require "rdoc/markup/to_html"

get '/' do
Expand Down
4 changes: 4 additions & 0 deletions Rakefile
Expand Up @@ -164,6 +164,10 @@ if defined?(Gem)
end

task 'release' => ['test', package('.gem')] do
if File.read("CHANGES") =~ /= \d\.\d\.\d . not yet released$/i
fail 'please update changes first'
end

sh <<-SH
gem install #{package('.gem')} --local &&
gem push #{package('.gem')} &&
Expand Down

0 comments on commit cf27ad4

Please sign in to comment.