Error while running Metrical

289 Views Asked by At

I've a Ruby 1.9.2 and Rails 3.0.9 development environment. When I run the gem "metrical" on my application, I get the following errors:

** Running the specs/tests in the [test] environment
Analyzing:     100% |oooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
/Users/tester/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/emitter.rb:17:in `end_document': undefined method `write' for #<Syck::Emitter:0x000001028d2388> (NoMethodError)

Anyone else seen this issue? I'm out of ideas for the error.

2

There are 2 best solutions below

0
On

The simplest solution is to set the RUBYOPT environment variable when you run metrical, so instead of metrical you type:

RUBYOPT='-rpsych' metrical

I am doing that and it's all working fine. This blog post figured it out for me: http://excid3.com/blog/undefined-method-write-for-syckemitter/ (possibly a bit simpler than hacking into metric_fu, until they fix this).

0
On

I ran into the same problem, seems to be related to YAML parsing with Ruby 1.9.2

I hacked into metric fu and inserted a explicit requirement of the Psych YAML Engine:

metric_fu-2.1.1/lib/metric_fu.rb:

require 'rake'
require 'psych'  # <-- added here
require 'yaml'

And now works...