I'm looking to use Thor to build some custom scripts for my app. Is
there a shortcut for loading the merb environment similar to how there
is in rake (via the :merb_env)
For example, here's a merb task in rake?
desc "lists all your datamapper models"
task :list_models => :merb_env do
DataMapper::Resource.descendants.each do |resource|
puts resource
end
end
Here's what I came up with in thor (which doesnt work at all):
class ListModels < Thor
desc "list", "lists all your datamapper models"
def list
require 'merb-core'
init_env = ENV['MERB_ENV'] || 'rake'
Merb.load_dependencies(:environment => init_env)
Merb::Plugins.rakefiles.each { |r| require r }
Merb.start_environment(:environment => init_env, :adapter =>
'runner')
DataMapper::Resource.descendants.each do |resource|
puts resource
end
end
end
Anyone know what I'm doing wrong here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---