diff --git a/Gemfile b/Gemfile index 44ce91df58..d28f8f2c41 100644 --- a/Gemfile +++ b/Gemfile @@ -31,8 +31,6 @@ if RUBY_ENGINE == 'jruby' || RUBY_ENGINE == 'ruby' end if RUBY_ENGINE == "ruby" - gem 'less', '~> 2.0' - gem 'therubyracer' gem 'redcarpet' gem 'wlang', '>= 3.0.1' gem 'bluecloth' diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 5bbe6e4061..8b142a7d52 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -685,7 +685,7 @@ def with_params(temp_params) # Possible options are: # :content_type The content type to use, same arguments as content_type. # :layout If set to something falsy, no layout is rendered, otherwise - # the specified layout is used (Ignored for `sass` and `less`) + # the specified layout is used (Ignored for `sass`) # :layout_engine Engine to use for rendering the layout. # :locals A hash with local variables that should be available # in the template @@ -727,11 +727,6 @@ def scss(template, options = {}, locals = {}) render :scss, template, options, locals end - def less(template, options = {}, locals = {}) - options.merge! :layout => false, :default_content_type => :css - render :less, template, options, locals - end - def builder(template = nil, options = {}, locals = {}, &block) options[:default_content_type] = :xml render_ruby(:builder, template, options, locals, &block) diff --git a/sinatra-contrib/Gemfile b/sinatra-contrib/Gemfile index aa0f68f86f..ee36a106db 100644 --- a/sinatra-contrib/Gemfile +++ b/sinatra-contrib/Gemfile @@ -27,9 +27,6 @@ group :development, :test do gem 'nokogiri', '1.5.10' gem 'redcarpet', '2.3.0' gem 'yajl-ruby' - # ref is a dependency of therubyracer - gem 'ref' - gem 'therubyracer' end gem 'multi_json' diff --git a/sinatra-contrib/lib/sinatra/engine_tracking.rb b/sinatra-contrib/lib/sinatra/engine_tracking.rb index 154d5c9fd1..743b862f95 100644 --- a/sinatra-contrib/lib/sinatra/engine_tracking.rb +++ b/sinatra-contrib/lib/sinatra/engine_tracking.rb @@ -44,11 +44,6 @@ def scss? @current_engine == :scss end - # @return [Boolean] Returns true if current engine is `:less`. - def less? - @current_engine == :less - end - # @return [Boolean] Returns true if current engine is `:builder`. def builder? @current_engine == :builder diff --git a/sinatra-contrib/lib/sinatra/namespace.rb b/sinatra-contrib/lib/sinatra/namespace.rb index fe07a649f8..ea8dd0057d 100644 --- a/sinatra-contrib/lib/sinatra/namespace.rb +++ b/sinatra-contrib/lib/sinatra/namespace.rb @@ -226,7 +226,7 @@ module NamespacedMethods ALLOWED_ENGINES = [ :erb, :erubi, :erubis, :haml, :hamlit, :builder, :nokogiri, :sass, :scss, - :less, :liquid, :markdown, :textile, :rdoc, :asciidoc, :radius, :markaby, + :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 ad208c0769..c1719eaecd 100644 --- a/sinatra-contrib/lib/sinatra/respond_with.rb +++ b/sinatra-contrib/lib/sinatra/respond_with.rb @@ -237,7 +237,7 @@ def self.jrubyify(engs) def self.engines engines = { - :css => [:less, :sass, :scss], + :css => [:sass, :scss], :xml => [:builder, :nokogiri], :js => [:coffee], :html => [:erb, :erubi, :erubis, :haml, :hamlit, :slim, :liquid, :radius, diff --git a/sinatra-contrib/sinatra-contrib.gemspec b/sinatra-contrib/sinatra-contrib.gemspec index 8fc70b27ea..f8d0c61bea 100644 --- a/sinatra-contrib/sinatra-contrib.gemspec +++ b/sinatra-contrib/sinatra-contrib.gemspec @@ -47,7 +47,6 @@ EOF s.add_development_dependency "erubi" s.add_development_dependency "erubis" s.add_development_dependency "slim" - s.add_development_dependency "less" s.add_development_dependency "sass" s.add_development_dependency "builder" s.add_development_dependency "liquid" diff --git a/test/less_test.rb b/test/less_test.rb deleted file mode 100644 index 3b2a783a5e..0000000000 --- a/test/less_test.rb +++ /dev/null @@ -1,69 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -begin -require 'less' - -class LessTest < Minitest::Test - def less_app(options = {}, &block) - mock_app do - set :views, __dir__ + '/views' - set options - get('/', &block) - end - get '/' - end - - it 'renders inline Less strings' do - less_app { - less "@white_color: #fff; #main { background-color: @white_color }" - } - assert ok? - assert_equal "#main{background-color:#ffffff;}", body.gsub(/\s/, "") - end - - it 'defaults content type to css' do - less_app { - less "@white_color: #fff; #main { background-color: @white_color }" - } - assert ok? - assert_equal "text/css;charset=utf-8", response['Content-Type'] - end - - it 'defaults allows setting content type per route' do - less_app do - content_type :html - less "@white_color: #fff; #main { background-color: @white_color }" - end - assert ok? - assert_equal "text/html;charset=utf-8", response['Content-Type'] - end - - it 'defaults allows setting content type globally' do - less_app(:less => { :content_type => 'html' }) do - less "@white_color: #fff; #main { background-color: @white_color }" - end - assert ok? - assert_equal "text/html;charset=utf-8", response['Content-Type'] - end - - it 'renders .less files in views path' do - less_app { less :hello } - assert ok? - assert_equal "#main{background-color:#ffffff;}", body.gsub(/\s/, "") - end - - it 'ignores the layout option' do - less_app { less :hello, :layout => :layout2 } - assert ok? - assert_equal "#main{background-color:#ffffff;}", body.gsub(/\s/, "") - end - - it "raises error if template not found" do - mock_app { get('/') { less :no_such_template } } - assert_raises(Errno::ENOENT) { get('/') } - end -end - -rescue LoadError - warn "#{$!}: skipping less tests" -end diff --git a/test/views/hello.less b/test/views/hello.less deleted file mode 100644 index 9eb99ddc6c..0000000000 --- a/test/views/hello.less +++ /dev/null @@ -1,5 +0,0 @@ -@white_colour: #fff; - -#main { - background-color: @white_colour; -} \ No newline at end of file