From e1eaa9322c0a2bd117830654f8b3b8aeb0d65487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20P=C3=A9rez?= Date: Sat, 26 Feb 2022 12:26:50 +0100 Subject: [PATCH] Remove support for erubis --- Gemfile | 1 - README.de.md | 4 ++-- README.es.md | 6 +++--- README.fr.md | 4 ++-- README.ja.md | 3 +-- README.ko.md | 4 ++-- README.malayalam.md | 4 ++-- README.md | 4 +--- README.pl.md | 4 +--- README.pt-br.md | 4 ++-- README.pt-pt.md | 15 --------------- README.ru.md | 4 ++-- README.zh.md | 4 ++-- lib/sinatra/base.rb | 6 ------ sinatra-contrib/README.md | 4 ++-- sinatra-contrib/lib/sinatra/content_for.rb | 4 ++-- sinatra-contrib/lib/sinatra/engine_tracking.rb | 11 +---------- sinatra-contrib/lib/sinatra/namespace.rb | 2 +- sinatra-contrib/lib/sinatra/respond_with.rb | 2 +- sinatra-contrib/sinatra-contrib.gemspec | 1 - sinatra-contrib/spec/capture_spec.rb | 3 +-- sinatra-contrib/spec/content_for_spec.rb | 2 +- test/erb_test.rb | 9 --------- 23 files changed, 29 insertions(+), 76 deletions(-) diff --git a/Gemfile b/Gemfile index f621325d..dda13afa 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,6 @@ gem 'liquid' gem 'rabl' gem 'builder' gem 'erubi' -gem 'erubis' gem 'haml', '>= 3.0' gem 'sass' gem 'celluloid', '~> 0.16.0' diff --git a/README.de.md b/README.de.md index 6af2fcdf..74907ba9 100644 --- a/README.de.md +++ b/README.de.md @@ -613,12 +613,12 @@ get('/') { markdown :index } - - + diff --git a/README.es.md b/README.es.md index c72e8595..73ef21de 100644 --- a/README.es.md +++ b/README.es.md @@ -618,13 +618,13 @@ get('/') { markdown :index } - + diff --git a/README.fr.md b/README.fr.md index 48a99b86..3ecb9920 100644 --- a/README.fr.md +++ b/README.fr.md @@ -613,13 +613,13 @@ get('/') { markdown :index } - + diff --git a/README.ja.md b/README.ja.md index 52459111..a0cdc657 100644 --- a/README.ja.md +++ b/README.ja.md @@ -555,13 +555,12 @@ get('/') { markdown :index } - + diff --git a/README.ko.md b/README.ko.md index 16950248..94c7550a 100644 --- a/README.ko.md +++ b/README.ko.md @@ -545,11 +545,11 @@ get('/') { markdown :index }
Abhängigkeiterubis oder erb + erubi oder erb (Standardbibliothek von Ruby)
Dateierweiterungen.erb, .rhtml oder .erubis (nur Erubis).erb, .rhtml oder .erubi (nur Erubi)
Beispiel
Dependencias - erubis - o erb (incluida en Ruby) + erubi + or erb (incluida in Ruby)
Extensiones de Archivo.erb, .rhtml o .erubis (solamente con Erubis).erb, .rhtml o .erubi (solamente con Erubi)
Ejemplo
Dépendances - erubis + erubi ou erb (inclus avec Ruby)
Extensions de fichier.erb, .rhtml ou .erubis (Erubis seulement).erb, .rhtml ou .erubi (Erubi seulement)
Exemple依存 erubi - または erubis または erb (Rubyに同梱)
ファイル拡張子.erb, .rhtml または .erubi (Erubiだけ) または.erubis (Erubisだけ).erb, .rhtml または .erubi (Erubiだけ) または
- + - + diff --git a/README.malayalam.md b/README.malayalam.md index 1c1deea6..55330c1e 100644 --- a/README.malayalam.md +++ b/README.malayalam.md @@ -584,13 +584,13 @@ get('/') { markdown :index } - + diff --git a/README.md b/README.md index bf8cfcf8..8ebff6e2 100644 --- a/README.md +++ b/README.md @@ -610,14 +610,12 @@ get('/') { markdown :index } - + diff --git a/README.pl.md b/README.pl.md index 0aa60110..33374786 100644 --- a/README.pl.md +++ b/README.pl.md @@ -609,14 +609,12 @@ get('/') { markdown :index } - + diff --git a/README.pt-br.md b/README.pt-br.md index 11d5f8ff..ab668bff 100644 --- a/README.pt-br.md +++ b/README.pt-br.md @@ -634,13 +634,13 @@ get('/') { markdown :index } - + diff --git a/README.pt-pt.md b/README.pt-pt.md index 5d01f22c..a27ed721 100644 --- a/README.pt-pt.md +++ b/README.pt-pt.md @@ -185,21 +185,6 @@ end Renderiza `./views/index.erb` -### Erubis - -A gem/biblioteca erubis é necessária para renderizar templates erubis: - -```ruby -# É necessário requerir 'erubis' na aplicação. -require 'erubis' - -get '/' do - erubis :index -end -``` - -Renderiza `./views/index.erubis` - ### Builder Templates A gem/biblioteca builder é necessária para renderizar templates builder: diff --git a/README.ru.md b/README.ru.md index 0d6c7a10..6872fe43 100644 --- a/README.ru.md +++ b/README.ru.md @@ -612,13 +612,13 @@ get('/') { markdown :index } - + diff --git a/README.zh.md b/README.zh.md index 0102761a..8d841708 100644 --- a/README.zh.md +++ b/README.zh.md @@ -548,13 +548,13 @@ get('/') { markdown :index } - + diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 49f549af..58ae6f19 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -707,12 +707,6 @@ module Sinatra render(:erb, template, options, locals, &block) end - def erubis(template, options = {}, locals = {}) - warn "Sinatra::Templates#erubis is deprecated and will be removed, use #erb instead.\n" \ - "If you have Erubis installed, it will be used automatically." - render :erubis, template, options, locals - end - def haml(template, options = {}, locals = {}, &block) render(:haml, template, options, locals, &block) end diff --git a/sinatra-contrib/README.md b/sinatra-contrib/README.md index b1c9a2a7..d9140e73 100644 --- a/sinatra-contrib/README.md +++ b/sinatra-contrib/README.md @@ -22,8 +22,8 @@ Currently included: * [`sinatra/config_file`][sinatra-config-file]: Allows loading configuration from yaml files. -* [`sinatra/content_for`][sinatra-content-for]: Adds Rails-style `content_for` helpers to Haml, Erb, Erubi, - Erubis and Slim. +* [`sinatra/content_for`][sinatra-content-for]: Adds Rails-style `content_for` helpers to Haml, Erb, Erubi + and Slim. * [`sinatra/cookies`][sinatra-cookies]: A `cookies` helper for reading and writing cookies. diff --git a/sinatra-contrib/lib/sinatra/content_for.rb b/sinatra-contrib/lib/sinatra/content_for.rb index c5e4bf67..6102f2c8 100644 --- a/sinatra-contrib/lib/sinatra/content_for.rb +++ b/sinatra-contrib/lib/sinatra/content_for.rb @@ -9,7 +9,7 @@ module Sinatra # blocks inside views to be rendered later during the request. The most # common use is to populate different parts of your layout from your view. # - # The currently supported engines are: Erb, Erubi, Erubis, Haml and Slim. + # The currently supported engines are: Erb, Erubi, Haml and Slim. # # == Usage # @@ -178,7 +178,7 @@ module Sinatra else content = content_blocks[key.to_sym].map { |b| capture(*args, &b) } content.join.tap do |c| - if block_given? && (erb? || erubi? || erubis?) + if block_given? && (erb? || erubi?) @_out_buf << c end end diff --git a/sinatra-contrib/lib/sinatra/engine_tracking.rb b/sinatra-contrib/lib/sinatra/engine_tracking.rb index 743b862f..6e5246ea 100644 --- a/sinatra-contrib/lib/sinatra/engine_tracking.rb +++ b/sinatra-contrib/lib/sinatra/engine_tracking.rb @@ -12,7 +12,7 @@ module Sinatra end # Returns true if the current engine is `:erubi`, or `Tilt[:erb]` is set - # to Tilt::ErubisTemplate. + # to Tilt::ErubiTemplate. # # @return [Boolean] Returns true if current engine is `:erubi`. def erubi? @@ -20,15 +20,6 @@ module Sinatra erb? && Tilt[:erb] == Tilt::ErubiTemplate end - # Returns true if the current engine is `:erubis`, or `Tilt[:erb]` is set - # to Tilt::ErubisTemplate. - # - # @return [Boolean] Returns true if current engine is `:erubis`. - def erubis? - @current_engine == :erubis or - erb? && Tilt[:erb] == Tilt::ErubisTemplate - end - # @return [Boolean] Returns true if current engine is `:haml`. def haml? @current_engine == :haml diff --git a/sinatra-contrib/lib/sinatra/namespace.rb b/sinatra-contrib/lib/sinatra/namespace.rb index cf72361a..fc6e6098 100644 --- a/sinatra-contrib/lib/sinatra/namespace.rb +++ b/sinatra-contrib/lib/sinatra/namespace.rb @@ -225,7 +225,7 @@ module Sinatra attr_reader :base, :templates ALLOWED_ENGINES = [ - :erb, :erubi, :erubis, :haml, :hamlit, :builder, :nokogiri, :sass, :scss, + :erb, :erubi, :haml, :hamlit, :builder, :nokogiri, :sass, :scss, :liquid, :markdown, :textile, :rdoc, :asciidoc, :radius, :markaby, :rabl, :slim, :creole, :mediawiki, :coffee, :yajl, :wlang ] diff --git a/sinatra-contrib/lib/sinatra/respond_with.rb b/sinatra-contrib/lib/sinatra/respond_with.rb index c1719eae..589b633b 100644 --- a/sinatra-contrib/lib/sinatra/respond_with.rb +++ b/sinatra-contrib/lib/sinatra/respond_with.rb @@ -240,7 +240,7 @@ module Sinatra :css => [:sass, :scss], :xml => [:builder, :nokogiri], :js => [:coffee], - :html => [:erb, :erubi, :erubis, :haml, :hamlit, :slim, :liquid, :radius, + :html => [:erb, :erubi, :haml, :hamlit, :slim, :liquid, :radius, :mab, :markdown, :textile, :rdoc], :all => (Sinatra::Templates.instance_methods.map(&:to_sym) + [:mab] - [:find_template, :markaby]), diff --git a/sinatra-contrib/sinatra-contrib.gemspec b/sinatra-contrib/sinatra-contrib.gemspec index 9c3909c7..80586538 100644 --- a/sinatra-contrib/sinatra-contrib.gemspec +++ b/sinatra-contrib/sinatra-contrib.gemspec @@ -45,7 +45,6 @@ EOF s.add_development_dependency "rspec", "~> 3" s.add_development_dependency "haml" s.add_development_dependency "erubi" - s.add_development_dependency "erubis" s.add_development_dependency "slim" s.add_development_dependency "sass" s.add_development_dependency "builder" diff --git a/sinatra-contrib/spec/capture_spec.rb b/sinatra-contrib/spec/capture_spec.rb index 2250421a..faf207d8 100644 --- a/sinatra-contrib/spec/capture_spec.rb +++ b/sinatra-contrib/spec/capture_spec.rb @@ -20,7 +20,7 @@ RSpec.describe Sinatra::Capture do shared_examples_for "a template language" do |engine| lang = engine - if engine == :erubi || engine == :erubis + if engine == :erubi lang = :erb end if engine == :hamlit @@ -41,7 +41,6 @@ RSpec.describe Sinatra::Capture do describe('hamlit') { it_behaves_like "a template language", :hamlit } describe('slim') { it_behaves_like "a template language", :slim } describe('erubi') { it_behaves_like "a template language", :erubi } - describe('erubis') { it_behaves_like "a template language", :erubis } describe 'erb' do it_behaves_like "a template language", :erb diff --git a/sinatra-contrib/spec/content_for_spec.rb b/sinatra-contrib/spec/content_for_spec.rb index c534a988..56ca8d6d 100644 --- a/sinatra-contrib/spec/content_for_spec.rb +++ b/sinatra-contrib/spec/content_for_spec.rb @@ -91,7 +91,7 @@ RSpec.describe Sinatra::ContentFor do end # TODO: liquid radius markaby builder nokogiri - engines = %w[erb erubi erubis haml hamlit slim] + engines = %w[erb erubi haml hamlit slim] engines.each do |inner| describe inner.capitalize do diff --git a/test/erb_test.rb b/test/erb_test.rb index e8e73cef..f306ae8e 100644 --- a/test/erb_test.rb +++ b/test/erb_test.rb @@ -113,12 +113,3 @@ begin rescue LoadError warn "#{$!}: skipping erubi tests" end - -begin - require 'erubis' - class ErubisTest < ERBTest - def engine; Tilt::ErubisTemplate end - end -rescue LoadError - warn "#{$!}: skipping erubis tests" -end
의존성erubis 또는 erb (루비 속에 포함)erubi 또는 erb (루비 속에 포함)
파일 확장자.erb, .rhtml, .erubis (Erubis만 해당).erb, .rhtml, .erubi (Erubi만 해당)
예제
Dependency - erubis + erubi or erb (included in Ruby)
File Extensions.erb, .rhtml or .erubis (Erubis only).erb, .rhtml or .erubi (Erubi only)
ExampleDependency erubi - or erubis or erb (included in Ruby)
File Extensions.erb, .rhtml or .erubi (Erubi only) - or .erubis (Erubis only).erb, .rhtml or .erubi (Erubi only)
ExampleDependency erubi - or erubis or erb (included in Ruby)
File Extensions.erb, .rhtml or .erubi (Erubi only) - or .erubis (Erubis only).erb, .rhtml or .erubi (Erubi only)
Example
Dependência - erubis + erubi or erb (included in Ruby)
Extensão dos Arquivos.erb, .rhtml or .erubis (Erubis only).erb, .rhtml or .erubi (Erubi only)
Exemplo
Зависимости - erubis + erubi или erb (включён в Ruby)
Расширения файлов.erb, .rhtml or .erubis (только Erubis).erb, .rhtml or .erubi (только Erubi)
Пример
依赖项 - erubis + erubi 或 erb (Ruby 标准库中已经包含)
文件扩展名.erb, .rhtml or .erubis (仅用于 Erubis).erb, .rhtml or .erubi (仅用于 Erubi)
例子