From e542dda2a2ab902885f34de736e69fa7768e577d Mon Sep 17 00:00:00 2001 From: Eloy Perez Date: Sun, 17 Jul 2022 11:32:46 +0200 Subject: [PATCH] Remove Radius support --- Gemfile | 1 - Rakefile | 2 +- lib/sinatra/base.rb | 4 -- .../lib/sinatra/engine_tracking.rb | 5 -- sinatra-contrib/lib/sinatra/namespace.rb | 2 +- sinatra-contrib/lib/sinatra/respond_with.rb | 2 +- sinatra-contrib/sinatra-contrib.gemspec | 1 - sinatra-contrib/spec/content_for_spec.rb | 2 +- test/radius_test.rb | 59 ------------------- test/views/hello.radius | 1 - test/views/layout2.radius | 2 - 11 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 test/radius_test.rb delete mode 100644 test/views/hello.radius delete mode 100644 test/views/layout2.radius diff --git a/Gemfile b/Gemfile index 78d01cbd..a4e9cc70 100644 --- a/Gemfile +++ b/Gemfile @@ -32,7 +32,6 @@ gem 'slim', '~> 4' gem 'rdoc' gem 'kramdown' gem 'markaby' -gem 'radius' gem 'asciidoctor' gem 'liquid' gem 'rabl' diff --git a/Rakefile b/Rakefile index f48ae4b3..3fb9707f 100644 --- a/Rakefile +++ b/Rakefile @@ -31,7 +31,7 @@ end Rake::TestTask.new(:"test:core") do |t| core_tests = %w[base delegator encoding extensions filter - helpers mapped_error middleware radius rdoc + helpers mapped_error middleware rdoc readme request response result route_added_hook routing server settings sinatra static templates] t.test_files = core_tests.map {|n| "test/#{n}_test.rb"} diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 727ea68f..90b1075c 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -733,10 +733,6 @@ module Sinatra render :asciidoc, template, options, locals end - def radius(template, options = {}, locals = {}) - render :radius, template, options, locals - end - def markaby(template = nil, options = {}, locals = {}, &block) render_ruby(:mab, template, options, locals, &block) end diff --git a/sinatra-contrib/lib/sinatra/engine_tracking.rb b/sinatra-contrib/lib/sinatra/engine_tracking.rb index c1432239..6709d880 100644 --- a/sinatra-contrib/lib/sinatra/engine_tracking.rb +++ b/sinatra-contrib/lib/sinatra/engine_tracking.rb @@ -45,11 +45,6 @@ module Sinatra @current_engine == :rdoc end - # @return [Boolean] Returns true if current engine is `:radius. - def radius? - @current_engine == :radius - end - # @return [Boolean] Returns true if current engine is `:markaby`. def markaby? @current_engine == :markaby diff --git a/sinatra-contrib/lib/sinatra/namespace.rb b/sinatra-contrib/lib/sinatra/namespace.rb index 5ff90b9e..157a965b 100644 --- a/sinatra-contrib/lib/sinatra/namespace.rb +++ b/sinatra-contrib/lib/sinatra/namespace.rb @@ -226,7 +226,7 @@ module Sinatra ALLOWED_ENGINES = [ :erb, :erubi, :haml, :hamlit, :builder, :nokogiri, - :liquid, :markdown, :rdoc, :asciidoc, :radius, :markaby, + :liquid, :markdown, :rdoc, :asciidoc, :markaby, :rabl, :slim, :yajl ] diff --git a/sinatra-contrib/lib/sinatra/respond_with.rb b/sinatra-contrib/lib/sinatra/respond_with.rb index 77e136e9..91c3391c 100644 --- a/sinatra-contrib/lib/sinatra/respond_with.rb +++ b/sinatra-contrib/lib/sinatra/respond_with.rb @@ -238,7 +238,7 @@ module Sinatra def self.engines engines = { :xml => [:builder, :nokogiri], - :html => [:erb, :erubi, :haml, :hamlit, :slim, :liquid, :radius, + :html => [:erb, :erubi, :haml, :hamlit, :slim, :liquid, :mab, :markdown, :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 b3854f80..858b6ff7 100644 --- a/sinatra-contrib/sinatra-contrib.gemspec +++ b/sinatra-contrib/sinatra-contrib.gemspec @@ -50,7 +50,6 @@ EOF s.add_development_dependency "liquid" s.add_development_dependency "redcarpet" s.add_development_dependency "asciidoctor" - s.add_development_dependency "radius" s.add_development_dependency "nokogiri" s.add_development_dependency "markaby" s.add_development_dependency "rake", "< 11" diff --git a/sinatra-contrib/spec/content_for_spec.rb b/sinatra-contrib/spec/content_for_spec.rb index 56ca8d6d..1ba5485d 100644 --- a/sinatra-contrib/spec/content_for_spec.rb +++ b/sinatra-contrib/spec/content_for_spec.rb @@ -90,7 +90,7 @@ RSpec.describe Sinatra::ContentFor do end end - # TODO: liquid radius markaby builder nokogiri + # TODO: liquid markaby builder nokogiri engines = %w[erb erubi haml hamlit slim] engines.each do |inner| diff --git a/test/radius_test.rb b/test/radius_test.rb deleted file mode 100644 index 8c20608c..00000000 --- a/test/radius_test.rb +++ /dev/null @@ -1,59 +0,0 @@ -require File.expand_path('helper', __dir__) - -begin -require 'radius' - -class RadiusTest < Minitest::Test - def radius_app(&block) - mock_app do - set :views, __dir__ + '/views' - get('/', &block) - end - get '/' - end - - it 'renders inline radius strings' do - radius_app { radius '

Hiya

' } - assert ok? - assert_equal "

Hiya

", body - end - - it 'renders .radius files in views path' do - radius_app { radius :hello } - assert ok? - assert_equal "

Hello From Radius

\n", body - end - - it "renders with inline layouts" do - mock_app do - layout { "

THIS. IS.

" } - get('/') { radius 'SPARTA' } - end - get '/' - assert ok? - assert_equal "

THIS. IS. SPARTA

", body - end - - it "renders with file layouts" do - radius_app { radius 'Hello World', :layout => :layout2 } - assert ok? - assert_equal "

Radius Layout!

\n

Hello World

\n", body - end - - it "raises error if template not found" do - mock_app { get('/') { radius :no_such_template } } - assert_raises(Errno::ENOENT) { get('/') } - end - - it "allows passing locals" do - radius_app { - radius '', :locals => { :value => 'foo' } - } - assert ok? - assert_equal 'foo', body - end -end - -rescue LoadError - warn "#{$!}: skipping radius tests" -end diff --git a/test/views/hello.radius b/test/views/hello.radius deleted file mode 100644 index 98e35f37..00000000 --- a/test/views/hello.radius +++ /dev/null @@ -1 +0,0 @@ -

Hello From Radius

diff --git a/test/views/layout2.radius b/test/views/layout2.radius deleted file mode 100644 index 57a06c04..00000000 --- a/test/views/layout2.radius +++ /dev/null @@ -1,2 +0,0 @@ -

Radius Layout!

-