The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Friday, June 24, 2011

rails 3.1 and ruby-1.9.2-p180 - rake aborted! stack level too deep

Ran into the following error when running rake with a rails 3.1 (rc4) app on ruby-1.9.2-p180 (RVM)

rake aborted! stack level too deep
Full error stack

$> rake --tasks

/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep

(See full trace by running task with --trace)

Steps to replicate, from the command line
  • rails new sample_app
  • cd sample_app
  • rake --tasks
The solution, prefix calls to rake with bundle exec
bundle exec rake --tasks
Resources

Thursday, June 16, 2011

rails 3.1 asset gem

Package up assets into a gem for use in rails 3.1 applications. Example uses javascript files, but the same should work for images and css.

I recommend you click the HD link on the player and view it on Vimeo in full screen mode, this embed version is not so crisp.


Resources

Wednesday, June 1, 2011

robocopy fix for exit code of 2

Sometimes you want to use robocopy from nant, a sql job or another build tool, robocopy will return 2 during a successful run, this gets interpreted as an error, a google search on the issue returned this article Fixing Robocopy for SQL Server Jobs.

Robocopy is now installed by default on Windows7 and Windows Server 2008
http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx

here is robocopy_fix.bat based on the code in the "Fixing Robocopy for SQL Server Jobs" article