Show Ticket

Duplicates of this ticket: 8585FA0D, 799C0629

Status: closed, reported by scott on 2007-10-17 (other)

Cmd-R to Run Script in Rails 2.0 Preview crashes.

Install the Rails 2.0 preview release from gem as described here:

http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release

ie:

sudo gem install rails --source http://gems.rubyonrails.org

Create a new rails app:

rails foo

Put foo.rb below in the scripts directory and try running it from Textmate, and you get...

usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added': stack level too deep (SystemStackError)
from /usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in `method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:111
...

foo.rb
=============

#!/usr/bin/env ruby

# Bring up the script within the rails environment.
# From: http://wiki.rubyonrails.org/rails/pages/Environments
RAILS_ENV = 'development'
require File.dirname(__FILE__) + '/../config/environment'

puts "hi"
Note added by Allan Odgaard on 2007-10-18 06:49:31

I suspect the problem is that Rails 2 has a builder library and so does TextMate, and your code gets a hold of the wrong one and/or both (it seems from the stack trace).

Can you verify that? E.g. try start your script with:

    $:.reject! { |e| e.include? 'TextMate' }

Note added by scott on 2007-10-18 15:13:00

Yes, that causes it to run properly, thank you!  I'm pretty sure I had builder installed as a gem before installing the Rails 2.0 preview gems.

For the sake of completeness, here's the entire stack dump:

/usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added': stack level too deep (SystemStackError)
from /usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in `method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:111
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/lib/active_support/core_ext/array/conversions.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
... 23 levels...
from ./import_helpers.rb:13
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /Users/scott/work/ruby/choral/script/import_publishers.rb:6
/usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added': stack level too deep (SystemStackError)
from /usr/local/lib/ruby/gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `blank_slate_method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in `method_added'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:111
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/lib/active_support/core_ext/array/conversions.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
... 23 levels...
from ./import_helpers.rb:13
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /Users/scott/work/ruby/choral/script/import_publishers.rb:6

Note added by Allan Odgaard on 2007-10-18 15:26:24

Okay, the problem is that both our and their ‘builder’ is in the global namespace.

I don’t think we actually use this library anymore, so probably I can just remove it, will check in to that.

For future reference, send bundle related stuff to the mailing list.

Note added by roger on 2008-09-29 17:07:33

Could we please get a status update on this?  I'm still experiencing this error [as are others] [1]
Thanks!
-=R
http://robsanheim.com/2007/12/07/fixing-textmate-test-issues-blank_slate_method_added-stack-level-too-deep-systemstackerror/