From b2baefcc146dbe561b6471038c75e04e9318e035 Mon Sep 17 00:00:00 2001 From: Kyle Maxwell Date: Thu, 26 Feb 2009 12:15:14 -0800 Subject: [PATCH] rake for ruby ext --- Makefile.am | 6 ++++-- Makefile.in | 3 +++ libtool | 2 +- ruby/Rakefile | 18 ++++++++++++++++++ ruby/test/test_dexterous.rb | 6 ++++++ 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 ruby/Rakefile diff --git a/Makefile.am b/Makefile.am index a35780c..0a39300 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,5 +47,7 @@ check-am: @echo "optional..."; ./dexter test/optional.dex test/optional.html | diff test/optional.json - && echo " success." @echo "malformed-function..."; ./dexter test/malformed-function.dex test/malformed-function.html | diff test/malformed-function.json - && echo " success." @echo "empty..."; ./dexter test/empty.dex test/empty.html | diff test/empty.json - && echo " success." - @echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success." - \ No newline at end of file + @echo "trivial..."; ./dexter test/trivial.dex test/trivial.html | diff test/trivial.json - && echo " success." + @echo "trivial2..."; ./dexter test/trivial2.dex test/trivial2.html | diff test/trivial2.json - && echo " success." + @echo "craigs-simple..."; ./dexter test/craigs-simple.dex test/craigs-simple.html | diff test/craigs-simple.json - && echo " success." + @echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success." \ No newline at end of file diff --git a/Makefile.in b/Makefile.in index 191c8f8..399d3c3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -750,6 +750,9 @@ check-am: @echo "optional..."; ./dexter test/optional.dex test/optional.html | diff test/optional.json - && echo " success." @echo "malformed-function..."; ./dexter test/malformed-function.dex test/malformed-function.html | diff test/malformed-function.json - && echo " success." @echo "empty..."; ./dexter test/empty.dex test/empty.html | diff test/empty.json - && echo " success." + @echo "trivial..."; ./dexter test/trivial.dex test/trivial.html | diff test/trivial.json - && echo " success." + @echo "trivial2..."; ./dexter test/trivial2.dex test/trivial2.html | diff test/trivial2.json - && echo " success." + @echo "craigs-simple..."; ./dexter test/craigs-simple.dex test/craigs-simple.html | diff test/craigs-simple.json - && echo " success." @echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success." # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/libtool b/libtool index 0206d8f..bf81b8a 100755 --- a/libtool +++ b/libtool @@ -2,7 +2,7 @@ # libtool - Provide generalized library-building support services. # Generated automatically by config.status (dexterc) 1.0 -# Libtool was configured on host kyle-maxwells-macbook.local: +# Libtool was configured on host 111.flood.pivotallabs.com: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, diff --git a/ruby/Rakefile b/ruby/Rakefile new file mode 100644 index 0000000..08e6f36 --- /dev/null +++ b/ruby/Rakefile @@ -0,0 +1,18 @@ +task :default => :test + +task :test => :build do + Dir["test/*test*.rb"].each {|f| load f } +end + +task :build => :clean do + "cd ext && ruby extconf.rb && make" +end + +task :clean do + "cd ext && make clean" +end + +task :install do + system "gem build dexterous.gemspec" + system "gem install dexterous" +end \ No newline at end of file diff --git a/ruby/test/test_dexterous.rb b/ruby/test/test_dexterous.rb index 89c9e68..49f5b78 100644 --- a/ruby/test/test_dexterous.rb +++ b/ruby/test/test_dexterous.rb @@ -6,6 +6,12 @@ class TestDexterous < Test::Unit::TestCase @file = File.dirname(__FILE__) + "/../../test/yelp.html" end + def test_yelp + @dex = Dexterous.new(File.read(File.dirname(__FILE__) + "/../../test/yelp-home.dex")) + out = @dex.parse(:file => File.dirname(__FILE__) + "/../../test/yelp-home.html") + assert_equal "/c/sf/shopping", out["categories"][0]["href"] + end + def test_simple @dex = Dexterous.new("hi" => "h1") assert_equal({"hi" => "Nick's Crispy Tacos"}, @dex.parse(:file => @file))