August 2009 Archives

Why I Hate Yacc

| | Comments (0)
call_args2: arg_value tCOMMA args                                      opt_block_arg
          | arg_value tCOMMA                                               block_arg
          | arg_value tCOMMA                           tSTAR arg_value opt_block_arg
          | arg_value tCOMMA args tCOMMA               tSTAR arg_value opt_block_arg
          |                              assocs                        opt_block_arg
          |                              assocs tCOMMA tSTAR arg_value opt_block_arg
          | arg_value tCOMMA             assocs                        opt_block_arg
          | arg_value tCOMMA args tCOMMA assocs                        opt_block_arg
          | arg_value tCOMMA             assocs tCOMMA tSTAR arg_value opt_block_arg
          | arg_value tCOMMA args tCOMMA assocs tCOMMA tSTAR arg_value opt_block_arg
          |                                            tSTAR arg_value opt_block_arg
          |                                                                block_arg

GEM_PATH, rubygems, and you

| | Comments (0)

On OSX, I have GEM_PATH set in my environment to stop using (or even seeing) apple installed gems which inevitably grow stale. I do that via:

export GEM_PATH=`gem env home`

This works pretty well, except for gem clean which always bitches about rails and libxml-ruby and a bunch of other crap I don't care about. I couldn't figure out why gem list was fine but gem clean was seeing stuff it shouldn't be able to see.

I figgered it out!

See, apple added a bunch of extra safeguards to the default sudo configuration:

# Defaults specification
Defaults        env_reset
Defaults        env_keep += "BLOCKSIZE"
# ...
Defaults        env_keep += "EDITOR VISUAL"

This is actually pretty cool when you think about it. Your environment is clean(er)ly scrubbed whenever you're acting as root. So, to fix this, you run sudo visudo and add this to the env_keep section:

# Added by ryand:
Defaults        env_keep += "GEM_PATH GEM_HOME"

rubytoc translates a static ruby subset to C. Hopefully it works.

NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE

                 THIS IS BETA SOFTWARE!

NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE ! NOTE

RubyToC has the following modules:

  • Rewriter - massages the sexp into a more consistent form.
  • TypeChecker - type inferencer for the above sexps.
  • RubyToRubyC - converts a ruby (subset) sexp to ruby interals C.
  • RubyToAnsiC - converts a ruby (subset) sexp to ANSI C.

and the following tools:

  • translate.rb - Translates a given file to C.

Changes:

1.0.0.7 / 2009-08-18

Vlad plugin providing perforce support. This was previously available in vlad but all extra modules outside of the core recipe have been removed.

Changes:

2.0.0 / 2009-08-18

Vlad the Deployer is pragmatic application deployment automation, without mercy. Much like Capistrano, but with 1/10th the complexity. Vlad integrates seamlessly with Rake, and uses familiar and standard tools like ssh and rsync.

Impale your application on the heartless spike of the Deployer.

Changes:

2.0.0 / 2009-08-18

  • 1 major enhancement:

    • Removed all extra modules that we don't support in core anymore.
  • 2 minor enhancements:

    • Added test to show that false is a valid variable value.
    • Moved vladtestcase from test to lib to support 3rd party vlad modules.

ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which does by default use a C extension). RP's output is the same as ParseTree's output: s-expressions using ruby's arrays and base types.

As an example:

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

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.0.4 / 2009-08-18

  • 1 minor enhancement:

    • Changed requires around to be more accurate.
  • 4 bug fixes:

    • Fixed .autotest for minitest
    • Fixed emacs escape lexing bug: "\C-\" (maglev/gemstone)
    • Fixed octal lexing edgecases. (maglev/gemstone)
    • Fixed regexp lexing edgecases. (maglev/gemstone)
  • http://parsetree.rubyforge.org/

Synchronizes bug tracking systems to omnifocus.

Changes:

1.2.1 / 2009-08-14

ImageScience is a clean and happy Ruby library that generates thumbnails -- and kicks the living crap out of RMagick. Oh, and it doesn't leak memory like a sieve. :)

For more information including build steps, see http://seattlerb.rubyforge.org/

Changes:

1.2.1 / 2009-08-14

zenprofiler helps answer WHAT is being called the most. spyon helps answer WHERE those calls are being made. ZenProfiler provides a faster version of the standard library ruby profiler. It is otherwise pretty much the same as before. spyon provides a clean way to redefine a bottleneck method so you can account for and aggregate all the calls to it.

% ruby -Ilib bin/zenprofile misc/factorial.rb 50000
Total time = 3.056884
Total time = 2.390000

          total     self              self    total
% time  seconds  seconds    calls  ms/call  ms/call  name
 50.70     1.64     1.64    50000     0.03     0.05 Integer#downto
 19.63     2.27     0.63   200000     0.00     0.00 Fixnum#*
 14.19     2.73     0.46    50000     0.01     0.05 Factorial#factorial
  9.93     3.05     0.32        1   320.36  3047.10 Range#each
  5.54     3.23     0.18        2    89.40   178.79 ZenProfiler#start_hook

Once you know that Integer#downto takes 50% of the entire run, you can use spy_on to find it. (See misc/factorial.rb for the actual code):

% SPY=1 ruby -Ilib misc/factorial.rb 50000
Spying on Integer#downto

Integer.downto

50000: total
50000: ./misc/factorial.rb:6:in `factorial' via 
       ./misc/factorial.rb:6:in `factorial'

Changes:

1.2.0 / 2009-08-14

Flay analyzes code for structural similarities. Differences in literal values, variable, class, method names, whitespace, programming style, braces vs do/end, etc are all ignored. Making this totally rad.

Changes:

1.4.0 / 2009-08-14

Flog reports the most tortured code in an easy to read pain report. The higher the score, the more pain the code is in.

Changes:

2.2.0 / 2009-08-14

  • 1 minor enhancement:

    • #mass pushed up to sexp_processor
  • 5 bug fixes:

    • --group didn't use canonical class name.
    • Fixed bin/flog to use flog, not flog_files (removed in last rev)
    • Fixed crasher when processing a block with empty goalposts.
    • Switching to ruby_parser broke ERB syntax error handling. (imccoy)
    • skip empty files instead of crashing. yay?
  • http://ruby.sadi.st/

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

ruby2ruby provides a means of generating pure ruby code easily from RubyParser compatible Sexps. This makes making dynamic language processors in ruby easier than ever!

Changes:

1.2.4 / 2009-08-14

sexp_processor branches from ParseTree bringing all the generic sexp processing tools with it. Sexp, SexpProcessor, Environment, etc... all for your language processing pleasure.

Changes:

3.0.3 / 2009-08-14

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.8.3 / 2009-08-07

ZenTest provides 4 different tools: zentest, unit_diff, autotest, and multiruby.

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. Nobody uses this tool anymore but it is the package namesake, so it stays.

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.

Changes:

4.1.4 / 2009-08-07

Hoe plugins providing tasks used by seattle.rb including minitest, perforce, and email providing full front-to-back release/annouce automation.

Changes:

1.2.1 / 2009-08-07

Hoe is a rake/rubygems helper for project Rakefiles. It helps generate rubygems and includes a dynamic plug-in system allowing for easy extensibility. Hoe ships with plug-ins for all your usual project tasks including rdoc generation, testing, packaging, and deployment.

Plug-ins Provided:

  • Hoe::Clean
  • Hoe::Debug
  • Hoe::Deps
  • Hoe::Flay
  • Hoe::Flog
  • Hoe::Inline
  • Hoe::Package
  • Hoe::Publish
  • Hoe::RCov
  • Hoe::Signing
  • Hoe::Test

See class rdoc for help. Hint: ri Hoe

Changes:

2.3.3 / 2009-08-07

Aja, one of the sexiest rubyists I know, just released omnifocus-bugzilla allowing her to avoid the doldrums caused by using bugzilla. She doesn't blog, so I decided to announce it here.

About this Archive

This page is an archive of entries from August 2009 listed from newest to oldest.

July 2009 is the previous archive.

September 2009 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.32-en