I am writing a rake task for my rails app to parse data from an XML and
keep getting the error:
rake aborted!
Text is not a module
here are the contents of my lib/tasks/xml_parse.rake
#--------------------------------
require ''rexml/document''
include REXML
namespace :xml do
task :parse => :environment do
puts "hello"
#commented out everything else until it works
#...
end
end
#----------------------------------
The output looks like this...
#----------------------------------
imac:HAA-TMS chris$ rake xml:parse --trace
(in /Users/chris/Projects/HAA-TMS)
hello1
** Invoke xml:parse (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Text is not a module
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.5/lib/action_mailer.rb:52
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require''
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in
`require''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
`new_constants_in''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in
`require_frameworks''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in
`each''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:268:in
`require_frameworks''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in
`process''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in
`send''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in
`run''
/Users/chris/Projects/HAA-TMS/config/environment.rb:5
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require''
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in
`require''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
`new_constants_in''
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
`require''
/Users/chris/.gem/ruby/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
`execute''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
`execute''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with_call_chain''
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prerequisites''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prerequisites''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with_call_chain''
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in
`invoke''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
`invoke_task''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
`top_level''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run''
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/local/bin/rake:19:in `load''
/opt/local/bin/rake:19
#----------------------------------
The only line trace is spitting out from my code is
/Users/chris/Projects/HAA-TMS/config/environment.rb:5
...and that line is the...
Rails::Initializer.run do |config|
The rake task will run fine if I remove the reference "=>
:environment"
from the task declaration but I need that so I can write the XML data to
a model in my application.
Also I''m using ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]
on
snow leopard with rubygems 1.3.5 just in case that helps
If you''ve read this far, I really appreciate it.
Many thanks in advance,
Chris
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.