undefined method `last' for {}:Hash rake db:migrate

I have tried everything I can think of to make this work for 3 days.
Thanks in advance.

Here is what I did:
rails _1.2.5_ little_ones_bend
svn export http://svn.subimage.com/source/substruct/site/trunk/vendor/plugins
vendor/plugins --username substruct --password substruct

svn export http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-5 vendor/
rails
followed instructions from http://dev.subimage.com/projects/substruct/wiki/InstallingSubstruct
ruby script/generate plugin_migration
rake db:migrate

As near as I can tell, the engine plugin is sending a Hash to the
function named "redefine_task"
which calls "resolve_args" and dies because Hash has no .last method
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1653:in
`resolve_args'

here it is. error on line 1653
    def resolve_args(args)
      task_name = args.shift
      arg_names = args #.map { |a| a.to_sym }
      needs = []
      if task_name.is_a?(Hash)
        hash = task_name
        task_name = hash.keys[0]
        needs = hash[task_name]
      end
      if arg_names.last.is_a?(Hash) # line 1653 error here
        hash = arg_names.pop
        needs = hash[:needs]
        fail "Unrecognized keys in task hash: #{hash.keys.inspect}" if
hash.size > 1
      end
      needs = [needs] unless needs.respond_to?(:to_ary)
      [task_name, arg_names, needs]
    end

Here is the engine code that is calling redefine_task
      Rake::Task.redefine_task(plugin => :environment) do
        plugin_base = RAILS_ROOT + "/vendor/plugins/#{plugin}"
        options = []
        files = Rake::FileList.new
        options << "-o doc/plugins/#{plugin}"
        options << "--title '#{plugin.titlecase} Plugin
Documentation'"
        options << '--line-numbers' << '--inline-source'
        options << '-T html'

C:\rails_projects\little_ones_bend>rake db:migrate --trace
(in C:/rails_projects/little_ones_bend)
rake aborted!
undefined method `last' for {}:Hash
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1653:in
`resolve_args'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:9:in `redefine_task'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:24:in `redefine_task'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:63
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:61
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737:in
`in_namespace'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:821:in
`namespace'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:58
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737:in
`in_namespace'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:821:in
`namespace'
C:/rails_projects/little_ones_bend/config/../vendor/plugins/engines/
tasks/engine
s.rake:54
C:/rails_projects/little_ones_bend/vendor/rails/railties/lib/tasks/
rails.rb:8:in
`load'
C:/rails_projects/little_ones_bend/vendor/rails/railties/lib/tasks/
rails.rb:8
C:/rails_projects/little_ones_bend/vendor/rails/railties/lib/tasks/
rails.rb:8:in
`each'
C:/rails_projects/little_ones_bend/vendor/rails/railties/lib/tasks/
rails.rb:8
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_re
quire'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
C:/rails_projects/little_ones_bend/rakefile:10
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2149:in `load'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2149:in
`raw_load_rakefile
'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1897:in
`load_rakefile'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exceptio
n_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1896:in
`load_rakefile'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1880:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
`standard_exceptio
n_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
C:/ruby/bin/rake:19:in `load'
C:/ruby/bin/rake:19

Hi, I had this same problem. I am not sure of exactly what the internal
issue is but if you do a
sudo gem install -v=0.7.3 rake

and then

sudo gem uninstall rake and choose all the latest above it you should
work

Brian

Brian Szucs wrote:

Hi, I had this same problem. I am not sure of exactly what the internal
issue is but if you do a
sudo gem install -v=0.7.3 rake

and then

sudo gem uninstall rake and choose all the latest above it you should
work

Brian

If you can't uninstall rake version 0.8.x (which seems to be causing the
problem), then run rake like
rake _0.7.3_ [command_name] # for it to run the right version.
GL.

You might want to just change your code to work. Do you have a “redefine_task” method by chance?


https://rubyforge.org/forum/forum.php?thread_id=20548&forum_id=20061

Cheers,

Walter McGinnis

http://katipo.co.nz/

This is happening in an "out of the box" install of substruct, which
was developed in a prior version of ruby, rails, rake and engines. Now
it is broken.

Redefine_task is part of the engines plugin which us non-compatible
with rake above version 7.3
There is a Trac ticket to fix this.

What I really want to do is move substruct into 2.02 as a root app
rather than an plugin, but I was trying to do some mods to an existing
system that is running in the older environment. I just had a heck of
a time reverting everything back.
There is version 2.0 of engines, but I think it needs rails 2.0 and I
froze at 1.2.5

Thanks

TW

I am not using engines or substruct so this must exist in another place.
I will look around for it but substruct/enginess is not the only reason
this is happening.