RedCloth 4.0.4 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of RedCloth might be problematic. Click here for more details.
- data/CHANGELOG +18 -5
- data/Manifest +57 -0
- data/Rakefile +138 -173
- data/RedCloth.gemspec +143 -0
- data/{extras → ext}/mingw-rbconfig.rb +0 -0
- data/ext/redcloth_scan/redcloth.h +27 -20
- data/ext/redcloth_scan/redcloth_attributes.c +41 -41
- data/ext/redcloth_scan/redcloth_attributes.c.rl +56 -0
- data/ext/redcloth_scan/redcloth_attributes.java.rl +96 -0
- data/ext/redcloth_scan/redcloth_attributes.rl +6 -51
- data/ext/redcloth_scan/redcloth_common.c.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.java.rl +18 -0
- data/ext/redcloth_scan/redcloth_common.rl +17 -27
- data/ext/redcloth_scan/redcloth_inline.c +210 -211
- data/ext/redcloth_scan/redcloth_inline.c.rl +159 -0
- data/ext/redcloth_scan/redcloth_inline.java.rl +108 -0
- data/ext/redcloth_scan/redcloth_inline.rl +49 -198
- data/ext/redcloth_scan/redcloth_scan.c +6708 -6698
- data/ext/redcloth_scan/redcloth_scan.c.rl +227 -0
- data/ext/redcloth_scan/redcloth_scan.java.rl +555 -0
- data/ext/redcloth_scan/redcloth_scan.rl +66 -282
- data/lib/redcloth.rb +6 -0
- data/lib/redcloth/erb_extension.rb +27 -0
- data/lib/redcloth/version.rb +2 -2
- data/setup.rb +1585 -0
- data/test/basic.yml +3 -4
- data/test/code.yml +28 -2
- data/test/test_erb.rb +13 -0
- metadata +73 -38
- data/lib/redcloth_scan.bundle +0 -0
data/CHANGELOG
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
|
1
|
+
=== 4.1.0 / October 31, 2008
|
2
|
+
|
3
|
+
* JRuby support! [olabini]
|
4
|
+
To run the tests with JRuby, you only need to: jruby -S rake
|
5
|
+
To compile the jruby version of the gem: jruby -S rake compile
|
6
|
+
|
7
|
+
* Added textilize ERB utility method. [edraut]
|
8
|
+
Use it in an ERB template like this: <%=t my_textile_string %> or
|
9
|
+
<%=r %{Some *textile* if you please!} %>
|
10
|
+
|
11
|
+
* Fix extended blockcode stripping whitespace following blank line. #78
|
12
|
+
|
13
|
+
|
14
|
+
=== 4.0.4 / October 1, 2008
|
2
15
|
|
3
16
|
* Added some very basic support for images in LaTeX. [virtualfunction]
|
4
17
|
|
@@ -23,14 +36,14 @@
|
|
23
36
|
* Fixed empty block HTML disappearing. #64
|
24
37
|
|
25
38
|
|
26
|
-
|
39
|
+
=== 4.0.3 / August 18, 2008
|
27
40
|
|
28
41
|
* Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. #38
|
29
42
|
|
30
43
|
* Fixed unititialized constant RedCloth::TextileDoc with Rails 2.1. Came from a workaround for Rails bug #320 that was applied even when not necessary. #42
|
31
44
|
|
32
45
|
|
33
|
-
|
46
|
+
=== 4.0.2 / August 15, 2008
|
34
47
|
|
35
48
|
* Fixed link references/aliases not being recognized when they include hyphens. #36
|
36
49
|
|
@@ -49,7 +62,7 @@
|
|
49
62
|
* Fixed HTML block ending tags terminating blocks prematurely. #22
|
50
63
|
|
51
64
|
|
52
|
-
|
65
|
+
=== 4.0.1 / July 24, 2008
|
53
66
|
|
54
67
|
* Fixed lines starting with dashes being recognized as a definition list when there were no definitions.
|
55
68
|
|
@@ -59,7 +72,7 @@
|
|
59
72
|
* Fixed links including prior quoted phrases. #17
|
60
73
|
|
61
74
|
|
62
|
-
|
75
|
+
=== 4.0.0 / July 21, 2008
|
63
76
|
|
64
77
|
* New SuperRedCloth (RedCloth 4.0) is a total rewrite using Ragel for the parsing.
|
65
78
|
|
data/Manifest
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
bin/redcloth
|
2
|
+
CHANGELOG
|
3
|
+
COPYING
|
4
|
+
ext/mingw-rbconfig.rb
|
5
|
+
ext/redcloth_scan/extconf.rb
|
6
|
+
ext/redcloth_scan/redcloth.h
|
7
|
+
ext/redcloth_scan/redcloth_attributes.c.rl
|
8
|
+
ext/redcloth_scan/redcloth_attributes.java.rl
|
9
|
+
ext/redcloth_scan/redcloth_attributes.rl
|
10
|
+
ext/redcloth_scan/redcloth_common.c.rl
|
11
|
+
ext/redcloth_scan/redcloth_common.java.rl
|
12
|
+
ext/redcloth_scan/redcloth_common.rl
|
13
|
+
ext/redcloth_scan/redcloth_inline.c.rl
|
14
|
+
ext/redcloth_scan/redcloth_inline.java.rl
|
15
|
+
ext/redcloth_scan/redcloth_inline.rl
|
16
|
+
ext/redcloth_scan/redcloth_scan.c.rl
|
17
|
+
ext/redcloth_scan/redcloth_scan.java.rl
|
18
|
+
ext/redcloth_scan/redcloth_scan.rl
|
19
|
+
extras/ragel_profiler.rb
|
20
|
+
lib/case_sensitive_require/RedCloth.rb
|
21
|
+
lib/redcloth/erb_extension.rb
|
22
|
+
lib/redcloth/formatters/base.rb
|
23
|
+
lib/redcloth/formatters/html.rb
|
24
|
+
lib/redcloth/formatters/latex.rb
|
25
|
+
lib/redcloth/formatters/latex_entities.yml
|
26
|
+
lib/redcloth/textile_doc.rb
|
27
|
+
lib/redcloth/version.rb
|
28
|
+
lib/redcloth.rb
|
29
|
+
Manifest
|
30
|
+
Rakefile
|
31
|
+
README
|
32
|
+
RedCloth.gemspec
|
33
|
+
setup.rb
|
34
|
+
test/basic.yml
|
35
|
+
test/code.yml
|
36
|
+
test/definitions.yml
|
37
|
+
test/extra_whitespace.yml
|
38
|
+
test/filter_html.yml
|
39
|
+
test/filter_pba.yml
|
40
|
+
test/helper.rb
|
41
|
+
test/html.yml
|
42
|
+
test/images.yml
|
43
|
+
test/instiki.yml
|
44
|
+
test/links.yml
|
45
|
+
test/lists.yml
|
46
|
+
test/poignant.yml
|
47
|
+
test/sanitize_html.yml
|
48
|
+
test/table.yml
|
49
|
+
test/test_custom_tags.rb
|
50
|
+
test/test_erb.rb
|
51
|
+
test/test_extensions.rb
|
52
|
+
test/test_formatters.rb
|
53
|
+
test/test_parser.rb
|
54
|
+
test/test_restrictions.rb
|
55
|
+
test/textism.yml
|
56
|
+
test/threshold.yml
|
57
|
+
test/validate_fixtures.rb
|
data/Rakefile
CHANGED
@@ -1,207 +1,135 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/gempackagetask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/testtask'
|
6
|
-
require 'fileutils'
|
7
|
-
include FileUtils
|
8
1
|
require 'lib/redcloth/version'
|
9
2
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'echoe', '>=2.7.11'
|
6
|
+
require 'echoe'
|
7
|
+
rescue LoadError
|
8
|
+
abort "You'll need to have `echoe' installed to use RedCloth's Rakefile"
|
9
|
+
end
|
10
|
+
|
11
|
+
e = Echoe.new('RedCloth', RedCloth::VERSION.to_s) do |p|
|
12
|
+
p.summary = RedCloth::DESCRIPTION
|
13
|
+
p.author = "Jason Garber"
|
14
|
+
p.email = 'redcloth-upwards@rubyforge.org'
|
15
|
+
p.clean_pattern += ['ext/redcloth_scan/**/*.{bundle,so,obj,pdb,lib,def,exp,c,o,xml,class,jar,java}', 'lib/*.{bundle,so,o,obj,pdb,lib,def,exp,jar}', 'ext/redcloth_scan/Makefile']
|
16
|
+
p.url = "http://redcloth.org"
|
17
|
+
p.project = "redcloth"
|
18
|
+
p.rdoc_pattern = ['README', 'COPING', 'CHANGELOG', 'lib/**/*.rb', 'doc/**/*.rdoc']
|
19
|
+
p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
|
20
|
+
p.ruby_version = '>=1.8.4'
|
21
|
+
p.extension_pattern = nil
|
22
|
+
|
23
|
+
|
24
|
+
if RUBY_PLATFORM =~ /mingw|mswin|java/
|
25
|
+
p.need_tar_gz = false
|
26
|
+
else
|
27
|
+
p.need_zip = true
|
28
|
+
p.need_tar_gz = true
|
29
|
+
p.extension_pattern = ["ext/**/extconf.rb"]
|
27
30
|
end
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "Packages up RedCloth."
|
31
|
-
task :package => [:clean, :compile]
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Run specific tests or test files
|
44
|
-
#
|
45
|
-
# rake test:parser
|
46
|
-
# => Runs the full TestParser unit test
|
47
|
-
#
|
48
|
-
# rake test:parser:textism
|
49
|
-
# => Runs the tests matching /textism/ in the TestParser unit test
|
50
|
-
rule "" do |t|
|
51
|
-
# test:file:method
|
52
|
-
if /test:(.*)(:([^.]+))?$/.match(t.name)
|
53
|
-
arguments = t.name.split(":")[1..-1]
|
54
|
-
file_name = arguments.first
|
55
|
-
test_name = arguments[1..-1]
|
56
|
-
|
57
|
-
if File.exist?("test/test_#{file_name}.rb")
|
58
|
-
run_file_name = "test_#{file_name}.rb"
|
32
|
+
p.eval = proc do
|
33
|
+
case RUBY_PLATFORM
|
34
|
+
when /mingw/
|
35
|
+
self.files += ['lib/redcloth_scan.so']
|
36
|
+
self.platform = 'x86-mswin32-60'
|
37
|
+
when /java/
|
38
|
+
self.files += ['lib/redcloth_scan.jar']
|
39
|
+
self.platform = 'jruby'
|
40
|
+
else
|
41
|
+
self.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
|
59
42
|
end
|
60
|
-
|
61
|
-
sh "ruby -Ilib:test test/#{run_file_name} -n /#{test_name}/"
|
62
43
|
end
|
63
|
-
end
|
64
44
|
|
65
|
-
Rake::RDocTask.new do |rdoc|
|
66
|
-
rdoc.rdoc_dir = 'doc/rdoc'
|
67
|
-
# rdoc.options += RDOC_OPTS
|
68
|
-
# rdoc.template = "extras/flipbook_rdoc.rb"
|
69
|
-
rdoc.main = "README"
|
70
|
-
rdoc.title = "RedCloth Documentation"
|
71
|
-
rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'ext/**/*.c']
|
72
45
|
end
|
73
46
|
|
74
|
-
|
75
|
-
Dir.glob("{bin,doc,test,lib,extras}/**/*") +
|
76
|
-
Dir.glob("ext/**/*.{h,c,rb,rl}") +
|
77
|
-
%w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
|
78
|
-
|
79
|
-
spec =
|
80
|
-
Gem::Specification.new do |s|
|
81
|
-
s.name = NAME
|
82
|
-
s.version = VERS
|
83
|
-
s.platform = Gem::Platform::RUBY
|
84
|
-
s.has_rdoc = true
|
85
|
-
s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
|
86
|
-
s.summary = SUMMARY
|
87
|
-
s.description = s.summary
|
88
|
-
s.author = "Jason Garber"
|
89
|
-
s.email = 'redcloth-upwards@rubyforge.org'
|
90
|
-
s.homepage = 'http://redcloth.org/'
|
91
|
-
s.rubyforge_project = 'redcloth'
|
92
|
-
|
93
|
-
s.files = PKG_FILES
|
94
|
-
|
95
|
-
s.require_paths << "lib/case_sensitive_require"
|
96
|
-
#s.autorequire = "redcloth" # no no no this is tHe 3v1l
|
97
|
-
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
98
|
-
s.executables = ["redcloth"]
|
99
|
-
end
|
47
|
+
#### Pre-compiled extensions for alternative platforms
|
100
48
|
|
101
|
-
|
102
|
-
|
103
|
-
p.gem_spec = spec
|
49
|
+
def move_extensions
|
50
|
+
Dir["ext/**/*.{bundle,so,jar}"].each { |file| mv file, "lib/" }
|
104
51
|
end
|
105
52
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
"#{ext}/Makefile",
|
115
|
-
"lib"
|
116
|
-
]
|
117
|
-
|
118
|
-
file ext_so => ext_files do
|
119
|
-
Dir.chdir(ext) do
|
120
|
-
sh(RUBY_PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
53
|
+
def java_classpath_arg
|
54
|
+
# A myriad of ways to discover the JRuby classpath
|
55
|
+
classpath = begin
|
56
|
+
require 'java'
|
57
|
+
# Already running in a JRuby JVM
|
58
|
+
Java::java.lang.System.getProperty('java.class.path')
|
59
|
+
rescue LoadError
|
60
|
+
ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
|
121
61
|
end
|
122
|
-
cp
|
62
|
+
classpath ? "-cp #{classpath}" : ""
|
123
63
|
end
|
124
64
|
|
125
|
-
|
126
|
-
directory "lib"
|
127
|
-
end
|
65
|
+
ext = "ext/redcloth_scan"
|
128
66
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
exit(1)
|
67
|
+
case RUBY_PLATFORM
|
68
|
+
when /mingw/
|
69
|
+
|
70
|
+
filename = "lib/redcloth_scan.so"
|
71
|
+
file filename => FileList["#{ext}/redcloth_scan.c", "#{ext}/redcloth_inline.c", "#{ext}/redcloth_attributes.c"] do
|
72
|
+
cp "ext/mingw-rbconfig.rb", "#{ext}/rbconfig.rb"
|
73
|
+
Dir.chdir("ext/redcloth_scan") do
|
74
|
+
ruby "-I. extconf.rb"
|
75
|
+
system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
|
139
76
|
end
|
77
|
+
move_extensions
|
78
|
+
rm "#{ext}/rbconfig.rb"
|
140
79
|
end
|
141
|
-
end
|
142
|
-
|
143
|
-
desc "Builds just the #{extension} extension"
|
144
|
-
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
145
80
|
|
146
|
-
|
147
|
-
Dir.chdir(ext) do ruby "extconf.rb" end
|
148
|
-
end
|
81
|
+
when /java/
|
149
82
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
s.description = s.summary
|
158
|
-
s.author = "Jason Garber"
|
159
|
-
s.email = 'redcloth-upwards@rubyforge.org'
|
160
|
-
s.homepage = 'http://redcloth.org/'
|
161
|
-
s.rubyforge_project = 'redcloth'
|
162
|
-
|
163
|
-
s.files = PKG_FILES + ["lib/redcloth_scan.so"]
|
164
|
-
|
165
|
-
s.require_path = "lib"
|
166
|
-
#s.autorequire = "redcloth" # no no no this is tHe 3v1l
|
167
|
-
s.extensions = []
|
168
|
-
s.bindir = "bin"
|
169
|
-
end
|
83
|
+
filename = "lib/redcloth_scan.jar"
|
84
|
+
file filename => FileList["#{ext}/RedclothScanService.java", "#{ext}/RedclothInline.java", "#{ext}/RedclothAttributes.java"] do
|
85
|
+
sources = FileList["#{ext}/**/*.java"].join(' ')
|
86
|
+
sh "javac -target 1.5 -source 1.5 -d #{ext} #{java_classpath_arg} #{sources}"
|
87
|
+
sh "jar cf lib/redcloth_scan.jar -C #{ext} ."
|
88
|
+
move_extensions
|
89
|
+
end
|
170
90
|
|
171
|
-
|
172
|
-
|
173
|
-
file
|
174
|
-
cp_r "pkg/#{NAME}-#{VERS}", "#{WIN32_PKG_DIR}"
|
91
|
+
else
|
92
|
+
filename = "#{ext}/redcloth_scan.#{Config::CONFIG['DLEXT']}"
|
93
|
+
file filename => FileList["#{ext}/redcloth_scan.c", "#{ext}/redcloth_inline.c", "#{ext}/redcloth_attributes.c"]
|
175
94
|
end
|
176
95
|
|
177
|
-
|
178
|
-
file "redcloth_scan_win32" => [WIN32_PKG_DIR] do
|
179
|
-
cp "extras/mingw-rbconfig.rb", "#{WIN32_PKG_DIR}/ext/redcloth_scan/rbconfig.rb"
|
180
|
-
sh "cd #{WIN32_PKG_DIR}/ext/redcloth_scan/ && ruby -I. extconf.rb && make"
|
181
|
-
mv "#{WIN32_PKG_DIR}/ext/redcloth_scan/redcloth_scan.so", "#{WIN32_PKG_DIR}/lib"
|
182
|
-
end
|
96
|
+
task :compile => [filename]
|
183
97
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
cp Dir["*.gem"].first, "../"
|
190
|
-
}
|
98
|
+
def ragel(target_file, source_file)
|
99
|
+
host_language = (target_file =~ /java$/) ? "J" : "C"
|
100
|
+
code_style = (host_language == "C") ? " -" + (@code_style || "T0") : ""
|
101
|
+
ensure_ragel_version(target_file) do
|
102
|
+
sh %{ragel #{source_file} -#{host_language}#{code_style} -o #{target_file}}
|
191
103
|
end
|
192
104
|
end
|
193
105
|
|
194
|
-
|
106
|
+
# Make sure the .c files exist if you try the Makefile, otherwise Ragel will have to generate them.
|
107
|
+
file "#{ext}/Makefile" => ["#{ext}/extconf.rb", "#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c","#{ext}/redcloth_attributes.c","#{ext}/redcloth_scan.o","#{ext}/redcloth_inline.o","#{ext}/redcloth_attributes.o"]
|
195
108
|
|
196
|
-
|
197
|
-
|
198
|
-
|
109
|
+
# Ragel-generated C files
|
110
|
+
file "#{ext}/redcloth_scan.c" => ["#{ext}/redcloth_scan.c.rl", "#{ext}/redcloth_scan.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
|
111
|
+
ragel "#{ext}/redcloth_scan.c", "#{ext}/redcloth_scan.c.rl"
|
112
|
+
end
|
113
|
+
file "#{ext}/redcloth_inline.c" => ["#{ext}/redcloth_inline.c.rl", "#{ext}/redcloth_inline.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
|
114
|
+
ragel "#{ext}/redcloth_inline.c", "#{ext}/redcloth_inline.c.rl"
|
115
|
+
end
|
116
|
+
file "#{ext}/redcloth_attributes.c" => ["#{ext}/redcloth_attributes.c.rl", "#{ext}/redcloth_attributes.rl", "#{ext}/redcloth_common.c.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
|
117
|
+
ragel "#{ext}/redcloth_attributes.c", "#{ext}/redcloth_attributes.c.rl"
|
199
118
|
end
|
200
119
|
|
201
|
-
|
202
|
-
|
203
|
-
|
120
|
+
# Ragel-generated Java files
|
121
|
+
file "#{ext}/RedclothScanService.java" => ["#{ext}/redcloth_scan.java.rl", "#{ext}/redcloth_scan.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl"] do
|
122
|
+
ragel "#{ext}/RedclothScanService.java", "#{ext}/redcloth_scan.java.rl"
|
204
123
|
end
|
124
|
+
file "#{ext}/RedclothInline.java" => ["#{ext}/redcloth_inline.java.rl", "#{ext}/redcloth_inline.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth_scan.java.rl"] do
|
125
|
+
ragel "#{ext}/RedclothInline.java", "#{ext}/redcloth_inline.java.rl"
|
126
|
+
end
|
127
|
+
file "#{ext}/RedclothAttributes.java" => ["#{ext}/redcloth_attributes.java.rl", "#{ext}/redcloth_attributes.rl", "#{ext}/redcloth_common.java.rl", "#{ext}/redcloth_common.rl", "#{ext}/redcloth_scan.java.rl"] do
|
128
|
+
ragel "#{ext}/RedclothAttributes.java", "#{ext}/redcloth_attributes.java.rl"
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
#### Optimization
|
205
133
|
|
206
134
|
RAGEL_CODE_GENERATION_STYLES = {
|
207
135
|
'T0' => "Table driven FSM (default)",
|
@@ -238,3 +166,40 @@ task :optimize do
|
|
238
166
|
end
|
239
167
|
puts RagelProfiler.results
|
240
168
|
end
|
169
|
+
|
170
|
+
|
171
|
+
#### Custom testing tasks
|
172
|
+
|
173
|
+
task :test => [:compile]
|
174
|
+
|
175
|
+
# Run specific tests or test files
|
176
|
+
#
|
177
|
+
# rake test:parser
|
178
|
+
# => Runs the full TestParser unit test
|
179
|
+
#
|
180
|
+
# rake test:parser:textism
|
181
|
+
# => Runs the tests matching /textism/ in the TestParser unit test
|
182
|
+
rule "" do |t|
|
183
|
+
# test:file:method
|
184
|
+
if /test:(.*)(:([^.]+))?$/.match(t.name)
|
185
|
+
arguments = t.name.split(":")[1..-1]
|
186
|
+
file_name = arguments.first
|
187
|
+
test_name = arguments[1..-1]
|
188
|
+
|
189
|
+
if File.exist?("test/test_#{file_name}.rb")
|
190
|
+
run_file_name = "test_#{file_name}.rb"
|
191
|
+
end
|
192
|
+
|
193
|
+
sh "ruby -Ilib:test test/#{run_file_name} -n /#{test_name}/"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def ensure_ragel_version(name)
|
198
|
+
@ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i}
|
199
|
+
if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 3)
|
200
|
+
yield
|
201
|
+
else
|
202
|
+
STDERR.puts "Ragel 6.3 or greater is required to generate #{name}."
|
203
|
+
exit(1)
|
204
|
+
end
|
205
|
+
end
|