How can run a rake task via "ruby ...." (i.e. so I can then use debug features of my IDE)

Hi,

Know how can run a rake task via “ruby …” (i.e. so I can then use
debug features of my IDE)?

For example the following doesn’t work:
Macintosh-2:equity greg$ ruby lib/tasks/populate_dummy_data.rake
lib/tasks/populate_dummy_data.rake:3: undefined method `namespace’
for main:Object (NoMethodError)

thanks