Ruby: June 2008 Archives

Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment.

Tasks Provided:

  • announce - Create news email file and post to rubyforge.
  • audit - Run ZenTest against the package.
  • check_manifest - Verify the manifest.
  • clean - Clean up all the extras.
  • config_hoe - Create a fresh ~/.hoerc file.
  • debug_gem - Show information about the gem.
  • default - Run the default tasks.
  • docs - Build the docs HTML Files
  • email - Generate email announcement file.
  • gem - Build the gem file hoe-1.5.0.gem
  • generate_key - Generate a key for signing your gems.
  • install_gem - Install the package as a gem.
  • multi - Run the test suite using multiruby.
  • package - Build all the packages
  • post_blog - Post announcement to blog.
  • post_news - Post announcement to rubyforge.
  • publish_docs - Publish RDoc to RubyForge.
  • release - Package and upload the release to rubyforge.
  • ridocs - Generate ri locally for testing.
  • test - Run the test suite.
  • test_deps - Show which test files fail when run alone.

See class rdoc for help. Hint: ri Hoe

Changes:

1.7.0 / 2008-06-30

Clue me? How do I disassemble a proc in 1.9?

>> p = proc { |n| n + 2 } 
=> #<Proc:0x3be994@(irb):1>
>> VM::InstructionSequence.disassemble p
>> class Temp1; end
>> Temp1.send :define_method, :m, p
=> #<Proc:0x3be9e4@(irb):1 (lambda)>
>> VM::InstructionSequence.disassemble(Temp1.instance_method :m)
=> nil
>> VM::InstructionSequence.disassemble(Temp1.new.method(:m))
=> nil
>> class Temp2; def m; 1 + 2; end; end
=> nil
>> puts VM::InstructionSequence.disassemble(Temp2.instance_method(:m))
== disasm: <ISeq:x@(irb)>===============================================
0000 putobject        1                                               (  12)
0002 putobject        2
0004 opt_plus         
0005 leave            
=> nil

Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment.

Tasks Provided:

  • announce - Create news email file and post to rubyforge.
  • audit - Run ZenTest against the package.
  • check_manifest - Verify the manifest.
  • clean - Clean up all the extras.
  • config_hoe - Create a fresh ~/.hoerc file.
  • debug_gem - Show information about the gem.
  • default - Run the default tasks.
  • docs - Build the docs HTML Files
  • email - Generate email announcement file.
  • gem - Build the gem file hoe-1.5.0.gem
  • generate_key - Generate a key for signing your gems.
  • install_gem - Install the package as a gem.
  • multi - Run the test suite using multiruby.
  • package - Build all the packages
  • post_blog - Post announcement to blog.
  • post_news - Post announcement to rubyforge.
  • publish_docs - Publish RDoc to RubyForge.
  • release - Package and upload the release to rubyforge.
  • ridocs - Generate ri locally for testing.
  • test - Run the test suite.
  • test_deps - Show which test files fail when run alone.

See class rdoc for help. Hint: ri Hoe

Changes:

1.6.0 / 2008-06-18

ZenTest provides 4 different tools and 1 library: zentest, unit_diff, autotest, multiruby, and Test::Rails.

ZenTest scans your target and unit-test code and writes your missing code based on simple naming rules, enabling XP at a much quicker pace. ZenTest only works with Ruby and Test::Unit.

unit_diff is a command-line filter to diff expected results from actual results and allow you to quickly see exactly what is wrong.

autotest is a continous testing facility meant to be used during development. As soon as you save a file, autotest will run the corresponding dependent tests.

multiruby runs anything you want on multiple versions of ruby. Great for compatibility checking! Use multiruby_setup to manage your installed versions.

Test::Rails helps you build industrial-strength Rails code.

Changes:

3.10.0 / 2008-06-17

mini/test is a completely minimial drop-in replacement for ruby's test/unit. This is meant to be clean and easy to use both as a regular test writer and for language implementors that need a minimal set of methods to bootstrap a working unit test suite.

mini/spec is a functionally complete spec engine.

mini/mock, by Steven Baker, is a beautifully tiny mock object framework.

Changes:

1.2.1 / 2008-06-10

  • 7 minor enhancements:

    • Added deprecations everywhere in test/unit.
    • Added test_order to TestCase. :random on mini, :sorted on test/unit (for now).
    • Big cleanup in test/unit for rails. Thanks Jeremy Kemper!
    • Minor readability cleanup.
    • Pushed setup/run/teardown down to testcase allowing specialized testcases.
    • Removed pp. Tests run 2x faster. :/
    • Renamed deprecation methods and moved to test/unit/deprecate.rb.
  • http://rubyforge.org/projects/bfts

ruby2ruby provides a means of generating pure ruby code easily from ParseTree's Sexps. This makes making dynamic language processors much easier in ruby than ever before.

Changes:

1.1.9 / 2008-06-09

  • 5 minor enhancements:

    • Added more defensive programming in the tests to make it work with 1.9 and rubinius better.
    • Converted r2r_show to more plain parse style, no more discover_new_classes.
    • Made Proc#to_sexp and #to_ruby more resiliant.
    • Started to work on fallback to ruby_parser code. Should prolly do flog first.
    • Updated rakefile and readme format for hoe. Much cleaner!
  • 6 bug fixes:

    • Added 1.9 fixes.
    • Added code to tests to isolate rubyinline builds.
    • Fixed miniunit-deprecated assertions
    • Fixes for const2/3, esp in class names
    • Renamed ProcStoreTmp#name to #new_name. dur.
    • Skip proc tests in 1.9 since they require ParseTree.
  • http://seattlerb.rubyforge.org/

  • http://rubyforge.org/projects/seattlerb

I've been putting a LOT of effort into getting miniunit (still needs a better name... c'mon ppl!) flushed out and polished. This is the release I think is finally ready to replace test/unit in 1.9, but I need your feedback to know how it is. You can help by installing the gem and flipping it on:

% sudo gem install miniunit
% sudo use_miniunit yes

The second command will install symlinks into your sitelib directory. That comes before the stdlib dir in $LOAD_PATH so it'll take over for test/unit. You can roll it out by providing "no" as an argument instead. It should be totally easy and safe.

I've added a lot of really great stuff in this release. The biggies:

  • New useful assertions like assert_includes.
  • A refute mirrors every assert. eg refute_empty ary
  • I added mini/spec and mini/mock and they can work side-by-side with mini/test.

One of the things I did was put a lot of effort into making it work with abusive frameworks like rails (they do bad things to test frameworks). But we used the rails tests in very particular ways, so I don't know if there are other ways that don't work with miniunit.

One thing I'm proud of: Even with all the extra assertions, the spec framework, the mock framework, I still blow test/unit away. Check it:

miniunit

 lib  loc     641 total
 test loc     905 total
 totl loc    1546 total
 flog = 707.623602773533

test/unit

 lib  loc    3571 total
 test loc    2464 total
 totl loc    6035 total
 flog = 3103.27739878118

Rad eh?

So, install it and take it for a spin. Report bugs on rubyforge.

NOTE: Do not report bugs against it if you're trying to use it integrated into a GUI IDE/test-runner like komodo. It isn't meant to be compatible with GUI runners and the like. It is meant to be compatible with your tests.

Yay! Four Thousand!

| | Comments (0)

Wow! We just hit commit #4000 in the repo. 4001 was made releasing ParseTree. Thanks to everyone who's contributed directly and indirectly towards hitting that number. We hit #2000 in april 2005 and have come a long long way since then.

% p4 changes -m 1
Change 4001 on 2008/06/09 by ryand@ryand-wrath 'Branching ParseTree to version '
% cut -f 6 -d\  changes.txt | cut -f 1 -d@ | occur
 3242: ryand
  591: drbrain
   67: wilson
   47: aaronp
   19: kevinclark
   10: shaners
    6: chad
    3: topfunky
    2: yipstar
    1: pate
    1: ryan
    1: evan

ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby's arrays, strings, symbols, and integers.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

[:defn, :conditional1, [:scope, [:block, [:args, :arg1], [:if, [:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]], [:return, [:lit, 1]], nil], [:return, [:lit, 0]]]]]

Changes:

2.2.0 / 2008-06-09

  • 18 minor enhancements:

    • Added 1.9 and rubinius to multiruby skip list.
    • Added 1.9 fixes for SexpProcessor.
    • Added compatibility changes for regexp option values.
    • Added custom compact since Array#compact is hostile to subclasses.
    • Added some tests for wonky index edge cases. some commented out.
    • Added test changes for 1.9 and r2r changes. Esp fixed regexp differences.
    • Added tests for dasgn, proc arities,
    • Added/updated some tests for ruby_parser.
    • Changed tests to default to nil for verbose.
    • Fixed all assertions deprecated in miniunit.
    • Raises LoadError if incompatible ruby, allows fallback to ruby_parser.
    • Removed Unified's rewrite_fbody and moved up into defn... not sure about that.
    • Removed argscat rewriter from unified_ruby.rb
    • Renamed shadowed variable name.
    • Reworked parsetreefor_(method|string) to take optional verbose arg.
    • Started removing ending newlines from pt_testcase.rb.
    • Uncommented all commented out tests. ruby_parser must not be a pansy.
    • Updated rakefile for new hoe abilities.
  • 3 bug fixes:

    • Fixed 1.8.[45] wrt dasgn_curr declaration removal.
    • Fixed pt_testcase bug.
    • Fixes for colon2/3 in class/module/cdecls.
  • http://rubyforge.org/projects/parsetree/

  • http://www.zenspider.com/ZSS/Products/ParseTree/
  • ryand-ruby@zenspider.com

Inline allows you to write foreign code within your ruby code. It automatically determines if the code in question has changed and builds it only when necessary. The extensions are then automatically loaded into the class/module that defines it.

You can even write extra builders that will allow you to write inlined code in any language. Use Inline::C as a template and look at Module#inline for the required API.

Changes:

3.7.0 / 2008-06-09

mini/test is a completely minimial drop-in replacement for ruby's test/unit. This is meant to be clean and easy to use both as a regular test writer and for language implementors that need a minimal set of methods to bootstrap a working unit test suite.

mini/spec is a functionally complete spec engine.

mini/mock, by Steven Baker, is a beautifully tiny mock object framework.

Changes:

1.2.0 / 2008-06-09

  • 2 major enhancements:

    • Added Mini::Spec.
    • Added Mini::Mock. Thanks Steven Baker!!
  • 23 minor enhancements:

    • Added bin/use_miniunit to make it easy to test out miniunit.
    • Added -n filtering, thanks to Phil Hagelberg!
    • Added args argument to #run, takes ARGV from at_exit.
    • Added test name output if $DEBUG.
    • Added a refute (was deny) for every assert.
    • Added capture_io and a bunch of nice assertions from zentest.
    • Added deprecation mechanism for assert_no/not methods to test/unit/assertions.
    • Added pp output when available.
    • Added tests for all assertions. Pretty much maxed out coverage.
    • Added tests to verify consistency and good naming.
    • Aliased and deprecated all ugly assertions.
    • Cleaned out test/unit. Moved autorun there.
    • Code cleanup to make extensions easier. Thanks Chad!
    • Got spec args reversed in all but a couple assertions. Much more readable.
    • Improved error messages across the board. Adds your message to the default.
    • Moved into Mini namespace, renamed to Mini::Test and Mini::Spec.
    • Pulled the assertions into their own module...
    • Removed as much code as I could while still maintaining full functionality.
    • Moved filter_backtrace into MiniTest.
    • Removed MiniTest::Unit::run. Unnecessary.
    • Removed locationoffailure. Unnecessary.
    • Rewrote test/unit's filter_backtrace. Flog from 37.0 to 18.1
    • Removed assert_send. Google says it is never used.
    • Renamed MiniTest::Unit.autotest to #run.
    • Renamed deny to refute.
    • Rewrote some ugly/confusing default assertion messages.
    • assertindelta now defaults to 0.001 precision. Makes specs prettier.
  • 9 bug fixes:

    • Fixed assert_raises to raise outside of the inner-begin/rescue.
    • Fixed for ruby 1.9 and rubinius.
    • No longer exits 0 if exception in code PRE-test run causes early exit.
    • Removed implementors method list from mini/test.rb - too stale.
    • assertnothingraised takes a class as an arg. wtf? STUPID
    • ".EF" output is now unbuffered.
    • Bunch of changes to get working with rails... UGH.
    • Added stupid hacks to deal with rails not requiring their dependencies.
    • Now bitch loudly if someone defines one of my classes instead of requiring.
    • Fixed infect method to work better on 1.9.
    • Fixed all shadowed variable warnings in 1.9.
  • http://rubyforge.org/projects/bfts

ZenTest provides 4 different tools and 1 library: zentest, unit_diff, autotest, multiruby, and Test::Rails.

ZenTest scans your target and unit-test code and writes your missing code based on simple naming rules, enabling XP at a much quicker pace. ZenTest only works with Ruby and Test::Unit.

unit_diff is a command-line filter to diff expected results from actual results and allow you to quickly see exactly what is wrong.

autotest is a continous testing facility meant to be used during development. As soon as you save a file, autotest will run the corresponding dependent tests.

multiruby runs anything you want on multiple versions of ruby. Great for compatibility checking!

Test::Rails helps you build industrial-strength Rails code.

Changes:

3.9.3 / 2008-06-09

  • 12 minor enhancements:

    • Added $RUBY env support to autotest so you can swap what ruby to run.
    • Added ALL_HOOKS array to autotest for hook devs.
    • Added EXCLUDED_VERSIONS to multiruby. Integrated with hoe.
    • Added miniunit compatibility to unit_diff's output.
    • Multiruby now determines the latest versions 1.8/1.9 automatically.
    • Removed deprecated :run hook.
    • Fixed zentest_assertions to be compatible with miniunit. Will phase out.
    • Minor autotest plugin cleanup / fixes.
    • Moved assertcallback to test/rails/testcase.rb
    • Reversed assert_includes' arguments.
    • Updated requirements info for other ruby impls.
    • util_capture now returns strings, not iostrings.
  • 1 bug fixes:

    • (add|remove)_(mappings|exceptions) now all return nil to help fix autotest hooks.
  • http://www.zenspider.com/ZSS/Products/ZenTest/

  • http://rubyforge.org/projects/zentest/
  • ryand-ruby@zenspider.com

About this Archive

This page is a archive of entries in the Ruby category from June 2008.

Ruby: May 2008 is the previous archive.

Ruby: August 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.1