Script/generate broken on vendored rails2.3.4 project

I was trying to add cucumber to a project which is using rails2.3.4
(which is vendored). The script/generate cucumber step is failing.

I first thought that this was a problem specific to cucumber but it
appears that script/generate is broken in general:

$ script/generate model foo --backtrace
undefined method exists' for #<ActiveSupport::BufferedLogger:0x000001017500d8> /Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/commands.rb:321:in directory’
/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:47:in
block in send_actions' /Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:46:in each’
/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:46:in
send_actions' /Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:31:in replay’
/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/commands.rb:42:in
invoke!' /Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/scripts.rb:31:in run’
/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/commands/generate.rb:6:in
<top (required)>' script/generate:3:in require’
script/generate:3:in `’

The problem is that the logger in the generator doesn’t seem to be the
right type here’s the directory method in
railsties/rails_generator/commands.rb which is failing:

    def directory(relative_path)
      path = destination_path(relative_path)
      if File.exist?(path)
        logger.exists relative_path
      else
        logger.create relative_path

Instead of an ActiveSupport::BufferecLogger, logger seems like it
should be something else, but I haven’t yet been able to figure out
where it’s set and what has gone wrong.

Any ideas?


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

So the following seems to only happen when I run script/generate under
ruby 1.9.1

If I use 1.8.7 script/generate works!

On Fri, Oct 30, 2009 at 1:06 PM, Rick DeNatale [email protected]
wrote:

/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:47:in
`run’
path = destination_path(relative_path)
Any ideas?


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

I tracked it down.

The problem was being caused by the log_buddy gem

This adds a logger method to Object which clobbers the Rails generator
script commands logger.

That cost me an hour or two.

On Fri, Oct 30, 2009 at 1:06 PM, Rick DeNatale [email protected]
wrote:

/Users/rick/fifthrail/legalpm/vendor/rails/railties/lib/rails_generator/manifest.rb:47:in
`run’
path = destination_path(relative_path)
Any ideas?


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale