add radius

This commit is contained in:
chris authored and ihower committed 2011-04-13 18:22:51 +08:00
1 parent 8d3e11cabe
commit 6e100d3499
42 files changed
+5795

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "radius"
gem.summary = "A tag-based templating language for Ruby."
gem.description = "Radius is a powerful tag-based template language for Ruby inspired by the template languages used in MovableType and TextPattern. It uses tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc...)."
gem.email = "me@johnwlong.com"
gem.homepage = "http://github.com/jlong/radius"
gem.authors = [
"John W. Long (me@johnwlong.com)",
"David Chelimsky (dchelimsky@gmail.com)",
"Bryce Kerley (bkerley@brycekerley.net)"
]
gem.files = FileList["[A-Z]*", "{bin,lib,tasks,test}/**/*"].exclude("tmp")
gem.extra_rdoc_files = ['README.rdoc', 'QUICKSTART.rdoc', 'LICENSE', 'CHANGELOG']
gem.add_development_dependency('RedCloth')
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
+13
View File
@@ -0,0 +1,13 @@
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "Radius #{version}"
rdoc.main = "README.rdoc"
rdoc.rdoc_files.include('*.rdoc')
rdoc.rdoc_files.include('LICENSE')
rdoc.rdoc_files.include('CHANGELOG')
rdoc.rdoc_files.include('QUICKSTART.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
+4
View File
@@ -0,0 +1,4 @@
desc "remove Rubinius rbc files"
task "rubinius:clean" do
(Dir['**/*.rbc']).each { |f| rm f }
end
+79
View File
@@ -0,0 +1,79 @@
namespace :scan do
desc 'Generate the parsers'
task 'build' => [
'lib/radius/parser/scanner.rb',
'lib/radius/parser/squiggle_scanner.rb',
'lib/radius/parser/java_scanner.jar'
]
desc 'Generate a PDF state graph from the parsers'
task 'graph' => ['doc/scanner.pdf', 'doc/squiggle_scanner.pdf']
desc 'turn the scanner.rl file into a ruby file'
file 'lib/radius/parser/scanner.rb' => 'lib/radius/parser/scanner.rl' do |t|
cd 'lib/radius/parser' do
sh "ragel -R -F1 scanner.rl"
end
end
desc 'turn the squiggle_scanner.rl file into a ruby file'
file 'lib/radius/parser/squiggle_scanner.rb' =>
['lib/radius/parser/squiggle_scanner.rl'] \
do |t|
cd 'lib/radius/parser' do
sh "ragel -R -F1 squiggle_scanner.rl"
end
end
desc 'package JavaScanner into a jar file'
file 'lib/radius/parser/java_scanner.jar' => 'lib/radius/parser/JavaScanner.class' do
cd 'lib' do
sh "jar -cf radius/parser/java_scanner.jar radius/parser/*.class"
end
end
desc 'turn the JavaScanner.java file into a java class file'
file 'lib/radius/parser/JavaScanner.class' => 'lib/radius/parser/JavaScanner.java' do |t|
cd 'lib' do
jruby_path = ENV['JRUBY_HOME'] || '/usr/local/jruby/current'
sh "javac -cp #{jruby_path}/lib/jruby.jar radius/parser/JavaScanner.java"
end
end
desc 'turn the JavaScanner.rl file into a java source file'
file 'lib/radius/parser/JavaScanner.java' => 'lib/radius/parser/JavaScanner.rl' do |t|
cd 'lib/radius/parser' do
sh "ragel -J -F1 JavaScanner.rl"
end
end
desc 'pdf of the ragel scanner'
file 'doc/scanner.pdf' => 'lib/radius/parser/scanner.dot' do |t|
cd 'lib/radius/parser' do
sh "dot -Tpdf -o ../../../doc/scanner.pdf scanner.dot"
end
end
desc 'pdf of the ragel squiggle scanner'
file 'doc/squiggle_scanner.pdf' =>
['lib/radius/parser/squiggle_scanner.dot'] \
do |t|
cd 'lib/radius/parser' do
sh "dot -Tpdf -o ../../../doc/squiggle_scanner.pdf squiggle_scanner.dot"
end
end
file 'lib/radius/parser/scanner.dot' => 'lib/radius/parser/scanner.rl' do |t|
cd 'lib/radius/parser' do
sh "ragel -Vp scanner.rl > scanner.dot"
end
end
file 'lib/radius/parser/squiggle_scanner.dot' =>
['lib/radius/parser/squiggle_scanner.rl'] \
do |t|
cd 'lib/radius/parser' do
sh "ragel -Vp squiggle_scanner.rl > squiggle_scanner.dot"
end
end
end
+7
View File
@@ -0,0 +1,7 @@
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "lib" << "test"
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end