File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77/spec /reports /
88/tmp /
99Gemfile.lock
10+ * .so
Original file line number Diff line number Diff line change @@ -2,5 +2,8 @@ source 'https://rubygems.org'
22
33gemspec
44
5- gem 'rake'
6- gem 'test-unit'
5+ group :development do
6+ gem 'rake'
7+ gem 'rake-compiler'
8+ gem 'test-unit'
9+ end
Original file line number Diff line number Diff line change 11require 'bundler/gem_tasks'
22require 'rake/testtask'
33
4+ if RUBY_ENGINE != 'jruby'
5+ require 'rake/extensiontask'
6+ extask = Rake ::ExtensionTask . new ( 'erb/html_escape' ) do |ext |
7+ ext . lib_dir . sub! ( %r[(?=/|\z )] , "/#{ RUBY_VERSION } /#{ ext . platform } " )
8+ end
9+ task test : :compile
10+ end
11+
412Rake ::TestTask . new ( :test ) do |t |
513 t . libs << 'test/lib'
14+ if extask
15+ t . libs << "lib/#{ RUBY_VERSION } /#{ extask . platform } "
16+ end
617 t . ruby_opts << '-rhelper'
718 t . test_files = FileList [ 'test/**/test_*.rb' ]
819end
Original file line number Diff line number Diff line change @@ -27,8 +27,11 @@ Gem::Specification.new do |spec|
2727 spec . executables = [ 'erb' ]
2828 spec . require_paths = [ 'lib' ]
2929
30- if RUBY_ENGINE != 'jruby'
30+ if RUBY_ENGINE == 'jruby'
31+ spec . platform = 'java'
32+ else
3133 spec . required_ruby_version = '>= 2.7.0'
34+ spec . extensions = [ 'ext/erb/html_escape/extconf.rb' ]
3235 end
3336
3437 spec . add_dependency 'cgi' , '>= 0.3.3'
Original file line number Diff line number Diff line change 1+ html_escape.o: $(RUBY_EXTCONF_H)
2+ html_escape.o: html_escape.c
Original file line number Diff line number Diff line change 1+ require 'mkmf'
2+
3+ create_makefile 'erb/html_escape'
Original file line number Diff line number Diff line change 1+ #include "ruby.h"
2+
3+ void
4+ Init_html_escape (void )
5+ {
6+ InitVM (html_escape );
7+ }
8+
9+ void
10+ InitVM_html_escape (void )
11+ {
12+ //
13+ }
Original file line number Diff line number Diff line change @@ -1006,6 +1006,11 @@ def html_escape(s)
10061006 module_function :h
10071007 module_function :html_escape
10081008
1009+ begin
1010+ require 'erb/html_escape'
1011+ rescue LoadError
1012+ end
1013+
10091014 #
10101015 # A utility method for encoding the String _s_ as a URL.
10111016 #
You can’t perform that action at this time.
0 commit comments